From patchwork Wed Oct 26 14:37:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 13020719 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24417C433FE for ; Wed, 26 Oct 2022 14:37:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234343AbiJZOhy (ORCPT ); Wed, 26 Oct 2022 10:37:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234041AbiJZOhw (ORCPT ); Wed, 26 Oct 2022 10:37:52 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACCF7B6036 for ; Wed, 26 Oct 2022 07:37:51 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id 192so8312554pfx.5 for ; Wed, 26 Oct 2022 07:37:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=ryvnisjp6FqvGD+eQPde85PGfq1lBI/RzVG5wn3Q2SY=; b=im1QuXd5ckK20zGoNiDhifi0upbX55rj0m08F5kiqP1WMFjwS2kew+Z6MJTMdLX1La 9Mt0az7ioAWcOFDRb1qN2RjDsWj17Kl/Rju6IUA1hYNekLQPswSeLCLfiUU4LpMgUtKB U1y0RM35E90XnQ7ryj+Dylr0iTuJpUGYHiZB54HYJKF8zNSuz6mypjJmyiNHEubRu3Zn S4BrHo1K6XcUIjc7PxMcycChmHBoGWdCSdgHiK6ylvraTt4ksvSX9CnWRnPbRE3vv7Jv E38NwqrJgjwzNNGxgz7cXYmtg/Q3HygjUNtxNBVk/gLLboCQUbTbMGZzHZTlMxZc9IKk eg+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ryvnisjp6FqvGD+eQPde85PGfq1lBI/RzVG5wn3Q2SY=; b=OInxJOYqRErzBHz92vuG2tI2tOm6Q+wUdT29bU5m5ccLjqjpmTpzQ7Dix5ONYIuW5c APGTx9b/iNEeeDywyaHNZaN1jmXOSSv5ibYM4k8AgB5cJphp6UUvaWG9BWd9ydlUJskf 9zDsA0ILjqQ/U6ny34xYOyKGpdtzzGBrfWO0xBg047RdG3zqj35vSLS5mkDriCFzSxfJ 94Bmft6/4Ux8VG1L7r5ku9LOrGX7qj39irgcqqOPUh/UxWBeSgByr9j2JlZ/JvhPcZJe xViiINTeRiQ/506sLfdDjCOPMmAOz3cVRLzuTTuiObvD9PlyXG6dk1U0Sz2P7PEjgbEy 1B/g== X-Gm-Message-State: ACrzQf1GUPZ+5tiTx0zO3mnD9XBjX+ix57HTzWwDb4jiDZEH2N9GXNWQ C5Q3tRW9AdEU3gtbP+Hwi5l6MQ== X-Google-Smtp-Source: AMsMyM7ED+/vDqrKfoE9FWqFyva4u1MsLU4DxWq8bH40xjI9Kou0Giow+yhurMxmWMTpB3R/9quxyg== X-Received: by 2002:a63:2a8b:0:b0:46e:9fda:2171 with SMTP id q133-20020a632a8b000000b0046e9fda2171mr28359799pgq.106.1666795071175; Wed, 26 Oct 2022 07:37:51 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id d185-20020a6236c2000000b0056286c552ecsm3060484pfa.184.2022.10.26.07.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 07:37:50 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org, leon@kernel.org Cc: drivers@pensando.io, Shannon Nelson Subject: [PATCH v3 net-next 1/5] ionic: replay VF attributes after fw crash recovery Date: Wed, 26 Oct 2022 07:37:40 -0700 Message-Id: <20221026143744.11598-2-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221026143744.11598-1-snelson@pensando.io> References: <20221026143744.11598-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The VF attributes that the user has set into the FW through the PF can be lost over a FW crash recovery. Much like we already replay the PF mac/vlan filters, we now add a replay in the recovery path to be sure the FW has the up-to-date VF configurations. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_lif.c | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 19d4848df17d..865ee58a3b1f 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -2562,6 +2562,74 @@ static int ionic_set_vf_link_state(struct net_device *netdev, int vf, int set) return ret; } +static void ionic_vf_attr_replay(struct ionic_lif *lif) +{ + struct ionic_vf_setattr_cmd vfc = { }; + struct ionic *ionic = lif->ionic; + struct ionic_vf *v; + int i; + + if (!ionic->vfs) + return; + + down_read(&ionic->vf_op_lock); + + for (i = 0; i < ionic->num_vfs; i++) { + v = &ionic->vfs[i]; + + if (v->stats_pa) { + vfc.attr = IONIC_VF_ATTR_STATSADDR; + vfc.stats_pa = cpu_to_le64(v->stats_pa); + ionic_set_vf_config(ionic, i, &vfc); + vfc.stats_pa = 0; + } + + if (!is_zero_ether_addr(v->macaddr)) { + vfc.attr = IONIC_VF_ATTR_MAC; + ether_addr_copy(vfc.macaddr, v->macaddr); + ionic_set_vf_config(ionic, i, &vfc); + eth_zero_addr(vfc.macaddr); + } + + if (v->vlanid) { + vfc.attr = IONIC_VF_ATTR_VLAN; + vfc.vlanid = v->vlanid; + ionic_set_vf_config(ionic, i, &vfc); + vfc.vlanid = 0; + } + + if (v->maxrate) { + vfc.attr = IONIC_VF_ATTR_RATE; + vfc.maxrate = v->maxrate; + ionic_set_vf_config(ionic, i, &vfc); + vfc.maxrate = 0; + } + + if (v->spoofchk) { + vfc.attr = IONIC_VF_ATTR_SPOOFCHK; + vfc.spoofchk = v->spoofchk; + ionic_set_vf_config(ionic, i, &vfc); + vfc.spoofchk = 0; + } + + if (v->trusted) { + vfc.attr = IONIC_VF_ATTR_TRUST; + vfc.trust = v->trusted; + ionic_set_vf_config(ionic, i, &vfc); + vfc.trust = 0; + } + + if (v->linkstate) { + vfc.attr = IONIC_VF_ATTR_LINKSTATE; + vfc.linkstate = v->linkstate; + ionic_set_vf_config(ionic, i, &vfc); + vfc.linkstate = 0; + } + } + + up_read(&ionic->vf_op_lock); +} + static const struct net_device_ops ionic_netdev_ops = { .ndo_open = ionic_open, .ndo_stop = ionic_stop, @@ -3042,6 +3110,8 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif) if (err) goto err_qcqs_free; + ionic_vf_attr_replay(lif); + if (lif->registered) ionic_lif_set_netdev_info(lif); From patchwork Wed Oct 26 14:37:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 13020720 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B0D5C38A2D for ; Wed, 26 Oct 2022 14:37:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234355AbiJZOhz (ORCPT ); Wed, 26 Oct 2022 10:37:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234350AbiJZOhy (ORCPT ); Wed, 26 Oct 2022 10:37:54 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F0B1B7F77 for ; Wed, 26 Oct 2022 07:37:53 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id m2so10204307pjr.3 for ; Wed, 26 Oct 2022 07:37:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=eTIJsZgmqePOP9eZKpB6HgjGD81o6xb78AHrtf1ewuw=; b=qY5k0bGUliMlMkMIGiXsMhV4MhvoTGyhrqL2U33LUvfABYWBec0LxgfSktqEEoHVh+ 5P6Tfug8NYVEPkXKB3ebKcj3LM81g7GbF6z9zVslPlXFKq91UMDWUeRBzNjC1/zXXLsa 6wQx6zHKUKik2iLAWOvhuyI9ER4w47LmJnvbW2kBu2f36k+mm5/WEX0HoH1XsH8zwNxj YvyZqPq2IuWy8Cfn0LnNNiXxRWkPFec/AAy7XOzIC+hB7ujzddxBA90n6PBXWb6FkZum MaG+i4ut1QxlEZQTQDIU8b8vXjaLFsdYoSTfpzTjYnwM7y7wednK8njhHKpiAe0VQte7 wGpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eTIJsZgmqePOP9eZKpB6HgjGD81o6xb78AHrtf1ewuw=; b=bxthBw15qcDqcDfRewD7ubcPveQZoeAoUZdR4YFxBuMrDF0kwdtCJ5kOVretPnV5H+ Qpr+6wCI8j+/1Wq9+rosblYMuz/hOWN+kQBmuvH884v8adFqVLXxQ+G55DrB26xanveF Jgts0+jKw/RcHki5iFjMqgM6fyc/aYivDq9Cg6vEQWSOCueEOHOTnRxghsSYtQZ4yuv7 LJOj89fTi170HSwiWcczJbYUJaZBqZGZf6L6EoGRXbbjvyLx95ODWpbe1ZJXL2ReYnKz KyMNpE3pgVXIBnKYTDR2MD3zgeycmIuNu6Lt4KiGitV8dA3WBbYyNCwpVZk2pLYi0vvK wtVw== X-Gm-Message-State: ACrzQf2xDO99WmMAT/71SaHJYjXk0DKYR2sJZhtj4Z8dpSdjS17n2VRN WK2ghy1PNwrxBnAY/HpimrTcRQ== X-Google-Smtp-Source: AMsMyM5ux1+aNBrTHG+f+YoYmcU2KwaZxTccm2TcOWFRVs14CPxNI27ySID4cbHGua4BkJEOJxqnMw== X-Received: by 2002:a17:903:1112:b0:178:a030:5f72 with SMTP id n18-20020a170903111200b00178a0305f72mr44293966plh.12.1666795072771; Wed, 26 Oct 2022 07:37:52 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id d185-20020a6236c2000000b0056286c552ecsm3060484pfa.184.2022.10.26.07.37.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 07:37:51 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org, leon@kernel.org Cc: drivers@pensando.io, Shannon Nelson Subject: [PATCH v3 net-next 2/5] ionic: only save the user set VF attributes Date: Wed, 26 Oct 2022 07:37:41 -0700 Message-Id: <20221026143744.11598-3-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221026143744.11598-1-snelson@pensando.io> References: <20221026143744.11598-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Report the current FW values for the VF attributes, but don't save the FW values locally, only save the vf attributes that are given to us from the user. This allows us to replay user data, and doesn't end up confusing things like "who set the mac address". Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_lif.c | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 865ee58a3b1f..a06b2da1e0c4 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -2220,7 +2220,7 @@ static int ionic_eth_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd } } -static int ionic_update_cached_vf_config(struct ionic *ionic, int vf) +static int ionic_get_fw_vf_config(struct ionic *ionic, int vf, struct ionic_vf *vfdata) { struct ionic_vf_getattr_comp comp = { 0 }; int err; @@ -2231,14 +2231,14 @@ static int ionic_update_cached_vf_config(struct ionic *ionic, int vf) if (err && comp.status != IONIC_RC_ENOSUPP) goto err_out; if (!err) - ionic->vfs[vf].vlanid = comp.vlanid; + vfdata->vlanid = comp.vlanid; attr = IONIC_VF_ATTR_SPOOFCHK; err = ionic_dev_cmd_vf_getattr(ionic, vf, attr, &comp); if (err && comp.status != IONIC_RC_ENOSUPP) goto err_out; if (!err) - ionic->vfs[vf].spoofchk = comp.spoofchk; + vfdata->spoofchk = comp.spoofchk; attr = IONIC_VF_ATTR_LINKSTATE; err = ionic_dev_cmd_vf_getattr(ionic, vf, attr, &comp); @@ -2247,13 +2247,13 @@ static int ionic_update_cached_vf_config(struct ionic *ionic, int vf) if (!err) { switch (comp.linkstate) { case IONIC_VF_LINK_STATUS_UP: - ionic->vfs[vf].linkstate = IFLA_VF_LINK_STATE_ENABLE; + vfdata->linkstate = IFLA_VF_LINK_STATE_ENABLE; break; case IONIC_VF_LINK_STATUS_DOWN: - ionic->vfs[vf].linkstate = IFLA_VF_LINK_STATE_DISABLE; + vfdata->linkstate = IFLA_VF_LINK_STATE_DISABLE; break; case IONIC_VF_LINK_STATUS_AUTO: - ionic->vfs[vf].linkstate = IFLA_VF_LINK_STATE_AUTO; + vfdata->linkstate = IFLA_VF_LINK_STATE_AUTO; break; default: dev_warn(ionic->dev, "Unexpected link state %u\n", comp.linkstate); @@ -2266,21 +2266,21 @@ static int ionic_update_cached_vf_config(struct ionic *ionic, int vf) if (err && comp.status != IONIC_RC_ENOSUPP) goto err_out; if (!err) - ionic->vfs[vf].maxrate = comp.maxrate; + vfdata->maxrate = comp.maxrate; attr = IONIC_VF_ATTR_TRUST; err = ionic_dev_cmd_vf_getattr(ionic, vf, attr, &comp); if (err && comp.status != IONIC_RC_ENOSUPP) goto err_out; if (!err) - ionic->vfs[vf].trusted = comp.trust; + vfdata->trusted = comp.trust; attr = IONIC_VF_ATTR_MAC; err = ionic_dev_cmd_vf_getattr(ionic, vf, attr, &comp); if (err && comp.status != IONIC_RC_ENOSUPP) goto err_out; if (!err) - ether_addr_copy(ionic->vfs[vf].macaddr, comp.macaddr); + ether_addr_copy(vfdata->macaddr, comp.macaddr); err_out: if (err) @@ -2295,6 +2295,7 @@ static int ionic_get_vf_config(struct net_device *netdev, { struct ionic_lif *lif = netdev_priv(netdev); struct ionic *ionic = lif->ionic; + struct ionic_vf vfdata = { 0 }; int ret = 0; if (!netif_device_present(netdev)) @@ -2308,14 +2309,14 @@ static int ionic_get_vf_config(struct net_device *netdev, ivf->vf = vf; ivf->qos = 0; - ret = ionic_update_cached_vf_config(ionic, vf); + ret = ionic_get_fw_vf_config(ionic, vf, &vfdata); if (!ret) { - ivf->vlan = le16_to_cpu(ionic->vfs[vf].vlanid); - ivf->spoofchk = ionic->vfs[vf].spoofchk; - ivf->linkstate = ionic->vfs[vf].linkstate; - 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); + ivf->vlan = le16_to_cpu(vfdata.vlanid); + ivf->spoofchk = vfdata.spoofchk; + ivf->linkstate = vfdata.linkstate; + ivf->max_tx_rate = le32_to_cpu(vfdata.maxrate); + ivf->trusted = vfdata.trusted; + ether_addr_copy(ivf->mac, vfdata.macaddr); } } From patchwork Wed Oct 26 14:37:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 13020721 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F94DC38A2D for ; Wed, 26 Oct 2022 14:38:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234363AbiJZOiC (ORCPT ); Wed, 26 Oct 2022 10:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234354AbiJZOhz (ORCPT ); Wed, 26 Oct 2022 10:37:55 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA8BCB7F7F for ; Wed, 26 Oct 2022 07:37:54 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id y13so10923919pfp.7 for ; Wed, 26 Oct 2022 07:37:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=SiNLOlmUHzmlxhswteeq31/L5KZSL+vkbvkQBEPuT6s=; b=L5rpnghKijeKhCmzGsfhvpS8NZizmtNM1TYasGn0Wxu3XLMFqCLYuYq39MNniJJZw6 B2sPMxV5dHHA4budsF0bFUDkE1sP2MFJiz7PYdDE5Vogq5ird8SIEkiRIdpOfb9kCfHL 2oBe52ggoS9Y30l0tw4k4GD0P7GrUCX0dXt5CUirnQ0gDePsy0x2m5QeC3ZloQidANnd 2SstaHLm37AZcIe1O2OCpIkA1M1A0k9xKwOF8tpxFL+WMuVSA2xOCciVXYMe1/BmSsCZ 2WzIVx/rhRfC3pdbL7optF1ZZ5f8oOcUzMS1f1MveGm6mQqzXyEhRBfJm/aJds8bHHjg xEtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SiNLOlmUHzmlxhswteeq31/L5KZSL+vkbvkQBEPuT6s=; b=4DOUB/kyGOxRsBf9u7gLjM2z23wKr787RTHnznHOx8di8ZH151fvn32SgUK5vHlzg8 O5ZOuRw3ChUnVa1irXxefR8DUeIlXwVk1HnjoK0DHkIxjFFEk5Ag4YL1wX9Uy+zBG1Bn 9PQV7iQHXFMdiF/b11dBDei7B5uEni9D9r72bnucZm5dn0jlFRotXO9vIYIt8wqT9nyU NFVcm/eA/qn9scsZdSdMbwGmmUxc5lUanYG8EcWy4qgl4vF+IoiWA3unW7k7KDBHiErB Tc+6MDEZGrYB+6RIPtFFpjHoSlhqh7bdNsNbHZsuCsVnutEFV4veVcUGNRlXzRWMUCs7 zNJg== X-Gm-Message-State: ACrzQf2Pj/PMxa1UHEo9zoMoSWQgcObWw3TtWl7BtoggQKbH3l3dFbTR skD/isQ84uIiziVMg9hFazVD6g== X-Google-Smtp-Source: AMsMyM4/HD0w7BDE2Sl0eEUQbLjJ4khmNOtDsrrXONT6E8PLQ6BsrV7/7CtxO5FMyL8ndfMBieDn2A== X-Received: by 2002:a63:6c84:0:b0:43c:700f:6218 with SMTP id h126-20020a636c84000000b0043c700f6218mr37313916pgc.420.1666795074220; Wed, 26 Oct 2022 07:37:54 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id d185-20020a6236c2000000b0056286c552ecsm3060484pfa.184.2022.10.26.07.37.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 07:37:53 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org, leon@kernel.org Cc: drivers@pensando.io, Shannon Nelson Subject: [PATCH v3 net-next 3/5] ionic: new ionic device identity level and VF start control Date: Wed, 26 Oct 2022 07:37:42 -0700 Message-Id: <20221026143744.11598-4-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221026143744.11598-1-snelson@pensando.io> References: <20221026143744.11598-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org A new ionic dev_cmd is added to the interface in ionic_if.h, with a new capabilities field in the ionic device identity to signal its availability in the FW. The identity level code is incremented to '2' to show support for this new capabilities bitfield. If the driver has indicated with the new identity level that it has the VF_CTRL command, newer FW will wait for the start command before starting the VFs after a FW update or crash recovery. This patch updates the driver to make use of the new VF start control in fw_up path to be sure that the PF has set the user attributes on the VF before the FW allows the VFs to restart. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_dev.c | 14 ++++++ .../net/ethernet/pensando/ionic/ionic_dev.h | 3 ++ .../net/ethernet/pensando/ionic/ionic_if.h | 45 ++++++++++++++++++- .../net/ethernet/pensando/ionic/ionic_lif.c | 2 + .../net/ethernet/pensando/ionic/ionic_main.c | 2 +- 5 files changed, 64 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index 9d0514cfeb5c..626b9113e7c4 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -481,6 +481,20 @@ int ionic_dev_cmd_vf_getattr(struct ionic *ionic, int vf, u8 attr, return err; } +void ionic_vf_start(struct ionic *ionic) +{ + union ionic_dev_cmd cmd = { + .vf_ctrl.opcode = IONIC_CMD_VF_CTRL, + .vf_ctrl.ctrl_opcode = IONIC_VF_CTRL_START_ALL, + }; + + if (!(ionic->ident.dev.capabilities & cpu_to_le64(IONIC_DEV_CAP_VF_CTRL))) + return; + + ionic_dev_cmd_go(&ionic->idev, &cmd); + ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT); +} + /* LIF commands */ void ionic_dev_cmd_queue_identify(struct ionic_dev *idev, u16 lif_type, u8 qtype, u8 qver) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.h b/drivers/net/ethernet/pensando/ionic/ionic_dev.h index 563c302eb033..2a1d7b9c07e7 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.h @@ -124,6 +124,8 @@ 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); +static_assert(sizeof(struct ionic_vf_ctrl_cmd) == 64); +static_assert(sizeof(struct ionic_vf_ctrl_comp) == 16); #endif /* __CHECKER__ */ struct ionic_devinfo { @@ -324,6 +326,7 @@ int ionic_dev_cmd_vf_getattr(struct ionic *ionic, int vf, u8 attr, struct ionic_vf_getattr_comp *comp); void ionic_dev_cmd_queue_identify(struct ionic_dev *idev, u16 lif_type, u8 qtype, u8 qver); +void ionic_vf_start(struct ionic *ionic); void ionic_dev_cmd_lif_identify(struct ionic_dev *idev, u8 type, u8 ver); void ionic_dev_cmd_lif_init(struct ionic_dev *idev, u16 lif_index, dma_addr_t addr); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_if.h b/drivers/net/ethernet/pensando/ionic/ionic_if.h index 4a90f611c611..eac09b2375b8 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_if.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_if.h @@ -8,7 +8,7 @@ #define IONIC_DEV_INFO_VERSION 1 #define IONIC_IFNAMSIZ 16 -/** +/* * enum ionic_cmd_opcode - Device commands */ enum ionic_cmd_opcode { @@ -54,6 +54,7 @@ enum ionic_cmd_opcode { /* SR/IOV commands */ IONIC_CMD_VF_GETATTR = 60, IONIC_CMD_VF_SETATTR = 61, + IONIC_CMD_VF_CTRL = 62, /* QoS commands */ IONIC_CMD_QOS_CLASS_IDENTIFY = 240, @@ -200,6 +201,7 @@ struct ionic_dev_reset_comp { }; #define IONIC_IDENTITY_VERSION_1 1 +#define IONIC_DEV_IDENTITY_VERSION_2 2 /** * struct ionic_dev_identify_cmd - Driver/device identify command @@ -253,6 +255,14 @@ union ionic_drv_identity { __le32 words[478]; }; +/** + * enum ionic_dev_capability - Device capabilities + * @IONIC_DEV_CAP_VF_CTRL: Device supports VF ctrl operations + */ +enum ionic_dev_capability { + IONIC_DEV_CAP_VF_CTRL = BIT(0), +}; + /** * union ionic_dev_identity - device identity information * @version: Version of device identify @@ -273,6 +283,7 @@ union ionic_drv_identity { * @hwstamp_mask: Bitmask for subtraction of hardware tick values. * @hwstamp_mult: Hardware tick to nanosecond multiplier. * @hwstamp_shift: Hardware tick to nanosecond divisor (power of two). + * @capabilities: Device capabilities */ union ionic_dev_identity { struct { @@ -290,6 +301,7 @@ union ionic_dev_identity { __le64 hwstamp_mask; __le32 hwstamp_mult; __le32 hwstamp_shift; + __le64 capabilities; }; __le32 words[478]; }; @@ -2044,6 +2056,35 @@ struct ionic_vf_getattr_comp { u8 color; }; +enum ionic_vf_ctrl_opcode { + IONIC_VF_CTRL_START_ALL = 0, + IONIC_VF_CTRL_START = 1, +}; + +/** + * struct ionic_vf_ctrl_cmd - VF control command + * @opcode: Opcode for the command + * @vf_index: VF Index. It is unused if op START_ALL is used. + * @ctrl_opcode: VF control operation type + */ +struct ionic_vf_ctrl_cmd { + u8 opcode; + u8 ctrl_opcode; + __le16 vf_index; + /* private: */ + u8 rsvd1[60]; +}; + +/** + * struct ionic_vf_ctrl_comp - VF_CTRL command completion. + * @status: Status of the command (enum ionic_status_code) + */ +struct ionic_vf_ctrl_comp { + u8 status; + /* private: */ + u8 rsvd[15]; +}; + /** * struct ionic_qos_identify_cmd - QoS identify command * @opcode: opcode @@ -2865,6 +2906,7 @@ union ionic_dev_cmd { struct ionic_vf_setattr_cmd vf_setattr; struct ionic_vf_getattr_cmd vf_getattr; + struct ionic_vf_ctrl_cmd vf_ctrl; struct ionic_lif_identify_cmd lif_identify; struct ionic_lif_init_cmd lif_init; @@ -2903,6 +2945,7 @@ union ionic_dev_cmd_comp { struct ionic_vf_setattr_comp vf_setattr; struct ionic_vf_getattr_comp vf_getattr; + struct ionic_vf_ctrl_comp vf_ctrl; struct ionic_lif_identify_comp lif_identify; struct ionic_lif_init_comp lif_init; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index a06b2da1e0c4..f5d39594ef54 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -2629,6 +2629,8 @@ static void ionic_vf_attr_replay(struct ionic_lif *lif) } up_read(&ionic->vf_op_lock); + + ionic_vf_start(ionic); } static const struct net_device_ops ionic_netdev_ops = { diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c index 56f93b030551..ed9d8c995236 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c @@ -533,7 +533,7 @@ int ionic_identify(struct ionic *ionic) sz = min(sizeof(ident->drv), sizeof(idev->dev_cmd_regs->data)); memcpy_toio(&idev->dev_cmd_regs->data, &ident->drv, sz); - ionic_dev_cmd_identify(idev, IONIC_IDENTITY_VERSION_1); + ionic_dev_cmd_identify(idev, IONIC_DEV_IDENTITY_VERSION_2); err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT); if (!err) { sz = min(sizeof(ident->dev), sizeof(idev->dev_cmd_regs->data)); From patchwork Wed Oct 26 14:37:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 13020722 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F5F6C38A2D for ; Wed, 26 Oct 2022 14:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233655AbiJZOiF (ORCPT ); Wed, 26 Oct 2022 10:38:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233815AbiJZOiB (ORCPT ); Wed, 26 Oct 2022 10:38:01 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AD8CBA263 for ; Wed, 26 Oct 2022 07:37:56 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id io19so9319951plb.8 for ; Wed, 26 Oct 2022 07:37:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=l6WKZVowwJKx99x52qYH6uDD4EwiMH/OqDvIe+d8MU0=; b=NaXhkAMZmdDURVEFF37SK+Ghzq+fXcUzbiLHOXxxaSb+aaMjsAaTGWiZgcZbGe21m5 ybVraDbzE5T+mQJXuOZhes8bXQ4gRXdZOh6JCI8DmO1/4mxvq/oIUz84Gbyhh3Xvhu6U zUuTQXA+VNWXv/8BAP17aJYCsYwHEa+Rav+UVtQHdDTYYdWPR/mePUPw3sZj3b0nuZ4w DbTbCEq13Z84lwdrQ2qArkNFItJcPgAJYHGvPp91BHflB2bBwScsc9wNgRy4tYF8349/ UaY7jBr8kqsEptgI21Ps71eZv2lx1QyQ0Bo/zVFT38li1M+FkVMVMqtn+GO+jU7PbQvv zbcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=l6WKZVowwJKx99x52qYH6uDD4EwiMH/OqDvIe+d8MU0=; b=wRQz6Kff/C39vkc/DMxGXWHF0V40ZQpDyAKymjnO/eTnZ5xzP1bAKPhmhcYcVtG/hx S4P/TPCkf1WLOPTka6eIsQTuDDmdqn4RUEbyHOZom11B4uleLGLj6FTINTDPmHXyyqLM zwG6gRAHmLOBj4in36ZdyW8sJHeJc0lunaCCvWulTDDcU7kp+c0qpgJzq+agUaZvTjGz YdPzuB+gam7u2t5+Wa6t5MyqOu/PbujqQBhI0MPL8hGgDflLttFBwhmOzpyR6S2V89kB 2k6gwgQ2qsfS4QNKVD6M2xPvpAJINSzKiWPkcwHAAkcl05y0JE2JeIYPcN7si7VQXjuz 3cpQ== X-Gm-Message-State: ACrzQf3gOznp/FUq1p/5a/wCIIWmvhNARIXrpWcqc0HLu6tRmYb2zDrB LczlT70D02AvW3TEskVuD89hvf9igEE9kg== X-Google-Smtp-Source: AMsMyM7RVhXopdmcF1JVhZfGg+mYRcP7kcfAb7+Ssnl1SiTBs1vWTa22Hn0EwnQtqdlOP++N+4gy4A== X-Received: by 2002:a17:902:f643:b0:185:50e4:f55e with SMTP id m3-20020a170902f64300b0018550e4f55emr44004775plg.156.1666795075917; Wed, 26 Oct 2022 07:37:55 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id d185-20020a6236c2000000b0056286c552ecsm3060484pfa.184.2022.10.26.07.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 07:37:55 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org, leon@kernel.org Cc: drivers@pensando.io, Neel Patel , Shannon Nelson Subject: [PATCH v3 net-next 4/5] ionic: enable tunnel offloads Date: Wed, 26 Oct 2022 07:37:43 -0700 Message-Id: <20221026143744.11598-5-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221026143744.11598-1-snelson@pensando.io> References: <20221026143744.11598-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Neel Patel Support stateless offloads for GRE, VXLAN, GENEVE, IPXIP4 and IPXIP6 when the FW supports them. Signed-off-by: Neel Patel Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 8 +++++++- drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index f5d39594ef54..4dd16c487f2b 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1491,7 +1491,13 @@ static int ionic_init_nic_features(struct ionic_lif *lif) NETIF_F_RXCSUM | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_TSO_ECN; + NETIF_F_TSO_ECN | + NETIF_F_GSO_GRE | + NETIF_F_GSO_GRE_CSUM | + NETIF_F_GSO_IPXIP4 | + NETIF_F_GSO_IPXIP6 | + NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM; if (lif->nxqs > 1) features |= NETIF_F_RXHASH; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index c03986bf2628..190681aa7187 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -925,8 +925,12 @@ static int ionic_tx_tso(struct ionic_queue *q, struct sk_buff *skb) len = skb->len; mss = skb_shinfo(skb)->gso_size; - outer_csum = (skb_shinfo(skb)->gso_type & SKB_GSO_GRE_CSUM) || - (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM); + outer_csum = (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE | + SKB_GSO_GRE_CSUM | + SKB_GSO_IPXIP4 | + SKB_GSO_IPXIP6 | + SKB_GSO_UDP_TUNNEL | + SKB_GSO_UDP_TUNNEL_CSUM)); has_vlan = !!skb_vlan_tag_present(skb); vlan_tci = skb_vlan_tag_get(skb); encap = skb->encapsulation; From patchwork Wed Oct 26 14:37:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 13020723 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE6B4FA373E for ; Wed, 26 Oct 2022 14:38:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234388AbiJZOiH (ORCPT ); Wed, 26 Oct 2022 10:38:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234359AbiJZOiB (ORCPT ); Wed, 26 Oct 2022 10:38:01 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E033AB7F67 for ; Wed, 26 Oct 2022 07:37:57 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id 130so5124204pfu.8 for ; Wed, 26 Oct 2022 07:37:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=EVLVwUvbbdRnPXpgkgorL4XSYztL7If2w8Rlat5ya04=; b=gMICKn9JaeTJ2U8eilapX7Uet3mnhi4b6+yY4DzrALdvd7RzqDsLcdD3eVyxN1/Dun 8KX/SoDTf2irIH1bpCDG1gLkpGOvnrndqsGv3++JHEwVSJoXsAA1dPxqypqFbUiROJW8 D7kYOFDHs1LV0h1zWiRtZ9t83UFp1rh6Rh0Z0/HHnj04iSzsWMnc6oGMuC00zHdKIjBg 6tLx0hYZx7oN22siFK1W4Verir4lVJd10x2qH0oFwcrJTMfVgOZTLm0HOSdetsJ3yZi9 0ElHL3lHR4o3faRUIhMBmKCm/gXV6HEpMAMR08uFSBDrCCc2ZFRFuHvDuH/fZdSlnNdu ccVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EVLVwUvbbdRnPXpgkgorL4XSYztL7If2w8Rlat5ya04=; b=a/BkljTmjMRL99uueMPRpGksvWoMeTqJ0BVAoqNLEvVNHU91u+crUyiGUcKKFsQrec T890fAzdFDeKmmT60OmUbuUY5zUEG4r48cS/xvLelqCEZAZQhxL3VmEuKTF+Z5fTqAyB j0IKKa77GoMwJvipJ7rRQo55DtOz2E3VhUpIp+O0akOa0gN5/COwgCoY3Gs8Yc7zm+Oq SEKcpqzBHQXOVjMg2CffnsDSnYwqLgGqgFENjnAM1+0LNE7cynAnrEvpZ6+WCWE4cZrv 3LOPfasqhv2GYWRwp70segNA8AbtfUiUe1+JCMWe9/e16Qk+EeEPayiacQNIGKWjwyZa BEpg== X-Gm-Message-State: ACrzQf1qTro5HygSgeQBp2yMjXSjrWepXLF14iaCoOwX0u1lz6oiEUar LFmDVCoUR3JPNSeuBi/KYCWeWg== X-Google-Smtp-Source: AMsMyM6dbyW4zUpgZ3Xny5v4TofrhVfYY/Vt/2AhzR4mMiL3q2qG8RHaNKBsv66wtEsD06QwWW7FJQ== X-Received: by 2002:aa7:8896:0:b0:56c:6e7a:a750 with SMTP id z22-20020aa78896000000b0056c6e7aa750mr2331083pfe.19.1666795077314; Wed, 26 Oct 2022 07:37:57 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id d185-20020a6236c2000000b0056286c552ecsm3060484pfa.184.2022.10.26.07.37.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 07:37:56 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org, leon@kernel.org Cc: drivers@pensando.io, Neel Patel , Shannon Nelson Subject: [PATCH v3 net-next 5/5] ionic: refactor use of ionic_rx_fill() Date: Wed, 26 Oct 2022 07:37:44 -0700 Message-Id: <20221026143744.11598-6-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221026143744.11598-1-snelson@pensando.io> References: <20221026143744.11598-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Neel Patel The same pre-work code is used before each call to ionic_rx_fill(), so bring it in and make it a part of the routine. Signed-off-by: Neel Patel Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_txrx.c | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index 190681aa7187..0c3977416cd1 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -348,16 +348,25 @@ void ionic_rx_fill(struct ionic_queue *q) struct ionic_rxq_sg_desc *sg_desc; struct ionic_rxq_sg_elem *sg_elem; struct ionic_buf_info *buf_info; + unsigned int fill_threshold; struct ionic_rxq_desc *desc; unsigned int remain_len; unsigned int frag_len; unsigned int nfrags; + unsigned int n_fill; unsigned int i, j; unsigned int len; + n_fill = ionic_q_space_avail(q); + + fill_threshold = min_t(unsigned int, IONIC_RX_FILL_THRESHOLD, + q->num_descs / IONIC_RX_FILL_DIV); + if (n_fill < fill_threshold) + return; + len = netdev->mtu + ETH_HLEN + VLAN_HLEN; - for (i = ionic_q_space_avail(q); i; i--) { + for (i = n_fill; i; i--) { nfrags = 0; remain_len = len; desc_info = &q->info[q->head_idx]; @@ -511,7 +520,6 @@ int ionic_rx_napi(struct napi_struct *napi, int budget) struct ionic_cq *cq = napi_to_cq(napi); struct ionic_dev *idev; struct ionic_lif *lif; - u16 rx_fill_threshold; u32 work_done = 0; u32 flags = 0; @@ -521,10 +529,7 @@ int ionic_rx_napi(struct napi_struct *napi, int budget) work_done = ionic_cq_service(cq, budget, ionic_rx_service, NULL, NULL); - rx_fill_threshold = min_t(u16, IONIC_RX_FILL_THRESHOLD, - cq->num_descs / IONIC_RX_FILL_DIV); - if (work_done && ionic_q_space_avail(cq->bound_q) >= rx_fill_threshold) - ionic_rx_fill(cq->bound_q); + ionic_rx_fill(cq->bound_q); if (work_done < budget && napi_complete_done(napi, work_done)) { ionic_dim_update(qcq, IONIC_LIF_F_RX_DIM_INTR); @@ -550,7 +555,6 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) struct ionic_dev *idev; struct ionic_lif *lif; struct ionic_cq *txcq; - u16 rx_fill_threshold; u32 rx_work_done = 0; u32 tx_work_done = 0; u32 flags = 0; @@ -565,10 +569,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) rx_work_done = ionic_cq_service(rxcq, budget, ionic_rx_service, NULL, NULL); - rx_fill_threshold = min_t(u16, IONIC_RX_FILL_THRESHOLD, - rxcq->num_descs / IONIC_RX_FILL_DIV); - if (rx_work_done && ionic_q_space_avail(rxcq->bound_q) >= rx_fill_threshold) - ionic_rx_fill(rxcq->bound_q); + ionic_rx_fill(rxcq->bound_q); if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) { ionic_dim_update(qcq, 0);