Received: by 10.213.65.68 with SMTP id h4csp2040511imn; Thu, 5 Apr 2018 08:01:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx49jr5NTxsFQH+OBSjS08XcwHr5ykP/lS6ObgeyVMOVUes6AopvNOIvHOzcGeNOSKq6sHoJh X-Received: by 2002:a17:902:2f:: with SMTP id 44-v6mr23364686pla.187.1522940506799; Thu, 05 Apr 2018 08:01:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522940506; cv=none; d=google.com; s=arc-20160816; b=RByrd2vf2EzIBwwfmlsPEjxu6g4aYONl3NYucNoY7dxqBOHAp6J7OUMUDydtqYympG oTPuCHTA6yNb39Qecr7AIofcnSpMhPb8cR3V5N+zzX7McS7zKLk4pYnMR8ZFZlmsFQu2 pou+gqhzO0dOViKWtb1RKAGUUk01vBQLY4quRVd4M3CDcvyXh7fH19sRKgee8ptsoYwq UhVAexmisxjlFcnTXI8ByxRHJwhC9P81fY0iWH8LYyYHo3t1cqQcgEeXQCwj958TQdiG zTDQlZ4A63djFj4SQO1MzVEeDJBob2EN7DAmuvKrlxWdc7dneJFEWkwKdSKscW163hCT Iz9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=l3/VjNBBj/weUm30dJ2wsFDfkMe+VmMT1sBYJ9S5lLE=; b=UXHLBzvD4m/N2NhrKJr0B2SMgdXCno/nOH18F2oUi/2tfXdPu0+XWA4vQiJWpN/lJO 6eqqmzVKIJYO8M/QeBqgnYNp9oVqjNs+z8VOUu63+oy9vhFJ4y5HeVe4Oa+2r3FZaask nsYmYNUKCBtB/CZbHmA3uMckn9aPFoWY5gJG9oYE4LzR+LgFkHM45ulwD54hR6JXff9X I7jWh55l7vtMqywX0gT+kTi2BAathhWl/y1QaKXqkg2J8cXtcKKTztwHTzOCgEi71Qb8 PVvGN6CguChF5lOeoD8FcbpYd4v43rw8xTf84lI6b48+UWHtCwak13KncxrH2dxjcc2w z0tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=oWRJuXyP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9-v6si5880382plr.493.2018.04.05.08.01.32; Thu, 05 Apr 2018 08:01:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=oWRJuXyP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751466AbeDEPAT (ORCPT + 99 others); Thu, 5 Apr 2018 11:00:19 -0400 Received: from mail-dm3nam03on0089.outbound.protection.outlook.com ([104.47.41.89]:14648 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751038AbeDEPAQ (ORCPT ); Thu, 5 Apr 2018 11:00:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=l3/VjNBBj/weUm30dJ2wsFDfkMe+VmMT1sBYJ9S5lLE=; b=oWRJuXyP4uj6J3eSVMMDvvSc4psIv/17GWi26kUb9u8pwlikQ/el5DugUJwR/Czvhr4+P/e+eYGdSxRjx2IVZSmSBGpQKsWDVFJ6KwdbzAP05mDKmBPjzZv5wff3BwG9akNqVNAcPTicxO4kr1Ze+Fs2jFo+xgT0jdhqp82A8PM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Vadim.Lomovtsev@cavium.com; Received: from localhost.localdomain (50.233.148.156) by CY4PR07MB2999.namprd07.prod.outlook.com (2603:10b6:903:d0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.10; Thu, 5 Apr 2018 15:00:13 +0000 Date: Thu, 5 Apr 2018 08:00:09 -0700 From: Vadim Lomovtsev To: sgoutham@cavium.com, sunil.kovvuri@gmail.com, rric@kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net Cc: dnelson@redhat.com, gustavo@embeddedor.com, Vadim Lomovtsev Subject: Re: [PATCH] net: thunderx: rework mac addresses list to u64 array Message-ID: <20180405150009.GA12703@localhost.localdomain> References: <20180405145756.12633-1-Vadim.Lomovtsev@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180405145756.12633-1-Vadim.Lomovtsev@caviumnetworks.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: DM3PR12CA0061.namprd12.prod.outlook.com (2603:10b6:0:56::29) To CY4PR07MB2999.namprd07.prod.outlook.com (2603:10b6:903:d0::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e3fa4251-889c-4df7-a14e-08d59b05efa1 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603328)(7153060)(7193020);SRVR:CY4PR07MB2999; X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB2999;3:AV4d4rUNEIYaaXOnMNbAOqWO7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a8TUzph41YCeIpgiIcl6zktiOOhhYagTYhs1IF0bpadofW7ioXCGkfXzpB19TeMpOA1W101vUkFFQqqyWwqDvI+F3neGYoEwPUbnViuMg/XCRJGdSPKAKO4KutPbFvTy1g00poThIEiu5atDO8AckPBizHZDdp2XDV4uEoJalgJBX/qeXECEg5wTIIDzon+InF63+aGDwOILgtPYQx3dGjupPhZ9yKJClGN2LJVadQa42Zs4PNzHJ8haUbW7awJLLi1bNxpwkW1d9i15qXQkQeTGOqieLscY/VdaZjxBY+WGRPRsr2YxmnZSzGje/RdwftzWOAx+Ib0Lf/LKe4jphKGyObHjG1Drzj9lz+ReP3BuWNHdj0kCMpsbCOGC0srD8YLyAVYmQOPNSyUh9rK864U5et+169V6Xk=;4:3jr8VxMTxT+Y608wQcspRUr1BtLj5mt13P+sRzpRhVKsUaAqV7CpUCBv8aOgDgi9O+z6D+ZI6HrKHKz5n2TJL4O/OyAmm3PAz0crw83XxFjnGBq9mAXijxQO6rkcqoYuKUoY9LG6IU6s4nkJTGf6x7blpBA0NZ9JmrSkAMlZdjPPgI2Ipb80ZETmHPuNv5Wu4CKWBdA+e2lYOF/oZ1CnKfIQl/Ao7FiSA9uslH1jYjMe4/Ei9A2fvnSsMwnxSMtg02im2zdZN4Tb+0qoXem0igXXwV9KhrT2SR6PvE6C4I2Sho/K2gjbcJ5tLtpDSIUk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(277106579953875); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(10201501046)(3002001)(93006095)(6041310)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011);SRVR:CY4PR07MB2999;BCL:0;PCL:0;RULEID:;SRVR:CY4PR07MB2999; X-Forefront-PRVS: 06339BAE63 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(39380400002)(376002)(366004)(346002)(39860400002)(396003)(199004)(189003)(42882007)(6116002)(8676002)(72206003)(47776003)(8936002)(50466002)(105586002)(478600001)(97736004)(66066001)(25786009)(5660300001)(81166006)(39060400002)(61506002)(81156014)(107886003)(229853002)(305945005)(386003)(16526019)(7736002)(76176011)(59450400001)(11346002)(446003)(52116002)(33896004)(6506007)(7696005)(4326008)(6246003)(2906002)(3846002)(68736007)(26005)(23726003)(58126008)(33656002)(6666003)(55016002)(53936002)(106356001)(316002)(956004)(486006)(476003)(16586007)(9686003)(1076002)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR07MB2999;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR07MB2999;23:/bZ68k6wCgG8fn5BYbWwZaXfArjOUgEENVP+viNqt?= =?us-ascii?Q?t5MfZxYwsHQIlDWYXg3Lni3EMDvME4S1PjJHA0oOJHAN8fJ7sy3imLnxyUvP?= =?us-ascii?Q?tQVFKBj751MJ5uMlCcYISPCVjJ8wvNT1T8kpjVUPp8z9Pgpwa4PGXYQJjqkQ?= =?us-ascii?Q?eWikcZaMbnWf+YXbQkeo7Ig5Qcn/KhgomehhPyY8rDiQlWQMbwYdUHSFUAy/?= =?us-ascii?Q?fqY2U08KyaRh/trEZjQM54xFrxdTJwHhq9bfcwm8Tzi7sGvzmNeUcna05zIa?= =?us-ascii?Q?mq6XkOh6c8tj1KiX2OYsSw2CTsjQHBmTMfK+BmRCihKbFxONnKcaajmRR8Zv?= =?us-ascii?Q?tgtZ+BD0ytgYAAynV7jH+4hlx7uE/ChMqGuqVUCurkR78bHdotKgl6Bb9fGb?= =?us-ascii?Q?h5kTv/XTmH63nb6QUSL3VafY0wCtrM4OvWy75r4sGlm/5t/b9HPcWNrArpIU?= =?us-ascii?Q?u6G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put: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB2999;7:4F8QseS9vFXEZbNo4wfCnwJFVJUN+Khuwpe7zm5jBKAGJAcZAE/RE3YOGxHLArrQ/ALsxLbvqFQ1kL0yZPJHPNdyUqWcEd4X2YIHh7MFMAUevTg5v1GjXL6u+9T6F2chnd82w+PB4YgDAkJQn/N10uZtwJ8rWlJp/Rbi7frCxzakkTuuh26XANUIJZMvywnoSPpSWGqS1UoNdK9YCj1aer0rxL9DG/sss1tfwfmch7+FnmiX5H1owDYfSbRiiuC2 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2018 15:00:13.2157 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3fa4251-889c-4df7-a14e-08d59b05efa1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB2999 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [correct Roberts' address] On Thu, Apr 05, 2018 at 07:57:56AM -0700, Vadim Lomovtsev wrote: > From: Vadim Lomovtsev > > It is too expensive to pass u64 values via linked list, instead > allocate array for them by overall number of mac addresses from netdev. > > This eventually removes multiple kmalloc() calls, aviod memory > fragmentation and allow to put single null check on kmalloc > return value in order to prevent a potential null pointer dereference. > > Addresses-Coverity-ID: 1467429 ("Dereference null return value") > Fixes: 37c3347eb247 ("net: thunderx: add ndo_set_rx_mode callback implementation for VF") > Signed-off-by: Vadim Lomovtsev > --- > drivers/net/ethernet/cavium/thunder/nic.h | 7 +----- > drivers/net/ethernet/cavium/thunder/nicvf_main.c | 28 +++++++++--------------- > 2 files changed, 11 insertions(+), 24 deletions(-) > > diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h > index 5fc46c5a4f36..da052159f014 100644 > --- a/drivers/net/ethernet/cavium/thunder/nic.h > +++ b/drivers/net/ethernet/cavium/thunder/nic.h > @@ -265,14 +265,9 @@ struct nicvf_drv_stats { > > struct cavium_ptp; > > -struct xcast_addr { > - struct list_head list; > - u64 addr; > -}; > - > struct xcast_addr_list { > - struct list_head list; > int count; > + u64 mc[0]; > }; > > struct nicvf_work { > diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c > index 1e9a31fef729..a26d8bc92e01 100644 > --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c > +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c > @@ -1929,7 +1929,7 @@ static void nicvf_set_rx_mode_task(struct work_struct *work_arg) > work.work); > struct nicvf *nic = container_of(vf_work, struct nicvf, rx_mode_work); > union nic_mbx mbx = {}; > - struct xcast_addr *xaddr, *next; > + u8 idx = 0; > > if (!vf_work) > return; > @@ -1956,16 +1956,10 @@ static void nicvf_set_rx_mode_task(struct work_struct *work_arg) > /* check if we have any specific MACs to be added to PF DMAC filter */ > if (vf_work->mc) { > /* now go through kernel list of MACs and add them one by one */ > - list_for_each_entry_safe(xaddr, next, > - &vf_work->mc->list, list) { > + for (idx = 0; idx < vf_work->mc->count; idx++) { > mbx.xcast.msg = NIC_MBOX_MSG_ADD_MCAST; > - mbx.xcast.data.mac = xaddr->addr; > + mbx.xcast.data.mac = vf_work->mc->mc[idx]; > nicvf_send_msg_to_pf(nic, &mbx); > - > - /* after receiving ACK from PF release memory */ > - list_del(&xaddr->list); > - kfree(xaddr); > - vf_work->mc->count--; > } > kfree(vf_work->mc); > } > @@ -1996,17 +1990,15 @@ static void nicvf_set_rx_mode(struct net_device *netdev) > mode |= BGX_XCAST_MCAST_FILTER; > /* here we need to copy mc addrs */ > if (netdev_mc_count(netdev)) { > - struct xcast_addr *xaddr; > - > - mc_list = kmalloc(sizeof(*mc_list), GFP_ATOMIC); > - INIT_LIST_HEAD(&mc_list->list); > + mc_list = kmalloc(sizeof(*mc_list) + > + sizeof(u64) * netdev_mc_count(netdev), > + GFP_ATOMIC); > + if (unlikely(!mc_list)) > + return; > + mc_list->count = 0; > netdev_hw_addr_list_for_each(ha, &netdev->mc) { > - xaddr = kmalloc(sizeof(*xaddr), > - GFP_ATOMIC); > - xaddr->addr = > + mc_list->mc[mc_list->count] = > ether_addr_to_u64(ha->addr); > - list_add_tail(&xaddr->list, > - &mc_list->list); > mc_list->count++; > } > } > -- > 2.14.3 >