diff options
Diffstat (limited to 'drivers/net/ethernet/freescale/enetc')
-rw-r--r-- | drivers/net/ethernet/freescale/enetc/enetc.c | 12 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/enetc/enetc.h | 22 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 110 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/enetc/enetc_hw.h | 4 |
4 files changed, 81 insertions, 67 deletions
diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index dcc3fbac3481..e4287725832e 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -1375,6 +1375,7 @@ static void enetc_get_offloads(struct enetc_bdr *rx_ring, } if (le16_to_cpu(rxbd->r.flags) & ENETC_RXBD_FLAG_VLAN) { + struct enetc_hw *hw = &priv->si->hw; __be16 tpid = 0; switch (le16_to_cpu(rxbd->r.flags) & ENETC_RXBD_FLAG_TPID) { @@ -1385,15 +1386,12 @@ static void enetc_get_offloads(struct enetc_bdr *rx_ring, tpid = htons(ETH_P_8021AD); break; case 2: - tpid = htons(enetc_port_rd(&priv->si->hw, - ENETC_PCVLANR1)); + tpid = htons(enetc_rd_hot(hw, ENETC_SICVLANR1) & + SICVLANR_ETYPE); break; case 3: - tpid = htons(enetc_port_rd(&priv->si->hw, - ENETC_PCVLANR2)); - break; - default: - break; + tpid = htons(enetc_rd_hot(hw, ENETC_SICVLANR2) & + SICVLANR_ETYPE); } __vlan_hwaccel_put_tag(skb, tpid, le16_to_cpu(rxbd->r.vlan_opt)); diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h index 872d2cbd088b..62e8ee4d2f04 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -96,17 +96,17 @@ struct enetc_rx_swbd { #define ENETC_TXBDS_MAX_NEEDED(x) ENETC_TXBDS_NEEDED((x) + 1) struct enetc_ring_stats { - unsigned int packets; - unsigned int bytes; - unsigned int rx_alloc_errs; - unsigned int xdp_drops; - unsigned int xdp_tx; - unsigned int xdp_tx_drops; - unsigned int xdp_redirect; - unsigned int xdp_redirect_failures; - unsigned int recycles; - unsigned int recycle_failures; - unsigned int win_drop; + unsigned long packets; + unsigned long bytes; + unsigned long rx_alloc_errs; + unsigned long xdp_drops; + unsigned long xdp_tx; + unsigned long xdp_tx_drops; + unsigned long xdp_redirect; + unsigned long xdp_redirect_failures; + unsigned long recycles; + unsigned long recycle_failures; + unsigned long win_drop; }; struct enetc_xdp_data { diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c index d38cd36be4a6..961e76cd8489 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c @@ -142,7 +142,7 @@ static const struct { static const struct { int reg; char name[ETH_GSTRING_LEN] __nonstring; -} enetc_port_counters[] = { +} enetc_pm_counters[] = { { ENETC_PM_REOCT(0), "MAC rx ethernet octets" }, { ENETC_PM_RALN(0), "MAC rx alignment errors" }, { ENETC_PM_RXPF(0), "MAC rx valid pause frames" }, @@ -194,6 +194,12 @@ static const struct { { ENETC_PM_TSCOL(0), "MAC tx single collisions" }, { ENETC_PM_TLCOL(0), "MAC tx late collisions" }, { ENETC_PM_TECOL(0), "MAC tx excessive collisions" }, +}; + +static const struct { + int reg; + char name[ETH_GSTRING_LEN] __nonstring; +} enetc_port_counters[] = { { ENETC_UFDMF, "SI MAC nomatch u-cast discards" }, { ENETC_MFDMF, "SI MAC nomatch m-cast discards" }, { ENETC_PBFDSIR, "SI MAC nomatch b-cast discards" }, @@ -240,6 +246,7 @@ static int enetc_get_sset_count(struct net_device *ndev, int sset) return len; len += ARRAY_SIZE(enetc_port_counters); + len += ARRAY_SIZE(enetc_pm_counters); return len; } @@ -266,6 +273,9 @@ static void enetc_get_strings(struct net_device *ndev, u32 stringset, u8 *data) for (i = 0; i < ARRAY_SIZE(enetc_port_counters); i++) ethtool_cpy(&data, enetc_port_counters[i].name); + for (i = 0; i < ARRAY_SIZE(enetc_pm_counters); i++) + ethtool_cpy(&data, enetc_pm_counters[i].name); + break; } } @@ -302,13 +312,16 @@ static void enetc_get_ethtool_stats(struct net_device *ndev, for (i = 0; i < ARRAY_SIZE(enetc_port_counters); i++) data[o++] = enetc_port_rd(hw, enetc_port_counters[i].reg); + + for (i = 0; i < ARRAY_SIZE(enetc_pm_counters); i++) + data[o++] = enetc_port_rd64(hw, enetc_pm_counters[i].reg); } static void enetc_pause_stats(struct enetc_hw *hw, int mac, struct ethtool_pause_stats *pause_stats) { - pause_stats->tx_pause_frames = enetc_port_rd(hw, ENETC_PM_TXPF(mac)); - pause_stats->rx_pause_frames = enetc_port_rd(hw, ENETC_PM_RXPF(mac)); + pause_stats->tx_pause_frames = enetc_port_rd64(hw, ENETC_PM_TXPF(mac)); + pause_stats->rx_pause_frames = enetc_port_rd64(hw, ENETC_PM_RXPF(mac)); } static void enetc_get_pause_stats(struct net_device *ndev, @@ -335,31 +348,31 @@ static void enetc_get_pause_stats(struct net_device *ndev, static void enetc_mac_stats(struct enetc_hw *hw, int mac, struct ethtool_eth_mac_stats *s) { - s->FramesTransmittedOK = enetc_port_rd(hw, ENETC_PM_TFRM(mac)); - s->SingleCollisionFrames = enetc_port_rd(hw, ENETC_PM_TSCOL(mac)); - s->MultipleCollisionFrames = enetc_port_rd(hw, ENETC_PM_TMCOL(mac)); - s->FramesReceivedOK = enetc_port_rd(hw, ENETC_PM_RFRM(mac)); - s->FrameCheckSequenceErrors = enetc_port_rd(hw, ENETC_PM_RFCS(mac)); - s->AlignmentErrors = enetc_port_rd(hw, ENETC_PM_RALN(mac)); - s->OctetsTransmittedOK = enetc_port_rd(hw, ENETC_PM_TEOCT(mac)); - s->FramesWithDeferredXmissions = enetc_port_rd(hw, ENETC_PM_TDFR(mac)); - s->LateCollisions = enetc_port_rd(hw, ENETC_PM_TLCOL(mac)); - s->FramesAbortedDueToXSColls = enetc_port_rd(hw, ENETC_PM_TECOL(mac)); - s->FramesLostDueToIntMACXmitError = enetc_port_rd(hw, ENETC_PM_TERR(mac)); - s->CarrierSenseErrors = enetc_port_rd(hw, ENETC_PM_TCRSE(mac)); - s->OctetsReceivedOK = enetc_port_rd(hw, ENETC_PM_REOCT(mac)); - s->FramesLostDueToIntMACRcvError = enetc_port_rd(hw, ENETC_PM_RDRNTP(mac)); - s->MulticastFramesXmittedOK = enetc_port_rd(hw, ENETC_PM_TMCA(mac)); - s->BroadcastFramesXmittedOK = enetc_port_rd(hw, ENETC_PM_TBCA(mac)); - s->MulticastFramesReceivedOK = enetc_port_rd(hw, ENETC_PM_RMCA(mac)); - s->BroadcastFramesReceivedOK = enetc_port_rd(hw, ENETC_PM_RBCA(mac)); + s->FramesTransmittedOK = enetc_port_rd64(hw, ENETC_PM_TFRM(mac)); + s->SingleCollisionFrames = enetc_port_rd64(hw, ENETC_PM_TSCOL(mac)); + s->MultipleCollisionFrames = enetc_port_rd64(hw, ENETC_PM_TMCOL(mac)); + s->FramesReceivedOK = enetc_port_rd64(hw, ENETC_PM_RFRM(mac)); + s->FrameCheckSequenceErrors = enetc_port_rd64(hw, ENETC_PM_RFCS(mac)); + s->AlignmentErrors = enetc_port_rd64(hw, ENETC_PM_RALN(mac)); + s->OctetsTransmittedOK = enetc_port_rd64(hw, ENETC_PM_TEOCT(mac)); + s->FramesWithDeferredXmissions = enetc_port_rd64(hw, ENETC_PM_TDFR(mac)); + s->LateCollisions = enetc_port_rd64(hw, ENETC_PM_TLCOL(mac)); + s->FramesAbortedDueToXSColls = enetc_port_rd64(hw, ENETC_PM_TECOL(mac)); + s->FramesLostDueToIntMACXmitError = enetc_port_rd64(hw, ENETC_PM_TERR(mac)); + s->CarrierSenseErrors = enetc_port_rd64(hw, ENETC_PM_TCRSE(mac)); + s->OctetsReceivedOK = enetc_port_rd64(hw, ENETC_PM_REOCT(mac)); + s->FramesLostDueToIntMACRcvError = enetc_port_rd64(hw, ENETC_PM_RDRNTP(mac)); + s->MulticastFramesXmittedOK = enetc_port_rd64(hw, ENETC_PM_TMCA(mac)); + s->BroadcastFramesXmittedOK = enetc_port_rd64(hw, ENETC_PM_TBCA(mac)); + s->MulticastFramesReceivedOK = enetc_port_rd64(hw, ENETC_PM_RMCA(mac)); + s->BroadcastFramesReceivedOK = enetc_port_rd64(hw, ENETC_PM_RBCA(mac)); } static void enetc_ctrl_stats(struct enetc_hw *hw, int mac, struct ethtool_eth_ctrl_stats *s) { - s->MACControlFramesTransmitted = enetc_port_rd(hw, ENETC_PM_TCNP(mac)); - s->MACControlFramesReceived = enetc_port_rd(hw, ENETC_PM_RCNP(mac)); + s->MACControlFramesTransmitted = enetc_port_rd64(hw, ENETC_PM_TCNP(mac)); + s->MACControlFramesReceived = enetc_port_rd64(hw, ENETC_PM_RCNP(mac)); } static const struct ethtool_rmon_hist_range enetc_rmon_ranges[] = { @@ -376,26 +389,26 @@ static const struct ethtool_rmon_hist_range enetc_rmon_ranges[] = { static void enetc_rmon_stats(struct enetc_hw *hw, int mac, struct ethtool_rmon_stats *s) { - s->undersize_pkts = enetc_port_rd(hw, ENETC_PM_RUND(mac)); - s->oversize_pkts = enetc_port_rd(hw, ENETC_PM_ROVR(mac)); - s->fragments = enetc_port_rd(hw, ENETC_PM_RFRG(mac)); - s->jabbers = enetc_port_rd(hw, ENETC_PM_RJBR(mac)); - - s->hist[0] = enetc_port_rd(hw, ENETC_PM_R64(mac)); - s->hist[1] = enetc_port_rd(hw, ENETC_PM_R127(mac)); - s->hist[2] = enetc_port_rd(hw, ENETC_PM_R255(mac)); - s->hist[3] = enetc_port_rd(hw, ENETC_PM_R511(mac)); - s->hist[4] = enetc_port_rd(hw, ENETC_PM_R1023(mac)); - s->hist[5] = enetc_port_rd(hw, ENETC_PM_R1522(mac)); - s->hist[6] = enetc_port_rd(hw, ENETC_PM_R1523X(mac)); - - s->hist_tx[0] = enetc_port_rd(hw, ENETC_PM_T64(mac)); - s->hist_tx[1] = enetc_port_rd(hw, ENETC_PM_T127(mac)); - s->hist_tx[2] = enetc_port_rd(hw, ENETC_PM_T255(mac)); - s->hist_tx[3] = enetc_port_rd(hw, ENETC_PM_T511(mac)); - s->hist_tx[4] = enetc_port_rd(hw, ENETC_PM_T1023(mac)); - s->hist_tx[5] = enetc_port_rd(hw, ENETC_PM_T1522(mac)); - s->hist_tx[6] = enetc_port_rd(hw, ENETC_PM_T1523X(mac)); + s->undersize_pkts = enetc_port_rd64(hw, ENETC_PM_RUND(mac)); + s->oversize_pkts = enetc_port_rd64(hw, ENETC_PM_ROVR(mac)); + s->fragments = enetc_port_rd64(hw, ENETC_PM_RFRG(mac)); + s->jabbers = enetc_port_rd64(hw, ENETC_PM_RJBR(mac)); + + s->hist[0] = enetc_port_rd64(hw, ENETC_PM_R64(mac)); + s->hist[1] = enetc_port_rd64(hw, ENETC_PM_R127(mac)); + s->hist[2] = enetc_port_rd64(hw, ENETC_PM_R255(mac)); + s->hist[3] = enetc_port_rd64(hw, ENETC_PM_R511(mac)); + s->hist[4] = enetc_port_rd64(hw, ENETC_PM_R1023(mac)); + s->hist[5] = enetc_port_rd64(hw, ENETC_PM_R1522(mac)); + s->hist[6] = enetc_port_rd64(hw, ENETC_PM_R1523X(mac)); + + s->hist_tx[0] = enetc_port_rd64(hw, ENETC_PM_T64(mac)); + s->hist_tx[1] = enetc_port_rd64(hw, ENETC_PM_T127(mac)); + s->hist_tx[2] = enetc_port_rd64(hw, ENETC_PM_T255(mac)); + s->hist_tx[3] = enetc_port_rd64(hw, ENETC_PM_T511(mac)); + s->hist_tx[4] = enetc_port_rd64(hw, ENETC_PM_T1023(mac)); + s->hist_tx[5] = enetc_port_rd64(hw, ENETC_PM_T1522(mac)); + s->hist_tx[6] = enetc_port_rd64(hw, ENETC_PM_T1523X(mac)); } static void enetc_get_eth_mac_stats(struct net_device *ndev, @@ -467,7 +480,8 @@ static void enetc_get_rmon_stats(struct net_device *ndev, #define ENETC_RSSHASH_L3 (RXH_L2DA | RXH_VLAN | RXH_L3_PROTO | RXH_IP_SRC | \ RXH_IP_DST) #define ENETC_RSSHASH_L4 (ENETC_RSSHASH_L3 | RXH_L4_B_0_1 | RXH_L4_B_2_3) -static int enetc_get_rsshash(struct ethtool_rxnfc *rxnfc) +static int enetc_get_rxfh_fields(struct net_device *netdev, + struct ethtool_rxfh_fields *rxnfc) { static const u32 rsshash[] = { [TCP_V4_FLOW] = ENETC_RSSHASH_L4, @@ -584,9 +598,6 @@ static int enetc_get_rxnfc(struct net_device *ndev, struct ethtool_rxnfc *rxnfc, case ETHTOOL_GRXRINGS: rxnfc->data = priv->num_rx_rings; break; - case ETHTOOL_GRXFH: - /* get RSS hash config */ - return enetc_get_rsshash(rxnfc); case ETHTOOL_GRXCLSRLCNT: /* total number of entries */ rxnfc->data = priv->si->num_fs_entries; @@ -639,8 +650,6 @@ static int enetc4_get_rxnfc(struct net_device *ndev, struct ethtool_rxnfc *rxnfc case ETHTOOL_GRXRINGS: rxnfc->data = priv->num_rx_rings; break; - case ETHTOOL_GRXFH: - return enetc_get_rsshash(rxnfc); default: return -EOPNOTSUPP; } @@ -1228,6 +1237,7 @@ const struct ethtool_ops enetc_pf_ethtool_ops = { .get_rxfh_indir_size = enetc_get_rxfh_indir_size, .get_rxfh = enetc_get_rxfh, .set_rxfh = enetc_set_rxfh, + .get_rxfh_fields = enetc_get_rxfh_fields, .get_ringparam = enetc_get_ringparam, .get_coalesce = enetc_get_coalesce, .set_coalesce = enetc_set_coalesce, @@ -1258,6 +1268,7 @@ const struct ethtool_ops enetc_vf_ethtool_ops = { .get_rxfh_indir_size = enetc_get_rxfh_indir_size, .get_rxfh = enetc_get_rxfh, .set_rxfh = enetc_set_rxfh, + .get_rxfh_fields = enetc_get_rxfh_fields, .get_ringparam = enetc_get_ringparam, .get_coalesce = enetc_get_coalesce, .set_coalesce = enetc_set_coalesce, @@ -1284,6 +1295,7 @@ const struct ethtool_ops enetc4_pf_ethtool_ops = { .get_rxfh_indir_size = enetc_get_rxfh_indir_size, .get_rxfh = enetc_get_rxfh, .set_rxfh = enetc_set_rxfh, + .get_rxfh_fields = enetc_get_rxfh_fields, }; void enetc_set_ethtool_ops(struct net_device *ndev) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h index 53e8d18c7a34..73763e8f4879 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h @@ -43,6 +43,9 @@ #define ENETC_SIPMAR0 0x80 #define ENETC_SIPMAR1 0x84 +#define ENETC_SICVLANR1 0x90 +#define ENETC_SICVLANR2 0x94 +#define SICVLANR_ETYPE GENMASK(15, 0) /* VF-PF Message passing */ #define ENETC_DEFAULT_MSG_SIZE 1024 /* and max size */ @@ -533,6 +536,7 @@ static inline u64 _enetc_rd_reg64_wa(void __iomem *reg) /* port register accessors - PF only */ #define enetc_port_rd(hw, off) enetc_rd_reg((hw)->port + (off)) #define enetc_port_wr(hw, off, val) enetc_wr_reg((hw)->port + (off), val) +#define enetc_port_rd64(hw, off) _enetc_rd_reg64_wa((hw)->port + (off)) #define enetc_port_rd_mdio(hw, off) _enetc_rd_mdio_reg_wa((hw)->port + (off)) #define enetc_port_wr_mdio(hw, off, val) _enetc_wr_mdio_reg_wa(\ (hw)->port + (off), val) |