Show a patch.

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

{
    "id": 378,
    "url": "https://patches.dpdk.org/api/patches/378/?format=api",
    "web_url": "https://patches.dpdk.org/patch/378/",
    "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"
    },
    "msgid": "<1410706109-30448-6-git-send-email-helin.zhang@intel.com>",
    "date": "2014-09-14T14:48:29",
    "name": "[dpdk-dev,v2,5/5] i40evf: support of configurable crc stripping in VF",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9b0aaa161d2e8ccb6491e769b86b2e0c93508630",
    "submitter": {
        "id": 14,
        "url": "https://patches.dpdk.org/api/people/14/?format=api",
        "name": "Helin Zhang",
        "email": "helin.zhang@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/378/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/378/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/378/checks/",
    "tags": {},
    "headers": {
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Message-Id": "<1410706109-30448-6-git-send-email-helin.zhang@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "To": "dev@dpdk.org",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id BC9D46891;\n\tSun, 14 Sep 2014 16:43:22 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 653FBB3A0\n\tfor <dev@dpdk.org>; Sun, 14 Sep 2014 16:43:20 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga103.fm.intel.com with ESMTP; 14 Sep 2014 07:40:02 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga001.fm.intel.com with ESMTP; 14 Sep 2014 07:48:46 -0700",
            "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id s8EEmjVF018793;\n\tSun, 14 Sep 2014 22:48:45 +0800",
            "from shecgisg004.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid s8EEmhpX030518; Sun, 14 Sep 2014 22:48:45 +0800",
            "(from hzhan75@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s8EEmh4t030514; \n\tSun, 14 Sep 2014 22:48:43 +0800"
        ],
        "X-BeenThere": "dev@dpdk.org",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Subject": "[dpdk-dev] [PATCH v2 5/5] i40evf: support of configurable crc\n\tstripping in VF",
        "In-Reply-To": "<1410706109-30448-1-git-send-email-helin.zhang@intel.com>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Date": "Sun, 14 Sep 2014 22:48:29 +0800",
        "X-ExtLoop1": "1",
        "Precedence": "list",
        "From": "Helin Zhang <helin.zhang@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,521,1406617200\"; d=\"scan'208\";a=\"591103966\"",
        "References": "<1410706109-30448-1-git-send-email-helin.zhang@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Errors-To": "dev-bounces@dpdk.org",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Delivered-To": "patchwork@dpdk.org",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "Configurable crc stripping is supported in DPDK PF host,\nwhile not in Linux PF host. Two functions have been\ndefined to talk with the those PF hosts respectively.\n\nv2 changes:\n* Put configuring crc stripping in VF into a single patch.\n\nSigned-off-by: Helin Zhang <helin.zhang@intel.com>\nReviewed-by: Jingjing Wu <jingjing.wu@intel.com>\nReviewed-by: Jing Chen <jing.d.chen@intel.com>\n---\n lib/librte_pmd_i40e/i40e_ethdev_vf.c | 133 +++++++++++++++++++++++++++--------\n 1 file changed, 102 insertions(+), 31 deletions(-)",
    "diff": "diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c\nindex 113bff8..af5a0f3 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c\n+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c\n@@ -523,8 +523,9 @@ i40evf_config_vlan_pvid(struct rte_eth_dev *dev,\n \treturn err;\n }\n \n+/* It configures VSI queues without extra configuration */\n static int\n-i40evf_configure_queues(struct rte_eth_dev *dev)\n+i40evf_configure_vsi_queues(struct rte_eth_dev *dev)\n {\n \tstruct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);\n \tstruct i40e_rx_queue **rxq =\n@@ -533,13 +534,13 @@ i40evf_configure_queues(struct rte_eth_dev *dev)\n \t\t(struct i40e_tx_queue **)dev->data->tx_queues;\n \tstruct i40e_virtchnl_vsi_queue_config_info *vc_vqci;\n \tstruct i40e_virtchnl_queue_pair_info *vc_qpi;\n-\tint size, i, nb_qp, ret, num_rxq, num_txq;\n \tstruct vf_cmd_info args;\n-\tstruct rte_pktmbuf_pool_private *mbp_priv;\n+\tint size, i, nb_qp, ret;\n \n \tnb_qp = vf->num_queue_pairs;\n-\tsize = sizeof(*vc_vqci) + sizeof(*vc_qpi) * nb_qp;\n-\tvc_vqci = rte_zmalloc(\"vc_vqci\", size, 0);\n+\tsize = sizeof(struct i40e_virtchnl_vsi_queue_config_info) +\n+\t\tsizeof(struct i40e_virtchnl_queue_pair_info) * nb_qp;\n+\tvc_vqci = rte_zmalloc(\"queue_info\", size, 0);\n \tif (!vc_vqci) {\n \t\tPMD_DRV_LOG(ERR, \"Failed to allocate memory for VF \"\n \t\t\t\t\t\"configuring queues\\n\");\n@@ -547,62 +548,132 @@ i40evf_configure_queues(struct rte_eth_dev *dev)\n \t}\n \tvc_vqci->vsi_id = vf->vsi_res->vsi_id;\n \tvc_vqci->num_queue_pairs = nb_qp;\n-\tvc_qpi = vc_vqci->qpair;\n \n-\tnum_rxq = dev->data->nb_rx_queues;\n-\tnum_txq = dev->data->nb_tx_queues;\n-\t/*\n-\t * PF host driver required to configure queues in pairs, which means\n-\t * rxq_num should equals to txq_num. The actual usage won't always\n-\t * work that way. The solution is fills 0 with HW ring option in case\n-\t * they are not equal.\n-\t */\n-\tfor (i = 0; i < nb_qp; i++) {\n-\t\t/*Fill TX info */\n+\tfor (i = 0, vc_qpi = vc_vqci->qpair; i < nb_qp; i++, vc_qpi++) {\n \t\tvc_qpi->txq.vsi_id = vc_vqci->vsi_id;\n \t\tvc_qpi->txq.queue_id = i;\n-\t\tif (i < num_txq) {\n+\t\tif (i < dev->data->nb_tx_queues) {\n \t\t\tvc_qpi->txq.ring_len = txq[i]->nb_tx_desc;\n \t\t\tvc_qpi->txq.dma_ring_addr = txq[i]->tx_ring_phys_addr;\n-\t\t} else {\n-\t\t\tvc_qpi->txq.ring_len = 0;\n-\t\t\tvc_qpi->txq.dma_ring_addr = 0;\n \t\t}\n \n-\t\t/* Fill RX info */\n \t\tvc_qpi->rxq.vsi_id = vc_vqci->vsi_id;\n \t\tvc_qpi->rxq.queue_id = i;\n \t\tvc_qpi->rxq.max_pkt_size = vf->max_pkt_len;\n-\t\tif (i < num_rxq) {\n+\t\tif (i < dev->data->nb_rx_queues) {\n+\t\t\tstruct rte_pktmbuf_pool_private *mbp_priv;\n+\n+\t\t\tvc_qpi->rxq.ring_len = rxq[i]->nb_rx_desc;\n+\t\t\tvc_qpi->rxq.dma_ring_addr = rxq[i]->rx_ring_phys_addr;\n \t\t\tmbp_priv = rte_mempool_get_priv(rxq[i]->mp);\n \t\t\tvc_qpi->rxq.databuffer_size =\n \t\t\t\tmbp_priv->mbuf_data_room_size -\n \t\t\t\t\tRTE_PKTMBUF_HEADROOM;\n+\t\t}\n+\t}\n+\tmemset(&args, 0, sizeof(args));\n+\targs.ops = I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES;\n+\targs.in_args = (uint8_t *)vc_vqci;\n+\targs.in_args_size = size;\n+\targs.out_buffer = cmd_result_buffer;\n+\targs.out_size = I40E_AQ_BUF_SZ;\n+\tret = i40evf_execute_vf_cmd(dev, &args);\n+\tif (ret)\n+\t\tPMD_DRV_LOG(ERR, \"Failed to execute command of \"\n+\t\t\t\"I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES\\n\");\n+\trte_free(vc_vqci);\n+\n+\treturn ret;\n+}\n+\n+/* It configures VSI queues with extra configuration of crc stripping */\n+static int\n+i40evf_configure_vsi_queues_ex(struct rte_eth_dev *dev)\n+{\n+\tstruct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);\n+\tstruct i40e_rx_queue **rxq =\n+\t\t(struct i40e_rx_queue **)dev->data->rx_queues;\n+\tstruct i40e_tx_queue **txq =\n+\t\t(struct i40e_tx_queue **)dev->data->tx_queues;\n+\tstruct i40e_virtchnl_vsi_queue_config_info *vc_vqci;\n+\tstruct i40e_virtchnl_queue_pair_info *vc_qpi;\n+\tstruct i40e_virtchnl_queue_pair_extra_info *vc_qpei;\n+\tstruct vf_cmd_info args;\n+\tint size, i, nb_qp, ret;\n+\n+\tnb_qp = vf->num_queue_pairs;\n+\tsize = sizeof(struct i40e_virtchnl_vsi_queue_config_info) +\n+\t\tsizeof(struct i40e_virtchnl_queue_pair_info) * nb_qp +\n+\t\tsizeof(struct i40e_virtchnl_queue_pair_extra_info) * nb_qp;\n+\tvc_vqci = rte_zmalloc(\"queue_info\", size, 0);\n+\tif (!vc_vqci) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to allocate memory for VF \"\n+\t\t\t\t\t\"configuring queues\\n\");\n+\t\treturn -ENOMEM;\n+\t}\n+\tvc_vqci->vsi_id = vf->vsi_res->vsi_id;\n+\tvc_vqci->num_queue_pairs = nb_qp;\n+\tvc_qpi = vc_vqci->qpair;\n+\tvc_qpei = (struct i40e_virtchnl_queue_pair_extra_info *)\n+\t\t(((uint8_t *)vc_vqci->qpair) +\n+\t\tsizeof(struct i40e_virtchnl_queue_pair_info) * nb_qp);\n+\n+\tfor (i = 0; i < nb_qp; i++, vc_qpi++, vc_qpei++) {\n+\t\tvc_qpi->txq.vsi_id = vc_vqci->vsi_id;\n+\t\tvc_qpi->txq.queue_id = i;\n+\t\tif (i < dev->data->nb_tx_queues) {\n+\t\t\tvc_qpi->txq.ring_len = txq[i]->nb_tx_desc;\n+\t\t\tvc_qpi->txq.dma_ring_addr = txq[i]->tx_ring_phys_addr;\n+\t\t}\n+\t\tvc_qpi->rxq.vsi_id = vc_vqci->vsi_id;\n+\t\tvc_qpi->rxq.queue_id = i;\n+\t\tvc_qpi->rxq.max_pkt_size = vf->max_pkt_len;\n+\t\tif (i < dev->data->nb_rx_queues) {\n+\t\t\tstruct rte_pktmbuf_pool_private *mbp_priv;\n+\n \t\t\tvc_qpi->rxq.ring_len = rxq[i]->nb_rx_desc;\n \t\t\tvc_qpi->rxq.dma_ring_addr = rxq[i]->rx_ring_phys_addr;\n-\t\t} else {\n-\t\t\tvc_qpi->rxq.ring_len = 0;\n-\t\t\tvc_qpi->rxq.dma_ring_addr = 0;\n-\t\t\tvc_qpi->rxq.databuffer_size = 0;\n+\t\t\tmbp_priv = rte_mempool_get_priv(rxq[i]->mp);\n+\t\t\tvc_qpi->rxq.databuffer_size =\n+\t\t\t\tmbp_priv->mbuf_data_room_size -\n+\t\t\t\t\tRTE_PKTMBUF_HEADROOM;\n+\t\t\t/*\n+\t\t\t * It adds extra info for configuring VSI queues, which\n+\t\t\t * is needed to enable the configurable crc stripping\n+\t\t\t * in VF.\n+\t\t\t */\n+\t\t\tvc_qpei->crcstrip =\n+\t\t\t\tdev->data->dev_conf.rxmode.hw_strip_crc;\n \t\t}\n-\t\tvc_qpi++;\n \t}\n-\n-\targs.ops = I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES;\n+\tmemset(&args, 0, sizeof(args));\n+\targs.ops =\n+\t\t(enum i40e_virtchnl_ops)I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX;\n \targs.in_args = (uint8_t *)vc_vqci;\n \targs.in_args_size = size;\n \targs.out_buffer = cmd_result_buffer;\n \targs.out_size = I40E_AQ_BUF_SZ;\n \tret = i40evf_execute_vf_cmd(dev, &args);\n \tif (ret)\n-\t\tPMD_DRV_LOG(ERR, \"fail to execute command \"\n-\t\t\t\t\"OP_CONFIG_VSI_QUEUES\\n\");\n+\t\tPMD_DRV_LOG(ERR, \"Failed to execute command of \"\n+\t\t\t\"I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX\\n\");\n \trte_free(vc_vqci);\n \n \treturn ret;\n }\n \n static int\n+i40evf_configure_queues(struct rte_eth_dev *dev)\n+{\n+\tstruct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);\n+\n+\tif (vf->host_is_dpdk) /* To support DPDK PF host */\n+\t\treturn i40evf_configure_vsi_queues_ex(dev);\n+\telse /* To support Linux PF host */\n+\t\treturn i40evf_configure_vsi_queues(dev);\n+}\n+\n+static int\n i40evf_config_irq_map(struct rte_eth_dev *dev)\n {\n \tstruct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "5/5"
    ]
}