Re: [dpdk-dev] [PATCH] bus/pci: fix mmap PCI resource
Tested-by: Xiao Qimai Regards, Xiao Qimai > -Original Message- > From: dev On Behalf Of alvinx.zh...@intel.com > Sent: Wednesday, July 8, 2020 5:25 PM > To: dev@dpdk.org > Cc: Xing, Beilei ; Guo, Jia > Subject: [dpdk-dev] [PATCH] bus/pci: fix mmap PCI resource > > From: Alvin Zhang > > When mapping a PCI BAR containing an MSI-X table, some devices do not > need to actually map this BAR or only need to map part of them, which may > cause the mapping to fail. Now some checks are added and a non-NULL initial > value is set to the variable to avoid this situation. > > Fixes: 2fd3567e5425 ("pci: use OS generic memory mapping functions") > Cc: tal...@mellanox.com > > Signed-off-by: Alvin Zhang > --- > drivers/bus/pci/linux/pci_vfio.c | 12 +++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/bus/pci/linux/pci_vfio.c > b/drivers/bus/pci/linux/pci_vfio.c > index fdeb9a8..9143bfc 100644 > --- a/drivers/bus/pci/linux/pci_vfio.c > +++ b/drivers/bus/pci/linux/pci_vfio.c > @@ -547,6 +547,14 @@ > bar_index, > memreg[0].offset, memreg[0].size, > memreg[1].offset, memreg[1].size); > + > + if (memreg[0].size == 0 && memreg[1].size == 0) { > + /* No need to map this BAR */ > + RTE_LOG(DEBUG, EAL, "Skipping BAR%d\n", > bar_index); > + bar->size = 0; > + bar->addr = 0; > + return 0; > + } > } else { > memreg[0].offset = bar->offset; > memreg[0].size = bar->size; > @@ -556,7 +564,9 @@ > bar_addr = mmap(bar->addr, bar->size, 0, MAP_PRIVATE | > MAP_ANONYMOUS | additional_flags, -1, 0); > if (bar_addr != MAP_FAILED) { > - void *map_addr = NULL; > + /* Set non NULL initial value for in case of no PCI mapping */ > + void *map_addr = bar_addr; > + > if (memreg[0].size) { > /* actual map of first part */ > map_addr = pci_map_resource(bar_addr, > vfio_dev_fd, > -- > 1.8.3.1
Re: [dpdk-dev] [PATCH] net/ice: fix core dumped issue in switch filter
Tested-by: Xiao, QimaiX Regards, Xiao Qimai > -Original Message- > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Junyu Jiang > Sent: Wednesday, April 29, 2020 3:25 PM > To: dev@dpdk.org > Cc: Yang, Qiming ; Jiang, JunyuX > ; sta...@dpdk.org > Subject: [dpdk-dev] [PATCH] net/ice: fix core dumped issue in switch filter > > The number of queues in queue group should be checked before using it to > avoid NULL pointer. This patch fixed the issue. > > Fixes: 47d460d63233 ("net/ice: rework switch filter") > Cc: sta...@dpdk.org > > Signed-off-by: Junyu Jiang > --- > drivers/net/ice/ice_switch_filter.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/net/ice/ice_switch_filter.c > b/drivers/net/ice/ice_switch_filter.c > index 179430136..c2762e331 100644 > --- a/drivers/net/ice/ice_switch_filter.c > +++ b/drivers/net/ice/ice_switch_filter.c > @@ -1296,6 +1296,8 @@ ice_switch_parse_action(struct ice_pf *pf, > switch (action_type) { > case RTE_FLOW_ACTION_TYPE_RSS: > act_qgrop = action->conf; > + if (act_qgrop->queue_num <= 1) > + goto error; > rule_info->sw_act.fltr_act = > ICE_FWD_TO_QGRP; > rule_info->sw_act.fwd_id.q_id = > -- > 2.17.1
Re: [dpdk-dev] [PATCH] net/ice: fix switch action number check
Tested-by: Xiao, QimaiX Regards, Xiao Qimai > -Original Message- > From: dev On Behalf Of Wei Zhao > Sent: Thursday, May 21, 2020 3:34 PM > To: dev@dpdk.org > Cc: sta...@dpdk.org; Zhang, Qi Z ; Ye, Xiaolong > ; Zhao1, Wei > Subject: [dpdk-dev] [PATCH] net/ice: fix switch action number check > > The action number for switch filter should be 1, any other such as 0 or more > than 1 is invalid. > > Fixes: 3428c6b6ec1f ("net/ice: add action number check for switch") > Cc: sta...@dpdk.org > > Signed-off-by: Wei Zhao > --- > drivers/net/ice/ice_switch_filter.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ice/ice_switch_filter.c > b/drivers/net/ice/ice_switch_filter.c > index dd3f4847a..20e8187d3 100644 > --- a/drivers/net/ice/ice_switch_filter.c > +++ b/drivers/net/ice/ice_switch_filter.c > @@ -1388,7 +1388,7 @@ ice_switch_check_action(const struct > rte_flow_action *actions, > } > } > > - if (actions_num > 1) { > + if (actions_num != 1) { > rte_flow_error_set(error, > EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, > actions, > -- > 2.19.1
Re: [dpdk-dev] [PATCH] vhost: fix packed ring zero-copy
Tested-by: Xiao, QimaiX Regards, Xiao Qimai > -Original Message- > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Marvin Liu > Sent: Monday, March 16, 2020 11:38 PM > To: maxime.coque...@redhat.com; Wang, Zhihong > ; Ye, Xiaolong > Cc: dev@dpdk.org; sta...@dpdk.org; Liu, Yong > Subject: [dpdk-dev] [PATCH] vhost: fix packed ring zero-copy > > Available buffer ID should be stored in the zmbuf in the packed-ring > dequeue path. There's no guarantee that local queue avail index is equal to > buffer ID. > > Fixes: d1eafb532268 ("vhost: add packed ring zcopy batch and single > dequeue") > Cc: sta...@dpdk.org > > Signed-off-by: Marvin Liu > Reported-by: Yinan Wang > Reviewed-by: Maxime Coquelin > > diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c > index > 37c47c7dc..210415904 100644 > --- a/lib/librte_vhost/virtio_net.c > +++ b/lib/librte_vhost/virtio_net.c > @@ -2004,7 +2004,7 @@ virtio_dev_tx_batch_packed_zmbuf(struct > virtio_net *dev, > > vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { > zmbufs[i]->mbuf = pkts[i]; > - zmbufs[i]->desc_idx = avail_idx + i; > + zmbufs[i]->desc_idx = ids[i]; > zmbufs[i]->desc_count = 1; > } > > @@ -2045,7 +2045,7 @@ virtio_dev_tx_single_packed_zmbuf(struct > virtio_net *dev, > return -1; > } > zmbuf->mbuf = *pkts; > - zmbuf->desc_idx = vq->last_avail_idx; > + zmbuf->desc_idx = buf_id; > zmbuf->desc_count = desc_count; > > rte_mbuf_refcnt_update(*pkts, 1); > -- > 2.17.1
Re: [dpdk-dev] [PATCH] net/i40e: remove useless check for queue number
Tested-by: Xiao, QimaiX -Original Message- From: Zhao1, Wei Sent: Sunday, April 28, 2019 2:13 PM To: dev@dpdk.org Cc: sta...@dpdk.org; Zhang, Qi Z ; Xiao, QimaiX ; Peng, Yuan ; Zhao1, Wei Subject: [PATCH] net/i40e: remove useless check for queue number There is no need to do such a check of queue number, so remove it. Fixes: ac8d22de2394 ("ethdev: flatten RSS configuration in flow API") Signed-off-by: Wei Zhao --- drivers/net/i40e/i40e_ethdev.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index dca61f0..5059bad 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -12699,9 +12699,6 @@ i40e_config_rss_filter(struct i40e_pf *pf, return -EINVAL; } - if (rss_info->conf.queue_num) - return -EINVAL; - /* If both VMDQ and RSS enabled, not all of PF queues are configured. * It's necessary to calculate the actual PF queues that are configured. */ -- 2.7.5
Re: [dpdk-dev] [PATCH v1] vhost: set zmbufs to NULL when freed
Tested-by: Xiao Qimai Regards, Xiao Qimai > -Original Message- > From: dev On Behalf Of patrick...@intel.com > Sent: Wednesday, July 15, 2020 11:59 PM > To: dev@dpdk.org; maxime.coque...@redhat.com; Xia, Chenbo > > Cc: Wang, Yinan ; Fu, Patrick > Subject: [dpdk-dev] [PATCH v1] vhost: set zmbufs to NULL when freed > > From: Patrick Fu > > zmbufs should be set to NULL when getting freed to avoid double free on > the same buffer pointer > > Fixes: b0a985d1f340 ("vhost: add dequeue zero copy") > > Signed-off-by: Patrick Fu > --- > lib/librte_vhost/vhost_user.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c > index df0db8a07..9ddeae362 100644 > --- a/lib/librte_vhost/vhost_user.c > +++ b/lib/librte_vhost/vhost_user.c > @@ -1934,6 +1934,7 @@ free_zmbufs(struct vhost_virtqueue *vq) > drain_zmbuf_list(vq); > > rte_free(vq->zmbufs); > + vq->zmbufs = NULL; > } > > /* > -- > 2.17.1
Re: [dpdk-dev] [PATCH v4 3/3] net/vhost: fix interrupt mode
Tested-by: Xiao Qimai Regards, Xiao Qimai > -Original Message- > From: dev On Behalf Of Xia, Chenbo > Sent: Wednesday, July 29, 2020 10:19 PM > To: Maxime Coquelin ; dev@dpdk.org; > ma...@mellanox.com; Liu, Yong ; Wang, Yinan > > Cc: tho...@monjalon.net; Yigit, Ferruh ; > david.march...@redhat.com > Subject: Re: [dpdk-dev] [PATCH v4 3/3] net/vhost: fix interrupt mode > > > > -Original Message- > > From: Maxime Coquelin > > Sent: Wednesday, July 29, 2020 9:36 PM > > To: dev@dpdk.org; ma...@mellanox.com; Xia, Chenbo > > ; Liu, Yong ; Wang, Yinan > > > > Cc: tho...@monjalon.net; Yigit, Ferruh ; > > david.march...@redhat.com; Maxime Coquelin > > > > Subject: [PATCH v4 3/3] net/vhost: fix interrupt mode > > > > At .new_device() time, only the first vring pair is now ready, other > > vrings are configured later. > > > > Problem is that when application will setup and enable interrupts, > > only the first queue pair Rx interrupt will be enabled. > > > > This patches fixes the issue by setting the number of max interrupts > > to the number of Rx queues that will be later initialized. Then, as > > soon as a Rx vring is ready and interrupt enabled by the application, > > it removes the corresponding uninitialized epoll event, and installs a new > one with the valid FD. > > > > Fixes: 604052ae5395 ("net/vhost: support queue update") > > > > Signed-off-by: Maxime Coquelin > > --- > > drivers/net/vhost/rte_eth_vhost.c | 91 > > +++ > > 1 file changed, 81 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/net/vhost/rte_eth_vhost.c > > b/drivers/net/vhost/rte_eth_vhost.c > > index 951929c663..e55278af69 100644 > > --- a/drivers/net/vhost/rte_eth_vhost.c > > +++ b/drivers/net/vhost/rte_eth_vhost.c > > @@ -5,6 +5,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > #include > > @@ -95,6 +96,8 @@ struct vhost_queue { > > uint16_t port; > > uint16_t virtqueue_id; > > struct vhost_stats stats; > > + int intr_enable; > > + rte_spinlock_t intr_lock; > > }; > > > > struct pmd_internal { > > @@ -524,12 +527,58 @@ find_internal_resource(char *ifname) > > return list; > > } > > > > +static int > > +eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx) { > > + struct rte_intr_handle *handle = eth_dev->intr_handle; > > + struct rte_epoll_event rev; > > + int epfd, ret; > > + > > + if (!handle) > > + return 0; > > + > > + if (handle->efds[rxq_idx] == handle->elist[rxq_idx].fd) > > + return 0; > > + > > + VHOST_LOG(INFO, "kickfd for rxq-%d was changed, updating > > handler.\n", > > + rxq_idx); > > + > > + if (handle->elist[rxq_idx].fd != -1) > > + VHOST_LOG(ERR, "Unexpected previous kickfd value > (Got %d, > > expected -1).\n", > > + handle->elist[rxq_idx].fd); > > + > > + /* > > +* First remove invalid epoll event, and then install > > +* the new one. May be solved with a proper API in the > > +* future. > > +*/ > > + epfd = handle->elist[rxq_idx].epfd; > > + rev = handle->elist[rxq_idx]; > > + ret = rte_epoll_ctl(epfd, EPOLL_CTL_DEL, rev.fd, > > + &handle->elist[rxq_idx]); > > + if (ret) { > > + VHOST_LOG(ERR, "Delete epoll event failed.\n"); > > + return ret; > > + } > > + > > + rev.fd = handle->efds[rxq_idx]; > > + handle->elist[rxq_idx] = rev; > > + ret = rte_epoll_ctl(epfd, EPOLL_CTL_ADD, rev.fd, > > + &handle->elist[rxq_idx]); > > + if (ret) { > > + VHOST_LOG(ERR, "Add epoll event failed.\n"); > > + return ret; > > + } > > + > > + return 0; > > +} > > + > > static int > > eth_rxq_intr_enable(struct rte_eth_dev *dev, uint16_t qid) { > > struct rte_vhost_vring vring; > > struct vhost_queue *vq; > > - int ret = 0; > > + int old_intr_enable, ret = 0; > > > > vq = dev->data->rx_queues[qid]; > > if (!vq) { > > @@ -537,6 +586,18 @@ eth_rxq_intr_enable(struct rte_eth_dev *dev, > > uint16_t > > qid) > > return -1; > > } > > > > + rte_spinlock_lock(&vq->intr_lock); > > + old_intr_enable = vq->intr_enable; > > + vq->intr_enable = 1; > > + ret = eth_vhost_update_intr(dev, qid); > > + rte_spinlock_unlock(&vq->intr_lock); > > + > > + if (ret < 0) { > > + VHOST_LOG(ERR, "Failed to update rxq%d's intr\n", qid); > > + vq->intr_enable = old_intr_enable; > > + return ret; > > + } > > + > > ret = rte_vhost_get_vhost_vring(vq->vid, (qid << 1) + 1, &vring); > > if (ret < 0) { > > VHOST_LOG(ERR, "Failed to get rxq%d's vring\n", qid); @@ - > > 571,6 +632,8 @@ eth_rxq_intr_disable(struct rte_eth_dev *dev, uint16_t > qid) > > rte_vhost_enable_guest_notification(vq->vid, (qid << 1) + 1, 0); > > rte_wmb(); > > > > + vq->intr_enable = 0; > > + > > return 0; > > } > > > > @@ -593,7 +656,6 @@ eth_vhost_ins
Re: [dpdk-dev] [PATCH] net/bnxt: fix variable size of port id
Tested-by: Xiao, Qimai Regards, Xiao Qimai > -Original Message- > From: dev On Behalf Of Chenbo Xia > Sent: Wednesday, August 5, 2020 1:42 AM > To: dev@dpdk.org > Cc: ajit.khapa...@broadcom.com; somnath.ko...@broadcom.com; > kishore.padmana...@broadcom.com; > venkatkumar.duvv...@broadcom.com; sta...@dpdk.org > Subject: [dpdk-dev] [PATCH] net/bnxt: fix variable size of port id > > Currenly the variable size of ethdev port id is 8 bits. This patch > standarizes it > to 16 bits. > > Fixes: 769de16872ab ("net/bnxt: fix port default rule create/destroy") > Cc: sta...@dpdk.org > > Reported-by: Yinan Wang > Signed-off-by: Chenbo Xia > --- > drivers/net/bnxt/tf_ulp/ulp_def_rules.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c > b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c > index 9fb1a028f..ff5aed3d7 100644 > --- a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c > +++ b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c > @@ -397,7 +397,7 @@ void > bnxt_ulp_destroy_df_rules(struct bnxt *bp, bool global) { > struct bnxt_ulp_df_rule_info *info; > - uint8_t port_id; > + uint16_t port_id; > > if (!BNXT_TRUFLOW_EN(bp) || > BNXT_ETH_DEV_IS_REPRESENTOR(bp->eth_dev)) > -- > 2.17.1