Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755835AbbFONk7 (ORCPT ); Mon, 15 Jun 2015 09:40:59 -0400 Received: from mail-bl2on0131.outbound.protection.outlook.com ([65.55.169.131]:5696 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755589AbbFONkt (ORCPT ); Mon, 15 Jun 2015 09:40:49 -0400 From: Madalin-Cristian Bucur To: Eric Dumazet CC: "netdev@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" Subject: RE: [RFC,v3 02/10] dpaa_eth: add support for DPAA Ethernet Thread-Topic: [RFC,v3 02/10] dpaa_eth: add support for DPAA Ethernet Thread-Index: AQHQgoy67USkhZ9S4U2K7B2IZnjQHp2mSFKAgAd4rHA= Date: Mon, 15 Jun 2015 13:40:46 +0000 Message-ID: References: <1430319405-31280-1-git-send-email-madalin.bucur@freescale.com> <1433958961.27504.15.camel@edumazet-glaptop2.roam.corp.google.com> In-Reply-To: <1433958961.27504.15.camel@edumazet-glaptop2.roam.corp.google.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gmail.com; dkim=none (message not signed) header.d=none; x-originating-ip: [192.88.166.1] x-microsoft-exchange-diagnostics: 1;BL2PR03MB546;3:CWK1v8TByDhh1HwEOlVH7XXoYo+csHqD4r8QSyrxohxc8/4j3YcnIsGjOC44wybDQDOzT993cy7UhFPXuFuMrZ7K46XAunfa8nGFLqhe3RruE1AQ8GT4DYTmJdq3ziFn5PV+g1jWBQFymklUrmJsoQ==;10:+IEPIq2YDFzZA6alLyQU+4b96tEWJJQS2ieHLef3hVXB3f1rhs+MTcJcvBOi4knEUbRA4KiyD+oyiJMtMuZWxbzNcdBUpXz1q7a5TBF5wAw=;6:M0pMHI1KgnMXUbVggkp3dZc7xybexW1WAB/vftFOZv/6LysPZhxYm7w+kSvAc3Ok x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB546; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(5005006)(520003)(3002001);SRVR:BL2PR03MB546;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB546; x-forefront-prvs: 0608DEDB67 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(377424004)(13464003)(24454002)(122556002)(33656002)(99286002)(102836002)(5001960100002)(76576001)(87936001)(77156002)(106116001)(46102003)(110136002)(66066001)(62966003)(2656002)(19580405001)(74316001)(86362001)(76176999)(77096005)(19580395003)(5002640100001)(189998001)(54356999)(50986999)(40100003)(2950100001)(92566002)(5003600100002)(142933001);DIR:OUT;SFP:1102;SCL:1;SRVR:BL2PR03MB546;H:BL2PR03MB545.namprd03.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jun 2015 13:40:46.3613 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR03MB546 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 t5FDf7TZ028026 Content-Length: 2297 Lines: 61 > -----Original Message----- > From: Eric Dumazet [mailto:eric.dumazet@gmail.com] > > On Wed, 2015-04-29 at 17:56 +0300, Madalin Bucur wrote: > > This introduces the Freescale Data Path Acceleration Architecture > > (DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan, > > BMan, PAMU and FMan drivers to deliver Ethernet connectivity on > > the Freescale DPAA QorIQ platforms. > ... > > > + /* We're going to store the skb backpointer at the beginning > > + * of the data buffer, so we need a privately owned skb > > + */ > > + > > + /* Code borrowed from skb_unshare(). */ > > + if (skb_cloned(skb)) { > > + struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC); > > + > > + /* Finally, create a contig FD from this skb */ > > + skb_to_contig_fd(priv, skb, &fd, countptr, &offset); > > + > > + kfree_skb(skb); > > + skb = nskb; > > + /* skb_copy() has now linearized the skbuff. */ > > + } > > + > > You know that TCP packets are clones, right ? > This code is killing performance. > > TCP allows the headers part being modified by a driver if needed. > > You should use skb_header_cloned() instead. Thank you, I'll address this. I plan to do something like this: + if (!nonlinear) { + /* We're going to store the skb backpointer at the beginning + * of the data buffer, so we need a privately owned skb + */ + + /* make sure skb is not shared, skb_cow_head() assumes it's not */ + skb = skb_share_check(skb, GFP_ATOMIC); + if (!skb) + goto enomem; + + /* verify the skb head is not cloned */ + if (skb_cow_head(skb, priv->tx_headroom)) + goto enomem; + + nonlinear = skb_is_nonlinear(skb); + } but I'm not sure the skb_share_check() is required on tx. I'm also a bit puzzled by the aliasing between shared and cloned terms (i.e. skb_unshare() could be named something like skb_unclone(); the skb_share_check() not only checks but also unshares an skb so the already taken skb_unshare() name would probably fit too). Madalin ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?