Skip to content

Commit bc23333

Browse files
Petri Gyntherdavem330
authored andcommitted
net: bcmgenet: fix bcmgenet_put_tx_csum()
bcmgenet_put_tx_csum() needs to return skb pointer back to the caller because it reallocates a new one in case of lack of skb headroom. Signed-off-by: Petri Gynther <pgynther@google.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 38b2cf2 commit bc23333

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎drivers/net/ethernet/broadcom/genet/bcmgenet.c‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,8 @@ static int bcmgenet_xmit_frag(struct net_device *dev,
10541054
/* Reallocate the SKB to put enough headroom in front of it and insert
10551055
* the transmit checksum offsets in the descriptors
10561056
*/
1057-
static int bcmgenet_put_tx_csum(struct net_device *dev, struct sk_buff *skb)
1057+
static struct sk_buff *bcmgenet_put_tx_csum(struct net_device *dev,
1058+
struct sk_buff *skb)
10581059
{
10591060
struct status_64 *status = NULL;
10601061
struct sk_buff *new_skb;
@@ -1072,7 +1073,7 @@ static int bcmgenet_put_tx_csum(struct net_device *dev, struct sk_buff *skb)
10721073
if (!new_skb) {
10731074
dev->stats.tx_errors++;
10741075
dev->stats.tx_dropped++;
1075-
return -ENOMEM;
1076+
return NULL;
10761077
}
10771078
skb = new_skb;
10781079
}
@@ -1090,7 +1091,7 @@ static int bcmgenet_put_tx_csum(struct net_device *dev, struct sk_buff *skb)
10901091
ip_proto = ipv6_hdr(skb)->nexthdr;
10911092
break;
10921093
default:
1093-
return 0;
1094+
return skb;
10941095
}
10951096

10961097
offset = skb_checksum_start_offset(skb) - sizeof(*status);
@@ -1111,7 +1112,7 @@ static int bcmgenet_put_tx_csum(struct net_device *dev, struct sk_buff *skb)
11111112
status->tx_csum_info = tx_csum_info;
11121113
}
11131114

1114-
return 0;
1115+
return skb;
11151116
}
11161117

11171118
static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
@@ -1158,8 +1159,8 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
11581159

11591160
/* set the SKB transmit checksum */
11601161
if (priv->desc_64b_en) {
1161-
ret = bcmgenet_put_tx_csum(dev, skb);
1162-
if (ret) {
1162+
skb = bcmgenet_put_tx_csum(dev, skb);
1163+
if (!skb) {
11631164
ret = NETDEV_TX_OK;
11641165
goto out;
11651166
}

0 commit comments

Comments
 (0)