get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 35798,
    "url": "http://patches.dpdk.org/api/patches/35798/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180309003216.29214-1-tiwei.bie@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": "<20180309003216.29214-1-tiwei.bie@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180309003216.29214-1-tiwei.bie@intel.com",
    "date": "2018-03-09T00:32:16",
    "name": "[dpdk-dev] net/virtio: move to new offloads API",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "e4af7d1ca751a0be37039b2ff5c3c4e8b2aca7ae",
    "submitter": {
        "id": 617,
        "url": "http://patches.dpdk.org/api/people/617/?format=api",
        "name": "Tiwei Bie",
        "email": "tiwei.bie@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/20180309003216.29214-1-tiwei.bie@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/35798/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/35798/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 0E8337CD8;\n\tFri,  9 Mar 2018 01:34:13 +0100 (CET)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby dpdk.org (Postfix) with ESMTP id 3387A7CC2\n\tfor <dev@dpdk.org>; Fri,  9 Mar 2018 01:34:09 +0100 (CET)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t08 Mar 2018 16:34:08 -0800",
            "from debian.sh.intel.com ([10.67.104.164])\n\tby fmsmga004.fm.intel.com with ESMTP; 08 Mar 2018 16:34:07 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.47,443,1515484800\"; d=\"scan'208\";a=\"35791636\"",
        "From": "Tiwei Bie <tiwei.bie@intel.com>",
        "To": "maxime.coquelin@redhat.com,\n\tyliu@fridaylinux.org",
        "Cc": "dev@dpdk.org,\n\ttiwei.bie@intel.com",
        "Date": "Fri,  9 Mar 2018 08:32:16 +0800",
        "Message-Id": "<20180309003216.29214-1-tiwei.bie@intel.com>",
        "X-Mailer": "git-send-email 2.11.0",
        "Subject": "[dpdk-dev] [PATCH] net/virtio: move to new offloads API",
        "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://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": "<https://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": "Ethdev offloads API has changed since:\n\ncommit ce17eddefc20 (\"ethdev: introduce Rx queue offloads API\")\ncommit cba7f53b717d (\"ethdev: introduce Tx queue offloads API\")\n\nSigned-off-by: Tiwei Bie <tiwei.bie@intel.com>\n---\n drivers/net/virtio/virtio_ethdev.c | 35 ++++++++++++++++++++---------------\n drivers/net/virtio/virtio_ethdev.h |  8 ++++++++\n drivers/net/virtio/virtio_rxtx.c   | 14 ++++++++------\n 3 files changed, 36 insertions(+), 21 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 884f74ad0..234fe5edb 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -1787,6 +1787,7 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n {\n \tconst struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;\n \tstruct virtio_hw *hw = dev->data->dev_private;\n+\tuint64_t rx_offloads = rxmode->offloads;\n \tuint64_t req_features;\n \tint ret;\n \n@@ -1799,14 +1800,11 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n \t\t\treturn ret;\n \t}\n \n-\t/* The name hw_ip_checksum is a bit confusing since it can be\n-\t * set by the application to request L3 and/or L4 checksums. In\n-\t * case of virtio, only L4 checksum is supported.\n-\t */\n-\tif (rxmode->hw_ip_checksum)\n+\tif (rx_offloads & (DEV_RX_OFFLOAD_UDP_CKSUM |\n+\t\t\t   DEV_RX_OFFLOAD_TCP_CKSUM))\n \t\treq_features |= (1ULL << VIRTIO_NET_F_GUEST_CSUM);\n \n-\tif (rxmode->enable_lro)\n+\tif (rx_offloads & DEV_RX_OFFLOAD_TCP_LRO)\n \t\treq_features |=\n \t\t\t(1ULL << VIRTIO_NET_F_GUEST_TSO4) |\n \t\t\t(1ULL << VIRTIO_NET_F_GUEST_TSO6);\n@@ -1818,14 +1816,15 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n \t\t\treturn ret;\n \t}\n \n-\tif (rxmode->hw_ip_checksum &&\n+\tif ((rx_offloads & (DEV_RX_OFFLOAD_UDP_CKSUM |\n+\t\t\t    DEV_RX_OFFLOAD_TCP_CKSUM)) &&\n \t\t!vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM)) {\n \t\tPMD_DRV_LOG(ERR,\n \t\t\t\"rx checksum not available on this host\");\n \t\treturn -ENOTSUP;\n \t}\n \n-\tif (rxmode->enable_lro &&\n+\tif ((rx_offloads & DEV_RX_OFFLOAD_TCP_LRO) &&\n \t\t(!vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4) ||\n \t\t !vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO6))) {\n \t\tPMD_DRV_LOG(ERR,\n@@ -1837,9 +1836,10 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n \tif (vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VQ))\n \t\tvirtio_dev_cq_start(dev);\n \n-\thw->vlan_strip = rxmode->hw_vlan_strip;\n+\tif (rx_offloads & DEV_RX_OFFLOAD_VLAN_STRIP)\n+\t\thw->vlan_strip = 1;\n \n-\tif (rxmode->hw_vlan_filter\n+\tif ((rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)\n \t    && !vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VLAN)) {\n \t\tPMD_DRV_LOG(ERR,\n \t\t\t    \"vlan filtering not available on this host\");\n@@ -1870,7 +1870,8 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n \t\thw->use_simple_tx = 0;\n \t}\n \n-\tif (rxmode->hw_ip_checksum)\n+\tif (rx_offloads & (DEV_RX_OFFLOAD_UDP_CKSUM |\n+\t\t\t   DEV_RX_OFFLOAD_TCP_CKSUM))\n \t\thw->use_simple_rx = 0;\n \n \treturn 0;\n@@ -2073,9 +2074,10 @@ virtio_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask)\n {\n \tconst struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;\n \tstruct virtio_hw *hw = dev->data->dev_private;\n+\tuint64_t offloads = rxmode->offloads;\n \n \tif (mask & ETH_VLAN_FILTER_MASK) {\n-\t\tif (rxmode->hw_vlan_filter &&\n+\t\tif ((offloads & DEV_RX_OFFLOAD_VLAN_FILTER) &&\n \t\t\t\t!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VLAN)) {\n \n \t\t\tPMD_DRV_LOG(NOTICE,\n@@ -2086,7 +2088,7 @@ virtio_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask)\n \t}\n \n \tif (mask & ETH_VLAN_STRIP_MASK)\n-\t\thw->vlan_strip = rxmode->hw_vlan_strip;\n+\t\thw->vlan_strip = !!(offloads & DEV_RX_OFFLOAD_VLAN_STRIP);\n \n \treturn 0;\n }\n@@ -2112,18 +2114,21 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)\n \t};\n \n \thost_features = VTPCI_OPS(hw)->get_features(hw);\n-\tdev_info->rx_offload_capa = 0;\n+\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP;\n \tif (host_features & (1ULL << VIRTIO_NET_F_GUEST_CSUM)) {\n \t\tdev_info->rx_offload_capa |=\n \t\t\tDEV_RX_OFFLOAD_TCP_CKSUM |\n \t\t\tDEV_RX_OFFLOAD_UDP_CKSUM;\n \t}\n+\tif (host_features & (1ULL << VIRTIO_NET_F_CTRL_VLAN))\n+\t\tdev_info->rx_offload_capa |= DEV_RX_OFFLOAD_VLAN_FILTER;\n \ttso_mask = (1ULL << VIRTIO_NET_F_GUEST_TSO4) |\n \t\t(1ULL << VIRTIO_NET_F_GUEST_TSO6);\n \tif ((host_features & tso_mask) == tso_mask)\n \t\tdev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO;\n \n-\tdev_info->tx_offload_capa = 0;\n+\tdev_info->tx_offload_capa = DEV_TX_OFFLOAD_MULTI_SEGS |\n+\t\t\t\t    DEV_TX_OFFLOAD_VLAN_INSERT;\n \tif (hw->guest_features & (1ULL << VIRTIO_NET_F_CSUM)) {\n \t\tdev_info->tx_offload_capa |=\n \t\t\tDEV_TX_OFFLOAD_UDP_CKSUM |\ndiff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h\nindex 4539d2e44..bb40064ea 100644\n--- a/drivers/net/virtio/virtio_ethdev.h\n+++ b/drivers/net/virtio/virtio_ethdev.h\n@@ -43,6 +43,14 @@\n \t 1u << VIRTIO_NET_F_GUEST_CSUM\t   |\t\\\n \t 1u << VIRTIO_NET_F_GUEST_TSO4     |\t\\\n \t 1u << VIRTIO_NET_F_GUEST_TSO6)\n+\n+#define VIRTIO_PMD_PER_DEVICE_RX_OFFLOADS\t\\\n+\t(DEV_RX_OFFLOAD_TCP_CKSUM |\t\t\\\n+\t DEV_RX_OFFLOAD_UDP_CKSUM |\t\t\\\n+\t DEV_RX_OFFLOAD_TCP_LRO |\t\t\\\n+\t DEV_RX_OFFLOAD_VLAN_FILTER |\t\t\\\n+\t DEV_RX_OFFLOAD_VLAN_STRIP)\n+\n /*\n  * CQ function prototype\n  */\ndiff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c\nindex 8dbf2a30e..a8aa87b32 100644\n--- a/drivers/net/virtio/virtio_rxtx.c\n+++ b/drivers/net/virtio/virtio_rxtx.c\n@@ -38,10 +38,6 @@\n #define  VIRTIO_DUMP_PACKET(m, len) do { } while (0)\n #endif\n \n-\n-#define VIRTIO_SIMPLE_FLAGS ((uint32_t)ETH_TXQ_FLAGS_NOMULTSEGS | \\\n-\tETH_TXQ_FLAGS_NOOFFLOADS)\n-\n int\n virtio_dev_rx_queue_done(void *rxq, uint16_t offset)\n {\n@@ -389,9 +385,10 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev,\n \t\t\tuint16_t queue_idx,\n \t\t\tuint16_t nb_desc,\n \t\t\tunsigned int socket_id __rte_unused,\n-\t\t\t__rte_unused const struct rte_eth_rxconf *rx_conf,\n+\t\t\tconst struct rte_eth_rxconf *rx_conf,\n \t\t\tstruct rte_mempool *mp)\n {\n+\tconst struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;\n \tuint16_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_RQ_QUEUE_IDX;\n \tstruct virtio_hw *hw = dev->data->dev_private;\n \tstruct virtqueue *vq = hw->vqs[vtpci_queue_idx];\n@@ -410,6 +407,11 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev,\n \t\trte_exit(EXIT_FAILURE,\n \t\t\t\"Cannot allocate mbufs for rx virtqueue\");\n \t}\n+\n+\tif ((rx_conf->offloads ^ rxmode->offloads) &\n+\t    VIRTIO_PMD_PER_DEVICE_RX_OFFLOADS)\n+\t\treturn -EINVAL;\n+\n \tdev->data->rx_queues[queue_idx] = rxvq;\n \n \treturn 0;\n@@ -502,7 +504,7 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev,\n \tPMD_INIT_FUNC_TRACE();\n \n \t/* cannot use simple rxtx funcs with multisegs or offloads */\n-\tif ((tx_conf->txq_flags & VIRTIO_SIMPLE_FLAGS) != VIRTIO_SIMPLE_FLAGS)\n+\tif (tx_conf->offloads)\n \t\thw->use_simple_tx = 0;\n \n \tif (nb_desc == 0 || nb_desc > vq->vq_nentries)\n",
    "prefixes": [
        "dpdk-dev"
    ]
}