Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752072AbdFJMn2 (ORCPT ); Sat, 10 Jun 2017 08:43:28 -0400 Received: from mail-bn3nam01on0042.outbound.protection.outlook.com ([104.47.33.42]:38818 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751583AbdFJMnZ (ORCPT ); Sat, 10 Jun 2017 08:43:25 -0400 From: "Mintz, Yuval" To: Salil Mehta , "davem@davemloft.net" CC: "yisen.zhuang@huawei.com" , "huangdaode@hisilicon.com" , "lipeng321@huawei.com" , "mehta.salil.lnk@gmail.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linuxarm@huawei.com" Subject: RE: [PATCH net-next 1/9] net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC Thread-Topic: [PATCH net-next 1/9] net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC Thread-Index: AQHS4ZylAUR/9UEISEenwnHcN46eG6IeAvvA Date: Sat, 10 Jun 2017 12:43:21 +0000 Message-ID: References: <20170610034630.493852-1-salil.mehta@huawei.com> <20170610034630.493852-2-salil.mehta@huawei.com> In-Reply-To: <20170610034630.493852-2-salil.mehta@huawei.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=cavium.com; x-originating-ip: [31.168.140.228] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BY2PR0701MB2006;7:LkbNhooUDkhOwrT+SiI++SDqYkY1nYH+vSXKX1eAYXOCrMV5UVCI/CVe2RTZI7h/8bw38+GsCXOSvJM8j0pv85v7Ef4p2WmE7MVT1IgUZzlc/QKPZeOWBePWt9zSRpHmH8/t/wagWxtk68h/B4klrdNqa1gUDHOV+wwvEu01wA6kfgyDX6gFh30owG0sJQMyBq3PJZc5xtLFMswsaY/MfhAAOFuK+a4+SRr2Filsmuk2XQyCLtbzQIYUrCFJelju5cHzI38FU0p3R807NlyPiHOVkfq54JUIP6Bn28vRfM8QzCpZZdWWn/rqzetQgwX0Lk8z0cdJzSt3f9DoPDcYeQ== x-ms-traffictypediagnostic: BY2PR0701MB2006: x-ms-office365-filtering-correlation-id: ec2eefc1-43a0-496f-1768-08d4affe474a x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(201703131423075)(201703031133081)(201702281549075);SRVR:BY2PR0701MB2006; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(20161123558100)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BY2PR0701MB2006;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BY2PR0701MB2006; x-forefront-prvs: 0334223192 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(39400400002)(39410400002)(39450400003)(39840400002)(39850400002)(86362001)(39060400002)(229853002)(4326008)(2950100002)(7696004)(122556002)(72206003)(33656002)(478600001)(25786009)(189998001)(66066001)(3846002)(102836003)(6116002)(8676002)(55016002)(99286003)(2501003)(54906002)(8936002)(54356999)(50986999)(6436002)(9686003)(6246003)(53936002)(14454004)(3280700002)(2906002)(5660300001)(38730400002)(74316002)(77096006)(7736002)(3660700001)(76176999)(305945005)(2900100001)(81166006)(6506006);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR0701MB2006;H:BY2PR0701MB2005.namprd07.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jun 2017 12:43:21.6174 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0701MB2006 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 quoted-printable to 8bit by mail.home.local id v5AChVn0005659 Content-Length: 1996 Lines: 72 > +static void hns3_nic_net_down(struct net_device *ndev) { > + struct hns3_nic_priv *priv = netdev_priv(ndev); > + struct hnae3_ae_ops *ops; > + int i; > + > + netif_tx_stop_all_queues(ndev); > + netif_carrier_off(ndev); > + netif_tx_disable(ndev); > + > + ops = priv->ae_handle->ae_algo->ops; > + > + if (ops->stop) > + ops->stop(priv->ae_handle); > + > + netif_tx_stop_all_queues(ndev); Looks a bit excessive. Why do you need all these netif_tx_stop_all_queues()? > +int hns3_nic_net_xmit_hw(struct net_device *ndev, ... > +out_map_frag_fail: > + > + while (ring->next_to_use != next_to_use) { > + if (ring->next_to_use != next_to_use) > + dma_unmap_page(dev, > + ring->desc_cb[ring->next_to_use].dma, > + ring->desc_cb[ring->next_to_use].length, > + DMA_TO_DEVICE); > + else > + dma_unmap_single(dev, > + ring->desc_cb[next_to_use].dma, > + ring->desc_cb[next_to_use].length, > + DMA_TO_DEVICE); > + } Something looks completely broken in this error-handling 'loop'. > +static int hns3_setup_tc(struct net_device *ndev, u8 tc) { ... > + /* Assign UP2TC map for the VSI */ > + for (i = 0; i < HNAE3_MAX_TC; i++) { > + netdev_set_prio_tc_map(ndev, > + kinfo->tc_info[i].up, > + kinfo->tc_info[i].tc); > + } ... > +static int hns3_nic_setup_tc(struct net_device *dev, u32 handle, > + u32 chain_index, __be16 protocol, > + struct tc_to_netdev *tc) > +{ > + if (handle != TC_H_ROOT || tc->type != TC_SETUP_MQPRIO) > + return -EINVAL; > + > + return hns3_setup_tc(dev, tc->mqprio->num_tc); } Isn't mqprio going to override your priority2tc mapping with the one provided by user? > + > +static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, > + struct sk_buff **out_skb, int *out_bnum) { ... > + /* Prefetch first cache line of first page */ > + prefetch(va); > +#if L1_CACHE_BYTES < 128 > + prefetch(va + L1_CACHE_BYTES); > +#endif Might be better to comment what you're actually fetching