diff mbox

[net-next,1/2] hv_netvsc: Cleanup the test for freeing skb when we use sendbuf mechanism

Message ID 1427688522-27991-1-git-send-email-kys@microsoft.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

KY Srinivasan March 30, 2015, 4:08 a.m. UTC
In preparation for embedding the rndis state and other packet state into
the skb, cleanup the test for freeing the skb.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/net/hyperv/netvsc.c     |    1 +
 drivers/net/hyperv/netvsc_drv.c |    3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Dan Carpenter March 30, 2015, 9:02 a.m. UTC | #1
On Sun, Mar 29, 2015 at 09:08:41PM -0700, K. Y. Srinivasan wrote:
> In preparation for embedding the rndis state and other packet state into
> the skb, cleanup the test for freeing the skb.
> 

So there is no behavior change in applying this patch?

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
KY Srinivasan March 30, 2015, 2:25 p.m. UTC | #2
> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Monday, March 30, 2015 2:03 AM
> To: KY Srinivasan
> Cc: davem@davemloft.net; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; devel@linuxdriverproject.org; olaf@aepfle.de;
> apw@canonical.com; jasowang@redhat.com
> Subject: Re: [PATCH net-next 1/2] hv_netvsc: Cleanup the test for freeing
> skb when we use sendbuf mechanism
> 
> On Sun, Mar 29, 2015 at 09:08:41PM -0700, K. Y. Srinivasan wrote:
> > In preparation for embedding the rndis state and other packet state into
> > the skb, cleanup the test for freeing the skb.
> >
> 
> So there is no behavior change in applying this patch?

No. When we send the packet through sendbuf, we will free up the skb after we
copy the data. The test used in the send path can also be used in the send complete path.
That is what I have done.

K. Y
> 
> regards,
> dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index b81bd37..ecbd813 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -870,6 +870,7 @@  int netvsc_send(struct hv_device *device,
 		       (unsigned long)packet->send_completion_tid;
 
 		packet->page_buf_cnt = 0;
+		packet->send_completion_tid = 0;
 		packet->send_buf_index = section_index;
 		packet->total_data_buflen += msd_len;
 
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 0c99818..75beb89 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -234,11 +234,10 @@  static void netvsc_xmit_completion(void *context)
 	struct hv_netvsc_packet *packet = (struct hv_netvsc_packet *)context;
 	struct sk_buff *skb = (struct sk_buff *)
 		(unsigned long)packet->send_completion_tid;
-	u32 index = packet->send_buf_index;
 
 	kfree(packet);
 
-	if (skb && (index == NETVSC_INVALID_INDEX))
+	if (skb)
 		dev_kfree_skb_any(skb);
 }