From 7b53c036e6bf56623b8273018ff1c8cc62847857 Mon Sep 17 00:00:00 2001 From: Ricardo Salveti Date: Mon, 25 Jul 2016 13:22:22 -0300 Subject: Imported Upstream version 16.07-rc4 Change-Id: Ic57f6a3726f2dbd1682223648d91310f45705327 Signed-off-by: Ricardo Salveti --- drivers/net/bnx2x/bnx2x.c | 4 ++-- drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++-- drivers/net/ena/base/ena_com.c | 4 ++-- drivers/net/enic/enic_ethdev.c | 1 + drivers/net/enic/enic_main.c | 1 + drivers/net/enic/enic_rxtx.c | 1 + drivers/net/fm10k/fm10k_ethdev.c | 8 ++++---- drivers/net/i40e/i40e_ethdev.c | 16 ++++++++------- drivers/net/i40e/i40e_rxtx_vec.c | 2 +- drivers/net/ixgbe/base/ixgbe_osdep.h | 2 ++ drivers/net/virtio/virtio_ethdev.c | 6 +++--- drivers/net/virtio/virtio_rxtx.c | 35 +++++++++++++++++++++++---------- drivers/net/virtio/virtio_rxtx_simple.c | 13 ++++++------ drivers/net/virtio/virtio_user_ethdev.c | 6 +++--- drivers/net/virtio/virtqueue.h | 25 +++++++++++++++-------- 15 files changed, 80 insertions(+), 48 deletions(-) (limited to 'drivers') diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 95fbad8d..a49a07fb 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/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/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index c8d2bf2e..f3ab3550 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/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/drivers/net/ena/base/ena_com.c b/drivers/net/ena/base/ena_com.c index a3649d8b..88053e33 100644 --- a/drivers/net/ena/base/ena_com.c +++ b/drivers/net/ena/base/ena_com.c @@ -329,7 +329,7 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev, struct ena_com_io_sq *io_sq) { size_t size; - int dev_node; + int dev_node = 0; ENA_TOUCH(ctx); @@ -383,7 +383,7 @@ static int ena_com_init_io_cq(struct ena_com_dev *ena_dev, struct ena_com_io_cq *io_cq) { size_t size; - int prev_node; + int prev_node = 0; ENA_TOUCH(ctx); memset(&io_cq->cdesc_addr, 0x0, sizeof(struct ena_com_io_desc_addr)); diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 59082d2a..47b07c92 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/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/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 542f0952..b4ca3710 100644 --- a/drivers/net/enic/enic_main.c +++ b/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/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c index 845a8e66..50f0b287 100644 --- a/drivers/net/enic/enic_rxtx.c +++ b/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/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 144b2de8..01f4a72c 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/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/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 3f9f05ee..11a58041 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/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" @@ -2628,10 +2628,10 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) if (i40e_is_40G_device(hw->device_id)) /* For XL710 */ - dev_info->speed_capa = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G; + dev_info->speed_capa = ETH_LINK_SPEED_40G; else /* For X710 */ - dev_info->speed_capa = ETH_LINK_SPEED_10G | ETH_LINK_SPEED_40G; + dev_info->speed_capa = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G; } static int @@ -4094,6 +4094,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; @@ -4106,7 +4107,7 @@ 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); @@ -4115,7 +4116,7 @@ i40e_vsi_release(struct i40e_vsi *vsi) } 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); @@ -4124,7 +4125,7 @@ i40e_vsi_release(struct i40e_vsi *vsi) /* 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 && @@ -4682,6 +4683,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; @@ -4706,7 +4708,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/drivers/net/i40e/i40e_rxtx_vec.c b/drivers/net/i40e/i40e_rxtx_vec.c index 05cb415e..51fb282a 100644 --- a/drivers/net/i40e/i40e_rxtx_vec.c +++ b/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/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h index 31cc1bef..06d1ee1c 100644 --- a/drivers/net/ixgbe/base/ixgbe_osdep.h +++ b/drivers/net/ixgbe/base/ixgbe_osdep.h @@ -108,7 +108,9 @@ typedef int16_t s16; typedef uint32_t u32; typedef int32_t s32; typedef uint64_t u64; +#ifndef __cplusplus typedef int bool; +#endif #define mb() rte_mb() #define wmb() rte_wmb() diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 850e3ba5..07d64497 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/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/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index a27208e3..724517e2 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/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/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c index d8fcc15e..6517aa80 100644 --- a/drivers/net/virtio/virtio_rxtx_simple.c +++ b/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/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 6b4f66e9..daef09bd 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/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/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index 455aaafe..6737b81d 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/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 -- cgit 1.2.3-korg