Skip to content

Commit dd4a578

Browse files
Wei FangPaolo Abeni
authored andcommitted
net: enetc: replace PCVLANR1/2 with SICVLANR1/2 and remove dead branch
Both PF and VF have rx-vlan-offload enabled, however, the PCVLANR1/2 registers are resources controlled by PF, so VF cannot access these two registers. Fortunately, the hardware provides SICVLANR1/2 registers for each SI to reflect the value of PCVLANR1/2 registers. Therefore, use SICVLANR1/2 instead of PCVLANR1/2. Note that this is not an issue in actual use, because the current driver does not support custom TPID, the driver will not access these two registers in actual use, so this modification is just an optimization. In addition, since ENETC_RXBD_FLAG_TPID is defined as GENMASK(1, 0), the possible values are only 0, 1, 2, 3, so the default branch will never be true, so remove the default branch. Signed-off-by: Wei Fang <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 3b5b1c4 commit dd4a578

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

drivers/net/ethernet/freescale/enetc/enetc.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,7 @@ static void enetc_get_offloads(struct enetc_bdr *rx_ring,
13751375
}
13761376

13771377
if (le16_to_cpu(rxbd->r.flags) & ENETC_RXBD_FLAG_VLAN) {
1378+
struct enetc_hw *hw = &priv->si->hw;
13781379
__be16 tpid = 0;
13791380

13801381
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,
13851386
tpid = htons(ETH_P_8021AD);
13861387
break;
13871388
case 2:
1388-
tpid = htons(enetc_port_rd(&priv->si->hw,
1389-
ENETC_PCVLANR1));
1389+
tpid = htons(enetc_rd_hot(hw, ENETC_SICVLANR1) &
1390+
SICVLANR_ETYPE);
13901391
break;
13911392
case 3:
1392-
tpid = htons(enetc_port_rd(&priv->si->hw,
1393-
ENETC_PCVLANR2));
1394-
break;
1395-
default:
1396-
break;
1393+
tpid = htons(enetc_rd_hot(hw, ENETC_SICVLANR2) &
1394+
SICVLANR_ETYPE);
13971395
}
13981396

13991397
__vlan_hwaccel_put_tag(skb, tpid, le16_to_cpu(rxbd->r.vlan_opt));

drivers/net/ethernet/freescale/enetc/enetc_hw.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343

4444
#define ENETC_SIPMAR0 0x80
4545
#define ENETC_SIPMAR1 0x84
46+
#define ENETC_SICVLANR1 0x90
47+
#define ENETC_SICVLANR2 0x94
48+
#define SICVLANR_ETYPE GENMASK(15, 0)
4649

4750
/* VF-PF Message passing */
4851
#define ENETC_DEFAULT_MSG_SIZE 1024 /* and max size */

0 commit comments

Comments
 (0)