Skip to content

Commit 7892ea2

Browse files
committed
Merge branch 'dsa-Move-padding-into-Broadcom-tagger'
Florian Fainelli says: ==================== net: dsa: Move padding into Broadcom tagger This patch series moves the padding of short packets to where it belongs within the DSA Broadcom tagger code, I just found myself doing this for a third driver, which was a clear indication this was wrong and did not scale. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 33c30a8 + c979da7 commit 7892ea2

File tree

3 files changed

+12
-27
lines changed

3 files changed

+12
-27
lines changed

drivers/net/ethernet/broadcom/bcmsysport.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,18 +1216,6 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
12161216
goto out;
12171217
}
12181218

1219-
/* The Ethernet switch we are interfaced with needs packets to be at
1220-
* least 64 bytes (including FCS) otherwise they will be discarded when
1221-
* they enter the switch port logic. When Broadcom tags are enabled, we
1222-
* need to make sure that packets are at least 68 bytes
1223-
* (including FCS and tag) because the length verification is done after
1224-
* the Broadcom tag is stripped off the ingress packet.
1225-
*/
1226-
if (skb_put_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) {
1227-
ret = NETDEV_TX_OK;
1228-
goto out;
1229-
}
1230-
12311219
/* Insert TSB and checksum infos */
12321220
if (priv->tsb_en) {
12331221
skb = bcm_sysport_insert_tsb(skb, dev);

drivers/net/ethernet/broadcom/bgmac.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ bgmac_dma_tx_add_buf(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
128128
dma_desc->ctl1 = cpu_to_le32(ctl1);
129129
}
130130

131-
#define ENET_BRCM_TAG_LEN 4
132-
133131
static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
134132
struct bgmac_dma_ring *ring,
135133
struct sk_buff *skb)
@@ -142,18 +140,6 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
142140
u32 flags;
143141
int i;
144142

145-
/* The Ethernet switch we are interfaced with needs packets to be at
146-
* least 64 bytes (including FCS) otherwise they will be discarded when
147-
* they enter the switch port logic. When Broadcom tags are enabled, we
148-
* need to make sure that packets are at least 68 bytes
149-
* (including FCS and tag) because the length verification is done after
150-
* the Broadcom tag is stripped off the ingress packet.
151-
*/
152-
if (netdev_uses_dsa(net_dev)) {
153-
if (skb_put_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN))
154-
goto err_stats;
155-
}
156-
157143
if (skb->len > BGMAC_DESC_CTL1_LEN) {
158144
netdev_err(bgmac->net_dev, "Too long skb (%d)\n", skb->len);
159145
goto err_drop;
@@ -240,7 +226,6 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
240226

241227
err_drop:
242228
dev_kfree_skb(skb);
243-
err_stats:
244229
net_dev->stats.tx_dropped++;
245230
net_dev->stats.tx_errors++;
246231
return NETDEV_TX_OK;

net/dsa/tag_brcm.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ static struct sk_buff *brcm_tag_xmit_ll(struct sk_buff *skb,
7070
if (skb_cow_head(skb, BRCM_TAG_LEN) < 0)
7171
return NULL;
7272

73+
/* The Ethernet switch we are interfaced with needs packets to be at
74+
* least 64 bytes (including FCS) otherwise they will be discarded when
75+
* they enter the switch port logic. When Broadcom tags are enabled, we
76+
* need to make sure that packets are at least 68 bytes
77+
* (including FCS and tag) because the length verification is done after
78+
* the Broadcom tag is stripped off the ingress packet.
79+
*
80+
* Let dsa_slave_xmit() free the SKB
81+
*/
82+
if (__skb_put_padto(skb, ETH_ZLEN + BRCM_TAG_LEN, false))
83+
return NULL;
84+
7385
skb_push(skb, BRCM_TAG_LEN);
7486

7587
if (offset)

0 commit comments

Comments
 (0)