get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 16939,
    "url": "https://patches.dpdk.org/api/patches/16939/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1478269793-11082-1-git-send-email-yuanhan.liu@linux.intel.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1478269793-11082-1-git-send-email-yuanhan.liu@linux.intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1478269793-11082-1-git-send-email-yuanhan.liu@linux.intel.com",
    "date": "2016-11-04T14:29:53",
    "name": "[dpdk-dev,v2] net/virtio: cache Rx/Tx offload ability check",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "7d257d605061b67f8fb63dc1298de4648ab9965e",
    "submitter": {
        "id": 307,
        "url": "https://patches.dpdk.org/api/people/307/?format=api",
        "name": "Yuanhan Liu",
        "email": "yuanhan.liu@linux.intel.com"
    },
    "delegate": {
        "id": 355,
        "url": "https://patches.dpdk.org/api/users/355/?format=api",
        "username": "yliu",
        "first_name": "Yuanhan",
        "last_name": "Liu",
        "email": "yuanhan.liu@linux.intel.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1478269793-11082-1-git-send-email-yuanhan.liu@linux.intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/16939/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/16939/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 44F45137C;\n\tFri,  4 Nov 2016 15:29:04 +0100 (CET)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id AACF61E2F\n\tfor <dev@dpdk.org>; Fri,  4 Nov 2016 15:29:01 +0100 (CET)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga102.jf.intel.com with ESMTP; 04 Nov 2016 07:29:00 -0700",
            "from yliu-dev.sh.intel.com ([10.239.67.162])\n\tby FMSMGA003.fm.intel.com with ESMTP; 04 Nov 2016 07:29:00 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.31,443,1473145200\"; d=\"scan'208\";a=\"782433308\"",
        "From": "Yuanhan Liu <yuanhan.liu@linux.intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Yuanhan Liu <yuanhan.liu@linux.intel.com>,\n\tOlivier Matz <olivier.matz@6wind.com>",
        "Date": "Fri,  4 Nov 2016 22:29:53 +0800",
        "Message-Id": "<1478269793-11082-1-git-send-email-yuanhan.liu@linux.intel.com>",
        "X-Mailer": "git-send-email 1.9.0",
        "In-Reply-To": "<1478251718-7464-1-git-send-email-yuanhan.liu@linux.intel.com>",
        "References": "<1478251718-7464-1-git-send-email-yuanhan.liu@linux.intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2] net/virtio: cache Rx/Tx offload ability check",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "It's not a good idea to do the check of whether Rx/Tx offload is\nenabled at the data path. Instead, we could do the check at init\nstage and store the result, so that we could avoid the check again\nand again at the critical datapath.\n\nCc: Olivier Matz <olivier.matz@6wind.com>\nSigned-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>\n---\nv2: - rebase on top of the bug fix patches\n    - define rx/tx_offload as uint8_t instead of int\n\n drivers/net/virtio/virtio_ethdev.c | 19 +++++++++++++++++++\n drivers/net/virtio/virtio_pci.h    |  2 ++\n drivers/net/virtio/virtio_rxtx.c   | 31 +++++--------------------------\n 3 files changed, 26 insertions(+), 26 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 1505f67..2adae58 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -1188,6 +1188,22 @@ rx_func_get(struct rte_eth_dev *eth_dev)\n \t\teth_dev->rx_pkt_burst = &virtio_recv_pkts;\n }\n \n+static inline int\n+rx_offload_enabled(struct virtio_hw *hw)\n+{\n+\treturn vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM) ||\n+\t\tvtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4) ||\n+\t\tvtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO6);\n+}\n+\n+static inline int\n+tx_offload_enabled(struct virtio_hw *hw)\n+{\n+\treturn vtpci_with_feature(hw, VIRTIO_NET_F_CSUM) ||\n+\t\tvtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO4) ||\n+\t\tvtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO6);\n+}\n+\n /* reset device and renegotiate features if needed */\n static int\n virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)\n@@ -1209,6 +1225,9 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)\n \tif (virtio_negotiate_features(hw, req_features) < 0)\n \t\treturn -1;\n \n+\thw->tx_offload = tx_offload_enabled(hw);\n+\thw->rx_offload = rx_offload_enabled(hw);\n+\n \t/* If host does not support status then disable LSC */\n \tif (!vtpci_with_feature(hw, VIRTIO_NET_F_STATUS))\n \t\teth_dev->data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC;\ndiff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h\nindex de271bf..7d1dd9b 100644\n--- a/drivers/net/virtio/virtio_pci.h\n+++ b/drivers/net/virtio/virtio_pci.h\n@@ -254,6 +254,8 @@ struct virtio_hw {\n \tuint8_t\t    use_msix;\n \tuint8_t     modern;\n \tuint8_t     use_simple_rxtx;\n+\tuint8_t     tx_offload;\n+\tuint8_t     rx_offload;\n \tuint8_t     mac_addr[ETHER_ADDR_LEN];\n \tuint32_t    notify_off_multiplier;\n \tuint8_t     *isr;\ndiff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c\nindex 4cb2ce7..7571191 100644\n--- a/drivers/net/virtio/virtio_rxtx.c\n+++ b/drivers/net/virtio/virtio_rxtx.c\n@@ -250,14 +250,6 @@ virtio_tso_fix_cksum(struct rte_mbuf *m)\n \t}\n }\n \n-static inline int\n-tx_offload_enabled(struct virtio_hw *hw)\n-{\n-\treturn vtpci_with_feature(hw, VIRTIO_NET_F_CSUM) ||\n-\t\tvtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO4) ||\n-\t\tvtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO6);\n-}\n-\n static inline void\n virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,\n \t\t       uint16_t needed, int use_indirect, int can_push)\n@@ -270,9 +262,7 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,\n \tuint16_t head_idx, idx;\n \tuint16_t head_size = vq->hw->vtnet_hdr_size;\n \tstruct virtio_net_hdr *hdr;\n-\tint offload;\n \n-\toffload = tx_offload_enabled(vq->hw);\n \thead_idx = vq->vq_desc_head_idx;\n \tidx = head_idx;\n \tdxp = &vq->vq_descx[idx];\n@@ -286,7 +276,7 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,\n \t\thdr = (struct virtio_net_hdr *)\n \t\t\trte_pktmbuf_prepend(cookie, head_size);\n \t\t/* if offload disabled, it is not zeroed below, do it now */\n-\t\tif (offload == 0)\n+\t\tif (vq->hw->tx_offload == 0)\n \t\t\tmemset(hdr, 0, head_size);\n \t} else if (use_indirect) {\n \t\t/* setup tx ring slot to point to indirect\n@@ -318,7 +308,7 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,\n \t}\n \n \t/* Checksum Offload / TSO */\n-\tif (offload) {\n+\tif (vq->hw->tx_offload) {\n \t\tif (cookie->ol_flags & PKT_TX_TCP_SEG)\n \t\t\tcookie->ol_flags |= PKT_TX_TCP_CKSUM;\n \n@@ -735,14 +725,6 @@ virtio_rx_offload(struct rte_mbuf *m, struct virtio_net_hdr *hdr)\n \treturn 0;\n }\n \n-static inline int\n-rx_offload_enabled(struct virtio_hw *hw)\n-{\n-\treturn vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM) ||\n-\t\tvtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4) ||\n-\t\tvtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO6);\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@@ -758,7 +740,6 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\n \tint error;\n \tuint32_t i, nb_enqueued;\n \tuint32_t hdr_size;\n-\tint offload;\n \tstruct virtio_net_hdr *hdr;\n \n \tnb_used = VIRTQUEUE_NUSED(vq);\n@@ -777,7 +758,6 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\n \tnb_rx = 0;\n \tnb_enqueued = 0;\n \thdr_size = hw->vtnet_hdr_size;\n-\toffload = rx_offload_enabled(hw);\n \n \tfor (i = 0; i < num ; i++) {\n \t\trxm = rcv_pkts[i];\n@@ -808,7 +788,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\n \t\tif (hw->vlan_strip)\n \t\t\trte_vlan_strip(rxm);\n \n-\t\tif (offload && virtio_rx_offload(rxm, hdr) < 0) {\n+\t\tif (hw->rx_offload && virtio_rx_offload(rxm, hdr) < 0) {\n \t\t\tvirtio_discard_rxbuf(vq, rxm);\n \t\t\trxvq->stats.errors++;\n \t\t\tcontinue;\n@@ -873,7 +853,6 @@ virtio_recv_mergeable_pkts(void *rx_queue,\n \tuint16_t extra_idx;\n \tuint32_t seg_res;\n \tuint32_t hdr_size;\n-\tint offload;\n \n \tnb_used = VIRTQUEUE_NUSED(vq);\n \n@@ -889,7 +868,6 @@ virtio_recv_mergeable_pkts(void *rx_queue,\n \textra_idx = 0;\n \tseg_res = 0;\n \thdr_size = hw->vtnet_hdr_size;\n-\toffload = rx_offload_enabled(hw);\n \n \twhile (i < nb_used) {\n \t\tstruct virtio_net_hdr_mrg_rxbuf *header;\n@@ -935,7 +913,8 @@ virtio_recv_mergeable_pkts(void *rx_queue,\n \t\trx_pkts[nb_rx] = rxm;\n \t\tprev = rxm;\n \n-\t\tif (offload && virtio_rx_offload(rxm, &header->hdr) < 0) {\n+\t\tif (hw->rx_offload &&\n+\t\t    virtio_rx_offload(rxm, &header->hdr) < 0) {\n \t\t\tvirtio_discard_rxbuf(vq, rxm);\n \t\t\trxvq->stats.errors++;\n \t\t\tcontinue;\n",
    "prefixes": [
        "dpdk-dev",
        "v2"
    ]
}