From patchwork Thu Jul 7 08:32:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 9218375 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1A31D607D9 for ; Thu, 7 Jul 2016 08:35:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E10A287B3 for ; Thu, 7 Jul 2016 08:35:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 026C7287B4; Thu, 7 Jul 2016 08:35:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B5A3287AC for ; Thu, 7 Jul 2016 08:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964784AbcGGIeu (ORCPT ); Thu, 7 Jul 2016 04:34:50 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:25408 "EHLO relmlie4.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030454AbcGGIdW (ORCPT ); Thu, 7 Jul 2016 04:33:22 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie4.idc.renesas.com with ESMTP; 07 Jul 2016 17:33:20 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 679E34D1CD; Thu, 7 Jul 2016 17:33:20 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id 56E93480A4; Thu, 7 Jul 2016 17:33:20 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id 4DD68480A3; Thu, 7 Jul 2016 17:33:20 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac4.idc.renesas.com with ESMTP id TAM26979; Thu, 7 Jul 2016 17:33:20 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="215083351" Received: from mail-sg2apc01lp0245.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.245]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 07 Jul 2016 17:33:19 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ky/7WoZxbfaVQcf7er1EyLYd0/TQFGMOEAZUg/vS/ak=; b=ZJxVT7ZpHmMhCgMeAJeoax2v8MzB+jRfpWGLogtm+V9HpNgTLnwxzpjK7fAmqv53deHSCaU1s4MCs5EleRcZnI4GY9FUeehIP2Ob3W779uJealWm+xqA2nJu8uLxmStqYhoR7dnbjOfLno5KQt73Fa2UMRDUZ8EpHNn2HjQlV80= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost (211.11.155.144) by HK2PR06MB0548.apcprd06.prod.outlook.com (10.161.183.153) with Microsoft SMTP Server (TLS) id 15.1.534.14; Thu, 7 Jul 2016 08:33:16 +0000 From: Yoshihiro Shimoda To: CC: , , , Yoshihiro Shimoda Subject: [PATCH/RFC 2/4] usb: gadget: u_ether: add a flag to avoid skb_reserve() calling Date: Thu, 7 Jul 2016 17:32:40 +0900 Message-ID: <1467880362-4844-3-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.1 In-Reply-To: <1467880362-4844-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1467880362-4844-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS1PR01CA0015.jpnprd01.prod.outlook.com (10.161.225.153) To HK2PR06MB0548.apcprd06.prod.outlook.com (10.161.183.153) X-MS-Office365-Filtering-Correlation-Id: 889eb7eb-bb30-4c06-1678-08d3a6415868 X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0548; 2:zRifKuewPF3mAhuIB5o86j1fiIlNw5JBw3X9yPhKwy8z6tZ2UUNppffhNpL0SoYVLDcW7wbhgVXsB7GAD6J57UjevLO7K2UIpR1Gk9iB88+7lx/xaMUguMg9383q+dZht0opjDiaENMivcbXR3KHfHThh+QVtVJwr0R9ovYTHZnbHNZihUt5mCNkJCC3uXss; 3:P5ljRzkKhBhdrdT/puVrqRIWgmokPU/IQ75sNEHUobR/wnSK7LxZS2a2Zy28v2TaWVGSzyCAdsj9nrnojCTA/HLwweoZ2dCI4pI8emb2ijktxIVjnWZT+w/SKFcLVkVs; 25:letEDvDFqoQRvdAJ+X5JNUSarziF5hx2I9yWx5hqeJ/glVmqEYqOafT3W2ywRQE8lonayIRjeXE0vbRGhOwlny+YedHBJ7D77mXe8evUq6IbI8N7DubThOl0XLZxjda8klX6j7HD02zDue5UTFDXm788xskl/6JPz6XsiF0qpKFIyUIRN4ZQCIHMXfOB/4hZl6cTTcGhpibUBoHc0VLZNUaKneF9UwnV6M6J1U4Q0W1c/tOT8Zmupqd/xGDBy1pUbuxzL3YK7ZE5mjUEzPLuQu1zH8fwLYt7jEcQfDJ+StN5c7mXOK+IxuNosGEbK6Fl1h/lHn+nz6XIodGKDQ4T+2MRCFwgUrHqsY6z14S9ad8Q9lUB7/KX3eGbIxPlyliyl/L6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/Kn+XRh7Ubs5+IgXuCN2NMUkAvdT3iST9j+ouM/O4E462F26lLE/huZviJnit5LGXbBg2USrJ59Rq05dPfqKMQVqorzToWpWVW4ScdE4hCSIR8HRp/0IkOaFC6Jc/DQ3vAKs49NAVe7CTAwvkygKBdXCurZ9hvByqXPBtYQMdhae2vdi2QA/r3+41RignQCXIrdaSecGsA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:HK2PR06MB0548; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB0548; X-Forefront-PRVS: 0996D1900D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(7916002)(189002)(199003)(7846002)(92566002)(4326007)(7736002)(189998001)(2950100001)(6116002)(586003)(33646002)(3846002)(19580405001)(81156014)(8676002)(68736007)(110136002)(19580395003)(50226002)(81166006)(97736004)(78352004)(2906002)(4001430100002)(107886002)(50986999)(50466002)(76176999)(305945005)(105586002)(101416001)(48376002)(66066001)(36756003)(47776003)(76506005)(2351001)(106356001)(229853001)(42186005)(5003940100001)(77096005); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB0548; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:0; A:0; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HK2PR06MB0548; 23:Vebp3umAe1GkkeXH4/iPpAyFf2RUrvh4exSxv3oT1?= =?us-ascii?Q?oQAvPD+qEQKRhSB2Iyv84TpOq218vmr/IImQznfIP9a/m+6A9nGRuGxqrWW8?= =?us-ascii?Q?06c1Q8Op+BvVmFpTA27jw4WPNnMwhS4bmKhMV48K8Gp1WQRUmfEK8bM+uW9W?= =?us-ascii?Q?G/zL/OSpD2UXa3OAlJn+gCmLe1j6PLaIAcXgnyb0TEhT99kREXO6KISX+WTY?=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CJ9BXnbgE8tVi?= =?us-ascii?Q?VVYqxQ0JSpWiabbSgep3znSjDHHLVUA/kJ3Oa59L0PrVg5rXvm2jw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0548; 6:yWUFtA6m8rU6QaYt1mGY+C9oUNaUHG7f04lbM5O0dQtaLSddsmOWEvkBelQfZ7W67av3R7HRKSZyzeNfq03vH4XHRJO1EG8ud1IakVnFLSz0OamK8U/GvmPqcisJTd8JVpAkxfC53F21gbpS6dZKXY1nevQzSVbe3G7CHciwOa/WR0FMzHUXo+CUOgQmmucIGiKBvS5p3zYQeKdY/V7DXVP9munh/CBkhYKm4yYSqXY97GHP0EUA0ytXam3lKh0vGZUn0rMurkcb/jWULR05Wn3lPmtMziNhKSK+/PB4fcS/t85f8gudohU33hLFXu8sas/8DQz0L44EHLI+aH1FtA==; 5:+imAlmqTOVrWepoxzh79g3zWQ7iL2B8WDUCXfMNkZHbohF3fLcF+WbUJGSf7HsDK0mklL2Bkuu711nmF/hLIgrP7wmAAxXRDjzESanhq7bQ9rGJv1i/6T7wzyZOUxB4QoLpbu8u2OJ2Sm7bNIti5tw==; 24:0a+qFrmQtN3moYFMjmim6cgELy2SkkABMUjFnQSiwNHnoBKlK8qF5lqU5G4XbSjHugGleXf+B0grkVpg0ScKBa0I+glvhwLIZfMgmQksAZA=; 7:hpPh74nfLNA8kL6oPlMYncXdH5VN09fLDeq9mGvYSAzWOw8dHqzr1BDVnm4gIGn6BCvdfYTBlhiGm5Q7E4OAzyQqZzEsF4uYl1yLWqkid9Svbmj1UVUKIkLJEF7xkEGvrzfXhIJBs/bJRjoSJs/cunqu934U/Qtdqg8FiwQQOWth+JmqpnqOQ2DccMw4WPXXwrsAroj5B9mlpqdzJYEXcAypnfyoO8IS4cn7i6VOa7Uw0/1DIkI31D2Mw+Li0eKi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0548; 20:mdXNGSdSF6uwAEfUxyMuJiyB8QjNA+euKc1PvjKkTFl2rBxoLTSyYpA8zpNssy5E/kadW9jsre2j5Rs0zvk7z9s/2pCXs6ckkCpzbScpgQU8/xq4bGRgMM8U5EkBfT+D3nW14YHZSW6bAv30hO3azCZHSlfOMJSOdnQXw8tqPJ8= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2016 08:33:16.9038 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB0548 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a flag "no_skb_reserve" in struct eth_dev. So, if a peripheral driver sets the quirk_avoids_skb_reserve flag, upper network gadget drivers (e.g. f_ncm.c) can avoid skb_reserve() calling using the flag as well. Signed-off-by: Yoshihiro Shimoda --- drivers/usb/gadget/function/u_ether.c | 5 ++++- drivers/usb/gadget/function/u_ether.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index a3f7e7c..04e30c6 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c @@ -82,6 +82,7 @@ struct eth_dev { #define WORK_RX_MEMORY 0 bool zlp; + bool no_skb_reserve; u8 host_mac[ETH_ALEN]; u8 dev_mac[ETH_ALEN]; }; @@ -233,7 +234,8 @@ rx_submit(struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags) * but on at least one, checksumming fails otherwise. Note: * RNDIS headers involve variable numbers of LE32 values. */ - skb_reserve(skb, NET_IP_ALIGN); + if (likely(!dev->no_skb_reserve)) + skb_reserve(skb, NET_IP_ALIGN); req->buf = skb->data; req->length = size; @@ -1062,6 +1064,7 @@ struct net_device *gether_connect(struct gether *link) if (result == 0) { dev->zlp = link->is_zlp_ok; + dev->no_skb_reserve = link->no_skb_reserve; DBG(dev, "qlen %d\n", qlen(dev->gadget, dev->qmult)); dev->header_len = link->header_len; diff --git a/drivers/usb/gadget/function/u_ether.h b/drivers/usb/gadget/function/u_ether.h index c77145b..81d94a7 100644 --- a/drivers/usb/gadget/function/u_ether.h +++ b/drivers/usb/gadget/function/u_ether.h @@ -64,6 +64,7 @@ struct gether { struct usb_ep *out_ep; bool is_zlp_ok; + bool no_skb_reserve; u16 cdc_filter;