From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762153AbbA3Pil (ORCPT ); Fri, 30 Jan 2015 10:38:41 -0500 Received: from mail-bl2on0118.outbound.protection.outlook.com ([65.55.169.118]:15348 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752192AbbA3Pik (ORCPT ); Fri, 30 Jan 2015 10:38:40 -0500 X-Greylist: delayed 2012 seconds by postgrey-1.27 at vger.kernel.org; Fri, 30 Jan 2015 10:38:39 EST From: Haiyang Zhang To: Jason Wang CC: "davem@davemloft.net" , "netdev@vger.kernel.org" , KY Srinivasan , "olaf@aepfle.de" , "linux-kernel@vger.kernel.org" , "driverdev-devel@linuxdriverproject.org" Subject: RE: [PATCH net] hyperv: Fix the error processing in netvsc_send() Thread-Topic: [PATCH net] hyperv: Fix the error processing in netvsc_send() Thread-Index: AQHQO/jiPyD0DaGOdEuEBUqp+E+oB5zYdiWAgABI5tA= Date: Fri, 30 Jan 2015 15:05:00 +0000 Message-ID: References: <1422563689-31036-1-git-send-email-haiyangz@microsoft.com> <1422613519.8840.0@smtp.corp.redhat.com> In-Reply-To: <1422613519.8840.0@smtp.corp.redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [96.237.174.38] authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=microsoft.com; x-dmarcaction-test: None x-microsoft-antispam: BCL:0;PCL:0;RULEID:(3005004);SRVR:BN1PR0301MB0707; x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:;SRVR:BN1PR0301MB0707; x-forefront-prvs: 04724A515E x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(377454003)(51704005)(13464003)(164054003)(54206007)(77156002)(122556002)(54356999)(54606007)(76176999)(76576001)(50986999)(92566002)(62966003)(33656002)(40100003)(87936001)(110136001)(106116001)(2900100001)(102836002)(2950100001)(74316001)(86612001)(66066001)(46102003)(2656002)(19580395003)(19580405001)(86362001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN1PR0301MB0707;H:BN1PR0301MB0770.namprd03.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: microsoft.onmicrosoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jan 2015 15:05:00.7261 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0301MB0707 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id t0UFclDi024640 > -----Original Message----- > From: Jason Wang [mailto:jasowang@redhat.com] > Sent: Friday, January 30, 2015 5:25 AM > > + if (ret != 0) { > > + if (section_index != NETVSC_INVALID_INDEX) > > + netvsc_free_send_slot(net_device, section_index); > > What if ret is -EINVAL or -ENOSPC? Looks like we need free the skb in > this case also. In these cases, skb is freed in netvsc_start_xmit(). > > > > + } else if (skb) { > > + dev_kfree_skb_any(skb); > > The caller - netvsc_start_xmit() do this also, may be handle this in > caller is better since netvsc_start_xmit() is the only user that tries > to send a skb? When the packet is sent out normally, we frees it in netvsc_send() if it's copied to send-buffer. The free is done in netvsc_send(), because the copy is also in this function. If it's not copied, it will be freed in another function -- netvsc_xmit_completion(). netvsc_start_xmit() only does free skb in error case. > btw, I find during netvsc_start_xmit(), ret was change to -ENOSPC when > queue_sends[q_idx] < 1. But non of the caller check -ENOSPC in fact? In this case, we don't request re-send, so set ret to a value other than -EAGAIN. It's handled in the same way as errors != -EAGAIN, so we don't need to check this value specifically. Thanks, - Haiyang ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayºʇڙë,j­¢f£¢·hšïêÿ‘êçz_è®(­éšŽŠÝ¢j"ú¶m§ÿÿ¾«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^¶m§ÿÿà ÿ¶ìÿ¢¸?–I¥