Skip to contentSkip to conversation

net/enic: a couple new features

PATCH In review Hyong Youb Kim 2 participants 4 messages Sep 23, 2019 – Oct 10, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover net/enic: a couple new features

The first patch enables Geneve offload that supports Geneve header options. Previous Geneve offload does not work when options are present.

The second patch adds the new flow implementation based on Flow Manager. So the driver now has two implementations: one based on the old filter API, and this new one based on Flow Manager. Flow Manager is newer firmware interface with more actions and match items than the filter API. enic_fm_flow.c is quite large but self contained. We tried to break it up into multiple patches, but it did not really make sense in the end. So sending the whole file in one patch.

checkpatches complains about these errors. We checked and found it safe to ignore them (false positives).

CHECK:CAMELCASE: Avoid CamelCase: <PRIx64>
ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses

Thanks.
-Hyong

v2: add FMOP_NOP to the flowman header, which was missing in v1

Hyong Youb Kim (2):
net/enic: enable Geneve with options offload net/enic: add flow implementation based on Flow Manager API

 doc/guides/nics/enic.rst               |   21 +
 doc/guides/rel_notes/release_19_11.rst |    5 +
 drivers/net/enic/Makefile              |    1 +
 drivers/net/enic/base/vnic_dev.c       |   90 +-
 drivers/net/enic/base/vnic_dev.h       |    2 +
 drivers/net/enic/base/vnic_devcmd.h    |   19 +
 drivers/net/enic/base/vnic_flowman.h   |  365 ++++
 drivers/net/enic/enic.h                |   24 +-
 drivers/net/enic/enic_ethdev.c         |   25 +-
 drivers/net/enic/enic_fm_flow.c        | 2459 ++++++++++++++++++++++++
 drivers/net/enic/enic_main.c           |   30 +-
 drivers/net/enic/enic_res.c            |   13 +-
 drivers/net/enic/meson.build           |    1 +
 13 files changed, 3047 insertions(+), 8 deletions(-)
 create mode 100644 drivers/net/enic/base/vnic_flowman.h
 create mode 100644 drivers/net/enic/enic_fm_flow.c
Signature · 1 line
2.22.0
#1 lore raw

PATCH v2 1/2 net/enic: enable Geneve with options offload

Latest firmware supports Geneve with options offload. Current overlay offload only supports Geneve with no options. This new feature is disabled by default, as it is intrusive and cannot be used with flow API. Add a new devarg 'geneve-opt' so the user can explicitly enable it.

---
 doc/guides/nics/enic.rst               | 12 ++++++++++++
 doc/guides/rel_notes/release_19_11.rst |  4 ++++
 drivers/net/enic/base/vnic_dev.c       | 11 +++++++++++
 drivers/net/enic/base/vnic_dev.h       |  1 +
 drivers/net/enic/base/vnic_devcmd.h    |  7 +++++++
 drivers/net/enic/enic.h                |  3 +++
 drivers/net/enic/enic_ethdev.c         | 15 +++++++++++++++
 drivers/net/enic/enic_main.c           | 22 ++++++++++++++++++++++
 drivers/net/enic/enic_res.c            |  4 ++++
 9 files changed, 79 insertions(+)
doc/guides/nics/enic.rst +12 -0
index 5681bdb54..2384cb5b8 100644
@@ -322,6 +322,18 @@ it through ``rte_eth_dev_udp_tunnel_port_{add,delete}``. However, as
 the current NIC has a single VXLAN port number, the user cannot
 configure multiple port numbers.
 
+Geneve headers with non-zero options are not supported by default. To
+use Geneve with options, update the VIC firmware to the latest version
+and then set ``devargs`` parameter ``geneve-opt=1``. When Geneve with
+options is enabled, flow API cannot be used as the features are
+currently mutually exclusive. When this feature is successfully
+enabled, PMD prints the following message.
+
+.. code-block:: console
+
+    Geneve with options is enabled
+
+
 Ingress VLAN Rewrite
 --------------------
 
