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.
Florian Fainelli (3):
net: dsa: Move padding into Broadcom tagger
net: systemport: Remove short packet padding
net: bgmac: Remove short packet padding for DSA
drivers/net/ethernet/broadcom/bcmsysport.c | 12 ------------
drivers/net/ethernet/broadcom/bgmac.c | 15 ---------------
net/dsa/tag_brcm.c | 12 ++++++++++++
3 files changed, 12 insertions(+), 27 deletions(-)
--
2.14.1
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(+)
@@ -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)returnNULL;+/* The Ethernet switch we are interfaced with needs packets to be at+*least64bytes(includingFCS)otherwisetheywillbediscardedwhen+*theyentertheswitchportlogic.WhenBroadcomtagsareenabled,we+*needtomakesurethatpacketsareatleast68bytes+*(includingFCSandtag)becausethelengthverificationisdoneafter+*theBroadcomtagisstrippedofftheingresspacket.+*+*Letdsa_slave_xmit()freetheSKB+*/+if(__skb_put_padto(skb,ETH_ZLEN+BRCM_TAG_LEN,false))+returnNULL;+skb_push(skb,BRCM_TAG_LEN);if(offset)
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(-)
@@ -1216,18 +1216,6 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,gotoout;}-/* The Ethernet switch we are interfaced with needs packets to be at-*least64bytes(includingFCS)otherwisetheywillbediscardedwhen-*theyentertheswitchportlogic.WhenBroadcomtagsareenabled,we-*needtomakesurethatpacketsareatleast68bytes-*(includingFCSandtag)becausethelengthverificationisdoneafter-*theBroadcomtagisstrippedofftheingresspacket.-*/-if(skb_put_padto(skb,ETH_ZLEN+ENET_BRCM_TAG_LEN)){-ret=NETDEV_TX_OK;-gotoout;-}-/* Insert TSB and checksum infos */if(priv->tsb_en){skb=bcm_sysport_insert_tsb(skb,dev);
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(-)
@@ -142,18 +140,6 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,u32flags;inti;-/* The Ethernet switch we are interfaced with needs packets to be at-*least64bytes(includingFCS)otherwisetheywillbediscardedwhen-*theyentertheswitchportlogic.WhenBroadcomtagsareenabled,we-*needtomakesurethatpacketsareatleast68bytes-*(includingFCSandtag)becausethelengthverificationisdoneafter-*theBroadcomtagisstrippedofftheingresspacket.-*/-if(netdev_uses_dsa(net_dev)){-if(skb_put_padto(skb,ETH_ZLEN+ENET_BRCM_TAG_LEN))-gotoerr_stats;-}-if(skb->len>BGMAC_DESC_CTL1_LEN){netdev_err(bgmac->net_dev,"Too long skb (%d)\n",skb->len);gotoerr_drop;
From: Andrew Lunn <andrew@lunn.ch> Date: 2018-01-04 12:43:52
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.
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.