From patchwork Mon Oct 31 14:25:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: drake@draketalley.com X-Patchwork-Id: 13270 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2349676wru; Mon, 31 Oct 2022 07:35:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76GhZU/m288vuUcLb84gjikHBkoy13/SYuDqBEuzibXZ4ettUf2BOHVMYU7NAnbLWQ7wUM X-Received: by 2002:a17:907:7f92:b0:78d:ed9c:d86f with SMTP id qk18-20020a1709077f9200b0078ded9cd86fmr12974298ejc.251.1667226920872; Mon, 31 Oct 2022 07:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667226920; cv=none; d=google.com; s=arc-20160816; b=Sk/dxrxmTCJ9nWAEFAvuBPHi9O/xj/4AjZpppWeCmDXHe7EagdX8sS5y3aV0HNdmgv A+i/EAJQkcz8ziyVRVudoXFDGGjxhcBwkm6TMEKbVJrWT9qCDU6EFwzN9tsK69nnSYG2 n+g5OUK7n7FcXZN82OhiNbBvrh36wek/m3fM9QfaGl+g/vnYkQqcrVM/DLug/hKdMLv4 4tnaeO6FWTvohwmvuAu8wMeDT+Cn5OcsfM8n5Eu43bl3E0ymLkPjf0ZWw7oUZmbe+77M hfbTZeXjfdQ+2GIBP094mxxRH94fKszW7njLRtQeI/ZxxC2wyIYh8Bs7OLm2N+7rtzl/ UdPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=r5Bh0x+yP3Enw40ZrvMyeMtrc6N5VMiX+6ju3M/Qv4Y=; b=SYqBLukUIsAZcBGUOIkhzcd93mUQBGUqsQiDoE4G4Gj7VazDlmXXLBI77oYFGnRGOq 99wLMdI4XDCUKoziVjmCDAPzfhmJU2EARAcoJINfq+0HT0eSBvcDYToYQHaG/YuU2XHD dwuBnRbKSkGSlch16yS461Q0J9LijlUJWksqv92PPjx9f7JJcWY8dRXZL3COUE9RPS0z 6dUvmn9jltKf/wPAvZWUqfpT3r3aw6BeEvDP696RozooAyaW6qxdkrv5v8LUYfiRlIFq U9/7++4ravFNJgc0FgsRlza/8tlYLKeZYcMMvdMVRErraJ11zdEVq180hWtK8pS3Dtoe jBfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t16-20020a056402241000b004534c7d4ebfsi8212222eda.434.2022.10.31.07.34.57; Mon, 31 Oct 2022 07:35:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231628AbiJaOdF (ORCPT + 99 others); Mon, 31 Oct 2022 10:33:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231237AbiJaOc5 (ORCPT ); Mon, 31 Oct 2022 10:32:57 -0400 Received: from mail.draketalley.com (mail.draketalley.com [3.213.214.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6671F58F; Mon, 31 Oct 2022 07:32:55 -0700 (PDT) Received: from pop-os.lan (cpe-74-72-139-32.nyc.res.rr.com [74.72.139.32]) by mail.draketalley.com (Postfix) with ESMTPSA id 9613655DD1; Mon, 31 Oct 2022 14:25:30 +0000 (UTC) From: drake@draketalley.com To: Manish Chopra , GR-Linux-NIC-Dev@marvell.com, Coiby Xu , Greg Kroah-Hartman , netdev@vger.kernel.org, linux-staging@lists.linux.dev Cc: linux-kernel@vger.kernel.org, Drake Talley Subject: [PATCH 1/3] staging: qlge: Separate multiple assignments Date: Mon, 31 Oct 2022 10:25:14 -0400 Message-Id: <20221031142516.266704-2-drake@draketalley.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221031142516.266704-1-drake@draketalley.com> References: <20221031142516.266704-1-drake@draketalley.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_SOFTFAIL, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748214135647584724?= X-GMAIL-MSGID: =?utf-8?q?1748214135647584724?= From: Drake Talley Adhere to coding style. Reported by checkpatch: > CHECK: multiple assignments should be avoided > #4088: FILE: drivers/staging/qlge/qlge_main.c:4088 > CHECK: multiple assignments should be avoided > #4108: FILE: drivers/staging/qlge/qlge_main.c:4108: Signed-off-by: Drake Talley --- drivers/staging/qlge/qlge_main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 1ead7793062a..8c1fdd8ebba0 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -4085,7 +4085,12 @@ static struct net_device_stats *qlge_get_stats(struct net_device int i; /* Get RX stats. */ - pkts = mcast = dropped = errors = bytes = 0; + pkts = 0; + mcast = 0; + dropped = 0; + errors = 0; + bytes = 0; + for (i = 0; i < qdev->rss_ring_count; i++, rx_ring++) { pkts += rx_ring->rx_packets; bytes += rx_ring->rx_bytes; @@ -4100,7 +4105,10 @@ static struct net_device_stats *qlge_get_stats(struct net_device ndev->stats.multicast = mcast; /* Get TX stats. */ - pkts = errors = bytes = 0; + pkts = 0; + errors = 0; + bytes = 0; + for (i = 0; i < qdev->tx_ring_count; i++, tx_ring++) { pkts += tx_ring->tx_packets; bytes += tx_ring->tx_bytes; From patchwork Mon Oct 31 14:25:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: drake@draketalley.com X-Patchwork-Id: 13269 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2349134wru; Mon, 31 Oct 2022 07:34:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5EJkPowoScnLrnTCAvVQDjFA8lto/JeevsMlKy+SYSjOPSmFW4mlZQKNezOSICaagG6ENI X-Received: by 2002:a05:6402:50c:b0:461:bc01:1828 with SMTP id m12-20020a056402050c00b00461bc011828mr14271420edv.64.1667226865394; Mon, 31 Oct 2022 07:34:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667226865; cv=none; d=google.com; s=arc-20160816; b=Sqd4fUEeF/iYemuddyq5Oja7HXQCAdyb0dU2cV6NDMiLuUbfB5Zs3wANALK4bwlG29 7RsOKFBxr7wrIr5TlogBAqydiq+KmGFiIl0y9kvpzOAs/rwtINf9mIpgr6u2wVO0/ja9 N5c4HSbTwiCnUS+pTbDINJmMPQ+REg90tpL7igHpVPuIjiBNBPf/rbgaEX3M8S3dVovw TUo/ZnQCFDEc+9v/mb16fBOHcn+y1kw5On9k2UNUpLvwt8R3NR5lJO/m80HcEHUWdOvS rajiUb5t1NPlqp2clzVLPB0SzDSfZJXiyHWtlS0YJyU61NqXvbenpGiSuvtqFZPoEjhU bJRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=cRv5ovCT7PejKnq88A5JeU+1suvZPa1V4ItBTGACXvs=; b=ib3LtuL8PQHKHVID5KiTBIIxyvkapHCfe0SUnmp3Ozqxxb0YP/3jumFa7aV4pXFeys hCcJ+v0NTuEOpNAq7hCj9IrNZRcEZfT9juSaHd3OsbGgZbSiyVxj3a5icoRcjY+6jxze OdIZYjmEUKv5x44VdKOCLJ3JlzkjxxXyseZVbLGc2YQtQ3CF/Q5HC5oXigg/Vx5DAjmZ XfdWFmtMvKxM4HXCXpaymnuaFVEP0kMtNLDP6R1LjkWqqy80mp6uUuHX9ENTQ0N5K52N qF2PUZWoy5AV3HVBbVIU5qa9Ip90Wb0bOhnEzqroZuvI3G8a3hmIwgc4TFsr81NYKyKS 3o/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a509307000000b0046107f951f9si8324010eda.237.2022.10.31.07.34.00; Mon, 31 Oct 2022 07:34:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231485AbiJaOc7 (ORCPT + 99 others); Mon, 31 Oct 2022 10:32:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231194AbiJaOc5 (ORCPT ); Mon, 31 Oct 2022 10:32:57 -0400 Received: from mail.draketalley.com (mail.draketalley.com [3.213.214.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D680EFADC; Mon, 31 Oct 2022 07:32:55 -0700 (PDT) Received: from pop-os.lan (cpe-74-72-139-32.nyc.res.rr.com [74.72.139.32]) by mail.draketalley.com (Postfix) with ESMTPSA id 0A33055DD3; Mon, 31 Oct 2022 14:25:31 +0000 (UTC) From: drake@draketalley.com To: Manish Chopra , GR-Linux-NIC-Dev@marvell.com, Coiby Xu , Greg Kroah-Hartman , netdev@vger.kernel.org, linux-staging@lists.linux.dev Cc: linux-kernel@vger.kernel.org, Drake Talley Subject: [PATCH 2/3] staging: qlge: replace msleep with usleep_range Date: Mon, 31 Oct 2022 10:25:15 -0400 Message-Id: <20221031142516.266704-3-drake@draketalley.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221031142516.266704-1-drake@draketalley.com> References: <20221031142516.266704-1-drake@draketalley.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_SOFTFAIL, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748214077378139420?= X-GMAIL-MSGID: =?utf-8?q?1748214077378139420?= From: Drake Talley Since msleep may delay for up to 20ms, usleep_range is recommended for short durations in the docs linked in the below warning. I set the range to 1000-2000 based on looking at other usages of usleep_range. Reported by checkpatch: WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.rst Signed-off-by: Drake Talley --- drivers/staging/qlge/qlge_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 8c1fdd8ebba0..c8403dbb5bad 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -3890,7 +3890,7 @@ static int qlge_close(struct net_device *ndev) * (Rarely happens, but possible.) */ while (!test_bit(QL_ADAPTER_UP, &qdev->flags)) - msleep(1); + usleep_range(1000, 2000); /* Make sure refill_work doesn't re-enable napi */ for (i = 0; i < qdev->rss_ring_count; i++) From patchwork Mon Oct 31 14:25:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: drake@draketalley.com X-Patchwork-Id: 13271 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2350892wru; Mon, 31 Oct 2022 07:37:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EvRUPUsGfKtgqmVC/0s9frAiLyLzkZQs/JLYJ/d1FgzupIxb9qXmFNuy+StlOQyDznMZs X-Received: by 2002:a17:906:6a17:b0:794:f0e8:1918 with SMTP id qw23-20020a1709066a1700b00794f0e81918mr13561026ejc.474.1667227070215; Mon, 31 Oct 2022 07:37:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667227070; cv=none; d=google.com; s=arc-20160816; b=WTLy1fODlzf+EMdpjAMSrcs6AkMhyb1UDRU/YxCdCkBV8GIGZIjkFNW801qet7ivL9 PrZv4Stm31qGJEdXNqMooAvbFPjPCZrEVSGWTyqhdd5J7glm8YPDWA7LV+O1KmKKURHT GFtQ5zlP6g33OC5J4zjm3JmaKPrrniumd2ARj9QPHCQLDRaJecDM8VCLiC9DNn4ke2Lc tt8gzAhwiQo0HIkL5bcMPaddN8quUb+S8c3ICxaOLm6lryAY61FO5yxNtE80hsb2F6Li EADDjOfynCcz/egBdOUZ/3MOXaH+kIc7aNeOgPBy4pGFcDCCRqxI8LbT4xUmTMGcSDBO dvHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZKnMIIi3dkx/Tr+herIgANb8VHE+1Sal7TQh/7d7m+8=; b=vIrdvbZW/J66icNb6t0qyoGI7gLJ4Yh2cepl2R1X75bwbZGHw5DtH3Ws55QJgNLCmS RQTQvpPsQi8SM4Yihiq7hwkdtwJ0rguaw5bh3NOxOYWRGl+7eD2Yos7Raz1ACGmZ1p6m L7kjfMA3O4lYfHsxmTvcRDbIL1+ekrr/J3GnwDxfcMXFS8UKl7d1tjp5tijrL6kZCCmw sKacLjb0Y1a2ix/XcaVIxc5FhH44EAbQ005w01HWo0Jwp2IyPac8qC3Mw5CFIbPQC2q9 OZBHQhJGFgnW8yAvyC/K26APaAh/pkCvQJOKceJWJkDui3LPnr+rgDoNsZU3K1BcQpDQ 7HCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c17-20020a05640227d100b00462846fc76fsi9223297ede.108.2022.10.31.07.37.23; Mon, 31 Oct 2022 07:37:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231634AbiJaOdH (ORCPT + 99 others); Mon, 31 Oct 2022 10:33:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231304AbiJaOc5 (ORCPT ); Mon, 31 Oct 2022 10:32:57 -0400 X-Greylist: delayed 444 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 31 Oct 2022 07:32:55 PDT Received: from mail.draketalley.com (mail.draketalley.com [3.213.214.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA153EE2B; Mon, 31 Oct 2022 07:32:55 -0700 (PDT) Received: from pop-os.lan (cpe-74-72-139-32.nyc.res.rr.com [74.72.139.32]) by mail.draketalley.com (Postfix) with ESMTPSA id 5EC0D55DD6; Mon, 31 Oct 2022 14:25:31 +0000 (UTC) From: drake@draketalley.com To: Manish Chopra , GR-Linux-NIC-Dev@marvell.com, Coiby Xu , Greg Kroah-Hartman , netdev@vger.kernel.org, linux-staging@lists.linux.dev Cc: linux-kernel@vger.kernel.org, Drake Talley Subject: [PATCH 3/3] staging: qlge: add comment explaining memory barrier Date: Mon, 31 Oct 2022 10:25:16 -0400 Message-Id: <20221031142516.266704-4-drake@draketalley.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221031142516.266704-1-drake@draketalley.com> References: <20221031142516.266704-1-drake@draketalley.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_SOFTFAIL, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748214292607454360?= X-GMAIL-MSGID: =?utf-8?q?1748214292607454360?= From: Drake Talley codestyle change that fixes the following report from checkpatch: > WARNING: memory barrier without comment > #2101: FILE: drivers/staging/qlge/qlge_main.c:2101: The added comment identifies the next item from the circular buffer (rx_ring->curr_entry) and its handling/unmapping as the two operations that must not be reordered. Based on the kernel documentation for memory barriers in circular buffers (https://www.kernel.org/doc/Documentation/circular-buffers.txt) and the presence of atomic operations in the current context I'm assuming this usage of the memory barrier is akin to what is explained in the linked doc. There are a couple of other uncommented usages of memory barriers in the current file. If this comment is adequate I can add similar comments to the others. Signed-off-by: Drake Talley --- drivers/staging/qlge/qlge_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index c8403dbb5bad..f70390bce6d8 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -2098,6 +2098,12 @@ static int qlge_clean_outbound_rx_ring(struct rx_ring *rx_ring) rx_ring->cq_id, prod, rx_ring->cnsmr_idx); net_rsp = (struct qlge_ob_mac_iocb_rsp *)rx_ring->curr_entry; + /* + * Ensure that the next item from the ring buffer is loaded + * before being processed. + * Adding rmb() prevents the compiler from reordering the read + * and subsequent handling of the outbound completion pointer. + */ rmb(); switch (net_rsp->opcode) { case OPCODE_OB_MAC_TSO_IOCB: