From dceb010b01e9f8a0e9c905370d39f149f01cab7e Mon Sep 17 00:00:00 2001 From: Ido Barnea Date: Sun, 31 Jul 2016 11:16:27 +0300 Subject: dpdk 16.07 - merges of final version changes --- src/dpdk/README | 5 ++++ src/dpdk/drivers/net/bnx2x/bnx2x.c | 4 +-- src/dpdk/drivers/net/bnx2x/bnx2x_ethdev.c | 4 +-- src/dpdk/drivers/net/enic/enic_ethdev.c | 1 + src/dpdk/drivers/net/enic/enic_main.c | 1 + src/dpdk/drivers/net/enic/enic_rxtx.c | 1 + src/dpdk/drivers/net/fm10k/fm10k_ethdev.c | 8 ++--- src/dpdk/drivers/net/i40e/i40e_ethdev.c | 14 ++++----- src/dpdk/drivers/net/i40e/i40e_fdir.c | 3 +- src/dpdk/drivers/net/i40e/i40e_rxtx.c | 4 +-- src/dpdk/drivers/net/i40e/i40e_rxtx_vec.c | 2 +- src/dpdk/drivers/net/virtio/virtio_ethdev.c | 6 ++-- src/dpdk/drivers/net/virtio/virtio_rxtx.c | 35 +++++++++++++++------- src/dpdk/drivers/net/virtio/virtio_rxtx_simple.c | 13 ++++---- src/dpdk/drivers/net/virtio/virtio_user_ethdev.c | 6 ++-- src/dpdk/drivers/net/virtio/virtqueue.h | 25 +++++++++++----- .../lib/librte_eal/common/eal_common_memzone.c | 12 ++++---- .../lib/librte_eal/common/eal_common_options.c | 19 +++++++----- src/dpdk/lib/librte_eal/common/include/rte_tailq.h | 8 +++++ .../lib/librte_eal/common/include/rte_version.h | 4 +-- src/dpdk/lib/librte_eal/linuxapp/eal/eal_memory.c | 17 ++++++++--- src/dpdk/lib/librte_ether/rte_ethdev.c | 2 +- src/dpdk/lib/librte_ether/rte_ethdev.h | 13 ++++---- src/dpdk/lib/librte_mempool/rte_mempool.c | 3 +- src/dpdk/lib/librte_mempool/rte_mempool.h | 11 +++++-- src/dpdk/lib/librte_mempool/rte_mempool_ops.c | 1 + src/dpdk/lib/librte_ring/rte_ring.h | 12 ++++++-- 27 files changed, 153 insertions(+), 81 deletions(-) create mode 100644 src/dpdk/README diff --git a/src/dpdk/README b/src/dpdk/README new file mode 100644 index 00000000..23c55bef --- /dev/null +++ b/src/dpdk/README @@ -0,0 +1,5 @@ +We were based on v16.07-rc3 (608487f3fc96704271c624d0f3fe9d7fb2187aea - hash in DPDK repository) +We copied the files we needed here (a551c94a6069f30617825f9046d36099846ab7ec - This repository) +Changes we did to DPDK files are in 8b0119ed99f893106a560ccb9db31c99e1d293eb +Then took tag v16.07 (20e2b6eba13d9eb61b23ea75f09f2aa966fa6325 - in DPDK repo) +merged it to our repository diff --git a/src/dpdk/drivers/net/bnx2x/bnx2x.c b/src/dpdk/drivers/net/bnx2x/bnx2x.c index 95fbad8d..a49a07fb 100644 --- a/src/dpdk/drivers/net/bnx2x/bnx2x.c +++ b/src/dpdk/drivers/net/bnx2x/bnx2x.c @@ -4507,7 +4507,7 @@ static void bnx2x_handle_fp_tq(struct bnx2x_fastpath *fp, int scan_fp) } bnx2x_ack_sb(sc, fp->igu_sb_id, USTORM_ID, - le16toh(fp->fp_hc_idx), IGU_INT_ENABLE, 1); + le16toh(fp->fp_hc_idx), IGU_INT_DISABLE, 1); } /* @@ -8886,7 +8886,7 @@ int bnx2x_alloc_hsi_mem(struct bnx2x_softc *sc) /***************************/ if (bnx2x_dma_alloc(sc, FW_BUF_SIZE, &sc->gz_buf_dma, - "fw_dec_buf", RTE_CACHE_LINE_SIZE) != 0) { + "fw_buf", RTE_CACHE_LINE_SIZE) != 0) { sc->spq = NULL; sc->sp = NULL; sc->eq = NULL; diff --git a/src/dpdk/drivers/net/bnx2x/bnx2x_ethdev.c b/src/dpdk/drivers/net/bnx2x/bnx2x_ethdev.c index c8d2bf2e..f3ab3550 100644 --- a/src/dpdk/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/src/dpdk/drivers/net/bnx2x/bnx2x_ethdev.c @@ -107,8 +107,8 @@ bnx2x_interrupt_action(struct rte_eth_dev *dev) PMD_DEBUG_PERIODIC_LOG(INFO, "Interrupt handled"); - if (bnx2x_intr_legacy(sc, 0)) - DELAY_MS(250); + bnx2x_intr_legacy(sc, 0); + if (sc->periodic_flags & PERIODIC_GO) bnx2x_periodic_callout(sc); link_status = REG_RD(sc, sc->link_params.shmem_base + diff --git a/src/dpdk/drivers/net/enic/enic_ethdev.c b/src/dpdk/drivers/net/enic/enic_ethdev.c index 59082d2a..47b07c92 100644 --- a/src/dpdk/drivers/net/enic/enic_ethdev.c +++ b/src/dpdk/drivers/net/enic/enic_ethdev.c @@ -356,6 +356,7 @@ static int enicpmd_dev_configure(struct rte_eth_dev *eth_dev) eth_dev->data->dev_conf.rxmode.split_hdr_size); } + enicpmd_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK); enic->hw_ip_checksum = eth_dev->data->dev_conf.rxmode.hw_ip_checksum; return 0; } diff --git a/src/dpdk/drivers/net/enic/enic_main.c b/src/dpdk/drivers/net/enic/enic_main.c index 542f0952..b4ca3710 100644 --- a/src/dpdk/drivers/net/enic/enic_main.c +++ b/src/dpdk/drivers/net/enic/enic_main.c @@ -317,6 +317,7 @@ enic_alloc_rx_queue_mbufs(struct enic *enic, struct vnic_rq *rq) return -ENOMEM; } + mb->data_off = RTE_PKTMBUF_HEADROOM; dma_addr = (dma_addr_t)(mb->buf_physaddr + RTE_PKTMBUF_HEADROOM); rq_enet_desc_enc(rqd, dma_addr, diff --git a/src/dpdk/drivers/net/enic/enic_rxtx.c b/src/dpdk/drivers/net/enic/enic_rxtx.c index 845a8e66..50f0b287 100644 --- a/src/dpdk/drivers/net/enic/enic_rxtx.c +++ b/src/dpdk/drivers/net/enic/enic_rxtx.c @@ -300,6 +300,7 @@ enic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, (struct cq_enet_rq_desc *)&cqd); /* Push descriptor for newly allocated mbuf */ + nmb->data_off = RTE_PKTMBUF_HEADROOM; dma_addr = (dma_addr_t)(nmb->buf_physaddr + RTE_PKTMBUF_HEADROOM); rq_enet_desc_enc(rqd_ptr, dma_addr, diff --git a/src/dpdk/drivers/net/fm10k/fm10k_ethdev.c b/src/dpdk/drivers/net/fm10k/fm10k_ethdev.c index 144b2de8..01f4a72c 100644 --- a/src/dpdk/drivers/net/fm10k/fm10k_ethdev.c +++ b/src/dpdk/drivers/net/fm10k/fm10k_ethdev.c @@ -2159,8 +2159,8 @@ fm10k_rss_hash_update(struct rte_eth_dev *dev, PMD_INIT_FUNC_TRACE(); - if (rss_conf->rss_key_len < FM10K_RSSRK_SIZE * - FM10K_RSSRK_ENTRIES_PER_REG) + if (key && (rss_conf->rss_key_len < FM10K_RSSRK_SIZE * + FM10K_RSSRK_ENTRIES_PER_REG)) return -EINVAL; if (hf == 0) @@ -2202,8 +2202,8 @@ fm10k_rss_hash_conf_get(struct rte_eth_dev *dev, PMD_INIT_FUNC_TRACE(); - if (rss_conf->rss_key_len < FM10K_RSSRK_SIZE * - FM10K_RSSRK_ENTRIES_PER_REG) + if (key && (rss_conf->rss_key_len < FM10K_RSSRK_SIZE * + FM10K_RSSRK_ENTRIES_PER_REG)) return -EINVAL; if (key != NULL) diff --git a/src/dpdk/drivers/net/i40e/i40e_ethdev.c b/src/dpdk/drivers/net/i40e/i40e_ethdev.c index 94b8cb7d..2ee9326e 100644 --- a/src/dpdk/drivers/net/i40e/i40e_ethdev.c +++ b/src/dpdk/drivers/net/i40e/i40e_ethdev.c @@ -31,7 +31,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include #include @@ -51,6 +50,7 @@ #include #include #include +#include #include "i40e_logs.h" #include "base/i40e_prototype.h" @@ -4206,6 +4206,7 @@ i40e_vsi_release(struct i40e_vsi *vsi) struct i40e_pf *pf; struct i40e_hw *hw; struct i40e_vsi_list *vsi_list; + void *temp; int ret; struct i40e_mac_filter *f; uint16_t user_param = vsi->user_param; @@ -4218,25 +4219,23 @@ i40e_vsi_release(struct i40e_vsi *vsi) /* VSI has child to attach, release child first */ if (vsi->veb) { - TAILQ_FOREACH(vsi_list, &vsi->veb->head, list) { + TAILQ_FOREACH_SAFE(vsi_list, &vsi->veb->head, list, temp) { if (i40e_vsi_release(vsi_list->vsi) != I40E_SUCCESS) return -1; - TAILQ_REMOVE(&vsi->veb->head, vsi_list, list); } i40e_veb_release(vsi->veb); } if (vsi->floating_veb) { - TAILQ_FOREACH(vsi_list, &vsi->floating_veb->head, list) { + TAILQ_FOREACH_SAFE(vsi_list, &vsi->floating_veb->head, list, temp) { if (i40e_vsi_release(vsi_list->vsi) != I40E_SUCCESS) return -1; - TAILQ_REMOVE(&vsi->floating_veb->head, vsi_list, list); } } /* Remove all macvlan filters of the VSI */ i40e_vsi_remove_all_macvlan_filter(vsi); - TAILQ_FOREACH(f, &vsi->mac_list, next) + TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) rte_free(f); if (vsi->type != I40E_VSI_MAIN && @@ -4818,6 +4817,7 @@ i40e_vsi_config_vlan_filter(struct i40e_vsi *vsi, bool on) { int i, num; struct i40e_mac_filter *f; + void *temp; struct i40e_mac_filter_info *mac_filter; enum rte_mac_filter_type desired_filter; int ret = I40E_SUCCESS; @@ -4842,7 +4842,7 @@ i40e_vsi_config_vlan_filter(struct i40e_vsi *vsi, bool on) i = 0; /* Remove all existing mac */ - TAILQ_FOREACH(f, &vsi->mac_list, next) { + TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) { mac_filter[i] = f->mac_info; ret = i40e_vsi_delete_mac(vsi, &f->mac_info.mac_addr); if (ret) { diff --git a/src/dpdk/drivers/net/i40e/i40e_fdir.c b/src/dpdk/drivers/net/i40e/i40e_fdir.c index 4f9a6b48..990937ec 100644 --- a/src/dpdk/drivers/net/i40e/i40e_fdir.c +++ b/src/dpdk/drivers/net/i40e/i40e_fdir.c @@ -1152,7 +1152,8 @@ i40e_fdir_filter_programming(struct i40e_pf *pf, #ifdef TREX_PATCH rte_cpu_to_le_32((fdir_action->stat_count_index << #else - rte_cpu_to_le_32((pf->fdir.match_counter_index << + rte_cpu_to_le_32( + ((uint32_t)pf->fdir.match_counter_index << #endif I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) & I40E_TXD_FLTR_QW1_CNTINDEX_MASK); diff --git a/src/dpdk/drivers/net/i40e/i40e_rxtx.c b/src/dpdk/drivers/net/i40e/i40e_rxtx.c index a6488898..444e8c0b 100644 --- a/src/dpdk/drivers/net/i40e/i40e_rxtx.c +++ b/src/dpdk/drivers/net/i40e/i40e_rxtx.c @@ -1436,10 +1436,10 @@ i40e_recv_scattered_pkts(void *rx_queue, i40e_rxd_pkt_type_mapping((uint8_t)((qword1 & I40E_RXD_QW1_PTYPE_MASK) >> I40E_RXD_QW1_PTYPE_SHIFT)); if (pkt_flags & PKT_RX_RSS_HASH) - rxm->hash.rss = + first_seg->hash.rss = rte_le_to_cpu_32(rxd.wb.qword0.hi_dword.rss); if (pkt_flags & PKT_RX_FDIR) - pkt_flags |= i40e_rxd_build_fdir(&rxd, rxm); + pkt_flags |= i40e_rxd_build_fdir(&rxd, first_seg); #ifdef RTE_LIBRTE_IEEE1588 pkt_flags |= i40e_get_iee15888_flags(first_seg, qword1); diff --git a/src/dpdk/drivers/net/i40e/i40e_rxtx_vec.c b/src/dpdk/drivers/net/i40e/i40e_rxtx_vec.c index 05cb415e..51fb282a 100644 --- a/src/dpdk/drivers/net/i40e/i40e_rxtx_vec.c +++ b/src/dpdk/drivers/net/i40e/i40e_rxtx_vec.c @@ -269,7 +269,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts, * D. fill info. from desc to mbuf */ - for (pos = 0, nb_pkts_recd = 0; pos < RTE_I40E_VPMD_RX_BURST; + for (pos = 0, nb_pkts_recd = 0; pos < nb_pkts; pos += RTE_I40E_DESCS_PER_LOOP, rxdp += RTE_I40E_DESCS_PER_LOOP) { __m128i descs[RTE_I40E_DESCS_PER_LOOP]; diff --git a/src/dpdk/drivers/net/virtio/virtio_ethdev.c b/src/dpdk/drivers/net/virtio/virtio_ethdev.c index 850e3ba5..07d64497 100644 --- a/src/dpdk/drivers/net/virtio/virtio_ethdev.c +++ b/src/dpdk/drivers/net/virtio/virtio_ethdev.c @@ -452,9 +452,9 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev, *pvq = cvq; } - /* For virtio-user case (that is when dev->pci_dev is NULL), we use + /* For virtio_user case (that is when dev->pci_dev is NULL), we use * virtual address. And we need properly set _offset_, please see - * MBUF_DATA_DMA_ADDR in virtqueue.h for more information. + * VIRTIO_MBUF_DATA_DMA_ADDR in virtqueue.h for more information. */ if (dev->pci_dev) vq->offset = offsetof(struct rte_mbuf, buf_physaddr); @@ -1541,7 +1541,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) if (dev->pci_dev) dev_info->driver_name = dev->driver->pci_drv.name; else - dev_info->driver_name = "virtio-user PMD"; + dev_info->driver_name = "virtio_user PMD"; dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues; dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues; dev_info->min_rx_bufsize = VIRTIO_MIN_RX_BUFSIZE; diff --git a/src/dpdk/drivers/net/virtio/virtio_rxtx.c b/src/dpdk/drivers/net/virtio/virtio_rxtx.c index a27208e3..724517e2 100644 --- a/src/dpdk/drivers/net/virtio/virtio_rxtx.c +++ b/src/dpdk/drivers/net/virtio/virtio_rxtx.c @@ -193,7 +193,8 @@ virtqueue_enqueue_recv_refill(struct virtqueue *vq, struct rte_mbuf *cookie) start_dp = vq->vq_ring.desc; start_dp[idx].addr = - MBUF_DATA_DMA_ADDR(cookie, vq->offset) - hw->vtnet_hdr_size; + VIRTIO_MBUF_ADDR(cookie, vq) + + RTE_PKTMBUF_HEADROOM - hw->vtnet_hdr_size; start_dp[idx].len = cookie->buf_len - RTE_PKTMBUF_HEADROOM + hw->vtnet_hdr_size; start_dp[idx].flags = VRING_DESC_F_WRITE; @@ -265,7 +266,7 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie, } do { - start_dp[idx].addr = MBUF_DATA_DMA_ADDR(cookie, vq->offset); + start_dp[idx].addr = VIRTIO_MBUF_DATA_DMA_ADDR(cookie, vq); start_dp[idx].len = cookie->data_len; start_dp[idx].flags = cookie->next ? VRING_DESC_F_NEXT : 0; idx = start_dp[idx].next; @@ -467,13 +468,19 @@ void virtio_dev_rx_queue_release(void *rxq) { struct virtnet_rx *rxvq = rxq; - struct virtqueue *vq = rxvq->vq; - /* rxvq is freed when vq is freed, and as mz should be freed after the + struct virtqueue *vq; + const struct rte_memzone *mz; + + if (rxvq == NULL) + return; + + /* + * rxvq is freed when vq is freed, and as mz should be freed after the * del_queue, so we reserve the mz pointer first. */ - const struct rte_memzone *mz = rxvq->mz; + vq = rxvq->vq; + mz = rxvq->mz; - /* no need to free rxq as vq and rxq are allocated together */ virtio_dev_queue_release(vq); rte_memzone_free(mz); } @@ -553,12 +560,20 @@ void virtio_dev_tx_queue_release(void *txq) { struct virtnet_tx *txvq = txq; - struct virtqueue *vq = txvq->vq; - /* txvq is freed when vq is freed, and as mz should be freed after the + struct virtqueue *vq; + const struct rte_memzone *mz; + const struct rte_memzone *hdr_mz; + + if (txvq == NULL) + return; + + /* + * txvq is freed when vq is freed, and as mz should be freed after the * del_queue, so we reserve the mz pointer first. */ - const struct rte_memzone *hdr_mz = txvq->virtio_net_hdr_mz; - const struct rte_memzone *mz = txvq->mz; + vq = txvq->vq; + mz = txvq->mz; + hdr_mz = txvq->virtio_net_hdr_mz; virtio_dev_queue_release(vq); rte_memzone_free(mz); diff --git a/src/dpdk/drivers/net/virtio/virtio_rxtx_simple.c b/src/dpdk/drivers/net/virtio/virtio_rxtx_simple.c index d8fcc15e..6517aa80 100644 --- a/src/dpdk/drivers/net/virtio/virtio_rxtx_simple.c +++ b/src/dpdk/drivers/net/virtio/virtio_rxtx_simple.c @@ -80,8 +80,9 @@ virtqueue_enqueue_recv_refill_simple(struct virtqueue *vq, vq->sw_ring[desc_idx] = cookie; start_dp = vq->vq_ring.desc; - start_dp[desc_idx].addr = MBUF_DATA_DMA_ADDR(cookie, vq->offset) - - vq->hw->vtnet_hdr_size; + start_dp[desc_idx].addr = + VIRTIO_MBUF_ADDR(cookie, vq) + + RTE_PKTMBUF_HEADROOM - vq->hw->vtnet_hdr_size; start_dp[desc_idx].len = cookie->buf_len - RTE_PKTMBUF_HEADROOM + vq->hw->vtnet_hdr_size; @@ -120,8 +121,8 @@ virtio_rxq_rearm_vec(struct virtnet_rx *rxvq) *(uint64_t *)p = rxvq->mbuf_initializer; start_dp[i].addr = - MBUF_DATA_DMA_ADDR(sw_ring[i], vq->offset) - - vq->hw->vtnet_hdr_size; + VIRTIO_MBUF_ADDR(sw_ring[i], vq) + + RTE_PKTMBUF_HEADROOM - vq->hw->vtnet_hdr_size; start_dp[i].len = sw_ring[i]->buf_len - RTE_PKTMBUF_HEADROOM + vq->hw->vtnet_hdr_size; } @@ -371,7 +372,7 @@ virtio_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts, vq->vq_descx[desc_idx + i].cookie = tx_pkts[i]; for (i = 0; i < nb_tail; i++) { start_dp[desc_idx].addr = - MBUF_DATA_DMA_ADDR(*tx_pkts, vq->offset); + VIRTIO_MBUF_DATA_DMA_ADDR(*tx_pkts, vq); start_dp[desc_idx].len = (*tx_pkts)->pkt_len; tx_pkts++; desc_idx++; @@ -383,7 +384,7 @@ virtio_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts, vq->vq_descx[desc_idx + i].cookie = tx_pkts[i]; for (i = 0; i < nb_commit; i++) { start_dp[desc_idx].addr = - MBUF_DATA_DMA_ADDR(*tx_pkts, vq->offset); + VIRTIO_MBUF_DATA_DMA_ADDR(*tx_pkts, vq); start_dp[desc_idx].len = (*tx_pkts)->pkt_len; tx_pkts++; desc_idx++; diff --git a/src/dpdk/drivers/net/virtio/virtio_user_ethdev.c b/src/dpdk/drivers/net/virtio/virtio_user_ethdev.c index 6b4f66e9..daef09bd 100644 --- a/src/dpdk/drivers/net/virtio/virtio_user_ethdev.c +++ b/src/dpdk/drivers/net/virtio/virtio_user_ethdev.c @@ -331,7 +331,7 @@ virtio_user_pmd_devinit(const char *name, const char *params) int ret = -1; if (!params || params[0] == '\0') { - PMD_INIT_LOG(ERR, "arg %s is mandatory for virtio-user", + PMD_INIT_LOG(ERR, "arg %s is mandatory for virtio_user", VIRTIO_USER_ARG_QUEUE_SIZE); goto end; } @@ -351,7 +351,7 @@ virtio_user_pmd_devinit(const char *name, const char *params) goto end; } } else { - PMD_INIT_LOG(ERR, "arg %s is mandatory for virtio-user\n", + PMD_INIT_LOG(ERR, "arg %s is mandatory for virtio_user\n", VIRTIO_USER_ARG_QUEUE_SIZE); goto end; } @@ -405,7 +405,7 @@ virtio_user_pmd_devinit(const char *name, const char *params) eth_dev = virtio_user_eth_dev_alloc(name); if (!eth_dev) { - PMD_INIT_LOG(ERR, "virtio-user fails to alloc device"); + PMD_INIT_LOG(ERR, "virtio_user fails to alloc device"); goto end; } diff --git a/src/dpdk/drivers/net/virtio/virtqueue.h b/src/dpdk/drivers/net/virtio/virtqueue.h index 455aaafe..6737b81d 100644 --- a/src/dpdk/drivers/net/virtio/virtqueue.h +++ b/src/dpdk/drivers/net/virtio/virtqueue.h @@ -67,12 +67,21 @@ struct rte_mbuf; #define VIRTQUEUE_MAX_NAME_SZ 32 #ifdef RTE_VIRTIO_USER -#define MBUF_DATA_DMA_ADDR(mb, offset) \ - ((uint64_t)((uintptr_t)(*(void **)((uintptr_t)mb + offset)) \ - + (mb)->data_off)) -#else /* RTE_VIRTIO_USER */ -#define MBUF_DATA_DMA_ADDR(mb, offset) rte_mbuf_data_dma_addr(mb) -#endif /* RTE_VIRTIO_USER */ +/** + * Return the physical address (or virtual address in case of + * virtio-user) of mbuf data buffer. + */ +#define VIRTIO_MBUF_ADDR(mb, vq) (*(uint64_t *)((uintptr_t)(mb) + (vq)->offset)) +#else +#define VIRTIO_MBUF_ADDR(mb, vq) ((mb)->buf_physaddr) +#endif + +/** + * Return the physical address (or virtual address in case of + * virtio-user) of mbuf data buffer, taking care of mbuf data offset + */ +#define VIRTIO_MBUF_DATA_DMA_ADDR(mb, vq) \ + (VIRTIO_MBUF_ADDR(mb, vq) + (mb)->data_off) #define VTNET_SQ_RQ_QUEUE_IDX 0 #define VTNET_SQ_TQ_QUEUE_IDX 1 @@ -182,8 +191,8 @@ struct virtqueue { void *vq_ring_virt_mem; /**< linear address of vring*/ unsigned int vq_ring_size; - phys_addr_t vq_ring_mem; /**< physical address of vring */ - /**< use virtual address for virtio-user. */ + phys_addr_t vq_ring_mem; /**< physical address of vring, + * or virtual address for virtio_user. */ /** * Head of the free chain in the descriptor table. If diff --git a/src/dpdk/lib/librte_eal/common/eal_common_memzone.c b/src/dpdk/lib/librte_eal/common/eal_common_memzone.c index 5d28341f..1bd0a33d 100644 --- a/src/dpdk/lib/librte_eal/common/eal_common_memzone.c +++ b/src/dpdk/lib/librte_eal/common/eal_common_memzone.c @@ -144,16 +144,16 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len, return NULL; } - /* zone already exist */ - if ((memzone_lookup_thread_unsafe(name)) != NULL) { - RTE_LOG(DEBUG, EAL, "%s(): memzone <%s> already exists\n", + if (strlen(name) > sizeof(mz->name) - 1) { + RTE_LOG(DEBUG, EAL, "%s(): memzone <%s>: name too long\n", __func__, name); - rte_errno = EEXIST; + rte_errno = ENAMETOOLONG; return NULL; } - if (strlen(name) >= sizeof(mz->name) - 1) { - RTE_LOG(DEBUG, EAL, "%s(): memzone <%s>: name too long\n", + /* zone already exist */ + if ((memzone_lookup_thread_unsafe(name)) != NULL) { + RTE_LOG(DEBUG, EAL, "%s(): memzone <%s> already exists\n", __func__, name); rte_errno = EEXIST; return NULL; diff --git a/src/dpdk/lib/librte_eal/common/eal_common_options.c b/src/dpdk/lib/librte_eal/common/eal_common_options.c index 0a594d7f..1a1bab36 100644 --- a/src/dpdk/lib/librte_eal/common/eal_common_options.c +++ b/src/dpdk/lib/librte_eal/common/eal_common_options.c @@ -116,9 +116,9 @@ TAILQ_HEAD_INITIALIZER(solib_list); static const char *default_solib_dir = RTE_EAL_PMD_PATH; /* - * Stringified version of solib path used by pmdinfo.py + * Stringified version of solib path used by dpdk-pmdinfo.py * Note: PLEASE DO NOT ALTER THIS without making a corresponding - * change to tools/pmdinfo.py + * change to tools/dpdk-pmdinfo.py */ static const char dpdk_solib_path[] __attribute__((used)) = "DPDK_PLUGIN_PATH=" RTE_EAL_PMD_PATH; @@ -530,6 +530,13 @@ eal_parse_set(const char *input, uint16_t set[], unsigned num) str = end + 1; } while (*end != '\0' && *end != ')'); + /* + * to avoid failure that tail blank makes end character check fail + * in eal_parse_lcores( ) + */ + while (isblank(*str)) + str++; + return str - input; } @@ -578,13 +585,12 @@ eal_parse_lcores(const char *lcores) struct rte_config *cfg = rte_eal_get_configuration(); static uint16_t set[RTE_MAX_LCORE]; unsigned idx = 0; - int i; unsigned count = 0; const char *lcore_start = NULL; const char *end = NULL; int offset; rte_cpuset_t cpuset; - int lflags = 0; + int lflags; int ret = -1; if (lcores == NULL) @@ -593,9 +599,6 @@ eal_parse_lcores(const char *lcores) /* Remove all blank characters ahead and after */ while (isblank(*lcores)) lcores++; - i = strlen(lcores); - while ((i > 0) && isblank(lcores[i - 1])) - i--; CPU_ZERO(&cpuset); @@ -613,6 +616,8 @@ eal_parse_lcores(const char *lcores) if (*lcores == '\0') goto err; + lflags = 0; + /* record lcore_set start point */ lcore_start = lcores; diff --git a/src/dpdk/lib/librte_eal/common/include/rte_tailq.h b/src/dpdk/lib/librte_eal/common/include/rte_tailq.h index 4a686e68..cc3c0f1d 100644 --- a/src/dpdk/lib/librte_eal/common/include/rte_tailq.h +++ b/src/dpdk/lib/librte_eal/common/include/rte_tailq.h @@ -155,6 +155,14 @@ void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \ rte_panic("Cannot initialize tailq: %s\n", t.name); \ } +/* This macro permits both remove and free var within the loop safely.*/ +#ifndef TAILQ_FOREACH_SAFE +#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = TAILQ_FIRST((head)); \ + (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ + (var) = (tvar)) +#endif + #ifdef __cplusplus } #endif diff --git a/src/dpdk/lib/librte_eal/common/include/rte_version.h b/src/dpdk/lib/librte_eal/common/include/rte_version.h index eacc86c1..615deb7f 100644 --- a/src/dpdk/lib/librte_eal/common/include/rte_version.h +++ b/src/dpdk/lib/librte_eal/common/include/rte_version.h @@ -70,14 +70,14 @@ extern "C" { /** * Extra string to be appended to version number */ -#define RTE_VER_SUFFIX "-rc" +#define RTE_VER_SUFFIX "" /** * Patch release number * 0-15 = release candidates * 16 = release */ -#define RTE_VER_RELEASE 3 +#define RTE_VER_RELEASE 16 /** * Macro to compute a version number usable for comparisons diff --git a/src/dpdk/lib/librte_eal/linuxapp/eal/eal_memory.c b/src/dpdk/lib/librte_eal/linuxapp/eal/eal_memory.c index 42a29faf..41e0a928 100644 --- a/src/dpdk/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/src/dpdk/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -99,6 +99,8 @@ #include "eal_filesystem.h" #include "eal_hugepages.h" +#define PFN_MASK_SIZE 8 + #ifdef RTE_LIBRTE_XEN_DOM0 int rte_xen_dom0_supported(void) { @@ -158,7 +160,7 @@ rte_mem_lock_page(const void *virt) phys_addr_t rte_mem_virt2phy(const void *virtaddr) { - int fd; + int fd, retval; uint64_t page, physaddr; unsigned long virt_pfn; int page_size; @@ -209,10 +211,17 @@ rte_mem_virt2phy(const void *virtaddr) close(fd); return RTE_BAD_PHYS_ADDR; } - if (read(fd, &page, sizeof(uint64_t)) < 0) { + + retval = read(fd, &page, PFN_MASK_SIZE); + close(fd); + if (retval < 0) { RTE_LOG(ERR, EAL, "%s(): cannot read /proc/self/pagemap: %s\n", __func__, strerror(errno)); - close(fd); + return RTE_BAD_PHYS_ADDR; + } else if (retval != PFN_MASK_SIZE) { + RTE_LOG(ERR, EAL, "%s(): read %d bytes from /proc/self/pagemap " + "but expected %d:\n", + __func__, retval, PFN_MASK_SIZE); return RTE_BAD_PHYS_ADDR; } @@ -222,7 +231,7 @@ rte_mem_virt2phy(const void *virtaddr) */ physaddr = ((page & 0x7fffffffffffffULL) * page_size) + ((unsigned long)virtaddr % page_size); - close(fd); + return physaddr; } diff --git a/src/dpdk/lib/librte_ether/rte_ethdev.c b/src/dpdk/lib/librte_ether/rte_ethdev.c index 47ea4696..9e30438c 100644 --- a/src/dpdk/lib/librte_ether/rte_ethdev.c +++ b/src/dpdk/lib/librte_ether/rte_ethdev.c @@ -1524,8 +1524,8 @@ rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats) memset(stats, 0, sizeof(*stats)); RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP); - (*dev->dev_ops->stats_get)(dev, stats); stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed; + (*dev->dev_ops->stats_get)(dev, stats); return 0; } diff --git a/src/dpdk/lib/librte_ether/rte_ethdev.h b/src/dpdk/lib/librte_ether/rte_ethdev.h index 6c99c88b..5339d3be 100644 --- a/src/dpdk/lib/librte_ether/rte_ethdev.h +++ b/src/dpdk/lib/librte_ether/rte_ethdev.h @@ -2044,9 +2044,8 @@ int rte_eth_dev_socket_id(uint8_t port_id); int rte_eth_dev_is_valid_port(uint8_t port_id); /** - * Allocate mbuf from mempool, setup the DMA physical address - * and then start RX for specified queue of a port. It is used - * when rx_deferred_start flag of the specified queue is true. + * Start specified RX queue of a port. It is used when rx_deferred_start + * flag of the specified queue is true. * * @param port_id * The port identifier of the Ethernet device @@ -2055,7 +2054,7 @@ int rte_eth_dev_is_valid_port(uint8_t port_id); * The value must be in the range [0, nb_rx_queue - 1] previously supplied * to rte_eth_dev_configure(). * @return - * - 0: Success, the transmit queue is correctly set up. + * - 0: Success, the receive queue is started. * - -EINVAL: The port_id or the queue_id out of range. * - -ENOTSUP: The function not supported in PMD driver. */ @@ -2071,7 +2070,7 @@ int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id); * The value must be in the range [0, nb_rx_queue - 1] previously supplied * to rte_eth_dev_configure(). * @return - * - 0: Success, the transmit queue is correctly set up. + * - 0: Success, the receive queue is stopped. * - -EINVAL: The port_id or the queue_id out of range. * - -ENOTSUP: The function not supported in PMD driver. */ @@ -2088,7 +2087,7 @@ int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id); * The value must be in the range [0, nb_tx_queue - 1] previously supplied * to rte_eth_dev_configure(). * @return - * - 0: Success, the transmit queue is correctly set up. + * - 0: Success, the transmit queue is started. * - -EINVAL: The port_id or the queue_id out of range. * - -ENOTSUP: The function not supported in PMD driver. */ @@ -2104,7 +2103,7 @@ int rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id); * The value must be in the range [0, nb_tx_queue - 1] previously supplied * to rte_eth_dev_configure(). * @return - * - 0: Success, the transmit queue is correctly set up. + * - 0: Success, the transmit queue is stopped. * - -EINVAL: The port_id or the queue_id out of range. * - -ENOTSUP: The function not supported in PMD driver. */ diff --git a/src/dpdk/lib/librte_mempool/rte_mempool.c b/src/dpdk/lib/librte_mempool/rte_mempool.c index 8806633b..2e28e2e8 100644 --- a/src/dpdk/lib/librte_mempool/rte_mempool.c +++ b/src/dpdk/lib/librte_mempool/rte_mempool.c @@ -1283,12 +1283,13 @@ void rte_mempool_walk(void (*func)(struct rte_mempool *, void *), { struct rte_tailq_entry *te = NULL; struct rte_mempool_list *mempool_list; + void *tmp_te; mempool_list = RTE_TAILQ_CAST(rte_mempool_tailq.head, rte_mempool_list); rte_rwlock_read_lock(RTE_EAL_MEMPOOL_RWLOCK); - TAILQ_FOREACH(te, mempool_list, next) { + TAILQ_FOREACH_SAFE(te, mempool_list, next, tmp_te) { (*func)((struct rte_mempool *) te->data, arg); } diff --git a/src/dpdk/lib/librte_mempool/rte_mempool.h b/src/dpdk/lib/librte_mempool/rte_mempool.h index 4a8fbb1e..059ad9e5 100644 --- a/src/dpdk/lib/librte_mempool/rte_mempool.h +++ b/src/dpdk/lib/librte_mempool/rte_mempool.h @@ -123,7 +123,9 @@ struct rte_mempool_objsz { /**< Total size of an object (header + elt + trailer). */ }; -#define RTE_MEMPOOL_NAMESIZE 32 /**< Maximum length of a memory pool. */ +/**< Maximum length of a memory pool's name. */ +#define RTE_MEMPOOL_NAMESIZE (RTE_RING_NAMESIZE - \ + sizeof(RTE_MEMPOOL_MZ_PREFIX) + 1) #define RTE_MEMPOOL_MZ_PREFIX "MP_" /* "MP_" */ @@ -208,7 +210,12 @@ struct rte_mempool_memhdr { * The RTE mempool structure. */ struct rte_mempool { - char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */ + /* + * Note: this field kept the RTE_MEMZONE_NAMESIZE size due to ABI + * compatibility requirements, it could be changed to + * RTE_MEMPOOL_NAMESIZE next time the ABI changes + */ + char name[RTE_MEMZONE_NAMESIZE]; /**< Name of mempool. */ union { void *pool_data; /**< Ring or pool to store objects. */ uint64_t pool_id; /**< External mempool identifier. */ diff --git a/src/dpdk/lib/librte_mempool/rte_mempool_ops.c b/src/dpdk/lib/librte_mempool/rte_mempool_ops.c index fd0b64cf..5f24de25 100644 --- a/src/dpdk/lib/librte_mempool/rte_mempool_ops.c +++ b/src/dpdk/lib/librte_mempool/rte_mempool_ops.c @@ -81,6 +81,7 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h) ops = &rte_mempool_ops_table.ops[ops_index]; snprintf(ops->name, sizeof(ops->name), "%s", h->name); ops->alloc = h->alloc; + ops->free = h->free; ops->enqueue = h->enqueue; ops->dequeue = h->dequeue; ops->get_count = h->get_count; diff --git a/src/dpdk/lib/librte_ring/rte_ring.h b/src/dpdk/lib/librte_ring/rte_ring.h index eb45e414..0e22e694 100644 --- a/src/dpdk/lib/librte_ring/rte_ring.h +++ b/src/dpdk/lib/librte_ring/rte_ring.h @@ -100,6 +100,7 @@ extern "C" { #include #include #include +#include #define RTE_TAILQ_RING_NAME "RTE_RING" @@ -126,8 +127,10 @@ struct rte_ring_debug_stats { } __rte_cache_aligned; #endif -#define RTE_RING_NAMESIZE 32 /**< The maximum length of a ring name. */ #define RTE_RING_MZ_PREFIX "RG_" +/**< The maximum length of a ring name. */ +#define RTE_RING_NAMESIZE (RTE_MEMZONE_NAMESIZE - \ + sizeof(RTE_RING_MZ_PREFIX) + 1) #ifndef RTE_RING_PAUSE_REP_COUNT #define RTE_RING_PAUSE_REP_COUNT 0 /**< Yield after pause num of times, no yield @@ -147,7 +150,12 @@ struct rte_memzone; /* forward declaration, so as not to require memzone.h */ * a problem. */ struct rte_ring { - char name[RTE_RING_NAMESIZE]; /**< Name of the ring. */ + /* + * Note: this field kept the RTE_MEMZONE_NAMESIZE size due to ABI + * compatibility requirements, it could be changed to RTE_RING_NAMESIZE + * next time the ABI changes + */ + char name[RTE_MEMZONE_NAMESIZE]; /**< Name of the ring. */ int flags; /**< Flags supplied at creation. */ const struct rte_memzone *memzone; /**< Memzone, if any, containing the rte_ring */ -- cgit 1.2.3-korg