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 5BB74A0573; Thu, 5 Mar 2020 11:48:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 960781BFE8; Thu, 5 Mar 2020 11:48:07 +0100 (CET) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 89D231BFD2 for ; Thu, 5 Mar 2020 11:48:06 +0100 (CET) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us4.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 00D4B800061 for ; Thu, 5 Mar 2020 10:48:05 +0000 (UTC) Received: from ukex01.SolarFlarecom.com (10.17.10.4) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 5 Mar 2020 10:48:01 +0000 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 5 Mar 2020 10:48:01 +0000 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 025Am1Go016213; Thu, 5 Mar 2020 10:48:01 GMT Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 2E77D161250; Thu, 5 Mar 2020 10:48:01 +0000 (GMT) From: Andrew Rybchenko To: CC: Ivan Malov Date: Thu, 5 Mar 2020 10:47:48 +0000 Message-ID: <1583405273-14176-3-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1583405273-14176-1-git-send-email-arybchenko@solarflare.com> References: <1583405273-14176-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1020-25270.003 X-TM-AS-Result: No-1.002900-8.000000-10 X-TMASE-MatchedRID: n9Ytw+RbsR/Gjl9nQey1Pm6HurDH4PpPx+jrF7TzRS38kFwgcyoo4bNt CD9U3Mz48XVI39JCRnRuL3ESIrARlyHhSBQfglfsA9lly13c/gGVKmGUZ/WnkajxqhyDxmYjUl0 3SIY6fe2Vl9mvMBSGfXLhQ+KR1I64SVQuRHVrNTEwjFu8zcBWiJwE50C6MzyI2An5g1C6+/Iyto nrvDOcsekhITXmkqbo6lMHeJW+THIfE8yM4pjsDwtuKBGekqUpnH7sbImOEBTYN+BAdeePDZpdo xoJPYDm5k6cpT6O/57fsbm0LqghAwGkTEV1U9JzxNGw6mRa/HCPyI6zPVPl+mD4Ge3a8QYfegXI pu27p2DkA8OrYHdwDGfYlY/yoV/0Up6EHOb2+c7kHZDO53QSwmA7bUFBqh2V X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.002900-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1020-25270.003 X-MDID: 1583405285-0e2KL7MN8PB7 Subject: [dpdk-dev] [PATCH 2/7] net/sfc: make the flow list engine-agnostic 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" From: Ivan Malov A backend which a driver employs to handle flow rules of a given type depends on the underlying NIC flow engine. The driver in question in its current state is tailored to support the only flow engine, VNIC filtering. As the need arises to add support for transfer rules, the driver has to be reworked so that it becomes possible to introduce yet another backend. As a preparation step, make the flow list shared between different engines. Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc.h | 2 ++ drivers/net/sfc/sfc_filter.h | 2 -- drivers/net/sfc/sfc_flow.c | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index cc5222877..2520cf2b7 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -242,6 +242,8 @@ struct sfc_adapter { struct sfc_port port; struct sfc_filter filter; + struct sfc_flow_list flow_list; + unsigned int rxq_max; unsigned int txq_max; diff --git a/drivers/net/sfc/sfc_filter.h b/drivers/net/sfc/sfc_filter.h index 64ab114e0..6a0254813 100644 --- a/drivers/net/sfc/sfc_filter.h +++ b/drivers/net/sfc/sfc_filter.h @@ -23,8 +23,6 @@ struct sfc_filter { size_t supported_match_num; /** Driver cache of supported filter match masks */ uint32_t *supported_match; - /** List of flow rules */ - struct sfc_flow_list flow_list; /** * Supports any of ip_proto, remote host or local host * filters. This flag is used for filter match exceptions diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index f285ba552..0826032e0 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -2317,7 +2317,7 @@ sfc_flow_create(struct rte_eth_dev *dev, sfc_adapter_lock(sa); - TAILQ_INSERT_TAIL(&sa->filter.flow_list, flow, entries); + TAILQ_INSERT_TAIL(&sa->flow_list, flow, entries); if (sa->state == SFC_ADAPTER_STARTED) { rc = sfc_flow_filter_insert(sa, flow); @@ -2334,7 +2334,7 @@ sfc_flow_create(struct rte_eth_dev *dev, return flow; fail_filter_insert: - TAILQ_REMOVE(&sa->filter.flow_list, flow, entries); + TAILQ_REMOVE(&sa->flow_list, flow, entries); fail_bad_value: rte_free(flow); @@ -2361,7 +2361,7 @@ sfc_flow_remove(struct sfc_adapter *sa, "Failed to destroy flow rule"); } - TAILQ_REMOVE(&sa->filter.flow_list, flow, entries); + TAILQ_REMOVE(&sa->flow_list, flow, entries); rte_free(flow); return rc; @@ -2378,7 +2378,7 @@ sfc_flow_destroy(struct rte_eth_dev *dev, sfc_adapter_lock(sa); - TAILQ_FOREACH(flow_ptr, &sa->filter.flow_list, entries) { + TAILQ_FOREACH(flow_ptr, &sa->flow_list, entries) { if (flow_ptr == flow) rc = 0; } @@ -2408,7 +2408,7 @@ sfc_flow_flush(struct rte_eth_dev *dev, sfc_adapter_lock(sa); - while ((flow = TAILQ_FIRST(&sa->filter.flow_list)) != NULL) { + while ((flow = TAILQ_FIRST(&sa->flow_list)) != NULL) { rc = sfc_flow_remove(sa, flow, error); if (rc != 0) ret = rc; @@ -2454,7 +2454,7 @@ sfc_flow_init(struct sfc_adapter *sa) { SFC_ASSERT(sfc_adapter_is_locked(sa)); - TAILQ_INIT(&sa->filter.flow_list); + TAILQ_INIT(&sa->flow_list); } void @@ -2464,8 +2464,8 @@ sfc_flow_fini(struct sfc_adapter *sa) SFC_ASSERT(sfc_adapter_is_locked(sa)); - while ((flow = TAILQ_FIRST(&sa->filter.flow_list)) != NULL) { - TAILQ_REMOVE(&sa->filter.flow_list, flow, entries); + while ((flow = TAILQ_FIRST(&sa->flow_list)) != NULL) { + TAILQ_REMOVE(&sa->flow_list, flow, entries); rte_free(flow); } } @@ -2477,7 +2477,7 @@ sfc_flow_stop(struct sfc_adapter *sa) SFC_ASSERT(sfc_adapter_is_locked(sa)); - TAILQ_FOREACH(flow, &sa->filter.flow_list, entries) + TAILQ_FOREACH(flow, &sa->flow_list, entries) sfc_flow_filter_remove(sa, flow); } @@ -2491,7 +2491,7 @@ sfc_flow_start(struct sfc_adapter *sa) SFC_ASSERT(sfc_adapter_is_locked(sa)); - TAILQ_FOREACH(flow, &sa->filter.flow_list, entries) { + TAILQ_FOREACH(flow, &sa->flow_list, entries) { rc = sfc_flow_filter_insert(sa, flow); if (rc != 0) goto fail_bad_flow; -- 2.17.1