From patchwork Mon Oct 24 10:17:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 13017036 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 2B21CFA373E for ; Mon, 24 Oct 2022 10:17:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230265AbiJXKR3 (ORCPT ); Mon, 24 Oct 2022 06:17:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbiJXKR2 (ORCPT ); Mon, 24 Oct 2022 06:17:28 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE179688B6 for ; Mon, 24 Oct 2022 03:17:27 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id d24so8065863pls.4 for ; Mon, 24 Oct 2022 03:17:27 -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=S0d7gcEhnJJ5kpkSJwxTbH/pz03nzSwFV7yqmr90Y34=; b=GLBnozeLXsN1+0v3P5hTyWFTSKiEbTEBL1sQEYITxIYXxOzoLxQ/fzBHDonRyDW7EL YDBLROAtFwHLix2D3CjPyZBbKMnAA7aizhyB1IyKRobF/i5u+oAzzvbEbomEwOp58793 dxsA8sZVL4ehD77NTWb8oX4B3LmW9321/lClVIvqB/sbtPKXlRCT9/aXaKcZp5sUEHh9 KeRBKwvSMYWnP2IEuRVEVEIBtKEbI8Dsf+NJd/fv9hd6QSLUXECMFuFZ/AKo+g5g67gN bHD0xDp6lKVjry83ulQOtUKCD6Wai+eY/7LBQLIrMfUot8NI6tmFQIObd/wi0P7LYOzp S7aA== 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=S0d7gcEhnJJ5kpkSJwxTbH/pz03nzSwFV7yqmr90Y34=; b=LIJ0tnAnCKqqNJxPp0okjVJ/lT2cWGv4n37v8NYC7lGaF3S2EF9UuRki/8xg1cjvE+ kYY+2p/VDniBBT/sECTxJOHfeVd1P5LIK5vP4JjbxGPC/qsF7ty3WUV2JHQeFV8+eYl3 xSeYAnHWx2qKB+8ntpUN4HfM4RKAXLmjMivku0N9kEyvA2rVysv1igATkiymXGbD0/k1 mbiAh3sz2KmtMDMlaWRT6FCmueJEVZI9w6foiM0dzS12qn1WGEfkwMgqZ48kNm8hCj9d gBn1MtfTJMIBC/IbmvWUbLG9gIdicsB3SsYH+cr4bISf/7hZuHeDj3ER6icjChRPCGx4 4YgQ== X-Gm-Message-State: ACrzQf2W+7i3O3cN0dhwkjERG3C5fakU4v8otTb+puGxrsoyv6OXsLf3 ORHjk2uRSfEhynOUcjfNoz2JYKS6N9OMuQ== X-Google-Smtp-Source: AMsMyM6lVgSye+SV00SKWFayJGPfVo/IoaSTpCRSAHc+8c+1L1F2Cze0TEU9etlNC6wjz8D0fOMDlA== X-Received: by 2002:a17:90b:4a0b:b0:212:d400:4173 with SMTP id kk11-20020a17090b4a0b00b00212d4004173mr17879686pjb.195.1666606647214; Mon, 24 Oct 2022 03:17:27 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id h197-20020a6283ce000000b0056bf6cd44cdsm586290pfe.91.2022.10.24.03.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 03:17:26 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, Shannon Nelson Subject: [PATCH net-next 1/5] ionic: replay VF attributes after fw crash recovery Date: Mon, 24 Oct 2022 03:17:13 -0700 Message-Id: <20221024101717.458-2-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221024101717.458-1-snelson@pensando.io> References: <20221024101717.458-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..5d593198ad72 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 = { 0 }; + 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); + (void)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); + (void)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; + (void)ionic_set_vf_config(ionic, i, &vfc); + vfc.vlanid = 0; + } + + if (v->maxrate) { + vfc.attr = IONIC_VF_ATTR_RATE; + vfc.maxrate = v->maxrate; + (void)ionic_set_vf_config(ionic, i, &vfc); + vfc.maxrate = 0; + } + + if (v->spoofchk) { + vfc.attr = IONIC_VF_ATTR_SPOOFCHK; + vfc.spoofchk = v->spoofchk; + (void)ionic_set_vf_config(ionic, i, &vfc); + vfc.spoofchk = 0; + } + + if (v->trusted) { + vfc.attr = IONIC_VF_ATTR_TRUST; + vfc.trust = v->trusted; + (void)ionic_set_vf_config(ionic, i, &vfc); + vfc.trust = 0; + } + + if (v->linkstate) { + vfc.attr = IONIC_VF_ATTR_LINKSTATE; + vfc.linkstate = v->linkstate; + (void)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 Mon Oct 24 10:17:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 13017037 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 A778AECAAA1 for ; Mon, 24 Oct 2022 10:17:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229976AbiJXKRa (ORCPT ); Mon, 24 Oct 2022 06:17:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbiJXKR3 (ORCPT ); Mon, 24 Oct 2022 06:17:29 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EECD7688AE for ; Mon, 24 Oct 2022 03:17:28 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id m14-20020a17090a3f8e00b00212dab39bcdso6043214pjc.0 for ; Mon, 24 Oct 2022 03:17:28 -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=sB+p3H1YwsKkIV+Z5v1g8fBi0nOAx7Yvg5DG0vbIZoU=; b=YEPVdP4cAjeRgFNbrkykGMsSyi5SB1vEB1VD2ZgrCG840ZGorPHudaOm+EP4yc5Pfm 0MmsXCZBHUlWUX9JD5MG6uZT1sJciJtYC71tRfi0L6URvj3UfCLRaP/czBeEmQRK1boQ wX82HO4nAXcDJ+8TxReRodxXnzDXngiPYTwe8H/AWXZRq4r97igk2PxtHTQbvujTtRD6 mDQOCyrTKsFCXK3jTSgqXF4aUx691rSQxVyCyvSJt85xy9mmQ4YiA1d3UDPLqj3izxup 8/7/+apuNQEA/UF54+jV4RqZkYCEjMPaUcgP0wguWKh+WBFf6GPN38wh6LKefK/QizW/ aOWA== 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=sB+p3H1YwsKkIV+Z5v1g8fBi0nOAx7Yvg5DG0vbIZoU=; b=N0AFKpePYqn8SLxBMHM+WXwC0E0/k1fBC1C1ZhJJ5YrvHk8DFA/8nyF7TbNKhpjhfX YjzG62DYhFHXhBVpWwYXeP5QtJQmmHn+8Xpx1OWLogDUevr4tdvFV/f2L9ivA97AR1X/ A9uzfqgfP74L3btm6zS16OifYmaWmDC1NtLYlwZkZtuwvGmqxl3Zw5DluqqC25T0d3++ v4PvAGxB7ebaEXh2Gfdw5rqnowm6OZnRBFoq0rHyt1Wy2puwY6X18my1Wg9PN1mxL9wB FCfr6bvhb6yDJ6udNPY2Elnd6ZTCfwngnV2fUJDtptsyjlaqS7Y9/TmP+SfKchZco8Rh Hivg== X-Gm-Message-State: ACrzQf0gx8/wqDoBK0238VRA2Ech/406N23I9o1yK+pWjuwmwioPTbF4 6ZxWR4oWbwPO7tAlrBnD8dhY4Q== X-Google-Smtp-Source: AMsMyM6+xz82hpag/PeA78zlKIAcG7ppAte4i9G2ONpYaND1PMOs5UJf2fi4zf/6YDUPj5PIiRGeSg== X-Received: by 2002:a17:903:124e:b0:178:6946:a2ba with SMTP id u14-20020a170903124e00b001786946a2bamr32490012plh.89.1666606648483; Mon, 24 Oct 2022 03:17:28 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id h197-20020a6283ce000000b0056bf6cd44cdsm586290pfe.91.2022.10.24.03.17.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 03:17:27 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, Shannon Nelson Subject: [PATCH net-next 2/5] ionic: only save the user set VF attributes Date: Mon, 24 Oct 2022 03:17:14 -0700 Message-Id: <20221024101717.458-3-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221024101717.458-1-snelson@pensando.io> References: <20221024101717.458-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 5d593198ad72..39a2e693e715 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 Mon Oct 24 10:17:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 13017038 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 86128ECAAA1 for ; Mon, 24 Oct 2022 10:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230178AbiJXKRj (ORCPT ); Mon, 24 Oct 2022 06:17:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230200AbiJXKRf (ORCPT ); Mon, 24 Oct 2022 06:17:35 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF24269187 for ; Mon, 24 Oct 2022 03:17:30 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id pb15so7768537pjb.5 for ; Mon, 24 Oct 2022 03:17:30 -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=zTc4ueicHoN3L3GA+MWQ4FHdHNf8AObYSYE7etjh7XM=; b=fQSmuomGhjh9UV4AV5pJDdHQfHAzsFX7sNLzZLpJhOx9SldLWBvRXDvlZLU7b70P+A PSzZNNeFhpV7DwI1Y0TRIBCVa29zHMAiCoNgazJG4wBDxr8sRdvDT10n+W53Qw5OTxwW ALP2JnMJc88Fx5iArKKrpJoz1SmW/OU1ajOgZrgBm0x3c0NOVZLY1jp+zknunSj6sJWH QUcd+vPgIpryLNECjjmGp2TEg57hrqr+DveYg9hFDhw6mGLD+XG6cOy/G6Pp2FHBGldj o4kVsR41xs6uMSB+8B8KHP5ahTjnYF91/fcdUSnYK158fJAmzp+Ut4a97pXPmeP9ig1c W5+w== 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=zTc4ueicHoN3L3GA+MWQ4FHdHNf8AObYSYE7etjh7XM=; b=FXtum686FmKALWDPbzVugGjFBtT8lFxTnQF8DN5h9w4eoTDs9fzCqcALEnHWTpc+FD 0Jqe+gWl8xQ9+zLEWJcBbDB6PnBySRiHU6twPaigqg8HZebXmQ2hId4w+6/V3kpK3wDd UVErwDGoiUihGoNzflebKiM+8Z62KoX7Oba8qoxBVA6746yqg65R+e50bKKvjD0JHF+d 9M/I4q5LH8KvcOouokKVF+whb4PgH7xe1kt/5xi1354PP4CVprIzndEl2XI9dbd8Ti7Y Jk9b61CnkG9mdx8T66x50n5N38ggFseHnsUuE4r4omDxt3pEkZM8HH5Uf9s+yBYLLkOj RyEQ== X-Gm-Message-State: ACrzQf2cuNxY6PVkhRaLIwRN4VEroluEvjXqkeGypVAgAOBfDBbyGAgq GO+LGKqh+k06+kxjn8a7ftnrNA== X-Google-Smtp-Source: AMsMyM6xUFQjNOkTHC/Wx1rr7YtMPsLBpIMf4famVmKpDsFLuGJZBux8oJzutR5AM8OzYSfd5y3ydw== X-Received: by 2002:a17:902:e952:b0:17c:7aaa:c679 with SMTP id b18-20020a170902e95200b0017c7aaac679mr32959587pll.74.1666606649783; Mon, 24 Oct 2022 03:17:29 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id h197-20020a6283ce000000b0056bf6cd44cdsm586290pfe.91.2022.10.24.03.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 03:17:29 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, Shannon Nelson Subject: [PATCH net-next 3/5] ionic: new ionic device identity level and VF start control Date: Mon, 24 Oct 2022 03:17:15 -0700 Message-Id: <20221024101717.458-4-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221024101717.458-1-snelson@pensando.io> References: <20221024101717.458-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 | 20 +++++++++ .../net/ethernet/pensando/ionic/ionic_dev.h | 3 ++ .../net/ethernet/pensando/ionic/ionic_if.h | 41 +++++++++++++++++++ .../net/ethernet/pensando/ionic/ionic_lif.c | 2 + .../net/ethernet/pensando/ionic/ionic_main.c | 2 +- 5 files changed, 67 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index 9d0514cfeb5c..20a0d87c9fce 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -481,6 +481,26 @@ int ionic_dev_cmd_vf_getattr(struct ionic *ionic, int vf, u8 attr, return err; } +void ionic_vf_start(struct ionic *ionic, int vf) +{ + union ionic_dev_cmd cmd = { + .vf_ctrl.opcode = IONIC_CMD_VF_CTRL, + }; + + if (!(ionic->ident.dev.capabilities & cpu_to_le64(IONIC_DEV_CAP_VF_CTRL))) + return; + + if (vf == -1) { + cmd.vf_ctrl.ctrl_opcode = IONIC_VF_CTRL_START_ALL; + } else { + cmd.vf_ctrl.ctrl_opcode = IONIC_VF_CTRL_START; + cmd.vf_ctrl.vf_index = cpu_to_le16(vf); + } + + ionic_dev_cmd_go(&ionic->idev, &cmd); + (void)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..b0329cfa7a1d 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, int vf); 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..264ce3a427e1 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_if.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_if.h @@ -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,33 @@ 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 - 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; + 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; + u8 rsvd[15]; +}; + /** * struct ionic_qos_identify_cmd - QoS identify command * @opcode: opcode @@ -2865,6 +2904,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 +2943,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 39a2e693e715..b5ade86b26a0 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, -1); } 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 Mon Oct 24 10:17:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 13017039 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 11034C38A2D for ; Mon, 24 Oct 2022 10:17:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230151AbiJXKRk (ORCPT ); Mon, 24 Oct 2022 06:17:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbiJXKRf (ORCPT ); Mon, 24 Oct 2022 06:17:35 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24C24696C8 for ; Mon, 24 Oct 2022 03:17:31 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id f23so8054769plr.6 for ; Mon, 24 Oct 2022 03:17:31 -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=rgCyTxjLfeJe8llYSesMLp8twRs5USMmlujSMm5YGTY=; b=dsKtLfvUH5BwTrs13mZ4f/CpONa5riRizkjBce+Ouqs4b1YC1/T49IPGpxWFrK2UAA w64PW0ivItppsfBalSrZWTZUB+jLO+1gjipRHSHjEcbWRuv7UVOxkrQTHTdrcKr+okSR lbYxLHn5ySmiLstWRPXVPovXMrlMGiq8aAbTpHQYROpC/kTlWKx+Ie5dXyV1skRq3yxT VpSunahWuXOaAA794R/8fv2LMJ/IpJdv2p2Tf31/y/c1mNL/uSW/jmK+arziNxSMA4ai nNvHbdySRX+B6fqxcoTl89LDgq3inB4w00MBeLx+Rcsdm5TNCQKzD3Tyx7WNBHCo3z4a Zb+w== 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=rgCyTxjLfeJe8llYSesMLp8twRs5USMmlujSMm5YGTY=; b=HdKUyHWiev5KK92RDFMxQ4BrO8ALhDPKjRvWOHzSsvhapumhADl0rahh97w0ELrQVf kg5o2egQ+6V+ocglg9MFlJootmKJUzYvzanTAmQuxcp8U+tclE7hqm0ygwdZRSbKomWI ffLMAq3xLrIYBL/i3odZxmWZtKGQANJkYAH0otETP+6/8EvFET/FEiUNHImMoBzD/Z4e Tw4ui7srTtCZwB/EgSQRbleRJ64gPnUFXd9hfDmvhYpCaL3oqZanrK6hULWYLiWFA2GW Oxim3XgxtSwvAWj47g1tusBdyY7SshjvsVltpyC89wipFaKTCrCZfIwKGGp1dpXMt+Tt YTfg== X-Gm-Message-State: ACrzQf2wZrkAYi3Gn4le1a9e3CZIL6KQ+1PtKOR/LlQOlngBMduyjgqQ lIJojgtdB0hTKs5PgM55qSnoaw== X-Google-Smtp-Source: AMsMyM4/b/Ud2vrfaOKUHXOaMB6jbx5a+KU5kaZ0TgKXzSzJ4UnU1GyzTKzuAZg73PD01ZQ4l9meSw== X-Received: by 2002:a17:902:d54a:b0:186:a43b:8e with SMTP id z10-20020a170902d54a00b00186a43b008emr5449679plf.36.1666606651108; Mon, 24 Oct 2022 03:17:31 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id h197-20020a6283ce000000b0056bf6cd44cdsm586290pfe.91.2022.10.24.03.17.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 03:17:30 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, Neel Patel , Shannon Nelson Subject: [PATCH net-next 4/5] ionic: enable tunnel offloads Date: Mon, 24 Oct 2022 03:17:16 -0700 Message-Id: <20221024101717.458-5-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221024101717.458-1-snelson@pensando.io> References: <20221024101717.458-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 b5ade86b26a0..cbfa3a9e626e 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 Mon Oct 24 10:17:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 13017040 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 98211FA373E for ; Mon, 24 Oct 2022 10:17:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbiJXKRl (ORCPT ); Mon, 24 Oct 2022 06:17:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230360AbiJXKRi (ORCPT ); Mon, 24 Oct 2022 06:17:38 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88E72696FC for ; Mon, 24 Oct 2022 03:17:33 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id m2so3793667pjr.3 for ; Mon, 24 Oct 2022 03:17:33 -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=HsM2iTUaK/TxgpF5+Y/D+LQff6N5qH5RyBb2smeNJLtiD8Y7WKLhpjyWimEK4CrrKW n8+DBXe/PMzWlAU0DTkgVpXZD0V5qrelGyhQhgwQhyDUoRn8mjwjNt58JZhGNh+etTS8 Zfje15i7R8LL1ZSjbLr/S4Z5KG8x/c4lFkmw5qDn9pi268XjpKY+t9N0WH6L4LhJocjk HIb0wRunxb7i7btjc8Y1o2hwCTA7MA6E9QNjfJXX1BoAxBj3+XtqmkCUBpig77TWRu0n eLRUUcjAHhi1A8PyKNZZyA38FX7/c030jFYvOF2zairCRYPVt1RRi3b8VkOz3QAWoEV/ m+Jg== 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=Rg5nJkbl/0qOEjSlZjTApzCKEF1cXkC61ukzbIdns2jo0BrgOcHCPyMfpdFTPOSCEO erGGM1RtN9YtgoHUb8a/681dgJjBqHkrNsLMPff4SjvK7uqhE8pVe1YIgMIVJBvS+TpR Ll6LgJmZCeT63a5Vh1c4eBHXKzFZtpfiF6xy44UbFJ0CVEK99Fd+2yItWPycG2xIpR0c DbIZWdO78GINJivfIR5r/5WhFQOX7AkHSewl33HP9Vo0jzSHK/BeeryYY8Co/qw94QH/ giGYxfCoKgVTNGHjO9QtYio87O11V0iM5vfTPpX4xoW0xn3m83IRIDd22QaVxZgkG4yH X5Qw== X-Gm-Message-State: ACrzQf2WqxrieLumxzmufPBn4JqPOYsxrPjd4Jr5iR2bh6KbAK1Btu1F Ds/340eev/fD85s0kTDr/D0OKw== X-Google-Smtp-Source: AMsMyM6VjvcwZoaDonxPg8stqCgO+61T1wPsYYSZXVWgBjZaJeiW2tzC7wxfvkch8hvKJVjBUSSewg== X-Received: by 2002:a17:902:ebc5:b0:186:b848:c6a with SMTP id p5-20020a170902ebc500b00186b8480c6amr476894plg.46.1666606652389; Mon, 24 Oct 2022 03:17:32 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id h197-20020a6283ce000000b0056bf6cd44cdsm586290pfe.91.2022.10.24.03.17.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 03:17:31 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, Neel Patel , Shannon Nelson Subject: [PATCH net-next 5/5] ionic: refactor use of ionic_rx_fill() Date: Mon, 24 Oct 2022 03:17:17 -0700 Message-Id: <20221024101717.458-6-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221024101717.458-1-snelson@pensando.io> References: <20221024101717.458-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);