From patchwork Thu Oct 22 23:55:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 11852107 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D17BC388F9 for ; Thu, 22 Oct 2020 23:55:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 070CE2465A for ; Thu, 22 Oct 2020 23:55:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="IZqGeDvq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S373640AbgJVXzy (ORCPT ); Thu, 22 Oct 2020 19:55:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S373630AbgJVXzx (ORCPT ); Thu, 22 Oct 2020 19:55:53 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79DA0C0613CE for ; Thu, 22 Oct 2020 16:55:53 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id s22so2026849pga.9 for ; Thu, 22 Oct 2020 16:55:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0PJBN/sBFpmtoIm/dAiFxgraYfKdEYPqonxyP9QB+D8=; b=IZqGeDvqFZAcK8Qhk4zoA7X6JWvyzaeQihsuFC9QfVJ5+WvhSYFU4uKSr4yRjiEegC +T5qvGBda2sS8NotMs7JeFqYi+/EHppxjsirnZakYR0/xbWFjthhLKLPrPYzYQjW13JG oq551FUPda3HEY2F0CBRAIUc9QT0NMw347090+eLvyKqpegmd8PxgVqZwB5RRKZ8kgpa 3cqLMPfl7b1Vht+UCXx35jACsPgFXjhUM7AOoeGpmJQNHt+pDgEKfsa0ogFT58jNFoN5 p8aC9IkCbEWVmRDJ9bGY0iMoxBgoEMAikwQ6ITrpr6XCzOZe89v0lFhIAGXbHaeEnYVH x3Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0PJBN/sBFpmtoIm/dAiFxgraYfKdEYPqonxyP9QB+D8=; b=UfGqXw/4JLKn7lJ3hVfKmSvHYfP72JVyB6+wf1C3mRSWFZiaeED0Z16LEy5jJBMsIH ZGoO4HDr8TBfxKjNeR/N48+7gM9et7ExOIhCxmdp5qRWXa8KEYRl9UQZegLPMDGp0PgY WAE1432USXMqnGzlTNNW+Hxbqiyl7WXjylUkkRvhGfNOHMRta+utRhNv0D7UFYbgItnX n+4V8fRxZ8JHhMARFhf4m2kR7ZJJMHlERhODU6p0Q+wWaYdhxmQIIutft2nqJTnZ+oZC p23mwBgI89m/wxKE9ETBjq9u05+4R2LrwmNOJXZzOLa38KIgRIdiaCYmNZXbRvCPv+pI 0j/g== X-Gm-Message-State: AOAM5322koG4Z3dyButV4WeMVv2BUgQRVTQ1c6fh7h88zAuolDQZymDU Gx+Nm+MVDWdb7d70AbNOh2ibBHH+FZ9ZTw== X-Google-Smtp-Source: ABdhPJx7MIbTStYVCtbq04/2n2wpUGXKF4mrQXAV8SaVrqPaCTc1B5qoBu2+DkOksnim5FrTjg2szA== X-Received: by 2002:a17:90b:47d5:: with SMTP id kc21mr4354855pjb.169.1603410952728; Thu, 22 Oct 2020 16:55:52 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id v3sm3167244pfu.165.2020.10.22.16.55.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2020 16:55:52 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH net 1/3] ionic: clean up sparse complaints Date: Thu, 22 Oct 2020 16:55:29 -0700 Message-Id: <20201022235531.65956-2-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201022235531.65956-1-snelson@pensando.io> References: <20201022235531.65956-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The sparse complaints around the static_asserts were obscuring more useful complaints. So, don't check the static_asserts, and fix the remaining sparse complaints. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_dev.c | 4 +-- .../net/ethernet/pensando/ionic/ionic_dev.h | 2 ++ .../net/ethernet/pensando/ionic/ionic_fw.c | 6 ++-- .../net/ethernet/pensando/ionic/ionic_lif.c | 28 +++++++++---------- .../net/ethernet/pensando/ionic/ionic_main.c | 4 +-- .../net/ethernet/pensando/ionic/ionic_stats.h | 2 +- .../net/ethernet/pensando/ionic/ionic_txrx.c | 10 +++---- 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index 545c99b15df8..dc5fbc2704f3 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -333,7 +333,7 @@ int ionic_set_vf_config(struct ionic *ionic, int vf, u8 attr, u8 *data) union ionic_dev_cmd cmd = { .vf_setattr.opcode = IONIC_CMD_VF_SETATTR, .vf_setattr.attr = attr, - .vf_setattr.vf_index = vf, + .vf_setattr.vf_index = cpu_to_le16(vf), }; int err; @@ -391,7 +391,7 @@ void ionic_dev_cmd_queue_identify(struct ionic_dev *idev, { union ionic_dev_cmd cmd = { .q_identify.opcode = IONIC_CMD_Q_IDENTIFY, - .q_identify.lif_type = lif_type, + .q_identify.lif_type = cpu_to_le16(lif_type), .q_identify.type = qtype, .q_identify.ver = qver, }; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.h b/drivers/net/ethernet/pensando/ionic/ionic_dev.h index c109cd5a0471..6c243b17312c 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.h @@ -29,6 +29,7 @@ struct ionic_dev_bar { int res_index; }; +#ifndef __CHECKER__ /* Registers */ static_assert(sizeof(struct ionic_intr) == 32); @@ -119,6 +120,7 @@ static_assert(sizeof(struct ionic_vf_setattr_cmd) == 64); static_assert(sizeof(struct ionic_vf_setattr_comp) == 16); static_assert(sizeof(struct ionic_vf_getattr_cmd) == 64); static_assert(sizeof(struct ionic_vf_getattr_comp) == 16); +#endif /* __CHECKER__ */ struct ionic_devinfo { u8 asic_type; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_fw.c b/drivers/net/ethernet/pensando/ionic/ionic_fw.c index f492ae406a60..d7bbf336c6f6 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_fw.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_fw.c @@ -27,9 +27,9 @@ static void ionic_dev_cmd_firmware_download(struct ionic_dev *idev, u64 addr, { union ionic_dev_cmd cmd = { .fw_download.opcode = IONIC_CMD_FW_DOWNLOAD, - .fw_download.offset = offset, - .fw_download.addr = addr, - .fw_download.length = length + .fw_download.offset = cpu_to_le32(offset), + .fw_download.addr = cpu_to_le64(addr), + .fw_download.length = cpu_to_le32(length), }; ionic_dev_cmd_go(idev, &cmd); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index d655a7ae3058..591c644b8e69 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1915,11 +1915,11 @@ static int ionic_get_vf_config(struct net_device *netdev, ret = -EINVAL; } else { ivf->vf = vf; - ivf->vlan = ionic->vfs[vf].vlanid; + ivf->vlan = le16_to_cpu(ionic->vfs[vf].vlanid); ivf->qos = 0; ivf->spoofchk = ionic->vfs[vf].spoofchk; ivf->linkstate = ionic->vfs[vf].linkstate; - ivf->max_tx_rate = ionic->vfs[vf].maxrate; + ivf->max_tx_rate = le32_to_cpu(ionic->vfs[vf].maxrate); ivf->trusted = ionic->vfs[vf].trusted; ether_addr_copy(ivf->mac, ionic->vfs[vf].macaddr); } @@ -2019,7 +2019,7 @@ static int ionic_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, ret = ionic_set_vf_config(ionic, vf, IONIC_VF_ATTR_VLAN, (u8 *)&vlan); if (!ret) - ionic->vfs[vf].vlanid = vlan; + ionic->vfs[vf].vlanid = cpu_to_le16(vlan); } up_write(&ionic->vf_op_lock); @@ -2048,7 +2048,7 @@ static int ionic_set_vf_rate(struct net_device *netdev, int vf, ret = ionic_set_vf_config(ionic, vf, IONIC_VF_ATTR_RATE, (u8 *)&tx_max); if (!ret) - lif->ionic->vfs[vf].maxrate = tx_max; + lif->ionic->vfs[vf].maxrate = cpu_to_le32(tx_max); } up_write(&ionic->vf_op_lock); @@ -2981,14 +2981,14 @@ void ionic_lif_unregister(struct ionic_lif *lif) static void ionic_lif_queue_identify(struct ionic_lif *lif) { + union ionic_q_identity __iomem *q_ident; struct ionic *ionic = lif->ionic; - union ionic_q_identity *q_ident; struct ionic_dev *idev; int qtype; int err; idev = &lif->ionic->idev; - q_ident = (union ionic_q_identity *)&idev->dev_cmd_regs->data; + q_ident = (union ionic_q_identity __iomem *)&idev->dev_cmd_regs->data; for (qtype = 0; qtype < ARRAY_SIZE(ionic_qtype_versions); qtype++) { struct ionic_qtype_info *qti = &lif->qtype_info[qtype]; @@ -3011,14 +3011,14 @@ static void ionic_lif_queue_identify(struct ionic_lif *lif) ionic_qtype_versions[qtype]); err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT); if (!err) { - qti->version = q_ident->version; - qti->supported = q_ident->supported; - qti->features = le64_to_cpu(q_ident->features); - qti->desc_sz = le16_to_cpu(q_ident->desc_sz); - qti->comp_sz = le16_to_cpu(q_ident->comp_sz); - qti->sg_desc_sz = le16_to_cpu(q_ident->sg_desc_sz); - qti->max_sg_elems = le16_to_cpu(q_ident->max_sg_elems); - qti->sg_desc_stride = le16_to_cpu(q_ident->sg_desc_stride); + qti->version = readb(&q_ident->version); + qti->supported = readb(&q_ident->supported); + qti->features = readq(&q_ident->features); + qti->desc_sz = readw(&q_ident->desc_sz); + qti->comp_sz = readw(&q_ident->comp_sz); + qti->sg_desc_sz = readw(&q_ident->sg_desc_sz); + qti->max_sg_elems = readw(&q_ident->max_sg_elems); + qti->sg_desc_stride = readw(&q_ident->sg_desc_stride); } mutex_unlock(&ionic->dev_cmd_lock); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c index ee0740881af3..d355676f6c16 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c @@ -311,7 +311,7 @@ int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) static void ionic_dev_cmd_clean(struct ionic *ionic) { - union ionic_dev_cmd_regs *regs = ionic->idev.dev_cmd_regs; + union __iomem ionic_dev_cmd_regs *regs = ionic->idev.dev_cmd_regs; iowrite32(0, ®s->doorbell); memset_io(®s->cmd, 0, sizeof(regs->cmd)); @@ -333,7 +333,7 @@ int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds) */ max_wait = jiffies + (max_seconds * HZ); try_again: - opcode = idev->dev_cmd_regs->cmd.cmd.opcode; + opcode = readb(&idev->dev_cmd_regs->cmd.cmd.opcode); start_time = jiffies; do { done = ionic_dev_cmd_done(idev); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_stats.h b/drivers/net/ethernet/pensando/ionic/ionic_stats.h index 3f543512616e..2a725834f792 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_stats.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_stats.h @@ -49,7 +49,7 @@ extern const int ionic_num_stats_grps; (*((u64 *)(((u8 *)(base_ptr)) + (desc_ptr)->offset))) #define IONIC_READ_STAT_LE64(base_ptr, desc_ptr) \ - __le64_to_cpu(*((u64 *)(((u8 *)(base_ptr)) + (desc_ptr)->offset))) + __le64_to_cpu(*((__le64 *)(((u8 *)(base_ptr)) + (desc_ptr)->offset))) struct ionic_stat_desc { char name[ETH_GSTRING_LEN]; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index 169ac4f54640..8f6fc7142bc5 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -200,7 +200,7 @@ static void ionic_rx_clean(struct ionic_queue *q, if (likely(netdev->features & NETIF_F_RXCSUM)) { if (comp->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC) { skb->ip_summed = CHECKSUM_COMPLETE; - skb->csum = (__wsum)le16_to_cpu(comp->csum); + skb->csum = (__force __wsum)le16_to_cpu(comp->csum); stats->csum_complete++; } } else { @@ -812,6 +812,7 @@ static int ionic_tx_tso(struct ionic_queue *q, struct sk_buff *skb) skb_frag_t *frag; bool start, done; bool outer_csum; + dma_addr_t addr; bool has_vlan; u16 desc_len; u8 desc_nsge; @@ -893,11 +894,10 @@ static int ionic_tx_tso(struct ionic_queue *q, struct sk_buff *skb) if (frag_left > 0) { len = min(frag_left, left); frag_left -= len; - elem->addr = - cpu_to_le64(ionic_tx_map_frag(q, frag, - offset, len)); - if (dma_mapping_error(dev, elem->addr)) + addr = ionic_tx_map_frag(q, frag, offset, len); + if (dma_mapping_error(dev, addr)) goto err_out_abort; + elem->addr = cpu_to_le64(addr); elem->len = cpu_to_le16(len); elem++; desc_nsge++; From patchwork Thu Oct 22 23:55:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 11852103 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E437FC388F7 for ; Thu, 22 Oct 2020 23:55:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8432724631 for ; Thu, 22 Oct 2020 23:55:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="gua+ljTg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S373645AbgJVXz4 (ORCPT ); Thu, 22 Oct 2020 19:55:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S373630AbgJVXzy (ORCPT ); Thu, 22 Oct 2020 19:55:54 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87A3AC0613CE for ; Thu, 22 Oct 2020 16:55:54 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id e15so2328147pfh.6 for ; Thu, 22 Oct 2020 16:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jRLTvXXWxxm1oTRZxFy/Nx+xnD8pQIKiy6bO0kS1ddY=; b=gua+ljTga9Ve8g5FqyRbi3YbduuK40hT5tIUBCciqOlxGv+lp9DkaRB0dDIDHaD1WE YUmRbgex7dA7yKpzoeyoIeW4vvnnSefwCckd6alJypKu9VctpJfCTtGF7U9kF6lgftmd cKJ8umQsHLaJGjBFuQqxJERdIoKpwSRPdLTG6GFTaTG5UoV8qBp0t+Ykk3aC9OXXa7mV 2BD1lI80N/k4Fm5OsxK3gbfNuwALGGOQmQc0k5wOGQvbCdb/0h2JJGkZ5QyhSUX62OPw XmUX40rosT+3yGWvLcpIAf8fNl1wh3d9omdN3xcIdhxM87yH26MM0fqECiKHQ/jdQVMA wBCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jRLTvXXWxxm1oTRZxFy/Nx+xnD8pQIKiy6bO0kS1ddY=; b=Lj6H6o5AXfLGVgOUG6qPWgVR3MWHZ1+DYKC5icnWeHnzDK2LrVJlvzw4NZFV8R2Yn9 hhLwg81u50eP6UMOPVthLMAu2GiG0rMGPcpSjtdg+R3pIHoR3+jWndDDB27auPFUFJm0 wgBuqeAi8Dkd3hg7diV6s2+PyarLHEsm6AzUSdXyXLlUdbH1NZEpkX3U7JL5cZEk27TU sXJFPQQQr0itVLLQHjnhb3PoxMTuykqD9AddYI5fMysWgYlK8SwzJidiNi3Z0Xl9AlSa Wwkf2xWAKFfmlsmRhDXQOhMkZgW01nEsipuZfpdMg6ez2UhOOYPL05+hDhNdpSaijijh 0P2w== X-Gm-Message-State: AOAM531JjS07Zmpdoxo2psGhzzM9LImGdsQ3rXUujB2/mKF0FNBJPkj3 hNtMVPrraROsDuj4Q2+eF1SJYVSaCyl4Tg== X-Google-Smtp-Source: ABdhPJy4Muug7dF5zqz6rYrBHayQ1PyKsYneMGghZBuOtoMabFNwG/EpVARp41y9jV08Xh3W2HN1iQ== X-Received: by 2002:aa7:9a87:0:b029:156:5806:b478 with SMTP id w7-20020aa79a870000b02901565806b478mr4676161pfi.8.1603410953811; Thu, 22 Oct 2020 16:55:53 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id v3sm3167244pfu.165.2020.10.22.16.55.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2020 16:55:53 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH net 2/3] ionic: no rx flush in deinit Date: Thu, 22 Oct 2020 16:55:30 -0700 Message-Id: <20201022235531.65956-3-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201022235531.65956-1-snelson@pensando.io> References: <20201022235531.65956-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Kmemleak pointed out to us that ionic_rx_flush() is sending skbs into napi_gro_XXX with a disabled napi context, and these end up getting lost and leaked. We can safely remove the flush. Fixes: 0f3154e6bcb3 ("ionic: Add Tx and Rx handling") Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 1 - drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 13 ------------- drivers/net/ethernet/pensando/ionic/ionic_txrx.h | 1 - 3 files changed, 15 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 591c644b8e69..a12df3946a07 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1656,7 +1656,6 @@ static void ionic_txrx_deinit(struct ionic_lif *lif) if (lif->rxqcqs) { for (i = 0; i < lif->nxqs && lif->rxqcqs[i]; i++) { ionic_lif_qcq_deinit(lif, lif->rxqcqs[i]); - ionic_rx_flush(&lif->rxqcqs[i]->cq); ionic_rx_empty(&lif->rxqcqs[i]->q); } } diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index 8f6fc7142bc5..35acb4d66e31 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -253,19 +253,6 @@ static bool ionic_rx_service(struct ionic_cq *cq, struct ionic_cq_info *cq_info) return true; } -void ionic_rx_flush(struct ionic_cq *cq) -{ - struct ionic_dev *idev = &cq->lif->ionic->idev; - u32 work_done; - - work_done = ionic_cq_service(cq, cq->num_descs, - ionic_rx_service, NULL, NULL); - - if (work_done) - ionic_intr_credits(idev->intr_ctrl, cq->bound_intr->index, - work_done, IONIC_INTR_CRED_RESET_COALESCE); -} - static int ionic_rx_page_alloc(struct ionic_queue *q, struct ionic_page_info *page_info) { diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.h b/drivers/net/ethernet/pensando/ionic/ionic_txrx.h index a5883be0413f..7667b72232b8 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.h @@ -4,7 +4,6 @@ #ifndef _IONIC_TXRX_H_ #define _IONIC_TXRX_H_ -void ionic_rx_flush(struct ionic_cq *cq); void ionic_tx_flush(struct ionic_cq *cq); void ionic_rx_fill(struct ionic_queue *q); From patchwork Thu Oct 22 23:55:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 11852105 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4202FC388F7 for ; Thu, 22 Oct 2020 23:56:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1E13223C7 for ; Thu, 22 Oct 2020 23:56:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="VzAkIRWF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S373649AbgJVX4A (ORCPT ); Thu, 22 Oct 2020 19:56:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S373643AbgJVXzz (ORCPT ); Thu, 22 Oct 2020 19:55:55 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD52DC0613CE for ; Thu, 22 Oct 2020 16:55:55 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id e15so2328175pfh.6 for ; Thu, 22 Oct 2020 16:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PU0QvKFwpPHkSe6vqPWqTywAUkijdCLP+2dreqDqs7I=; b=VzAkIRWFJhiuXsi66Lz9462BIIhLi4g8xEt7Z4jAy9nKmfKLOAYmw7DkhXemqP6To6 Yib02SoJhJf3Ng6nwT+3HCQE+VYsc9Scb8OMpzVGnu9nX0Ajennc936OBtfczoBIgbG2 dA66G1XjH5E0Av0wIo4tEfWMtleA1GCqFEWVWzLJE2ca2lEzM8y47yxit1RSK6SECuPr DmEWnDHmOvN7cNHVIkW14itDoHbFCUvyWTQUubLaPhfCbwUpuJlctfi5rRzKj1n1Cz9B mBJ4fq9DY/s5SLmo9XqvacCiwX7sRheVYNqQX0c+NDogMHHsZN+8qbpBRj+HmWgBg0jZ wqyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PU0QvKFwpPHkSe6vqPWqTywAUkijdCLP+2dreqDqs7I=; b=gGjFqGyFypoHRDl8lddE5Wv+Z0H3W/jjX6cJoP3Y6OfnNgGRHa3gWb8biKeeuf4j5t BTzEYDnDlQac0Ph0zuBXoLHOjzzrzk80PpTEI46oV0dtYtjoXp3tTfd7jNcEyrhCbxcE 3NA4lkkSJidwV/pedtouUNnKI7oo1Wb1fJqDXsiklYzkhr0oF7C4Eq6HEEKkGVF4k3fl CipzgfH8WhLkorQ3FpQODY2pnv+MZM6EQO2NE/B/NO4nb4HrZPvHuJsx7RdO1EwXZ3KO EBVvKn1HAEaqSU5i2KpSIUkRWH4hd89DKzKyvh4YKPPKXS54ofhHeuOxdK17V3vtpiSg 1/+A== X-Gm-Message-State: AOAM531T5l2kzTA/Vu5RQTTWPwyJhb+Ybc1gag9oswWJvW1qQbXLSh/U B10xJgrHftyD1Ct4X8swv9EzJSRC2ax0QA== X-Google-Smtp-Source: ABdhPJzo7bFesnpTh8p3ikvbFlytkOJg+i4bi3YkgntXC4xzkb9ilTNeG/KIAkw3Dc7iQI4l7UFKrA== X-Received: by 2002:a63:4e5e:: with SMTP id o30mr4455708pgl.251.1603410954900; Thu, 22 Oct 2020 16:55:54 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id v3sm3167244pfu.165.2020.10.22.16.55.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2020 16:55:54 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: Shannon Nelson Subject: [PATCH net 3/3] ionic: fix mem leak in rx_empty Date: Thu, 22 Oct 2020 16:55:31 -0700 Message-Id: <20201022235531.65956-4-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201022235531.65956-1-snelson@pensando.io> References: <20201022235531.65956-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The sentinel descriptor entry was getting missed in the traverse of the ring from head to tail, so change to a loop of 0 to the end. Fixes: f1d2e894f1b7 ("ionic: use index not pointer for queue tracking") Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_txrx.c | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index 35acb4d66e31..b3d2250c77d0 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -400,22 +400,20 @@ static void ionic_rx_fill_cb(void *arg) void ionic_rx_empty(struct ionic_queue *q) { struct ionic_desc_info *desc_info; - struct ionic_rxq_desc *desc; - unsigned int i; - u16 idx; - - idx = q->tail_idx; - while (idx != q->head_idx) { - desc_info = &q->info[idx]; - desc = desc_info->desc; - desc->addr = 0; - desc->len = 0; + struct ionic_page_info *page_info; + unsigned int i, j; - for (i = 0; i < desc_info->npages; i++) - ionic_rx_page_free(q, &desc_info->pages[i]); + for (i = 0; i < q->num_descs; i++) { + desc_info = &q->info[i]; + for (j = 0; j < IONIC_RX_MAX_SG_ELEMS + 1; j++) { + page_info = &desc_info->pages[j]; + if (page_info->page) + ionic_rx_page_free(q, page_info); + } + desc_info->npages = 0; + desc_info->cb = NULL; desc_info->cb_arg = NULL; - idx = (idx + 1) & (q->num_descs - 1); } }