Skip to contentSkip to conversation

net/enic: enic driver doesn't work with 2nd process

PATCH New dirk 1 participant 2 messages Aug 27, 2019 Network drivers

lore
Share & tools
lore

dirk

author
#0 lore raw

cover net/enic: enic driver doesn't work with 2nd process

dirk (1):
net/enic: enic driver doesn't work with 2nd process. the problem is that the private data structure enic uses pointers to rte_eth_dev and rte_pci_device which are overwritten when a 2nd process starts using this device. given patch removes these two pointers from the private data and uses the correct pointers. For us the given patch works fine on a cisco rack. (we used three processes working concurrently)

 drivers/net/enic/enic.h               |  36 ++++---
 drivers/net/enic/enic_clsf.c          |   5 +-
 drivers/net/enic/enic_ethdev.c        |  79 ++++++---------
 drivers/net/enic/enic_main.c          | 177 +++++++++++++++++++---------------
 drivers/net/enic/enic_res.c           |   7 +-
 drivers/net/enic/enic_res.h           |   6 +-
 drivers/net/enic/enic_rxtx_vec_avx2.c |   5 +-
 7 files changed, 156 insertions(+), 159 deletions(-)
Signature · 1 line
2.15.1
author
#1 lore raw

PATCH 1/1 net/enic: enic driver doesn't work with 2nd process

---
 drivers/net/enic/enic.h               |  36 ++++---
 drivers/net/enic/enic_clsf.c          |   5 +-
 drivers/net/enic/enic_ethdev.c        |  79 ++++++---------
 drivers/net/enic/enic_main.c          | 177 +++++++++++++++++++---------------
 drivers/net/enic/enic_res.c           |   7 +-
 drivers/net/enic/enic_res.h           |   6 +-
 drivers/net/enic/enic_rxtx_vec_avx2.c |   5 +-
 7 files changed, 156 insertions(+), 159 deletions(-)
