* [PATCH net-next] net: bcmgenet: fix bcmgenet_put_tx_csum()
@ 2014-10-01 18:30 Petri Gynther
2014-10-01 18:39 ` Florian Fainelli
2014-10-02 2:12 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Petri Gynther @ 2014-10-01 18:30 UTC (permalink / raw)
To: netdev; +Cc: davem, f.fainelli
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>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 77cb755..d51729c 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1054,7 +1054,8 @@ static int bcmgenet_xmit_frag(struct net_device *dev,
/* Reallocate the SKB to put enough headroom in front of it and insert
* the transmit checksum offsets in the descriptors
*/
-static int bcmgenet_put_tx_csum(struct net_device *dev, struct sk_buff *skb)
+static struct sk_buff *bcmgenet_put_tx_csum(struct net_device *dev,
+ struct sk_buff *skb)
{
struct status_64 *status = NULL;
struct sk_buff *new_skb;
@@ -1072,7 +1073,7 @@ static int bcmgenet_put_tx_csum(struct net_device *dev, struct sk_buff *skb)
if (!new_skb) {
dev->stats.tx_errors++;
dev->stats.tx_dropped++;
- return -ENOMEM;
+ return NULL;
}
skb = new_skb;
}
@@ -1090,7 +1091,7 @@ static int bcmgenet_put_tx_csum(struct net_device *dev, struct sk_buff *skb)
ip_proto = ipv6_hdr(skb)->nexthdr;
break;
default:
- return 0;
+ return skb;
}
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)
status->tx_csum_info = tx_csum_info;
}
- return 0;
+ return skb;
}
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)
/* set the SKB transmit checksum */
if (priv->desc_64b_en) {
- ret = bcmgenet_put_tx_csum(dev, skb);
- if (ret) {
+ skb = bcmgenet_put_tx_csum(dev, skb);
+ if (!skb) {
ret = NETDEV_TX_OK;
goto out;
}
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: bcmgenet: fix bcmgenet_put_tx_csum()
2014-10-01 18:30 [PATCH net-next] net: bcmgenet: fix bcmgenet_put_tx_csum() Petri Gynther
@ 2014-10-01 18:39 ` Florian Fainelli
2014-10-02 2:12 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2014-10-01 18:39 UTC (permalink / raw)
To: Petri Gynther, netdev; +Cc: davem
On 10/01/2014 11:30 AM, Petri Gynther wrote:
> 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.
Good catch! I guess I never really saw a reallocation thanks to the
needed_headroom provisioned. The bcmsysport driver suffers from the same
problem, I will take care of that one. Thanks!
>
> Signed-off-by: Petri Gynther <pgynther@google.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> drivers/net/ethernet/broadcom/genet/bcmgenet.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index 77cb755..d51729c 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -1054,7 +1054,8 @@ static int bcmgenet_xmit_frag(struct net_device *dev,
> /* Reallocate the SKB to put enough headroom in front of it and insert
> * the transmit checksum offsets in the descriptors
> */
> -static int bcmgenet_put_tx_csum(struct net_device *dev, struct sk_buff *skb)
> +static struct sk_buff *bcmgenet_put_tx_csum(struct net_device *dev,
> + struct sk_buff *skb)
> {
> struct status_64 *status = NULL;
> struct sk_buff *new_skb;
> @@ -1072,7 +1073,7 @@ static int bcmgenet_put_tx_csum(struct net_device *dev, struct sk_buff *skb)
> if (!new_skb) {
> dev->stats.tx_errors++;
> dev->stats.tx_dropped++;
> - return -ENOMEM;
> + return NULL;
> }
> skb = new_skb;
> }
> @@ -1090,7 +1091,7 @@ static int bcmgenet_put_tx_csum(struct net_device *dev, struct sk_buff *skb)
> ip_proto = ipv6_hdr(skb)->nexthdr;
> break;
> default:
> - return 0;
> + return skb;
> }
>
> 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)
> status->tx_csum_info = tx_csum_info;
> }
>
> - return 0;
> + return skb;
> }
>
> 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)
>
> /* set the SKB transmit checksum */
> if (priv->desc_64b_en) {
> - ret = bcmgenet_put_tx_csum(dev, skb);
> - if (ret) {
> + skb = bcmgenet_put_tx_csum(dev, skb);
> + if (!skb) {
> ret = NETDEV_TX_OK;
> goto out;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: bcmgenet: fix bcmgenet_put_tx_csum()
2014-10-01 18:30 [PATCH net-next] net: bcmgenet: fix bcmgenet_put_tx_csum() Petri Gynther
2014-10-01 18:39 ` Florian Fainelli
@ 2014-10-02 2:12 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-10-02 2:12 UTC (permalink / raw)
To: pgynther; +Cc: netdev, f.fainelli
From: Petri Gynther <pgynther@google.com>
Date: Wed, 1 Oct 2014 11:30:01 -0700 (PDT)
> 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>
Applied, thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-02 2:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-01 18:30 [PATCH net-next] net: bcmgenet: fix bcmgenet_put_tx_csum() Petri Gynther
2014-10-01 18:39 ` Florian Fainelli
2014-10-02 2:12 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).