This patch helps enic migrate to the new flow-director API.
It takes care of the following.
1. The change in fdir_filter structure and stats structure
2. DPDK interface functions in enic_ethdev.c
3. ENIC driver functions that deal with the VIC adapter
Signed-off-by: Sujith Sankar
---
lib/librte_pmd_enic/enic.h| 12 +++---
lib/librte_pmd_enic/enic_clsf.c | 43 --
lib/librte_pmd_enic/enic_ethdev.c | 77 ++-
3 files changed, 89 insertions(+), 43 deletions(-)
diff --git a/lib/librte_pmd_enic/enic.h b/lib/librte_pmd_enic/enic.h
index a50bff1..acdd0f6 100644
--- a/lib/librte_pmd_enic/enic.h
+++ b/lib/librte_pmd_enic/enic.h
@@ -80,13 +80,13 @@
#define ENICPMD_FDIR_MAX 64
struct enic_fdir_node {
- struct rte_fdir_filter filter;
+ struct rte_eth_fdir_filter filter;
u16 fltr_id;
u16 rq_index;
};
struct enic_fdir {
- struct rte_eth_fdir stats;
+ struct rte_eth_fdir_stats stats;
struct rte_hash *hash;
struct enic_fdir_node *nodes[ENICPMD_FDIR_MAX];
};
@@ -110,7 +110,7 @@ struct enic {
pthread_t err_intr_thread;
int promisc;
int allmulti;
- uint8_t ig_vlan_strip_en;
+ u8 ig_vlan_strip_en;
int link_status;
u8 hw_ip_checksum;
@@ -154,10 +154,12 @@ static inline struct enic *pmd_priv(struct rte_eth_dev
*eth_dev)
return (struct enic *)eth_dev->data->dev_private;
}
+extern void enic_fdir_stats_get(struct enic *enic,
+ struct rte_eth_fdir_stats *stats);
extern int enic_fdir_add_fltr(struct enic *enic,
- struct rte_fdir_filter *params, u16 queue, u8 drop);
+ struct rte_eth_fdir_filter *params);
extern int enic_fdir_del_fltr(struct enic *enic,
- struct rte_fdir_filter *params);
+ struct rte_eth_fdir_filter *params);
extern void enic_free_wq(void *txq);
extern int enic_alloc_intr_resources(struct enic *enic);
extern int enic_setup_finish(struct enic *enic);
diff --git a/lib/librte_pmd_enic/enic_clsf.c b/lib/librte_pmd_enic/enic_clsf.c
index b61d625..f4cba75 100644
--- a/lib/librte_pmd_enic/enic_clsf.c
+++ b/lib/librte_pmd_enic/enic_clsf.c
@@ -65,7 +65,12 @@
#define ENICPMD_CLSF_HASH_ENTRIES ENICPMD_FDIR_MAX
#define ENICPMD_CLSF_BUCKET_ENTRIES 4
-int enic_fdir_del_fltr(struct enic *enic, struct rte_fdir_filter *params)
+void enic_fdir_stats_get(struct enic *enic, struct rte_eth_fdir_stats *stats)
+{
+ *stats = enic->fdir.stats;
+}
+
+int enic_fdir_del_fltr(struct enic *enic, struct rte_eth_fdir_filter *params)
{
int32_t pos;
struct enic_fdir_node *key;
@@ -92,23 +97,33 @@ int enic_fdir_del_fltr(struct enic *enic, struct
rte_fdir_filter *params)
return 0;
}
-int enic_fdir_add_fltr(struct enic *enic, struct rte_fdir_filter *params,
- u16 queue, u8 drop)
+int enic_fdir_add_fltr(struct enic *enic, struct rte_eth_fdir_filter *params)
{
struct enic_fdir_node *key;
struct filter fltr = {.type = 0};
int32_t pos;
u8 do_free = 0;
u16 old_fltr_id = 0;
+ u32 flowtype_supported;
+ u16 flex_bytes;
+ u16 queue;
+
+ flowtype_supported = (
+ (RTE_ETH_FLOW_NONFRAG_IPV4_TCP == params->input.flow_type) ||
+ (RTE_ETH_FLOW_NONFRAG_IPV4_UDP == params->input.flow_type));
+
+ flex_bytes = ((params->input.flow_ext.flexbytes[1] << 8 & 0xFF00) |
+ (params->input.flow_ext.flexbytes[0] & 0xFF));
- if (!enic->fdir.hash || params->vlan_id || !params->l4type ||
- (RTE_FDIR_IPTYPE_IPV6 == params->iptype) ||
- (RTE_FDIR_L4TYPE_SCTP == params->l4type) ||
- params->flex_bytes || drop) {
+ if (!enic->fdir.hash ||
+ (params->input.flow_ext.vlan_tci & 0xFFF) ||
+ !flowtype_supported || flex_bytes ||
+ params->action.behavior /* drop */) {
enic->fdir.stats.f_add++;
return -ENOTSUP;
}
+ queue = params->action.rx_queue;
/* See if the key is already there in the table */
pos = rte_hash_del_key(enic->fdir.hash, params);
switch (pos) {
@@ -168,12 +183,16 @@ int enic_fdir_add_fltr(struct enic *enic, struct
rte_fdir_filter *params,
key->rq_index = queue;
fltr.type = FILTER_IPV4_5TUPLE;
- fltr.u.ipv4.src_addr = rte_be_to_cpu_32(params->ip_src.ipv4_addr);
- fltr.u.ipv4.dst_addr = rte_be_to_cpu_32(params->ip_dst.ipv4_addr);
- fltr.u.ipv4.src_port = rte_be_to_cpu_16(params->port_src);
- fltr.u.ipv4.dst_port = rte_be_to_cpu_16(params->port_dst);
+ fltr.u.ipv4.src_addr = rte_be_to_cpu_32(
+ params->input.flow.ip4_flow.src_ip);
+ fltr.u.ipv4.dst_addr = rte_be_to_cpu_32(
+ params->input.flow.ip4_flow.dst_ip);
+ fltr.u.ipv4.src_port = rte_be_to_cpu_16(
+ params->input.flow.udp4_flow.src_port);
+