mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-17 16:14:25 +08:00
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 <davem@davemloft.net>
This commit is contained in:
commit
7892ea23c9
@ -1216,18 +1216,6 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
|
|||||||
goto out;
|
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 */
|
/* Insert TSB and checksum infos */
|
||||||
if (priv->tsb_en) {
|
if (priv->tsb_en) {
|
||||||
skb = bcm_sysport_insert_tsb(skb, dev);
|
skb = bcm_sysport_insert_tsb(skb, dev);
|
||||||
|
@ -128,8 +128,6 @@ bgmac_dma_tx_add_buf(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
|
|||||||
dma_desc->ctl1 = cpu_to_le32(ctl1);
|
dma_desc->ctl1 = cpu_to_le32(ctl1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ENET_BRCM_TAG_LEN 4
|
|
||||||
|
|
||||||
static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
|
static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
|
||||||
struct bgmac_dma_ring *ring,
|
struct bgmac_dma_ring *ring,
|
||||||
struct sk_buff *skb)
|
struct sk_buff *skb)
|
||||||
@ -142,18 +140,6 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
|
|||||||
u32 flags;
|
u32 flags;
|
||||||
int i;
|
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) {
|
if (skb->len > BGMAC_DESC_CTL1_LEN) {
|
||||||
netdev_err(bgmac->net_dev, "Too long skb (%d)\n", skb->len);
|
netdev_err(bgmac->net_dev, "Too long skb (%d)\n", skb->len);
|
||||||
goto err_drop;
|
goto err_drop;
|
||||||
@ -240,7 +226,6 @@ err_dma_head:
|
|||||||
|
|
||||||
err_drop:
|
err_drop:
|
||||||
dev_kfree_skb(skb);
|
dev_kfree_skb(skb);
|
||||||
err_stats:
|
|
||||||
net_dev->stats.tx_dropped++;
|
net_dev->stats.tx_dropped++;
|
||||||
net_dev->stats.tx_errors++;
|
net_dev->stats.tx_errors++;
|
||||||
return NETDEV_TX_OK;
|
return NETDEV_TX_OK;
|
||||||
|
@ -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)
|
if (skb_cow_head(skb, BRCM_TAG_LEN) < 0)
|
||||||
return NULL;
|
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);
|
skb_push(skb, BRCM_TAG_LEN);
|
||||||
|
|
||||||
if (offset)
|
if (offset)
|
||||||
|
Loading…
Reference in New Issue
Block a user