Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Petri Gynther and committed by
David S. Miller
bc23333b 38b2cf29

+7 -6
+7 -6
drivers/net/ethernet/broadcom/genet/bcmgenet.c
··· 1054 1054 /* Reallocate the SKB to put enough headroom in front of it and insert 1055 1055 * the transmit checksum offsets in the descriptors 1056 1056 */ 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) 1058 1059 { 1059 1060 struct status_64 *status = NULL; 1060 1061 struct sk_buff *new_skb; ··· 1073 1072 if (!new_skb) { 1074 1073 dev->stats.tx_errors++; 1075 1074 dev->stats.tx_dropped++; 1076 - return -ENOMEM; 1075 + return NULL; 1077 1076 } 1078 1077 skb = new_skb; 1079 1078 } ··· 1091 1090 ip_proto = ipv6_hdr(skb)->nexthdr; 1092 1091 break; 1093 1092 default: 1094 - return 0; 1093 + return skb; 1095 1094 } 1096 1095 1097 1096 offset = skb_checksum_start_offset(skb) - sizeof(*status); ··· 1112 1111 status->tx_csum_info = tx_csum_info; 1113 1112 } 1114 1113 1115 - return 0; 1114 + return skb; 1116 1115 } 1117 1116 1118 1117 static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) ··· 1159 1158 1160 1159 /* set the SKB transmit checksum */ 1161 1160 if (priv->desc_64b_en) { 1162 - ret = bcmgenet_put_tx_csum(dev, skb); 1163 - if (ret) { 1161 + skb = bcmgenet_put_tx_csum(dev, skb); 1162 + if (!skb) { 1164 1163 ret = NETDEV_TX_OK; 1165 1164 goto out; 1166 1165 }