From patchwork Wed Jun 8 09:29:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12873137 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 B829BC43334 for ; Wed, 8 Jun 2022 09:57:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235557AbiFHJ5x (ORCPT ); Wed, 8 Jun 2022 05:57:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235507AbiFHJ5h (ORCPT ); Wed, 8 Jun 2022 05:57:37 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2096.outbound.protection.outlook.com [40.107.223.96]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B297E60D8 for ; Wed, 8 Jun 2022 02:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f0u8HydMPXD/WubQbtImNg36sNfVpzyqxW8EiVinRnJPTNPtFGcRqVnNvJlFqeqv97kVbDyzQdW0QRVttvfRTywpL6RbBxPb+ZwRiJAly4e9sLPdioRtun1XyXPMHitVeeaAHOT8V1Bkj1qFq6KwLTCuscJo2HBouHdYF4wm5UPFjJdsn5WUptcWZvjawZtcumI45mBmXY4J6oaVe/ykEWtqbOdWbjhanyW+cMKtjkk3YSnTYzGOUGJ/aRiijAWyHp4GA77L25fnNfGv8hEGOqJzJLFHFP6B2Mza8AqetnZfpiMh0FVK2exeCjhiWYdCi48+/cwdBik9Qy49x7CBlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iAd1PCTZkb3tZQnsyPrquW9c0hI6ICKXchX1cwyNVvU=; b=SJ6pwaV3qK0BS000X7hiM+f9ER1z4QQM4ANzNOBB6Qy60X+yh9aXEncQaTlD65xQjf5PcXxoNwbg4TZgU9Eq1+MoV46Vn7b8X+vczYtS25DuYDC2DKdmJW1rSZzN+pJWtTm5SVZ9vc3RfpYk6kAjSO30DmZegAtcGH+qMLQQuDSe59i4Z6nan7ihmsq6dPXIjeOZmqjH7+5/PByOxpqjqV1Z9HK5YTD/41Gytv16kG40+uzCj05dQbgad+Np1Mt11xnH9RyLSlov64w3E7wI24998qs58p7KqQ2s7LrtgnhMxTPChmF6OnmdnYJ63xH5NXFgIU784AulvFjLfGPlzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iAd1PCTZkb3tZQnsyPrquW9c0hI6ICKXchX1cwyNVvU=; b=HgEeC0OjCzpZjWeNYYPmRQV0z80tUNpFcwyTcm6iXxQIAEHxw3Wvt7OjW+1s8JjAyloTiStM+dIYyE79aMOjfqtpDLci5hq0m8hytgXJ+QJC95pPlXNb2+qQA/GnT0JCAWeqJANJe9m8qyA8ffnpLbx51HPV4oQ+AWxWvW29Bug= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by PH7PR13MB5575.namprd13.prod.outlook.com (2603:10b6:510:139::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.4; Wed, 8 Jun 2022 09:29:57 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::b18b:5e90:6805:a8fa]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::b18b:5e90:6805:a8fa%8]) with mapi id 15.20.5332.011; Wed, 8 Jun 2022 09:29:57 +0000 From: Simon Horman To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, oss-drivers@corigine.com, Fei Qin , Etienne van der Linde Subject: [PATCH net 1/2] nfp: avoid unnecessary check warnings in nfp_app_get_vf_config Date: Wed, 8 Jun 2022 11:29:00 +0200 Message-Id: <20220608092901.124780-2-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220608092901.124780-1-simon.horman@corigine.com> References: <20220608092901.124780-1-simon.horman@corigine.com> X-ClientProxiedBy: AM3PR07CA0071.eurprd07.prod.outlook.com (2603:10a6:207:4::29) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cfd7e16d-507d-4b84-b764-08da493173b9 X-MS-TrafficTypeDiagnostic: PH7PR13MB5575:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WBOKNJKI3rETN8yHQeMM8/qm6DoLGISChUZlyNPCXTlfhS0wnIGl/6twEYGve1pfZBbgr+4C6Dtwkvpkxgqdykpfi4CHZK/P5UvNqF0zCHBo4PlMyDaFB6m9WELtl2WmWcPN6OevYads6qxiEbtfqzCxMTEzcBPQ1hQMG0p1XQRVI6Z7StZWsDkCgATxEV0KDB1nDPhsURGCdDQ7c396VOwJmFTIMh9DYDHXxykjssAkSLe/txIwx4XJ8CwBzEWfbYQt8+eT4t3JaAr2jvyO7uvXfERLtAmwVzlWdXaYK/ct9TqhqPux6ynD1QxPtyP930kkB42rG1466ioTf4MQlrzSuwzpk9EsmK9hqD6YPcCl1d8OMcfXQGbFisRIbVv+Op7OLgswpW6umm+JuR2RbXhBkXNYbBROOSEX1wg4NbfhtM+Y2oMcFyxM4CYPDobZtKhONl2ti2tCiLjlhKubvT7hGnUJVdjhf3PLVgSjMoYebxL1r28DkABw5MQdMijPYE2ih733OewFxZ22Rpoa43qMG3RnIaVSw33eNOwuQVpDuz8FyOG8lIxzF36++1ewd1Mn7GDGv5l5rp1QYNLDr8agnVgbZC/k6r0AzDjZC0Al1O/8WVq0F9sAug6spEQ8BTmHpX+s0tyJsywvzZa4QtLDZkpHienBSzSbSY3o82bFvV1WzoOWBPM+xe/NPQ2IbpItEizDPZunjul17Adzlw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(346002)(396003)(136003)(366004)(39840400004)(41300700001)(1076003)(186003)(508600001)(8936002)(2906002)(54906003)(83380400001)(36756003)(6486002)(38100700002)(44832011)(86362001)(2616005)(316002)(110136005)(107886003)(5660300002)(6666004)(6506007)(4326008)(52116002)(8676002)(66556008)(66476007)(66946007)(6512007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: jNfgQjhwEIyvz7/7YjIsjJX2lwmO6/ge22BydC8Y5p63k7ey/fG+yj/NqqPulJ/wQP667zN0ARt05m7usMQIO8uACCKHN17Lw97hLyhA8kHwPD/DkzMhCI4JquS4e+H4rsrnk0tMSQfgr1qVZbACG5mFbCdrI3VCEjwzRQH/k+OIaXPWhjbF3T8uzojs4LeP+BikpzeSNPGpCb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o+PmLob41GRLG/2WXuV9375MajItFJX5pUX8DfQ4pRa49+4+b8B7KaApiHdFNMWK3a0jhA3X6W5RPmd7bUqkaLLtSnVmH90VttoIcaI61L3Ra/A6o9ES5fiXM0GFia2yJUVCqMJwuXOeWromZL94VBJBwbjViNN7OEo3iLDBFpFR8BI3EOvTv1tgCm0fnHtKzdXgcwXut0IxAZ7uGFcWtupLxLmvqDtlAlpTvUuB4/cf7tYitP+LROJUbuu150m8J/z14fG5Do1q0ojYA71ceZLTbIEH1JgodusAsC9Gk/72txhi7JoNvJPHL3vSUOK/agVohGeMpaDgbibSxGyyMbj9Q0+VlAp62Xc7FwdFi6lzXIvenBT0F2xgc+l8gg7LgHdbSiniLsK9QwYyf0dWXivgS8ovY74T+4/1y7Ss3z3AeVpgMalRL4fN9BHIlgnWF9YlUSi1VYC3Z9txpB9PhkKSyrF0bRSsGtrBDMMpc5/mgpMjYBrD7W0gGJ6RI+mfnS X-MS-Exchange-AntiSpam-MessageData-1: iGusMirZYl3CLxJu4WFHMyCGsauxAD9Nr7M= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: cfd7e16d-507d-4b84-b764-08da493173b9 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2022 09:29:57.1216 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vJBjyYsujtlO42wpobYSbdPUxfmY/eyeH3pc2yadCkAiyraERkF6E7gZCrBRjweiduZf5gHA/DwxifylPFiUe2vz8lzjuQOcxB8b+NAM39c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB5575 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Fei Qin nfp_net_sriov_check is added in nfp_app_get_vf_config which intends to ensure ivi->vlan_proto and ivi->max_tx_rate/min_tx_rate can be read from VF config table only when firmware supports corresponding capability. However, "nfp_app_get_vf_config" can be called by commands like "ip a", "ip link set $DEV up" and "ip link set $DEV vf $NUM vlan $param" (with VF). When using commands above, many warnings "ndo_set_vf_ not supported" would appear if firmware doesn't support VF rate limit and 802.1ad VLAN assingment. If more VFs are created, things could get worse. Thus, this patch add an extra bool parameter for nfp_net_sriov_check to enable/disable the cap check warning report. Unnecessary warnings in nfp_app_get_vf_config can be avoided. Valid warnings in kinds of vf setting function can be reserved. Fixes: e0d0e1fdf1ed ("nfp: VF rate limit support") Fixes: 59359597b010 ("nfp: support 802.1ad VLAN assingment to VF") Signed-off-by: Fei Qin Signed-off-by: Yinjun Zhang Signed-off-by: Louis Peens Signed-off-by: Simon Horman --- .../ethernet/netronome/nfp/nfp_net_sriov.c | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_sriov.c b/drivers/net/ethernet/netronome/nfp/nfp_net_sriov.c index 54af30961351..6eeeb0fda91f 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_sriov.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_sriov.c @@ -15,7 +15,7 @@ #include "nfp_net_sriov.h" static int -nfp_net_sriov_check(struct nfp_app *app, int vf, u16 cap, const char *msg) +nfp_net_sriov_check(struct nfp_app *app, int vf, u16 cap, const char *msg, bool warn) { u16 cap_vf; @@ -24,12 +24,14 @@ nfp_net_sriov_check(struct nfp_app *app, int vf, u16 cap, const char *msg) cap_vf = readw(app->pf->vfcfg_tbl2 + NFP_NET_VF_CFG_MB_CAP); if ((cap_vf & cap) != cap) { - nfp_warn(app->pf->cpp, "ndo_set_vf_%s not supported\n", msg); + if (warn) + nfp_warn(app->pf->cpp, "ndo_set_vf_%s not supported\n", msg); return -EOPNOTSUPP; } if (vf < 0 || vf >= app->pf->num_vfs) { - nfp_warn(app->pf->cpp, "invalid VF id %d\n", vf); + if (warn) + nfp_warn(app->pf->cpp, "invalid VF id %d\n", vf); return -EINVAL; } @@ -65,7 +67,7 @@ int nfp_app_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) unsigned int vf_offset; int err; - err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_MAC, "mac"); + err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_MAC, "mac", true); if (err) return err; @@ -101,7 +103,7 @@ int nfp_app_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos, u32 vlan_tag; int err; - err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_VLAN, "vlan"); + err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_VLAN, "vlan", true); if (err) return err; @@ -115,7 +117,7 @@ int nfp_app_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos, } /* Check if fw supports or not */ - err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_VLAN_PROTO, "vlan_proto"); + err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_VLAN_PROTO, "vlan_proto", true); if (err) is_proto_sup = false; @@ -149,7 +151,7 @@ int nfp_app_set_vf_rate(struct net_device *netdev, int vf, u32 vf_offset, ratevalue; int err; - err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_RATE, "rate"); + err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_RATE, "rate", true); if (err) return err; @@ -181,7 +183,7 @@ int nfp_app_set_vf_spoofchk(struct net_device *netdev, int vf, bool enable) int err; err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_SPOOF, - "spoofchk"); + "spoofchk", true); if (err) return err; @@ -205,7 +207,7 @@ int nfp_app_set_vf_trust(struct net_device *netdev, int vf, bool enable) int err; err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_TRUST, - "trust"); + "trust", true); if (err) return err; @@ -230,7 +232,7 @@ int nfp_app_set_vf_link_state(struct net_device *netdev, int vf, int err; err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_LINK_STATE, - "link_state"); + "link_state", true); if (err) return err; @@ -265,7 +267,7 @@ int nfp_app_get_vf_config(struct net_device *netdev, int vf, u8 flags; int err; - err = nfp_net_sriov_check(app, vf, 0, ""); + err = nfp_net_sriov_check(app, vf, 0, "", true); if (err) return err; @@ -285,13 +287,13 @@ int nfp_app_get_vf_config(struct net_device *netdev, int vf, ivi->vlan = FIELD_GET(NFP_NET_VF_CFG_VLAN_VID, vlan_tag); ivi->qos = FIELD_GET(NFP_NET_VF_CFG_VLAN_QOS, vlan_tag); - if (!nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_VLAN_PROTO, "vlan_proto")) + if (!nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_VLAN_PROTO, "vlan_proto", false)) ivi->vlan_proto = htons(FIELD_GET(NFP_NET_VF_CFG_VLAN_PROT, vlan_tag)); ivi->spoofchk = FIELD_GET(NFP_NET_VF_CFG_CTRL_SPOOF, flags); ivi->trusted = FIELD_GET(NFP_NET_VF_CFG_CTRL_TRUST, flags); ivi->linkstate = FIELD_GET(NFP_NET_VF_CFG_CTRL_LINK_STATE, flags); - err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_RATE, "rate"); + err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_RATE, "rate", false); if (!err) { rate = readl(app->pf->vfcfg_tbl2 + vf_offset + NFP_NET_VF_CFG_RATE); From patchwork Wed Jun 8 09:29:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12873138 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 3271DC43334 for ; Wed, 8 Jun 2022 09:58:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235180AbiFHJ6o (ORCPT ); Wed, 8 Jun 2022 05:58:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235879AbiFHJ5t (ORCPT ); Wed, 8 Jun 2022 05:57:49 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2096.outbound.protection.outlook.com [40.107.223.96]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2E61E20 for ; Wed, 8 Jun 2022 02:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nBRKeCDQdP1uA56rFlSBAdtq0wor19OM89tbHLSbHRkSyLvzaYp12UTwxbw+XaMO7JG7uKy/y185uUMXgT5R+Lg9lFsRBiGcar8eddg5XCWxvZI7WoJef/P7cYU5k7sYYi7HuphlIiSK77dMI0qR14q+5vnJft7YXCxT0RL5Bh0Dfjg9chf8xihZ46QkeC0utiRmrZR0PKi2ky8Spva+RiRIUT/kb1YkGxlfSldZqO35aj5ECZK4z1QTwL7k89XGlGrwn9WqQm0oBfHAvUOhU8X7BS9BEnmJmIL/2s7JmE5b64TBFzcMX3exHwUnX+NY8YL3WbPdJ1uUs0uk+e/EVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=b8gd9IN6M/HGRAWkn0Ut8QBW7hAiRv0jBqVOyoJ8Y6Y=; b=QVY17908q9GBytxSKFURAN3JkzcuUomheMIuc503L8qYS79LQHBQBMBN8UTZt8WxArChpLMpUDlKx2SXHZNE5gJy4utGAkJTHxuKnmlh9xJcuQBrxdk48Ndrqe3pUEMz0OkOorOQoW50lKo5S9hQs8LK705U037KD4UlZx9DIwfrrnqDSqpqQDjiah+k4ST3gDpgYEKtgsPo0cwiCPha7o0cFB1Zq9qHVtnAAHEFtolteewqUfMoOiy7uOwpFaJws4YfOQNpBMRjlil9cgbmQspFE1nLyTdrkVUH1sAeyrLNXqJixYFTGzWwZWUlbzyLqz7iV+mFVMoSgUBFO3kVQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b8gd9IN6M/HGRAWkn0Ut8QBW7hAiRv0jBqVOyoJ8Y6Y=; b=d7QtkmNfKnvCAAnWJyh7aWyvphO9ClfzgX8smHiT0P3UH8Y4OGvQX4w8+tZ01uOfYp1i/bw3zACuINMhl+oWzM956cCyohnseN/nwBxqJtxBDh1GgoE9gerivS6SUoil9503VYfg+szMtfAq4ctdXqkGe6knNS10m0pzHtYsDjQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by PH7PR13MB5575.namprd13.prod.outlook.com (2603:10b6:510:139::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.4; Wed, 8 Jun 2022 09:29:58 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::b18b:5e90:6805:a8fa]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::b18b:5e90:6805:a8fa%8]) with mapi id 15.20.5332.011; Wed, 8 Jun 2022 09:29:58 +0000 From: Simon Horman To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, oss-drivers@corigine.com, Fei Qin , Etienne van der Linde Subject: [PATCH net 2/2] nfp: flower: restructure flow-key for gre+vlan combination Date: Wed, 8 Jun 2022 11:29:01 +0200 Message-Id: <20220608092901.124780-3-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220608092901.124780-1-simon.horman@corigine.com> References: <20220608092901.124780-1-simon.horman@corigine.com> X-ClientProxiedBy: AM3PR07CA0071.eurprd07.prod.outlook.com (2603:10a6:207:4::29) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f05cff7d-3fbd-4644-32a6-08da493174b4 X-MS-TrafficTypeDiagnostic: PH7PR13MB5575:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n2nZ0cUUbbm5IBxm7xDm7PCLAI7LGDCD575hs497gPauGvVwj+wXs6R636iFL49/5Ct3dGWTtW3jpk4GSobLLc3LNqvleFf+gCprnn/G+IUCQCG4JlR8pYgrlyUeR351/RMTLNofsVzrDus9Auv7wMKS6urmJVFslHsD++y/i7brgrgghZw0V65IH6oY+WV+/7yDnXEx7cyDYl9Uc2AHbueka8HOZ/8GVAzSbWcx2eEQGQspe1oTQy6qviKDMT364vrDIZJX9z7NU16f831ycYk0Zn9z3095BNhGWausiRaEewNycfZiHiY8lzuIdaOsRoPgq2tp37v+P35E7sC/reZjb/xR6SrbGOSM+jlU2a4QQr3JZFxO1YY4uGTKxy2L3omZatl8MBccjLHa6/sjGBk4lxL9looWFaIoXUGxI3yJYOeRktXzo/OMrvqWYYwmK2ZIYlwnq2rFenMnsCGyHF7TWRgbbh4WLAWrvmILICVT1WBtbHa7rn9fv+InWnKYT+Lwn6x2lVubA+JcQJbccNEUfAE4NJ+ABZxp6UVUgAWMTMIatgcY0o9QBMTD6YY7ckkdcj7PLLDrkfOEaqez4IQZfgo4eIh+hjH7lMc+bY+ieaZ4YEChnMIvSuGhYZjiTmcec42lGVX3vDj6mAQNu3hZ8HOzWXpj7nSW+8KN39I6Yf4/L/ix3tfuiYcHtEKD X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(346002)(396003)(136003)(366004)(39840400004)(41300700001)(1076003)(186003)(508600001)(8936002)(2906002)(54906003)(83380400001)(36756003)(6486002)(38100700002)(44832011)(86362001)(2616005)(316002)(110136005)(107886003)(5660300002)(6666004)(6506007)(4326008)(52116002)(8676002)(66556008)(66476007)(66946007)(6512007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: bAJ1ONONGEJE2CiTG88m9p2FsLkYZyPLI4bLzMbFlkjjnaWaRCuzkj7zDAt7tAj/aPNFx5O7YpE1ejTkRc4eomTMCEaKn1/NFNCbcE6/jjzu3nuF1V/4wD1GBu5rd5heSc8+/Bw8bOEEVTLjIryiY0WFK29rN2Z9zfS+PBjN/fqBhvhwSfJDTBRO2wiOFdvYoQQfTGdMNY4MxuORg9//O4orB6RoUJXUYncwac+B98ecGybiGzwRt0q7YsmDXHon76PEPJFNXJvHyTR7MyiETX+I7Af7mrNlFHdi0QJB3+niVkVvQVA+YdyyjZp4j//jaxE7iwAFTdD9wRyXiKmuLj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ZSJSSweiBamuBzEpM1X6zpX/Vwe6DNBc16EdKAeFDSa103a9e8V/P8gL4bpcpLu3fNlLyS4JMOf5nEq95ZUbQrsRjYUsyPp77xD6iWND44HxR2somGINJ8WMSAQyx/U/RYlVjkjREKZn9YJIMhgXowhHiDbR9S3IMmrZNVKsUJztlR5/j7mZ4fBjQd/U0GsUdo3huMOVyay8c27bQnolQFZClC3ENYe5GHqp36rtxdl7kO1m8T7+YbbwanXLA/EjHkLF1Dci8U90BrBg/U/i5s+eftFN1Fy0f9V6BoFETE5G3qTNpymlXLUS+YakyKFCStoWrq2C173t3a/wXAYbsRpL/OLjfAZyR2C8PLoxaG1uj2nrIghfdOqRYAYi7MMo X-MS-Exchange-AntiSpam-MessageData-1: cF30SwdS0geASl87m3wAZeJHS+Mr95KiBIk= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: f05cff7d-3fbd-4644-32a6-08da493174b4 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2022 09:29:58.7631 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1rwNMVcwHA4yfSJ7VdPxM8+Md+36nYYbCpg211CLDXyzI3Rfkt3GrBFDx+kBMgAVt53EhQizCbJeRTSuZN+mPAJeAIfywaktp/Dv/WSUxgA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB5575 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Etienne van der Linde Swap around the GRE and VLAN parts in the flow-key offloaded by the driver to fit in with other tunnel types and the firmware. Without this change used cases with GRE+VLAN on the outer header does not get offloaded as the flow-key mismatches what the firmware expect. Fixes: 0d630f58989a ("nfp: flower: add support to offload QinQ match") Fixes: 5a2b93041646 ("nfp: flower-ct: compile match sections of flow_payload") Signed-off-by: Etienne van der Linde Signed-off-by: Louis Peens Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- .../ethernet/netronome/nfp/flower/conntrack.c | 32 +++++++++---------- .../net/ethernet/netronome/nfp/flower/match.c | 16 +++++----- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/conntrack.c b/drivers/net/ethernet/netronome/nfp/flower/conntrack.c index 443a5d6eb57b..7c31a46195b2 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/conntrack.c +++ b/drivers/net/ethernet/netronome/nfp/flower/conntrack.c @@ -507,6 +507,11 @@ nfp_fl_calc_key_layers_sz(struct nfp_fl_key_ls in_key_ls, uint16_t *map) key_size += sizeof(struct nfp_flower_ipv6); } + if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_QINQ) { + map[FLOW_PAY_QINQ] = key_size; + key_size += sizeof(struct nfp_flower_vlan); + } + if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_GRE) { map[FLOW_PAY_GRE] = key_size; if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6) @@ -515,11 +520,6 @@ nfp_fl_calc_key_layers_sz(struct nfp_fl_key_ls in_key_ls, uint16_t *map) key_size += sizeof(struct nfp_flower_ipv4_gre_tun); } - if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_QINQ) { - map[FLOW_PAY_QINQ] = key_size; - key_size += sizeof(struct nfp_flower_vlan); - } - if ((in_key_ls.key_layer & NFP_FLOWER_LAYER_VXLAN) || (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_GENEVE)) { map[FLOW_PAY_UDP_TUN] = key_size; @@ -758,6 +758,17 @@ static int nfp_fl_ct_add_offload(struct nfp_fl_nft_tc_merge *m_entry) } } + if (NFP_FLOWER_LAYER2_QINQ & key_layer.key_layer_two) { + offset = key_map[FLOW_PAY_QINQ]; + key = kdata + offset; + msk = mdata + offset; + for (i = 0; i < _CT_TYPE_MAX; i++) { + nfp_flower_compile_vlan((struct nfp_flower_vlan *)key, + (struct nfp_flower_vlan *)msk, + rules[i]); + } + } + if (key_layer.key_layer_two & NFP_FLOWER_LAYER2_GRE) { offset = key_map[FLOW_PAY_GRE]; key = kdata + offset; @@ -798,17 +809,6 @@ static int nfp_fl_ct_add_offload(struct nfp_fl_nft_tc_merge *m_entry) } } - if (NFP_FLOWER_LAYER2_QINQ & key_layer.key_layer_two) { - offset = key_map[FLOW_PAY_QINQ]; - key = kdata + offset; - msk = mdata + offset; - for (i = 0; i < _CT_TYPE_MAX; i++) { - nfp_flower_compile_vlan((struct nfp_flower_vlan *)key, - (struct nfp_flower_vlan *)msk, - rules[i]); - } - } - if (key_layer.key_layer & NFP_FLOWER_LAYER_VXLAN || key_layer.key_layer_two & NFP_FLOWER_LAYER2_GENEVE) { offset = key_map[FLOW_PAY_UDP_TUN]; diff --git a/drivers/net/ethernet/netronome/nfp/flower/match.c b/drivers/net/ethernet/netronome/nfp/flower/match.c index 193a167a6762..e01430139b6d 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/match.c +++ b/drivers/net/ethernet/netronome/nfp/flower/match.c @@ -625,6 +625,14 @@ int nfp_flower_compile_flow_match(struct nfp_app *app, msk += sizeof(struct nfp_flower_ipv6); } + if (NFP_FLOWER_LAYER2_QINQ & key_ls->key_layer_two) { + nfp_flower_compile_vlan((struct nfp_flower_vlan *)ext, + (struct nfp_flower_vlan *)msk, + rule); + ext += sizeof(struct nfp_flower_vlan); + msk += sizeof(struct nfp_flower_vlan); + } + if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_GRE) { if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6) { struct nfp_flower_ipv6_gre_tun *gre_match; @@ -660,14 +668,6 @@ int nfp_flower_compile_flow_match(struct nfp_app *app, } } - if (NFP_FLOWER_LAYER2_QINQ & key_ls->key_layer_two) { - nfp_flower_compile_vlan((struct nfp_flower_vlan *)ext, - (struct nfp_flower_vlan *)msk, - rule); - ext += sizeof(struct nfp_flower_vlan); - msk += sizeof(struct nfp_flower_vlan); - } - if (key_ls->key_layer & NFP_FLOWER_LAYER_VXLAN || key_ls->key_layer_two & NFP_FLOWER_LAYER2_GENEVE) { if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6) {