get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/66645/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 66645,
    "url": "http://patches.dpdk.org/api/patches/66645/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200313174230.74661-4-yong.liu@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20200313174230.74661-4-yong.liu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200313174230.74661-4-yong.liu@intel.com",
    "date": "2020-03-13T17:42:26",
    "name": "[v1,3/7] net/virtio: add vectorized packed ring Rx function",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "1204ffe8c40ce1460619302c60b6c6613db607cd",
    "submitter": {
        "id": 17,
        "url": "http://patches.dpdk.org/api/people/17/?format=api",
        "name": "Marvin Liu",
        "email": "yong.liu@intel.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200313174230.74661-4-yong.liu@intel.com/mbox/",
    "series": [
        {
            "id": 8904,
            "url": "http://patches.dpdk.org/api/series/8904/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8904",
            "date": "2020-03-13T17:42:23",
            "name": "vectorize virtio packed ring datapath",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/8904/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/66645/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/66645/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id B6771A0567;\n\tFri, 13 Mar 2020 11:07:49 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id C2E7B1C06D;\n\tFri, 13 Mar 2020 11:07:31 +0100 (CET)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by dpdk.org (Postfix) with ESMTP id 1C5E41C066\n for <dev@dpdk.org>; Fri, 13 Mar 2020 11:07:28 +0100 (CET)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n 13 Mar 2020 03:07:28 -0700",
            "from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.58])\n by orsmga006.jf.intel.com with ESMTP; 13 Mar 2020 03:07:26 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.70,548,1574150400\"; d=\"scan'208\";a=\"246653895\"",
        "From": "Marvin Liu <yong.liu@intel.com>",
        "To": "maxime.coquelin@redhat.com, xiaolong.ye@intel.com, zhihong.wang@intel.com",
        "Cc": "dev@dpdk.org,\n\tMarvin Liu <yong.liu@intel.com>",
        "Date": "Sat, 14 Mar 2020 01:42:26 +0800",
        "Message-Id": "<20200313174230.74661-4-yong.liu@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200313174230.74661-1-yong.liu@intel.com>",
        "References": "<20200313174230.74661-1-yong.liu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v1 3/7] net/virtio: add vectorized packed ring Rx\n\tfunction",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Optimize packed ring Rx datapath when mergeable buffer and LRO are not\nrequired. Solution of optimization is pretty like vhost, split batch\nand single functions. Batch function will only dequeue those descs\nwhose cacheline are aligned. Also padding desc extra structure to 16\nbytes aligned.\n\nSigned-off-by: Marvin Liu <yong.liu@intel.com>",
    "diff": "diff --git a/drivers/net/virtio/Makefile b/drivers/net/virtio/Makefile\nindex efdcb0d93..0458e8bf2 100644\n--- a/drivers/net/virtio/Makefile\n+++ b/drivers/net/virtio/Makefile\n@@ -37,6 +37,36 @@ else ifneq ($(filter y,$(CONFIG_RTE_ARCH_ARM) $(CONFIG_RTE_ARCH_ARM64)),)\n SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx_simple_neon.c\n endif\n \n+ifeq ($(RTE_TOOLCHAIN), gcc)\n+ifeq ($(shell test $(GCC_VERSION) -ge 83 && echo 1), 1)\n+CFLAGS += -DVIRTIO_GCC_UNROLL_PRAGMA\n+endif\n+endif\n+\n+ifeq ($(RTE_TOOLCHAIN), clang)\n+ifeq ($(shell test $(CLANG_MAJOR_VERSION)$(CLANG_MINOR_VERSION) -ge 37 && echo 1), 1)\n+CFLAGS += -DVIRTIO_CLANG_UNROLL_PRAGMA\n+endif\n+endif\n+\n+ifeq ($(RTE_TOOLCHAIN), icc)\n+ifeq ($(shell test $(ICC_MAJOR_VERSION) -ge 16 && echo 1), 1)\n+CFLAGS += -DVIRTIO_ICC_UNROLL_PRAGMA\n+endif\n+endif\n+\n+CC_AVX512_SUPPORT=$(shell $(CC) -dM -E -mavx512f -dM -E - </dev/null 2>&1 | \\\n+\t\t  grep -q AVX512F && echo 1)\n+\n+ifeq ($(CC_AVX512_SUPPORT), 1)\n+CFLAGS_virtio_ethdev.o += -DCC_AVX512_SUPPORT\n+CFLAGS_virtio_rxtx.o += -DCC_AVX512_SUPPORT\n+ifeq ($(shell test $(GCC_VERSION) -ge 100 && echo 1), 1)\n+CFLAGS_virtio_rxtx_packed_avx.o += -Wno-zero-length-bounds\n+endif\n+SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx_packed_avx.c\n+endif\n+\n ifeq ($(CONFIG_RTE_VIRTIO_USER),y)\n SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_user/vhost_user.c\n SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_user/vhost_kernel.c\ndiff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h\nindex cd8947656..10e39670e 100644\n--- a/drivers/net/virtio/virtio_ethdev.h\n+++ b/drivers/net/virtio/virtio_ethdev.h\n@@ -104,6 +104,9 @@ uint16_t virtio_xmit_pkts_inorder(void *tx_queue, struct rte_mbuf **tx_pkts,\n uint16_t virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,\n \t\tuint16_t nb_pkts);\n \n+uint16_t virtio_recv_pkts_packed_vec(void *rx_queue, struct rte_mbuf **rx_pkts,\n+\t\tuint16_t nb_pkts);\n+\n int eth_virtio_dev_init(struct rte_eth_dev *eth_dev);\n \n void virtio_interrupt_handler(void *param);\ndiff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c\nindex 3a2dbc2e0..ac417232b 100644\n--- a/drivers/net/virtio/virtio_rxtx.c\n+++ b/drivers/net/virtio/virtio_rxtx.c\n@@ -1245,7 +1245,6 @@ virtio_rx_offload(struct rte_mbuf *m, struct virtio_net_hdr *hdr)\n \treturn 0;\n }\n \n-#define VIRTIO_MBUF_BURST_SZ 64\n #define DESC_PER_CACHELINE (RTE_CACHE_LINE_SIZE / sizeof(struct vring_desc))\n uint16_t\n virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\n@@ -2328,3 +2327,11 @@ virtio_xmit_pkts_inorder(void *tx_queue,\n \n \treturn nb_tx;\n }\n+\n+__rte_weak uint16_t\n+virtio_recv_pkts_packed_vec(void __rte_unused *rx_queue,\n+\t\t\t    struct rte_mbuf __rte_unused **rx_pkts,\n+\t\t\t    uint16_t __rte_unused nb_pkts)\n+{\n+\treturn 0;\n+}\ndiff --git a/drivers/net/virtio/virtio_rxtx_packed_avx.c b/drivers/net/virtio/virtio_rxtx_packed_avx.c\nnew file mode 100644\nindex 000000000..d8cda9d71\n--- /dev/null\n+++ b/drivers/net/virtio/virtio_rxtx_packed_avx.c\n@@ -0,0 +1,380 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2014 Intel Corporation\n+ */\n+\n+#include <stdint.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <string.h>\n+#include <errno.h>\n+\n+#include <rte_net.h>\n+\n+#include \"virtio_logs.h\"\n+#include \"virtio_ethdev.h\"\n+#include \"virtio_pci.h\"\n+#include \"virtqueue.h\"\n+\n+#define PACKED_FLAGS_MASK (1ULL << 55 | 1ULL << 63)\n+\n+#define PACKED_BATCH_SIZE (RTE_CACHE_LINE_SIZE / \\\n+\tsizeof(struct vring_packed_desc))\n+#define PACKED_BATCH_MASK (PACKED_BATCH_SIZE - 1)\n+\n+#ifdef VIRTIO_GCC_UNROLL_PRAGMA\n+#define virtio_for_each_try_unroll(iter, val, size) _Pragma(\"GCC unroll 4\") \\\n+\tfor (iter = val; iter < size; iter++)\n+#endif\n+\n+#ifdef VIRTIO_CLANG_UNROLL_PRAGMA\n+#define virtio_for_each_try_unroll(iter, val, size) _Pragma(\"unroll 4\") \\\n+\tfor (iter = val; iter < size; iter++)\n+#endif\n+\n+#ifdef VIRTIO_ICC_UNROLL_PRAGMA\n+#define virtio_for_each_try_unroll(iter, val, size) _Pragma(\"unroll (4)\") \\\n+\tfor (iter = val; iter < size; iter++)\n+#endif\n+\n+#ifndef virtio_for_each_try_unroll\n+#define virtio_for_each_try_unroll(iter, val, num) \\\n+\tfor (iter = val; iter < num; iter++)\n+#endif\n+\n+static inline void\n+virtio_update_batch_stats(struct virtnet_stats *stats,\n+\t\t\t  uint16_t pkt_len1,\n+\t\t\t  uint16_t pkt_len2,\n+\t\t\t  uint16_t pkt_len3,\n+\t\t\t  uint16_t pkt_len4)\n+{\n+\tstats->bytes += pkt_len1;\n+\tstats->bytes += pkt_len2;\n+\tstats->bytes += pkt_len3;\n+\tstats->bytes += pkt_len4;\n+}\n+\n+/* Optionally fill offload information in structure */\n+static inline int\n+virtio_vec_rx_offload(struct rte_mbuf *m, struct virtio_net_hdr *hdr)\n+{\n+\tstruct rte_net_hdr_lens hdr_lens;\n+\tuint32_t hdrlen, ptype;\n+\tint l4_supported = 0;\n+\n+\t/* nothing to do */\n+\tif (hdr->flags == 0)\n+\t\treturn 0;\n+\n+\t/* GSO not support in vec path, skip check */\n+\tm->ol_flags |= PKT_RX_IP_CKSUM_UNKNOWN;\n+\n+\tptype = rte_net_get_ptype(m, &hdr_lens, RTE_PTYPE_ALL_MASK);\n+\tm->packet_type = ptype;\n+\tif ((ptype & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP ||\n+\t    (ptype & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP ||\n+\t    (ptype & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_SCTP)\n+\t\tl4_supported = 1;\n+\n+\tif (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) {\n+\t\thdrlen = hdr_lens.l2_len + hdr_lens.l3_len + hdr_lens.l4_len;\n+\t\tif (hdr->csum_start <= hdrlen && l4_supported) {\n+\t\t\tm->ol_flags |= PKT_RX_L4_CKSUM_NONE;\n+\t\t} else {\n+\t\t\t/* Unknown proto or tunnel, do sw cksum. We can assume\n+\t\t\t * the cksum field is in the first segment since the\n+\t\t\t * buffers we provided to the host are large enough.\n+\t\t\t * In case of SCTP, this will be wrong since it's a CRC\n+\t\t\t * but there's nothing we can do.\n+\t\t\t */\n+\t\t\tuint16_t csum = 0, off;\n+\n+\t\t\trte_raw_cksum_mbuf(m, hdr->csum_start,\n+\t\t\t\trte_pktmbuf_pkt_len(m) - hdr->csum_start,\n+\t\t\t\t&csum);\n+\t\t\tif (likely(csum != 0xffff))\n+\t\t\t\tcsum = ~csum;\n+\t\t\toff = hdr->csum_offset + hdr->csum_start;\n+\t\t\tif (rte_pktmbuf_data_len(m) >= off + 1)\n+\t\t\t\t*rte_pktmbuf_mtod_offset(m, uint16_t *,\n+\t\t\t\t\toff) = csum;\n+\t\t}\n+\t} else if (hdr->flags & VIRTIO_NET_HDR_F_DATA_VALID && l4_supported) {\n+\t\tm->ol_flags |= PKT_RX_L4_CKSUM_GOOD;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static uint16_t\n+virtqueue_dequeue_batch_packed_vec(struct virtnet_rx *rxvq,\n+\t\t\t\t   struct rte_mbuf **rx_pkts)\n+{\n+\tstruct virtqueue *vq = rxvq->vq;\n+\tstruct virtio_hw *hw = vq->hw;\n+\tuint16_t hdr_size = hw->vtnet_hdr_size;\n+\tstruct virtio_net_hdr *hdrs[PACKED_BATCH_SIZE];\n+\tuint64_t addrs[PACKED_BATCH_SIZE << 1];\n+\tuint16_t id = vq->vq_used_cons_idx;\n+\tuint8_t desc_stats;\n+\tuint16_t i;\n+\tvoid *desc_addr;\n+\n+\tif (id & PACKED_BATCH_MASK)\n+\t\treturn -1;\n+\n+\t/* only care avail/used bits */\n+\t__m512i desc_flags = _mm512_set_epi64(\n+\t\t\tPACKED_FLAGS_MASK, 0x0,\n+\t\t\tPACKED_FLAGS_MASK, 0x0,\n+\t\t\tPACKED_FLAGS_MASK, 0x0,\n+\t\t\tPACKED_FLAGS_MASK, 0x0);\n+\n+\tdesc_addr = &vq->vq_packed.ring.desc[id];\n+\trte_smp_rmb();\n+\t__m512i packed_desc = _mm512_loadu_si512(desc_addr);\n+\t__m512i flags_mask  = _mm512_maskz_and_epi64(0xff, packed_desc,\n+\t\t\tdesc_flags);\n+\n+\t__m512i used_flags;\n+\tif (vq->vq_packed.used_wrap_counter) {\n+\t\tused_flags = _mm512_set_epi64(\n+\t\t\t\tPACKED_FLAGS_MASK, 0x0,\n+\t\t\t\tPACKED_FLAGS_MASK, 0x0,\n+\t\t\t\tPACKED_FLAGS_MASK, 0x0,\n+\t\t\t\tPACKED_FLAGS_MASK, 0x0);\n+\t} else {\n+\t\tused_flags = _mm512_set_epi64(\n+\t\t\t\t0x0, 0x0,\n+\t\t\t\t0x0, 0x0,\n+\t\t\t\t0x0, 0x0,\n+\t\t\t\t0x0, 0x0);\n+\t}\n+\n+\t/* Check all descs are used */\n+\tdesc_stats = _mm512_cmp_epu64_mask(flags_mask, used_flags,\n+\t\t\t_MM_CMPINT_EQ);\n+\tif (desc_stats != 0xff)\n+\t\treturn -1;\n+\n+\tvirtio_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n+\t\trx_pkts[i] = (struct rte_mbuf *)vq->vq_descx[id + i].cookie;\n+\t\trte_packet_prefetch(rte_pktmbuf_mtod(rx_pkts[i], void *));\n+\n+\t\taddrs[i << 1] = (uint64_t)rx_pkts[i]->rx_descriptor_fields1;\n+\t\taddrs[(i << 1) + 1] =\n+\t\t\t(uint64_t)rx_pkts[i]->rx_descriptor_fields1 + 8;\n+\t}\n+\n+\tvirtio_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n+\t\tchar *addr = (char *)rx_pkts[i]->buf_addr +\n+\t\t\tRTE_PKTMBUF_HEADROOM - hdr_size;\n+\t\thdrs[i] = (struct virtio_net_hdr *)addr;\n+\t}\n+\n+\t/* addresses of pkt_len and data_len */\n+\t__m512i vindex = _mm512_set_epi64(\n+\t\t\taddrs[7], addrs[6],\n+\t\t\taddrs[5], addrs[4],\n+\t\t\taddrs[3], addrs[2],\n+\t\t\taddrs[1], addrs[0]);\n+\n+\t/*\n+\t * select 0x10   load 32bit from packed_desc[95:64]\n+\t * mmask  0x0110 save 32bit into pkt_len and data_len\n+\t */\n+\t__m512i value = _mm512_maskz_shuffle_epi32(0x6666, packed_desc, 0xAA);\n+\n+\t__m512i mbuf_len_offset = _mm512_set_epi32(\n+\t\t\t0, (uint32_t)-hdr_size, (uint32_t)-hdr_size, 0,\n+\t\t\t0, (uint32_t)-hdr_size, (uint32_t)-hdr_size, 0,\n+\t\t\t0, (uint32_t)-hdr_size, (uint32_t)-hdr_size, 0,\n+\t\t\t0, (uint32_t)-hdr_size, (uint32_t)-hdr_size, 0);\n+\n+\tvalue = _mm512_add_epi32(value, mbuf_len_offset);\n+\t/* batch store into mbufs */\n+\t_mm512_i64scatter_epi64(0, vindex, value, 1);\n+\n+\tif (hw->has_rx_offload) {\n+\t\tvirtio_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n+\t\t\tvirtio_vec_rx_offload(rx_pkts[i], hdrs[i]);\n+\t}\n+\n+\tvirtio_update_batch_stats(&rxvq->stats, rx_pkts[0]->pkt_len,\n+\t\t\trx_pkts[1]->pkt_len, rx_pkts[2]->pkt_len,\n+\t\t\trx_pkts[3]->pkt_len);\n+\n+\tvq->vq_free_cnt += PACKED_BATCH_SIZE;\n+\n+\tvq->vq_used_cons_idx += PACKED_BATCH_SIZE;\n+\tif (vq->vq_used_cons_idx >= vq->vq_nentries) {\n+\t\tvq->vq_used_cons_idx -= vq->vq_nentries;\n+\t\tvq->vq_packed.used_wrap_counter ^= 1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static uint16_t\n+virtqueue_dequeue_single_packed_vec(struct virtnet_rx *rxvq,\n+\t\t\t\t    struct rte_mbuf **rx_pkts)\n+{\n+\tuint16_t used_idx, id;\n+\tuint32_t len;\n+\tstruct virtqueue *vq = rxvq->vq;\n+\tstruct virtio_hw *hw = vq->hw;\n+\tuint32_t hdr_size = hw->vtnet_hdr_size;\n+\tstruct virtio_net_hdr *hdr;\n+\tstruct vring_packed_desc *desc;\n+\tstruct rte_mbuf *cookie;\n+\n+\tdesc = vq->vq_packed.ring.desc;\n+\tused_idx = vq->vq_used_cons_idx;\n+\tif (!desc_is_used(&desc[used_idx], vq))\n+\t\treturn -1;\n+\n+\tlen = desc[used_idx].len;\n+\tid = desc[used_idx].id;\n+\tcookie = (struct rte_mbuf *)vq->vq_descx[id].cookie;\n+\tif (unlikely(cookie == NULL)) {\n+\t\tPMD_DRV_LOG(ERR, \"vring descriptor with no mbuf cookie at %u\",\n+\t\t\t\tvq->vq_used_cons_idx);\n+\t\treturn -1;\n+\t}\n+\trte_prefetch0(cookie);\n+\trte_packet_prefetch(rte_pktmbuf_mtod(cookie, void *));\n+\n+\tcookie->data_off = RTE_PKTMBUF_HEADROOM;\n+\tcookie->ol_flags = 0;\n+\tcookie->pkt_len = (uint32_t)(len - hdr_size);\n+\tcookie->data_len = (uint32_t)(len - hdr_size);\n+\n+\thdr = (struct virtio_net_hdr *)((char *)cookie->buf_addr +\n+\t\t\t\t\tRTE_PKTMBUF_HEADROOM - hdr_size);\n+\tif (hw->has_rx_offload)\n+\t\tvirtio_vec_rx_offload(cookie, hdr);\n+\n+\t*rx_pkts = cookie;\n+\n+\trxvq->stats.bytes += cookie->pkt_len;\n+\n+\tvq->vq_free_cnt++;\n+\tvq->vq_used_cons_idx++;\n+\tif (vq->vq_used_cons_idx >= vq->vq_nentries) {\n+\t\tvq->vq_used_cons_idx -= vq->vq_nentries;\n+\t\tvq->vq_packed.used_wrap_counter ^= 1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static inline void\n+virtio_recv_refill_packed_vec(struct virtnet_rx *rxvq,\n+\t\t\t      struct rte_mbuf **cookie,\n+\t\t\t      uint16_t num)\n+{\n+\tstruct virtqueue *vq = rxvq->vq;\n+\tstruct vring_packed_desc *start_dp = vq->vq_packed.ring.desc;\n+\tuint16_t flags = vq->vq_packed.cached_flags;\n+\tstruct virtio_hw *hw = vq->hw;\n+\tstruct vq_desc_extra *dxp;\n+\tuint16_t idx, i;\n+\tuint16_t total_num = 0;\n+\tuint16_t head_idx = vq->vq_avail_idx;\n+\tuint16_t head_flag = vq->vq_packed.cached_flags;\n+\tuint64_t addr;\n+\n+\tdo {\n+\t\tidx = vq->vq_avail_idx;\n+\t\tvirtio_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n+\t\t\tdxp = &vq->vq_descx[idx + i];\n+\t\t\tdxp->cookie = (void *)cookie[total_num + i];\n+\n+\t\t\taddr = VIRTIO_MBUF_ADDR(cookie[total_num + i], vq) +\n+\t\t\t\tRTE_PKTMBUF_HEADROOM - hw->vtnet_hdr_size;\n+\t\t\tstart_dp[idx + i].addr = addr;\n+\t\t\tstart_dp[idx + i].len = cookie[total_num + i]->buf_len\n+\t\t\t\t- RTE_PKTMBUF_HEADROOM + hw->vtnet_hdr_size;\n+\t\t\tif (total_num || i) {\n+\t\t\t\tvirtqueue_store_flags_packed(&start_dp[idx + i],\n+\t\t\t\t\t\tflags, hw->weak_barriers);\n+\t\t\t}\n+\t\t}\n+\n+\t\tvq->vq_avail_idx += PACKED_BATCH_SIZE;\n+\t\tif (vq->vq_avail_idx >= vq->vq_nentries) {\n+\t\t\tvq->vq_avail_idx -= vq->vq_nentries;\n+\t\t\tvq->vq_packed.cached_flags ^=\n+\t\t\t\tVRING_PACKED_DESC_F_AVAIL_USED;\n+\t\t\tflags = vq->vq_packed.cached_flags;\n+\t\t}\n+\t\ttotal_num += PACKED_BATCH_SIZE;\n+\t} while (total_num < num);\n+\n+\tvirtqueue_store_flags_packed(&start_dp[head_idx], head_flag,\n+\t\t\t\thw->weak_barriers);\n+\tvq->vq_free_cnt = (uint16_t)(vq->vq_free_cnt - num);\n+}\n+\n+uint16_t\n+virtio_recv_pkts_packed_vec(void *rx_queue,\n+\t\t\t    struct rte_mbuf **rx_pkts,\n+\t\t\t    uint16_t nb_pkts)\n+{\n+\tstruct virtnet_rx *rxvq = rx_queue;\n+\tstruct virtqueue *vq = rxvq->vq;\n+\tstruct virtio_hw *hw = vq->hw;\n+\tuint16_t num, nb_rx = 0;\n+\tuint32_t nb_enqueued = 0;\n+\tuint16_t free_cnt = vq->vq_free_thresh;\n+\n+\tif (unlikely(hw->started == 0))\n+\t\treturn nb_rx;\n+\n+\tnum = RTE_MIN(VIRTIO_MBUF_BURST_SZ, nb_pkts);\n+\tif (likely(num > PACKED_BATCH_SIZE))\n+\t\tnum = num - ((vq->vq_used_cons_idx + num) % PACKED_BATCH_SIZE);\n+\n+\twhile (num) {\n+\t\tif (!virtqueue_dequeue_batch_packed_vec(rxvq,\n+\t\t\t\t\t&rx_pkts[nb_rx])) {\n+\t\t\tnb_rx += PACKED_BATCH_SIZE;\n+\t\t\tnum -= PACKED_BATCH_SIZE;\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (!virtqueue_dequeue_single_packed_vec(rxvq,\n+\t\t\t\t\t&rx_pkts[nb_rx])) {\n+\t\t\tnb_rx++;\n+\t\t\tnum--;\n+\t\t\tcontinue;\n+\t\t}\n+\t\tbreak;\n+\t};\n+\n+\tPMD_RX_LOG(DEBUG, \"dequeue:%d\", num);\n+\n+\trxvq->stats.packets += nb_rx;\n+\n+\tif (likely(vq->vq_free_cnt >= free_cnt)) {\n+\t\tstruct rte_mbuf *new_pkts[free_cnt];\n+\t\tif (likely(rte_pktmbuf_alloc_bulk(rxvq->mpool, new_pkts,\n+\t\t\t\t\t\tfree_cnt) == 0)) {\n+\t\t\tvirtio_recv_refill_packed_vec(rxvq, new_pkts,\n+\t\t\t\t\tfree_cnt);\n+\t\t\tnb_enqueued += free_cnt;\n+\t\t} else {\n+\t\t\tstruct rte_eth_dev *dev =\n+\t\t\t\t&rte_eth_devices[rxvq->port_id];\n+\t\t\tdev->data->rx_mbuf_alloc_failed += free_cnt;\n+\t\t}\n+\t}\n+\n+\tif (likely(nb_enqueued)) {\n+\t\tif (unlikely(virtqueue_kick_prepare_packed(vq))) {\n+\t\t\tvirtqueue_notify(vq);\n+\t\t\tPMD_RX_LOG(DEBUG, \"Notified\");\n+\t\t}\n+\t}\n+\n+\treturn nb_rx;\n+}\ndiff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h\nindex bce1db030..43e305ecc 100644\n--- a/drivers/net/virtio/virtqueue.h\n+++ b/drivers/net/virtio/virtqueue.h\n@@ -19,6 +19,8 @@\n struct rte_mbuf;\n \n #define DEFAULT_RX_FREE_THRESH 32\n+\n+#define VIRTIO_MBUF_BURST_SZ 64\n /*\n  * Per virtio_ring.h in Linux.\n  *     For virtio_pci on SMP, we don't need to order with respect to MMIO\n@@ -235,7 +237,8 @@ struct vq_desc_extra {\n \tvoid *cookie;\n \tuint16_t ndescs;\n \tuint16_t next;\n-};\n+\tuint8_t padding[4];\n+} __rte_packed __rte_aligned(16);\n \n struct virtqueue {\n \tstruct virtio_hw  *hw; /**< virtio_hw structure pointer. */\n",
    "prefixes": [
        "v1",
        "3/7"
    ]
}