doc/guides/rel_notes/release_19_11.rst +4 -0
index 8490d897c..afe71f8fa 100644
@@ -56,6 +56,10 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated the enic driver.**
+
+  * Added support for Geneve with options offload.
+
 
 Removed Items
 -------------
drivers/net/enic/base/vnic_dev.c +11 -0
index 8e190687d..807d4096f 100644
@@ -1120,3 +1120,14 @@ int vnic_dev_capable_vxlan(struct vnic_dev *vdev)
 		(a1 & (FEATURE_VXLAN_IPV6 | FEATURE_VXLAN_MULTI_WQ)) ==
 		(FEATURE_VXLAN_IPV6 | FEATURE_VXLAN_MULTI_WQ);
 }
+
+int vnic_dev_capable_geneve(struct vnic_dev *vdev)
+{
+	u64 a0 = VIC_FEATURE_GENEVE;
+	u64 a1 = 0;
+	int wait = 1000;
+	int ret;
+
+	ret = vnic_dev_cmd(vdev, CMD_GET_SUPP_FEATURE_VER, &a0, &a1, wait);
+	return ret == 0 && (a1 & FEATURE_GENEVE_OPTIONS);
+}
drivers/net/enic/base/vnic_dev.h +1 -0
index 270a47bd2..8a1363486 100644
@@ -187,4 +187,5 @@ int vnic_dev_overlay_offload_ctrl(struct vnic_dev *vdev,
 int vnic_dev_overlay_offload_cfg(struct vnic_dev *vdev, u8 overlay,
 	u16 vxlan_udp_port_number);
 int vnic_dev_capable_vxlan(struct vnic_dev *vdev);
+int vnic_dev_capable_geneve(struct vnic_dev *vdev);
 #endif /* _VNIC_DEV_H_ */
drivers/net/enic/base/vnic_devcmd.h +7 -0
index fffe307e0..da60be7b0 100644
@@ -537,6 +537,7 @@ enum vnic_devcmd_cmd {
 	 * Control (Enable/Disable) overlay offloads on the given vnic
 	 * in: (u8) a0 = OVERLAY_FEATURE_NVGRE : NVGRE
 	 *          a0 = OVERLAY_FEATURE_VXLAN : VxLAN
+	 *          a0 = OVERLAY_FEATURE_GENEVE : Geneve
 	 * in: (u8) a1 = OVERLAY_OFFLOAD_ENABLE : Enable or
 	 *          a1 = OVERLAY_OFFLOAD_DISABLE : Disable or
 	 *          a1 = OVERLAY_OFFLOAD_ENABLE_V2 : Enable with version 2
@@ -547,6 +548,7 @@ enum vnic_devcmd_cmd {
 	/*
 	 * Configuration of overlay offloads feature on a given vNIC
 	 * in: (u8) a0 = OVERLAY_CFG_VXLAN_PORT_UPDATE : VxLAN
+	 *               OVERLAY_CFG_GENEVE_PORT_UPDATE : Geneve
 	 * in: (u16) a1 = unsigned short int port information
 	 */
 	CMD_OVERLAY_OFFLOAD_CFG = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 73),
@@ -1081,6 +1083,7 @@ struct devcmd2_result {
 typedef enum {
 	OVERLAY_FEATURE_NVGRE = 1,
 	OVERLAY_FEATURE_VXLAN,
+	OVERLAY_FEATURE_GENEVE,
 	OVERLAY_FEATURE_MAX,
 } overlay_feature_t;
 
@@ -1089,6 +1092,7 @@ typedef enum {
 #define OVERLAY_OFFLOAD_ENABLE_V2       2
 
 #define OVERLAY_CFG_VXLAN_PORT_UPDATE 0
+#define OVERLAY_CFG_GENEVE_PORT_UPDATE 1
 
 /*
  * Use this enum to get the supported versions for each of these features
@@ -1098,6 +1102,7 @@ typedef enum {
 typedef enum {
 	VIC_FEATURE_VXLAN,
 	VIC_FEATURE_RDMA,
+	VIC_FEATURE_GENEVE,
 	VIC_FEATURE_MAX,
 } vic_feature_t;
 
@@ -1112,6 +1117,8 @@ typedef enum {
 
 #define FEATURE_VXLAN_IPV6		(FEATURE_VXLAN_IPV6_INNER | \
 					 FEATURE_VXLAN_IPV6_OUTER)
+/* Support Geneve option bytes */
+#define FEATURE_GENEVE_OPTIONS		(1 << 0)
 
 /*
  * CMD_CONFIG_GRPINTR subcommands
drivers/net/enic/enic.h +3 -0
index 5a92508f0..87792deec 100644
@@ -130,6 +130,9 @@ struct enic {
 	bool vxlan;
 	bool disable_overlay; /* devargs disable_overlay=1 */
 	uint8_t enable_avx2_rx;  /* devargs enable-avx2-rx=1 */
+	uint8_t geneve_opt_avail;    /* Geneve with options offload available */
+	uint8_t geneve_opt_enabled;  /* Geneve with options offload enabled */
+	uint8_t geneve_opt_request;  /* devargs geneve-opt=1 */
 	bool nic_cfg_chk;     /* NIC_CFG_CHK available */
 	bool udp_rss_weak;    /* Bodega style UDP RSS */
 	uint8_t ig_vlan_rewrite_mode; /* devargs ig-vlan-rewrite */
drivers/net/enic/enic_ethdev.c +15 -0
index 06dc67122..e1c6da3b3 100644
@@ -67,6 +67,7 @@ static const struct vic_speed_capa {
 
 #define ENIC_DEVARG_DISABLE_OVERLAY "disable-overlay"
 #define ENIC_DEVARG_ENABLE_AVX2_RX "enable-avx2-rx"
+#define ENIC_DEVARG_GENEVE_OPT "geneve-opt"
 #define ENIC_DEVARG_IG_VLAN_REWRITE "ig-vlan-rewrite"
 
 RTE_INIT(enicpmd_init_log)
@@ -127,10 +128,17 @@ enicpmd_dev_filter_ctrl(struct rte_eth_dev *dev,
 		     enum rte_filter_op filter_op,
 		     void *arg)
 {
+	struct enic *enic = pmd_priv(dev);
 	int ret = 0;
 
 	ENICPMD_FUNC_TRACE();
 
+	/*
+	 * Currently, when Geneve with options offload is enabled, host
+	 * cannot insert match-action rules.
+	 */
+	if (enic->geneve_opt_enabled)
+		return -ENOTSUP;
 	switch (filter_type) {
 	case RTE_ETH_FILTER_GENERIC:
 		if (filter_op != RTE_ETH_FILTER_GET)
@@ -1123,6 +1131,8 @@ static int enic_parse_zero_one(const char *key,
 		enic->disable_overlay = b;
 	if (strcmp(key, ENIC_DEVARG_ENABLE_AVX2_RX) == 0)
 		enic->enable_avx2_rx = b;
+	if (strcmp(key, ENIC_DEVARG_GENEVE_OPT) == 0)
+		enic->geneve_opt_request = b;
 	return 0;
 }
 
@@ -1164,6 +1174,7 @@ static int enic_check_devargs(struct rte_eth_dev *dev)
 	static const char *const valid_keys[] = {
 		ENIC_DEVARG_DISABLE_OVERLAY,
 		ENIC_DEVARG_ENABLE_AVX2_RX,
+		ENIC_DEVARG_GENEVE_OPT,
 		ENIC_DEVARG_IG_VLAN_REWRITE,
 		NULL};
 	struct enic *enic = pmd_priv(dev);
@@ -1173,6 +1184,7 @@ static int enic_check_devargs(struct rte_eth_dev *dev)
 
 	enic->disable_overlay = false;
 	enic->enable_avx2_rx = false;
+	enic->geneve_opt_request = false;
 	enic->ig_vlan_rewrite_mode = IG_VLAN_REWRITE_MODE_PASS_THRU;
 	if (!dev->device->devargs)
 		return 0;
@@ -1183,6 +1195,8 @@ static int enic_check_devargs(struct rte_eth_dev *dev)
 			       enic_parse_zero_one, enic) < 0 ||
 	    rte_kvargs_process(kvlist, ENIC_DEVARG_ENABLE_AVX2_RX,
 			       enic_parse_zero_one, enic) < 0 ||
+	    rte_kvargs_process(kvlist, ENIC_DEVARG_GENEVE_OPT,
+			       enic_parse_zero_one, enic) < 0 ||
 	    rte_kvargs_process(kvlist, ENIC_DEVARG_IG_VLAN_REWRITE,
 			       enic_parse_ig_vlan_rewrite, enic) < 0) {
 		rte_kvargs_free(kvlist);
@@ -1252,4 +1266,5 @@ RTE_PMD_REGISTER_KMOD_DEP(net_enic, "* igb_uio | uio_pci_generic | vfio-pci");
 RTE_PMD_REGISTER_PARAM_STRING(net_enic,
 	ENIC_DEVARG_DISABLE_OVERLAY "=0|1 "
 	ENIC_DEVARG_ENABLE_AVX2_RX "=0|1 "
+	ENIC_DEVARG_GENEVE_OPT "=0|1 "
 	ENIC_DEVARG_IG_VLAN_REWRITE "=trunk|untag|priority|pass");
drivers/net/enic/enic_main.c +22 -0
index 40af3781b..fa993c657 100644
@@ -1683,6 +1683,16 @@ static int enic_dev_init(struct enic *enic)
 	/* set up link status checking */
 	vnic_dev_notify_set(enic->vdev, -1); /* No Intr for notify */
 
+	/*
+	 * When Geneve with options offload is available, always disable it
+	 * first as it can interfere with user flow rules.
+	 */
+	if (enic->geneve_opt_avail &&
+	    vnic_dev_overlay_offload_ctrl(enic->vdev,
+			OVERLAY_FEATURE_GENEVE,
+			OVERLAY_OFFLOAD_DISABLE)) {
+		dev_err(enic, "failed to disable geneve+option\n");
+	}
 	enic->overlay_offload = false;
 	if (enic->disable_overlay && enic->vxlan) {
 		/*
@@ -1714,6 +1724,18 @@ static int enic_dev_init(struct enic *enic)
 		enic->overlay_offload = true;
 		dev_info(enic, "Overlay offload is enabled\n");
 	}
+	/* Geneve with options offload requires overlay offload */
+	if (enic->overlay_offload && enic->geneve_opt_avail &&
+	    enic->geneve_opt_request) {
+		if (vnic_dev_overlay_offload_ctrl(enic->vdev,
+				OVERLAY_FEATURE_GENEVE,
+				OVERLAY_OFFLOAD_ENABLE)) {
+			dev_err(enic, "failed to enable geneve+option\n");
+		} else {
+			enic->geneve_opt_enabled = 1;
+			dev_info(enic, "Geneve with options is enabled\n");
+		}
+	}
 	/*
 	 * Reset the vxlan port if HW vxlan parsing is available. It
 	 * is always enabled regardless of overlay offload
drivers/net/enic/enic_res.c +4 -0
index 9405e1933..742999cd0 100644
@@ -179,6 +179,10 @@ int enic_get_vnic_config(struct enic *enic)
 
 	enic->vxlan = ENIC_SETTING(enic, VXLAN) &&
 		vnic_dev_capable_vxlan(enic->vdev);
+	if (vnic_dev_capable_geneve(enic->vdev)) {
+		dev_info(NULL, "Geneve with options offload available\n");
+		enic->geneve_opt_avail = 1;
+	}
 	/*
 	 * Default hardware capabilities. enic_dev_init() may add additional
 	 * flags if it enables overlay offloads.
Signature · 1 line
2.22.0
#2 lore raw

PATCH v2 2/2 net/enic: add flow implementation based on Flow Manager API

In reply to Hyong Youb Kim

Flow Manager API is the new firmware interface that exposes match action capabilities in 1400 series VIC adapters. It is intended for virtual switch offloads and enables more advanced features than the existing filter API. For example, it supports VXLAN encap and decap actions, and exposes TCAM and exact match tables.

Add the new flow implementation using Flow Manager and use it when available. When Flow Manager is not available, the driver will continue to use the old filter-based flow implementation.

---
 doc/guides/nics/enic.rst               |    9 +
 doc/guides/rel_notes/release_19_11.rst |    1 +
 drivers/net/enic/Makefile              |    1 +
 drivers/net/enic/base/vnic_dev.c       |   79 +-
 drivers/net/enic/base/vnic_dev.h       |    1 +
 drivers/net/enic/base/vnic_devcmd.h    |   12 +
 drivers/net/enic/base/vnic_flowman.h   |  365 ++++
 drivers/net/enic/enic.h                |   21 +-
 drivers/net/enic/enic_ethdev.c         |   10 +-
 drivers/net/enic/enic_fm_flow.c        | 2459 ++++++++++++++++++++++++
 drivers/net/enic/enic_main.c           |    8 +-
 drivers/net/enic/enic_res.c            |    9 +-
 drivers/net/enic/meson.build           |    1 +
 13 files changed, 2968 insertions(+), 8 deletions(-)
 create mode 100644 drivers/net/enic/base/vnic_flowman.h
 create mode 100644 drivers/net/enic/enic_fm_flow.c
doc/guides/nics/enic.rst +9 -0
index 2384cb5b8..b324d4506 100644
@@ -260,6 +260,15 @@ Generic Flow API is supported. The baseline support is:
   - Selectors: 'is', 'spec' and 'mask'. 'last' is not supported
   - In total, up to 64 bytes of mask is allowed across all headers
 
+- **1400 and later series VICs with Flow Manager API enabled**
+
+  - Attributes: ingress, egress
+  - Items: eth, vlan, ipv4, ipv6, sctp, udp, tcp, vxlan, raw, inner eth, vlan, ipv4, ipv6, sctp, udp, tcp
+  - Ingress Actions: count, drop, flag, jump, mark, port_id, passthru, queue, rss, vxlan_decap, vxlan_encap, and void
+  - Egress Actions: count, drop, jump, passthru, vxlan_encap, and void
+  - Selectors: 'is', 'spec' and 'mask'. 'last' is not supported
+  - In total, up to 64 bytes of mask is allowed across all headers
+
 The VIC performs packet matching after applying VLAN strip. If VLAN
 stripping is enabled, EtherType in the ETH item corresponds to the
 stripped VLAN header's EtherType. Stripping does not affect the VLAN
doc/guides/rel_notes/release_19_11.rst +1 -0
index afe71f8fa..82e38a904 100644
@@ -59,6 +59,7 @@ New Features
 * **Updated the enic driver.**
 
   * Added support for Geneve with options offload.
+  * Added flow API implementation based on VIC Flow Manager API.
 
 
 Removed Items
drivers/net/enic/Makefile +1 -0
index 04bae35e3..10736a567 100644
@@ -32,6 +32,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_clsf.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_res.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_flow.c
+SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_fm_flow.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_cq.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_wq.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_dev.c
drivers/net/enic/base/vnic_dev.c +78 -1

110 lines not on this page · raw message

drivers/net/enic/base/vnic_dev.h +1 -0
index 8a1363486..d84e0c773 100644
@@ -182,6 +182,7 @@ int vnic_dev_deinit_done(struct vnic_dev *vdev, int *status);
 int vnic_dev_set_mac_addr(struct vnic_dev *vdev, u8 *mac_addr);
 int vnic_dev_classifier(struct vnic_dev *vdev, u8 cmd, u16 *entry,
 	struct filter_v2 *data, struct filter_action_v2 *action_v2);
+int vnic_dev_flowman_cmd(struct vnic_dev *vdev, u64 *args, int nargs);
 int vnic_dev_overlay_offload_ctrl(struct vnic_dev *vdev,
 	u8 overlay, u8 config);
 int vnic_dev_overlay_offload_cfg(struct vnic_dev *vdev, u8 overlay,
drivers/net/enic/base/vnic_devcmd.h +12 -0
index da60be7b0..d85d40be2 100644
@@ -600,6 +600,16 @@ enum vnic_devcmd_cmd {
 	 *                       a3 = bitmask of supported actions
 	 */
 	CMD_ADD_ADV_FILTER = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 77),
+
+	/*
+	 * Perform a Flow Manager Operation (see flowman_api.h)
+	 * in:	(u32) a0 = sub-command
+	 *	(u64) a1..15 = (sub-command specific)
+	 *
+	 * All arguments that have not been assigned a meaning should be
+	 * initialized to 0 to allow for better driver forward compatibility.
+	 */
+	CMD_FLOW_MANAGER_OP = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 88),
 };
 
 /* Modes for exchanging advanced filter capabilities. The modes supported by
@@ -865,6 +875,7 @@ struct filter_action {
 #define FILTER_ACTION_RQ_STEERING_FLAG	(1 << 0)
 #define FILTER_ACTION_FILTER_ID_FLAG	(1 << 1)
 #define FILTER_ACTION_DROP_FLAG		(1 << 2)
+#define FILTER_ACTION_COUNTER_FLAG	(1 << 3)
 #define FILTER_ACTION_V2_ALL		(FILTER_ACTION_RQ_STEERING_FLAG \
 					 | FILTER_ACTION_DROP_FLAG \
 					 | FILTER_ACTION_FILTER_ID_FLAG)
@@ -889,6 +900,7 @@ enum filter_type {
 	FILTER_NVGRE_VMQ = 4,
 	FILTER_USNIC_IP = 5,
 	FILTER_DPDK_1 = 6,
+	FILTER_FLOWMAN = 7,
 	FILTER_MAX
 };
 
drivers/net/enic/base/vnic_flowman.h new file +365 -0

365 lines not on this page · raw message

drivers/net/enic/enic.h +20 -1
index 87792deec..7413e9354 100644
@@ -8,6 +8,7 @@
 
 #include "vnic_enet.h"
 #include "vnic_dev.h"
+#include "vnic_flowman.h"
 #include "vnic_wq.h"
 #include "vnic_rq.h"
 #include "vnic_cq.h"
@@ -88,10 +89,17 @@ struct enic_memzone_entry {
 	LIST_ENTRY(enic_memzone_entry) entries;
 };
 
+/* Defined in enic_fm_flow.c */
+struct enic_flowman;
+struct enic_fm_flow;
+
 struct rte_flow {
 	LIST_ENTRY(rte_flow) next;
-	u16 enic_filter_id;
+	/* Data for filter API based flow (enic_flow.c) */
+	uint16_t enic_filter_id;
 	struct filter_v2 enic_filter;
+	/* Data for flow manager based flow (enic_fm_flow.c) */
+	struct enic_fm_flow *fm;
 };
 
 /* Per-instance private data structure */
@@ -195,6 +203,9 @@ struct enic {
 	/* Multicast MAC addresses added to the NIC */
 	uint32_t mc_count;
 	struct rte_ether_addr mc_addrs[ENIC_MULTICAST_PERFECT_FILTERS];
+
+	/* Flow manager API */
+	struct enic_flowman *fm;
 };
 
 /* Compute ethdev's max packet size from MTU */
@@ -276,6 +287,7 @@ enic_ring_incr(uint32_t n_descriptors, uint32_t idx)
 	return idx;
 }
 
+int dev_is_enic(struct rte_eth_dev *dev);
 void enic_fdir_stats_get(struct enic *enic,
 			 struct rte_eth_fdir_stats *stats);
 int enic_fdir_add_fltr(struct enic *enic,
@@ -321,6 +333,12 @@ void enic_post_wq_index(struct vnic_wq *wq);
 int enic_probe(struct enic *enic);
 int enic_clsf_init(struct enic *enic);
 void enic_clsf_destroy(struct enic *enic);
+int enic_fm_init(struct enic *enic);
+void enic_fm_destroy(struct enic *enic);
+void *enic_alloc_consistent(void *priv, size_t size, dma_addr_t *dma_handle,
+			    u8 *name);
+void enic_free_consistent(void *priv, size_t size, void *vaddr,
+			  dma_addr_t dma_handle);
 uint16_t enic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			uint16_t nb_pkts);
 uint16_t enic_noscatter_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
@@ -340,4 +358,5 @@ bool enic_use_vector_rx_handler(struct enic *enic);
 void enic_fdir_info(struct enic *enic);
 void enic_fdir_info_get(struct enic *enic, struct rte_eth_fdir_info *stats);
 extern const struct rte_flow_ops enic_flow_ops;
+extern const struct rte_flow_ops enic_fm_flow_ops;
 #endif /* _ENIC_H_ */
drivers/net/enic/enic_ethdev.c +9 -1
index e1c6da3b3..e8afc2dcd 100644
@@ -143,7 +143,10 @@ enicpmd_dev_filter_ctrl(struct rte_eth_dev *dev,
 	case RTE_ETH_FILTER_GENERIC:
 		if (filter_op != RTE_ETH_FILTER_GET)
 			return -EINVAL;
-		*(const void **)arg = &enic_flow_ops;
+		if (enic->flow_filter_mode == FILTER_FLOWMAN)
+			*(const void **)arg = &enic_fm_flow_ops;
+		else
+			*(const void **)arg = &enic_flow_ops;
 		break;
 	case RTE_ETH_FILTER_FDIR:
 		ret = enicpmd_fdir_ctrl_func(dev, filter_op, arg);
@@ -1260,6 +1263,11 @@ static struct rte_pci_driver rte_enic_pmd = {
 	.remove = eth_enic_pci_remove,
 };
 
+int dev_is_enic(struct rte_eth_dev *dev)
+{
+	return dev->device->driver == &rte_enic_pmd.driver;
+}
+
 RTE_PMD_REGISTER_PCI(net_enic, rte_enic_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_enic, pci_id_enic_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_enic, "* igb_uio | uio_pci_generic | vfio-pci");
drivers/net/enic/enic_fm_flow.c new file +2459 -0

2,379 lines not on this page · raw message

drivers/net/enic/enic_main.c +6 -2
index fa993c657..40bdd0963 100644

Lines of this file are not shown. View the raw message.

drivers/net/enic/enic_res.c +6 -3
index 742999cd0..f403a0b66 100644

Lines of this file are not shown. View the raw message.

drivers/net/enic/meson.build +1 -0
index 6716cdaf3..1bd7cc7e1 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.22.0

Part of the diff is not shown here. View the raw message.

#3 lore raw
In reply to Hyong Youb Kim
Quoted 18 lines · Hyong Youb Kim

The first patch enables Geneve offload that supports Geneve header options. Previous Geneve offload does not work when options are present.

The second patch adds the new flow implementation based on Flow Manager. So the driver now has two implementations: one based on the old filter API, and this new one based on Flow Manager. Flow Manager is newer firmware interface with more actions and match items than the filter API. enic_fm_flow.c is quite large but self contained. We tried to break it up into multiple patches, but it did not really make sense in the end. So sending the whole file in one patch.

checkpatches complains about these errors. We checked and found it safe to ignore them (false positives).

CHECK:CAMELCASE: Avoid CamelCase: <PRIx64>
ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses

Quoted 8 lines

Thanks.
-Hyong

v2: add FMOP_NOP to the flowman header, which was missing in v1

Hyong Youb Kim (2):
net/enic: enable Geneve with options offload net/enic: add flow implementation based on Flow Manager API

Series applied to dpdk-next-net/master, thanks.