drivers/net/enic/enic.h +17 -19
index 5a92508f0..87d799594 100644
@@ -97,7 +97,6 @@ struct rte_flow {
 /* Per-instance private data structure */
 struct enic {
 	struct enic *next;
-	struct rte_pci_device *pdev;
 	struct vnic_enet_config config;
 	struct vnic_dev_bar bar0;
 	struct vnic_dev *vdev;
@@ -109,7 +108,6 @@ struct enic {
 	uint64_t mbuf_initializer;
 	unsigned int port_id;
 	bool overlay_offload;
-	struct rte_eth_dev *rte_dev;
 	struct enic_fdir fdir;
 	char bdf_name[ENICPMD_BDF_LENGTH];
 	int dev_fd;
@@ -275,7 +273,7 @@ enic_ring_incr(uint32_t n_descriptors, uint32_t idx)
 
 void enic_fdir_stats_get(struct enic *enic,
 			 struct rte_eth_fdir_stats *stats);
-int enic_fdir_add_fltr(struct enic *enic,
+int enic_fdir_add_fltr(struct rte_eth_dev *eth_dev,
 		       struct rte_eth_fdir_filter *params);
 int enic_fdir_del_fltr(struct enic *enic,
 		       struct rte_eth_fdir_filter *params);
@@ -284,30 +282,30 @@ int enic_alloc_intr_resources(struct enic *enic);
 int enic_setup_finish(struct enic *enic);
 int enic_alloc_wq(struct enic *enic, uint16_t queue_idx,
 		  unsigned int socket_id, uint16_t nb_desc);
-void enic_start_wq(struct enic *enic, uint16_t queue_idx);
-int enic_stop_wq(struct enic *enic, uint16_t queue_idx);
-void enic_start_rq(struct enic *enic, uint16_t queue_idx);
-int enic_stop_rq(struct enic *enic, uint16_t queue_idx);
+void enic_start_wq(struct rte_eth_dev *eth_dev, uint16_t queue_idx);
+int enic_stop_wq(struct rte_eth_dev *eth_dev, uint16_t queue_idx);
+void enic_start_rq(struct rte_eth_dev *eth_dev, uint16_t queue_idx);
+int enic_stop_rq(struct rte_eth_dev *eth_dev, uint16_t queue_idx);
 void enic_free_rq(void *rxq);
-int enic_alloc_rq(struct enic *enic, uint16_t queue_idx,
+int enic_alloc_rq(struct rte_eth_dev *eth_dev, uint16_t queue_idx,
 		  unsigned int socket_id, struct rte_mempool *mp,
 		  uint16_t nb_desc, uint16_t free_thresh);
-int enic_set_vnic_res(struct enic *enic);
-int enic_init_rss_nic_cfg(struct enic *enic);
-int enic_set_rss_conf(struct enic *enic,
+int enic_set_vnic_res(struct rte_eth_dev *eth_dev);
+int enic_init_rss_nic_cfg(struct rte_eth_dev *eth_dev);
+int enic_set_rss_conf(struct rte_eth_dev *eth_dev,
 		      struct rte_eth_rss_conf *rss_conf);
 int enic_set_rss_reta(struct enic *enic, union vnic_rss_cpu *rss_cpu);
 int enic_set_vlan_strip(struct enic *enic);
-int enic_enable(struct enic *enic);
-int enic_disable(struct enic *enic);
+int enic_enable(struct rte_eth_dev *eth_dev);
+int enic_disable(struct rte_eth_dev *eth_dev);
 void enic_remove(struct enic *enic);
 int enic_get_link_status(struct enic *enic);
 int enic_dev_stats_get(struct enic *enic,
 		       struct rte_eth_stats *r_stats);
 void enic_dev_stats_clear(struct enic *enic);
 void enic_add_packet_filter(struct enic *enic);
-int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr);
-int enic_del_mac_address(struct enic *enic, int mac_index);
+int enic_set_mac_address(struct rte_eth_dev *eth_dev, uint8_t *mac_addr);
+int enic_del_mac_address(struct rte_eth_dev *eth_dev, int mac_index);
 unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq);
 void enic_send_pkt(struct enic *enic, struct vnic_wq *wq,
 		   struct rte_mbuf *tx_pkt, unsigned short len,
@@ -315,7 +313,7 @@ void enic_send_pkt(struct enic *enic, struct vnic_wq *wq,
 		   uint16_t ol_flags, uint16_t vlan_tag);
 
 void enic_post_wq_index(struct vnic_wq *wq);
-int enic_probe(struct enic *enic);
+int enic_probe(struct rte_eth_dev *eth_dev);
 int enic_clsf_init(struct enic *enic);
 void enic_clsf_destroy(struct enic *enic);
 uint16_t enic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
@@ -331,9 +329,9 @@ uint16_t enic_simple_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			       uint16_t nb_pkts);
 uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			uint16_t nb_pkts);
-int enic_set_mtu(struct enic *enic, uint16_t new_mtu);
-int enic_link_update(struct enic *enic);
-bool enic_use_vector_rx_handler(struct enic *enic);
+int enic_set_mtu(struct rte_eth_dev *eth_dev, uint16_t new_mtu);
+int enic_link_update(struct rte_eth_dev *eth_dev);
+bool enic_use_vector_rx_handler(struct rte_eth_dev *eth_dev);
 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;
drivers/net/enic/enic_clsf.c +3 -2
index 080b642c8..ba68a42ad 100644
@@ -332,7 +332,7 @@ int enic_fdir_del_fltr(struct enic *enic, struct rte_eth_fdir_filter *params)
 	return 0;
 }
 
-int enic_fdir_add_fltr(struct enic *enic, struct rte_eth_fdir_filter *params)
+int enic_fdir_add_fltr(struct rte_eth_dev *eth_dev, struct rte_eth_fdir_filter *params)
 {
 	struct enic_fdir_node *key;
 	struct filter_v2 fltr;
@@ -343,6 +343,7 @@ int enic_fdir_add_fltr(struct enic *enic, struct rte_eth_fdir_filter *params)
 	u16 flex_bytes;
 	u16 queue;
 	struct filter_action_v2 action;
+  struct enic *enic = pmd_priv(eth_dev);
 
 	memset(&fltr, 0, sizeof(fltr));
 	memset(&action, 0, sizeof(action));
@@ -429,7 +430,7 @@ int enic_fdir_add_fltr(struct enic *enic, struct rte_eth_fdir_filter *params)
 	key->rq_index = queue;
 
 	enic->fdir.copy_fltr_fn(&fltr, &params->input,
-				&enic->rte_dev->data->dev_conf.fdir_conf.mask);
+				&eth_dev->data->dev_conf.fdir_conf.mask);
 	action.type = FILTER_ACTION_RQ_STEERING;
 	action.rq_idx = queue;
 
drivers/net/enic/enic_ethdev.c +30 -49

275 lines not on this page · raw message

drivers/net/enic/enic_main.c +97 -80

535 lines not on this page · raw message

drivers/net/enic/enic_res.c +4 -3
index 9405e1933..3e2013598 100644
@@ -21,8 +21,9 @@
 #include "enic_res.h"
 #include "enic.h"
 
-int enic_get_vnic_config(struct enic *enic)
+int enic_get_vnic_config(struct rte_eth_dev *eth_dev)
 {
+  struct enic *enic = pmd_priv(eth_dev);
 	struct vnic_enet_config *c = &enic->config;
 	int err;
 
@@ -68,7 +69,7 @@ int enic_get_vnic_config(struct enic *enic)
 	if (c->mtu == 0)
 		c->mtu = 1500;
 
-	enic->rte_dev->data->mtu = min_t(u16, enic->max_mtu,
+	eth_dev->data->mtu = min_t(u16, enic->max_mtu,
 					 max_t(u16, ENIC_MIN_MTU, c->mtu));
 
 	enic->adv_filters = vnic_dev_capable_adv_filters(enic->vdev);
@@ -118,7 +119,7 @@ int enic_get_vnic_config(struct enic *enic)
 		enic->mac_addr[0], enic->mac_addr[1], enic->mac_addr[2],
 		enic->mac_addr[3], enic->mac_addr[4], enic->mac_addr[5],
 		c->wq_desc_count, c->rq_desc_count,
-		enic->rte_dev->data->mtu, enic->max_mtu);
+		eth_dev->data->mtu, enic->max_mtu);
 	dev_info(enic_get_dev(enic), "vNIC csum tx/rx %s/%s "
 		"rss %s intr mode %s type %s timer %d usec "
 		"loopback tag 0x%04x\n",
drivers/net/enic/enic_res.h +3 -3
index faaaad9bd..ffe918a32 100644
@@ -58,15 +58,15 @@
 
 struct enic;
 
-int enic_get_vnic_config(struct enic *);
+int enic_get_vnic_config(struct rte_eth_dev *eth_dev);
 int enic_set_nic_cfg(struct enic *enic, u8 rss_default_cpu, u8 rss_hash_type,
 	u8 rss_hash_bits, u8 rss_base_cpu, u8 rss_enable, u8 tso_ipid_split_en,
 	u8 ig_vlan_strip_en);
 int enic_set_rss_key(struct enic *enic, dma_addr_t key_pa, u64 len);
 int enic_set_rss_cpu(struct enic *enic, dma_addr_t cpu_pa, u64 len);
 void enic_get_res_counts(struct enic *enic);
-void enic_init_vnic_resources(struct enic *enic);
-int enic_alloc_vnic_resources(struct enic *);
+void enic_init_vnic_resources(struct rte_eth_dev *eth_dev);
+//int enic_alloc_vnic_resources(struct enic *);
 void enic_free_vnic_resources(struct enic *);
 
 #endif /* _ENIC_RES_H_ */
drivers/net/enic/enic_rxtx_vec_avx2.c +2 -3
index 517d4092f..fc31126e2 100644
@@ -806,12 +806,11 @@ enic_noscatter_vec_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 }
 
 bool
-enic_use_vector_rx_handler(struct enic *enic)
+enic_use_vector_rx_handler(struct rte_eth_dev *eth_dev)
 {
-	struct rte_eth_dev *eth_dev;
 	struct rte_fdir_conf *fconf;
+	struct enic *enic = pmd_priv(eth_dev);
 
-	eth_dev = enic->rte_dev;
 	/* User needs to request for the avx2 handler */
 	if (!enic->enable_avx2_rx)
 		return false;
Signature · 1 line
2.15.1