* [PATCH net-next 1/3] net: dsa: Move padding into Broadcom tagger
2018-01-04 6:12 [PATCH net-next 0/3] net: dsa: Move padding into Broadcom tagger Florian Fainelli
@ 2018-01-04 6:13 ` Florian Fainelli
2018-01-04 6:13 ` [PATCH net-next 2/3] net: systemport: Remove short packet padding Florian Fainelli
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2018-01-04 6:13 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, Florian Fainelli
Instead of having the different master network device drivers
potentially used by DSA/Broadcom tags, move the padding necessary for
the switches to accept short packets where it makes most sense: within
tag_brcm.c. This avoids multiplying the number of similar commits to
e.g: bgmac, bcmsysport, etc.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/tag_brcm.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
index e6e0b7b6025c..2b06bb91318b 100644
--- a/net/dsa/tag_brcm.c
+++ b/net/dsa/tag_brcm.c
@@ -70,6 +70,18 @@ static struct sk_buff *brcm_tag_xmit_ll(struct sk_buff *skb,
if (skb_cow_head(skb, BRCM_TAG_LEN) < 0)
return NULL;
+ /* The Ethernet switch we are interfaced with needs packets to be at
+ * least 64 bytes (including FCS) otherwise they will be discarded when
+ * they enter the switch port logic. When Broadcom tags are enabled, we
+ * need to make sure that packets are at least 68 bytes
+ * (including FCS and tag) because the length verification is done after
+ * the Broadcom tag is stripped off the ingress packet.
+ *
+ * Let dsa_slave_xmit() free the SKB
+ */
+ if (__skb_put_padto(skb, ETH_ZLEN + BRCM_TAG_LEN, false))
+ return NULL;
+
skb_push(skb, BRCM_TAG_LEN);
if (offset)
--
2.14.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH net-next 2/3] net: systemport: Remove short packet padding
2018-01-04 6:12 [PATCH net-next 0/3] net: dsa: Move padding into Broadcom tagger Florian Fainelli
2018-01-04 6:13 ` [PATCH net-next 1/3] " Florian Fainelli
@ 2018-01-04 6:13 ` Florian Fainelli
2018-01-04 6:13 ` [PATCH net-next 3/3] net: bgmac: Remove short packet padding for DSA Florian Fainelli
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2018-01-04 6:13 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, Florian Fainelli
Short packet padding added to the driver is only necessary when using
Broadcom tags, but since this is now taken care of net/dsa/tag_brcm.c,
we are guaranteed being given correctly padded packets.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 087f01b4dc3a..f15a8fc6dfc9 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1216,18 +1216,6 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
goto out;
}
- /* The Ethernet switch we are interfaced with needs packets to be at
- * least 64 bytes (including FCS) otherwise they will be discarded when
- * they enter the switch port logic. When Broadcom tags are enabled, we
- * need to make sure that packets are at least 68 bytes
- * (including FCS and tag) because the length verification is done after
- * the Broadcom tag is stripped off the ingress packet.
- */
- if (skb_put_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) {
- ret = NETDEV_TX_OK;
- goto out;
- }
-
/* Insert TSB and checksum infos */
if (priv->tsb_en) {
skb = bcm_sysport_insert_tsb(skb, dev);
--
2.14.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH net-next 3/3] net: bgmac: Remove short packet padding for DSA
2018-01-04 6:12 [PATCH net-next 0/3] net: dsa: Move padding into Broadcom tagger Florian Fainelli
2018-01-04 6:13 ` [PATCH net-next 1/3] " Florian Fainelli
2018-01-04 6:13 ` [PATCH net-next 2/3] net: systemport: Remove short packet padding Florian Fainelli
@ 2018-01-04 6:13 ` Florian Fainelli
2018-01-04 12:43 ` [PATCH net-next 0/3] net: dsa: Move padding into Broadcom tagger Andrew Lunn
2018-01-05 16:21 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2018-01-04 6:13 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, Florian Fainelli
DSA now correctly pads short packets within net/dsa/tag_brcm.c such that
this it is no longer necessary to do this within bgmac.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/bgmac.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index 1d96cd594ade..8eef9fb6b1fe 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -128,8 +128,6 @@ bgmac_dma_tx_add_buf(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
dma_desc->ctl1 = cpu_to_le32(ctl1);
}
-#define ENET_BRCM_TAG_LEN 4
-
static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
struct bgmac_dma_ring *ring,
struct sk_buff *skb)
@@ -142,18 +140,6 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
u32 flags;
int i;
- /* The Ethernet switch we are interfaced with needs packets to be at
- * least 64 bytes (including FCS) otherwise they will be discarded when
- * they enter the switch port logic. When Broadcom tags are enabled, we
- * need to make sure that packets are at least 68 bytes
- * (including FCS and tag) because the length verification is done after
- * the Broadcom tag is stripped off the ingress packet.
- */
- if (netdev_uses_dsa(net_dev)) {
- if (skb_put_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN))
- goto err_stats;
- }
-
if (skb->len > BGMAC_DESC_CTL1_LEN) {
netdev_err(bgmac->net_dev, "Too long skb (%d)\n", skb->len);
goto err_drop;
@@ -240,7 +226,6 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
err_drop:
dev_kfree_skb(skb);
-err_stats:
net_dev->stats.tx_dropped++;
net_dev->stats.tx_errors++;
return NETDEV_TX_OK;
--
2.14.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH net-next 0/3] net: dsa: Move padding into Broadcom tagger
2018-01-04 6:12 [PATCH net-next 0/3] net: dsa: Move padding into Broadcom tagger Florian Fainelli
` (2 preceding siblings ...)
2018-01-04 6:13 ` [PATCH net-next 3/3] net: bgmac: Remove short packet padding for DSA Florian Fainelli
@ 2018-01-04 12:43 ` Andrew Lunn
2018-01-05 16:21 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2018-01-04 12:43 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot
On Wed, Jan 03, 2018 at 10:12:59PM -0800, Florian Fainelli wrote:
> Hi all,
>
> 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.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net-next 0/3] net: dsa: Move padding into Broadcom tagger
2018-01-04 6:12 [PATCH net-next 0/3] net: dsa: Move padding into Broadcom tagger Florian Fainelli
` (3 preceding siblings ...)
2018-01-04 12:43 ` [PATCH net-next 0/3] net: dsa: Move padding into Broadcom tagger Andrew Lunn
@ 2018-01-05 16:21 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-01-05 16:21 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, andrew, vivien.didelot
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Wed, 3 Jan 2018 22:12:59 -0800
> 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.
Series applied, thanks Florian.
^ permalink raw reply [flat|nested] 6+ messages in thread