From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 22C64A0577; Tue, 14 Apr 2020 10:32:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A9B871C238; Tue, 14 Apr 2020 10:32:02 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 91ECF1C1B1 for ; Tue, 14 Apr 2020 10:32:00 +0200 (CEST) IronPort-SDR: ynnvB9Vlneg6CzPPATvUQ2ZCTcnJ6i04iBJco53hSoxKscmo/2uNPQBCz/eZ0aVOuij6h5LyKz xlJ5JFGF1x9Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2020 01:31:59 -0700 IronPort-SDR: 0NQRzLvYkjkLPAmcUq7sXnnI0mSb573TWstvw3B+QX7hdsGAmLyiilv/zkia2kFQ3U6xm8GqAn D5n7/08+Udsw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,382,1580803200"; d="scan'208";a="454492993" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by fmsmga006.fm.intel.com with ESMTP; 14 Apr 2020 01:31:59 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 14 Apr 2020 01:31:58 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.177) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 14 Apr 2020 01:31:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fxf8y+7tFgYDuRWuZpg6iMRdpN4xjNIxSgeQR902x2COMi0p7FNIU9csDZj6ircRjfuv0GCjVoygyczmjjmxMDKXDxnCS++a36uhgxJUqnoKKR83OdTpvUds0gsHgSLKwVrgE9ppDBCJJCZ5E8x+Q+et+0hI9aGBVLbXrBzJRLHBvHorZhTRqsCMpOkovJm+9gy9wrM/eTE623ze1Vj5mnOBM+lvXC/HZyZ8fJyFBCHVX8aldeJmVoLcGf93c3moVnuuYFz+QZSi4v+tgQNg/Q1BLx75CZMSP+oYA+0i/2KeZrxE2Skq3PimxdiSTypN82Qzjt9WWP8VBliyNYAyjw== 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-SenderADCheck; bh=ZjZJ+IsB/YX/xpildLzjHihFnJE3zyDE72oSXARafmc=; b=f5t3/uqmB3iYkBHHIHGgLmwfUcGGRVLBUHGKvFxJdMGk165qkhrk19NwrvNg9VrxlrLMRB/JzgReBII/xcWY5v88/rbDuPMuFNV4ZkTo9n2f6e/YWyY+fomfYC3YRJvlMVTYEyYhwuoAirRNYWDQYpGNNCIHfWB4I3Rcz2vRgmVQQS0xRJ2Mc8S5TxXmnNT9NMAk/8p8CpqB5GE/MdPx+ulbPDCjhGe5ACae4S1oBcJk9BxSDi+3joR5mdhBZRDFObxiNj4YzryA4KmPuCYwT+5Q8UXuv62svgy4M34/jPf3Gd49b/wy5bZRABFaFy7cFtvGJ4f98pITUbLxBmTYdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZjZJ+IsB/YX/xpildLzjHihFnJE3zyDE72oSXARafmc=; b=iKBoYeOCFqvl30V7AkfE0ybeUOBSuqBbL3SM+quWn9NtBneNLF66541SnXl8yjdzt0JUL4lfXb5iSziUCS9h+BX68X7mA1fQT5MxynaEEeGGqFs5WLwAf+N7o97Mzz3713HsXoaMSLDud26OYphi06Qg/YfyClOtE0a6++znfEQ= Received: from BL0PR11MB3380.namprd11.prod.outlook.com (2603:10b6:208:69::12) by BL0PR11MB3106.namprd11.prod.outlook.com (2603:10b6:208:7a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.26; Tue, 14 Apr 2020 08:31:55 +0000 Received: from BL0PR11MB3380.namprd11.prod.outlook.com ([fe80::2c08:5b44:ebfd:6ea6]) by BL0PR11MB3380.namprd11.prod.outlook.com ([fe80::2c08:5b44:ebfd:6ea6%6]) with mapi id 15.20.2900.028; Tue, 14 Apr 2020 08:31:55 +0000 From: "Su, Simei" To: "Ye, Xiaolong" CC: "Zhang, Qi Z" , "Wu, Jingjing" , "dev@dpdk.org" , "Cao, Yahui" Thread-Topic: [PATCH v3 1/5] net/iavf: add support for FDIR basic rule Thread-Index: AQHWDyHY6oVC16hR7U+uaiWwOzBbVKh4QNaAgAAKxNA= Date: Tue, 14 Apr 2020 08:31:55 +0000 Message-ID: References: <1585834375-157346-1-git-send-email-simei.su@intel.com> <1586513905-437173-1-git-send-email-simei.su@intel.com> <1586513905-437173-2-git-send-email-simei.su@intel.com> <20200414073729.GA27150@intel.com> In-Reply-To: <20200414073729.GA27150@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.2.0.6 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: spf=none (sender IP is ) smtp.mailfrom=simei.su@intel.com; x-originating-ip: [192.102.204.45] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e5161b5d-07a2-44bf-273e-08d7e04e4a71 x-ms-traffictypediagnostic: BL0PR11MB3106: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 0373D94D15 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL0PR11MB3380.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10019020)(366004)(136003)(39860400002)(376002)(346002)(396003)(76116006)(9686003)(55016002)(66476007)(54906003)(316002)(7696005)(6506007)(2906002)(5660300002)(478600001)(6636002)(107886003)(53546011)(4326008)(8936002)(81156014)(186003)(71200400001)(8676002)(66946007)(52536014)(26005)(86362001)(66446008)(66556008)(6862004)(64756008)(33656002); DIR:OUT; SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /1bC9IX6qYEeQpuMyxOsvIRvDjJpMzLyW2wwXrq3wlzlm8JaETZjSL0j77G0DfYsrqIzv6Z91o6U68yma5BMyP5SU4QYzvUwNewXeonHVhoLyNCkcM9J9jjAadGcYJsv08M1ztVnto3OKOdjWeW2hkeQ2op4Xgvu79waLEGXeH98xtYbJdrRTHQkOBHHgGFEdIt5razhADf2Td/9iAzMhUSJvKjoq1e/Z44DBR1aDm1zVhTOHMeMfXMEFbNIILjMdv3P01w5P/SRRIlZF1gHprGETDyk0uKTdt/JN/aeFVsec0QFI6paifuT2F6ahqaBf/ssAugGT+zy26vnofSVfRyULo766eyLgZDWNsHEdHTBu+PozY5QLPCli8iBLRQUcA4gDjjmPIEvsAn9B/Z8ci7VvriUP8Mm1ntU7dCSOdyLo5GcB3wqBjSv+klNroQi x-ms-exchange-antispam-messagedata: eLScYFwjjkjTVNKffbM3bbF8A9nOpDOh6Fe930iSbi7nbYNgEtomxOCI8YRGhqaiZzUcieAhqBXnBhrDpnS4SQW8YwEPfUCYr6dHEFtSUgr25we2TKY9Oaet6pfPwY3G2jtf5dlL9769+6AXPczIiA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: e5161b5d-07a2-44bf-273e-08d7e04e4a71 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Apr 2020 08:31:55.4526 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: kdcMMGJ4GHC6Jyk47SLw+5VqUXrtQ6fiGcyIYWkK0kWr6xv/y7JqRL6Ndt7v1kowqEUWw0cHl9S02H9Ph5CR+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR11MB3106 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3 1/5] net/iavf: add support for FDIR basic rule X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, Xiaolong > -----Original Message----- > From: Ye, Xiaolong > Sent: Tuesday, April 14, 2020 3:37 PM > To: Su, Simei > Cc: Zhang, Qi Z ; Wu, Jingjing ; > dev@dpdk.org; Cao, Yahui > Subject: Re: [PATCH v3 1/5] net/iavf: add support for FDIR basic rule >=20 > On 04/10, Simei Su wrote: > >This patch adds FDIR create/destroy/validate function in AVF. > >Common pattern and queue/qgroup/passthru/drop actions are supported. > > > >Signed-off-by: Simei Su > >--- > > doc/guides/rel_notes/release_20_05.rst | 1 + > > drivers/net/iavf/Makefile | 1 + > > drivers/net/iavf/iavf.h | 17 + > > drivers/net/iavf/iavf_fdir.c | 749 > +++++++++++++++++++++++++++++++++ > > drivers/net/iavf/iavf_vchnl.c | 154 ++++++- > > drivers/net/iavf/meson.build | 1 + > > 6 files changed, 922 insertions(+), 1 deletion(-) create mode 100644 > >drivers/net/iavf/iavf_fdir.c > > > >diff --git a/doc/guides/rel_notes/release_20_05.rst > >b/doc/guides/rel_notes/release_20_05.rst > >index b5962d8..17299ef 100644 > >--- a/doc/guides/rel_notes/release_20_05.rst > >+++ b/doc/guides/rel_notes/release_20_05.rst > >@@ -99,6 +99,7 @@ New Features > > > > * Added generic filter support. > > * Added advanced RSS configuration for VFs. > >+ * Added advanced iavf with FDIR capability. > > > > > > Removed Items > >diff --git a/drivers/net/iavf/Makefile b/drivers/net/iavf/Makefile > >index 7b0093a..b2b75d7 100644 > >--- a/drivers/net/iavf/Makefile > >+++ b/drivers/net/iavf/Makefile > >@@ -25,6 +25,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) +=3D > iavf_vchnl.c > > SRCS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) +=3D iavf_rxtx.c > > SRCS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) +=3D iavf_generic_flow.c > > SRCS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) +=3D iavf_hash.c > >+SRCS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) +=3D iavf_fdir.c > > ifeq ($(CONFIG_RTE_ARCH_X86), y) > > SRCS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) +=3D iavf_rxtx_vec_sse.c endif > diff > >--git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index > >d813296..2f84a1f 100644 > >--- a/drivers/net/iavf/iavf.h > >+++ b/drivers/net/iavf/iavf.h > >@@ -92,6 +92,17 @@ struct iavf_vsi { > > struct iavf_flow_parser_node; > > TAILQ_HEAD(iavf_parser_list, iavf_flow_parser_node); > > > >+struct iavf_fdir_conf { > >+ struct virtchnl_fdir_add add_fltr; > >+ struct virtchnl_fdir_del del_fltr; > >+ uint64_t input_set; > >+ uint32_t flow_id; > >+}; > >+ > >+struct iavf_fdir_info { > >+ struct iavf_fdir_conf conf; > >+}; >=20 > Why we need struct iavf_fdir_info since it has only one member? In 20.05, it doesn't support flow director query counter. It will support= query counter feature later, Which may need related counter config. So I write it in this form in case o= ther configuration will be added in the future. >=20 > >+ > > /* TODO: is that correct to assume the max number to be 16 ?*/ > > #define IAVF_MAX_MSIX_VECTORS 16 > > > >@@ -131,6 +142,8 @@ struct iavf_info { > > rte_spinlock_t flow_ops_lock; > > struct iavf_parser_list rss_parser_list; > > struct iavf_parser_list dist_parser_list; > >+ > >+ struct iavf_fdir_info fdir; /* flow director info */ > > }; > > > > #define IAVF_MAX_PKT_TYPE 1024 > >@@ -254,4 +267,8 @@ int iavf_add_del_eth_addr(struct iavf_adapter > >*adapter, int iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t > >vlanid, bool add); int iavf_add_del_rss_cfg(struct iavf_adapter *adapte= r, > > struct virtchnl_rss_cfg *rss_cfg, bool add); > >+int iavf_fdir_add(struct iavf_adapter *adapter, struct iavf_fdir_conf > >+*filter); int iavf_fdir_del(struct iavf_adapter *adapter, struct > >+iavf_fdir_conf *filter); int iavf_fdir_check(struct iavf_adapter *adapt= er, > >+ struct iavf_fdir_conf *filter); > > #endif /* _IAVF_ETHDEV_H_ */ > >diff --git a/drivers/net/iavf/iavf_fdir.c > >b/drivers/net/iavf/iavf_fdir.c new file mode 100644 index > >0000000..f2b10d7 > >--- /dev/null > >+++ b/drivers/net/iavf/iavf_fdir.c > >@@ -0,0 +1,749 @@ > >+/* SPDX-License-Identifier: BSD-3-Clause > >+ * Copyright(c) 2019 Intel Corporation >=20 > Should be 2020. Yes, wrote it wrong. >=20 > >+ */ > >+ > >+#include > >+#include > >+#include > >+#include > >+#include > >+#include > >+#include > >+ > >+#include > >+#include > >+#include > >+#include > >+ > >+#include "iavf.h" > >+#include "iavf_generic_flow.h" > >+#include "virtchnl.h" > >+ > >+#define IAVF_FDIR_MAX_QREGION_SIZE 128 > >+ > >+#define IAVF_FDIR_IPV6_TC_OFFSET 20 > >+#define IAVF_IPV6_TC_MASK (0xFF << IAVF_FDIR_IPV6_TC_OFFSET) > >+ > >+#define IAVF_FDIR_INSET_ETH (\ > >+ IAVF_INSET_ETHERTYPE) > >+ > >+#define IAVF_FDIR_INSET_ETH_IPV4 (\ > >+ IAVF_INSET_IPV4_SRC | IAVF_INSET_IPV4_DST | \ > >+ IAVF_INSET_IPV4_PROTO | IAVF_INSET_IPV4_TOS | \ > >+ IAVF_INSET_IPV4_TTL) > >+ > >+#define IAVF_FDIR_INSET_ETH_IPV4_UDP (\ > >+ IAVF_INSET_IPV4_SRC | IAVF_INSET_IPV4_DST | \ > >+ IAVF_INSET_IPV4_TOS | IAVF_INSET_IPV4_TTL | \ > >+ IAVF_INSET_UDP_SRC_PORT | IAVF_INSET_UDP_DST_PORT) > >+ > >+#define IAVF_FDIR_INSET_ETH_IPV4_TCP (\ > >+ IAVF_INSET_IPV4_SRC | IAVF_INSET_IPV4_DST | \ > >+ IAVF_INSET_IPV4_TOS | IAVF_INSET_IPV4_TTL | \ > >+ IAVF_INSET_TCP_SRC_PORT | IAVF_INSET_TCP_DST_PORT) > >+ > >+#define IAVF_FDIR_INSET_ETH_IPV4_SCTP (\ > >+ IAVF_INSET_IPV4_SRC | IAVF_INSET_IPV4_DST | \ > >+ IAVF_INSET_IPV4_TOS | IAVF_INSET_IPV4_TTL | \ > >+ IAVF_INSET_SCTP_SRC_PORT | IAVF_INSET_SCTP_DST_PORT) > >+ > >+#define IAVF_FDIR_INSET_ETH_IPV6 (\ > >+ IAVF_INSET_IPV6_SRC | IAVF_INSET_IPV6_DST | \ > >+ IAVF_INSET_IPV6_NEXT_HDR | IAVF_INSET_IPV6_TC | \ > >+ IAVF_INSET_IPV6_HOP_LIMIT) > >+ > >+#define IAVF_FDIR_INSET_ETH_IPV6_UDP (\ > >+ IAVF_INSET_IPV6_SRC | IAVF_INSET_IPV6_DST | \ > >+ IAVF_INSET_IPV6_TC | IAVF_INSET_IPV6_HOP_LIMIT | \ > >+ IAVF_INSET_UDP_SRC_PORT | IAVF_INSET_UDP_DST_PORT) > >+ > >+#define IAVF_FDIR_INSET_ETH_IPV6_TCP (\ > >+ IAVF_INSET_IPV6_SRC | IAVF_INSET_IPV6_DST | \ > >+ IAVF_INSET_IPV6_TC | IAVF_INSET_IPV6_HOP_LIMIT | \ > >+ IAVF_INSET_TCP_SRC_PORT | IAVF_INSET_TCP_DST_PORT) > >+ > >+#define IAVF_FDIR_INSET_ETH_IPV6_SCTP (\ > >+ IAVF_INSET_IPV6_SRC | IAVF_INSET_IPV6_DST | \ > >+ IAVF_INSET_IPV6_TC | IAVF_INSET_IPV6_HOP_LIMIT | \ > >+ IAVF_INSET_SCTP_SRC_PORT | IAVF_INSET_SCTP_DST_PORT) > >+ > >+static struct iavf_pattern_match_item iavf_fdir_pattern[] =3D { > >+ {iavf_pattern_ethertype, IAVF_FDIR_INSET_ETH, > IAVF_INSET_NONE}, > >+ {iavf_pattern_eth_ipv4, IAVF_FDIR_INSET_ETH_IPV4, > IAVF_INSET_NONE}, > >+ {iavf_pattern_eth_ipv4_udp, IAVF_FDIR_INSET_ETH_IPV4_UDP, > IAVF_INSET_NONE}, > >+ {iavf_pattern_eth_ipv4_tcp, IAVF_FDIR_INSET_ETH_IPV4_TCP, > IAVF_INSET_NONE}, > >+ {iavf_pattern_eth_ipv4_sctp, IAVF_FDIR_INSET_ETH_IPV4_SCTP, > IAVF_INSET_NONE}, > >+ {iavf_pattern_eth_ipv6, IAVF_FDIR_INSET_ETH_IPV6, > IAVF_INSET_NONE}, > >+ {iavf_pattern_eth_ipv6_udp, IAVF_FDIR_INSET_ETH_IPV6_UDP, > IAVF_INSET_NONE}, > >+ {iavf_pattern_eth_ipv6_tcp, IAVF_FDIR_INSET_ETH_IPV6_TCP, > IAVF_INSET_NONE}, > >+ {iavf_pattern_eth_ipv6_sctp, IAVF_FDIR_INSET_ETH_IPV6_SCTP, > IAVF_INSET_NONE}, > >+}; > >+ > >+static struct iavf_flow_parser iavf_fdir_parser; > >+ > >+static int > >+iavf_fdir_init(struct iavf_adapter *ad) { > >+ struct iavf_info *vf =3D IAVF_DEV_PRIVATE_TO_VF(ad); > >+ struct iavf_flow_parser *parser; > >+ > >+ if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_FDIR_PF) >=20 > Need to check whether vf->vf_res is NULL, otherwise it may cause segfault= . >=20 Ok, I will think it over. > >+ parser =3D &iavf_fdir_parser; > >+ else > >+ return -ENOTSUP; > >+ > >+ return iavf_register_parser(parser, ad); } > >+ > >+static void > >+iavf_fdir_uninit(struct iavf_adapter *ad) { > >+ struct iavf_flow_parser *parser; > >+ > >+ parser =3D &iavf_fdir_parser; > >+ > >+ iavf_unregister_parser(parser, ad); >=20 > Simplify to iavf_unregister_parser(&iavf_fdir_parser, ad) ? Ok, will simplify it. >=20 > >+} > >+ > >+static int > >+iavf_fdir_create(struct iavf_adapter *ad, > >+ struct rte_flow *flow, > >+ void *meta, > >+ struct rte_flow_error *error) > >+{ > >+ struct iavf_fdir_conf *filter =3D meta; > >+ struct iavf_fdir_conf *rule; > >+ int ret; > >+ > >+ rule =3D rte_zmalloc("fdir_entry", sizeof(*rule), 0); > >+ if (!rule) { > >+ rte_flow_error_set(error, ENOMEM, > >+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL, > >+ "Failed to allocate memory"); >=20 > Better to be more specific, like "Failed to allocate memory for fdir rule= ." Ok, it makes sense. >=20 > >+ return -rte_errno; > >+ } > >+ > >+ ret =3D iavf_fdir_add(ad, filter); > >+ if (ret) { > >+ rte_flow_error_set(error, -ret, > >+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL, > >+ "Add filter rule failed."); >=20 > What about "Failed to add filter rule" to make it consistent with other e= rror > log. > And same for other error logs below. Ok, I will modify it. Thanks. >=20 >=20 > Thanks, > Xiaolong Br Simei