Show a patch.

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

{
    "id": 187,
    "url": "https://patches.dpdk.org/api/patches/187/?format=api",
    "web_url": "https://patches.dpdk.org/patch/187/",
    "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": "<1408505611-6959-3-git-send-email-helin.zhang@intel.com>",
    "date": "2014-08-20T03:33:30",
    "name": "[dpdk-dev,2/3] i40evf: support I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX in i40e VF PMD",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a075f4ac5f3a5f8dd79a35c189ff71c3e11dabe9",
    "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/187/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/187/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/187/checks/",
    "tags": {},
    "headers": {
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "Return-Path": "<hzhan75@shecgisg004.sh.intel.com>",
        "Message-Id": "<1408505611-6959-3-git-send-email-helin.zhang@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "To": "dev@dpdk.org",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-BeenThere": "dev@dpdk.org",
        "Received": [
            "from mga03.intel.com (mga03.intel.com [143.182.124.21])\n\tby dpdk.org (Postfix) with ESMTP id 3D149B36B\n\tfor <dev@dpdk.org>; Wed, 20 Aug 2014 05:30:21 +0200 (CEST)",
            "from azsmga001.ch.intel.com ([10.2.17.19])\n\tby azsmga101.ch.intel.com with ESMTP; 19 Aug 2014 20:33:50 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby azsmga001.ch.intel.com with ESMTP; 19 Aug 2014 20:33:49 -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 s7K3Xe3H014295;\n\tWed, 20 Aug 2014 11:33:40 +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 s7K3Xbcq007084; Wed, 20 Aug 2014 11:33:39 +0800",
            "(from hzhan75@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s7K3Xbc5007080; \n\tWed, 20 Aug 2014 11:33:37 +0800"
        ],
        "Subject": "[dpdk-dev] [PATCH 2/3] i40evf: support\n\tI40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX in i40e VF PMD",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "In-Reply-To": "<1408505611-6959-1-git-send-email-helin.zhang@intel.com>",
        "X-ExtLoop1": "1",
        "Precedence": "list",
        "From": "Helin Zhang <helin.zhang@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.01,898,1400050800\"; d=\"scan'208\";a=\"470603802\"",
        "References": "<1408505611-6959-1-git-send-email-helin.zhang@intel.com>",
        "X-List-Received-Date": "Wed, 20 Aug 2014 03:30:22 -0000",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Date": "Wed, 20 Aug 2014 11:33:30 +0800",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "To support configurable CRC in VF, use operation of\nI40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX to carry more\ninformation from VM to PF host, if the peer is DPDK\nPF host. Otherwise assume it is Linux PF host and\njust use operation of I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES.\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 | 188 ++++++++++++++++++++++++-----------\n 1 file changed, 130 insertions(+), 58 deletions(-)",
    "diff": "diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c\nindex 2726bfb..97310ea 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c\n+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c\n@@ -515,82 +515,154 @@ i40evf_config_vlan_pvid(struct rte_eth_dev *dev,\n \treturn err;\n }\n \n+/* It configures VSI queues to co-work with Linux PF host */\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_virtchnl_vsi_queue_config_info *queue_info;\n-\tstruct i40e_virtchnl_queue_pair_info *queue_cfg;\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-\tint i, len, nb_qpairs, num_rxq, num_txq;\n-\tint err;\n+\tstruct i40e_virtchnl_vsi_queue_config_info *vc_vqci;\n+\tstruct i40e_virtchnl_queue_pair_info *vc_qpi;\n \tstruct vf_cmd_info args;\n-\tstruct rte_pktmbuf_pool_private *mbp_priv;\n-\n-\tnb_qpairs = vf->num_queue_pairs;\n-\tlen = sizeof(*queue_info) + sizeof(*queue_cfg) * nb_qpairs;\n-\tqueue_info = rte_zmalloc(\"queue_info\", len, 0);\n-\tif (queue_info == NULL) {\n-\t\tPMD_INIT_LOG(ERR, \"failed alloc memory for queue_info\\n\");\n-\t\treturn -1;\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+\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-\tqueue_info->vsi_id = vf->vsi_res->vsi_id;\n-\tqueue_info->num_queue_pairs = nb_qpairs;\n-\tqueue_cfg = queue_info->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_qpairs; i++) {\n-\t\t/*Fill TX info */\n-\t\tqueue_cfg->txq.vsi_id = queue_info->vsi_id;\n-\t\tqueue_cfg->txq.queue_id = i;\n-\t\tif (i < num_txq) {\n-\t\t\tqueue_cfg->txq.ring_len = txq[i]->nb_tx_desc;\n-\t\t\tqueue_cfg->txq.dma_ring_addr = txq[i]->tx_ring_phys_addr;\n-\t\t} else {\n-\t\t\tqueue_cfg->txq.ring_len = 0;\n-\t\t\tqueue_cfg->txq.dma_ring_addr = 0;\n+\tvc_vqci->vsi_id = vf->vsi_res->vsi_id;\n+\tvc_vqci->num_queue_pairs = nb_qp;\n+\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 < 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 \n-\t\t/* Fill RX info */\n-\t\tqueue_cfg->rxq.vsi_id = queue_info->vsi_id;\n-\t\tqueue_cfg->rxq.queue_id = i;\n-\t\tqueue_cfg->rxq.max_pkt_size = vf->max_pkt_len;\n-\t\tif (i < num_rxq) {\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\tmbp_priv = rte_mempool_get_priv(rxq[i]->mp);\n-\t\t\tqueue_cfg->rxq.databuffer_size = mbp_priv->mbuf_data_room_size -\n-\t\t\t\t\t\t   RTE_PKTMBUF_HEADROOM;;\n-\t\t\tqueue_cfg->rxq.ring_len = rxq[i]->nb_rx_desc;\n-\t\t\tqueue_cfg->rxq.dma_ring_addr = rxq[i]->rx_ring_phys_addr;;\n-\t\t} else {\n-\t\t\tqueue_cfg->rxq.ring_len = 0;\n-\t\t\tqueue_cfg->rxq.dma_ring_addr = 0;\n-\t\t\tqueue_cfg->rxq.databuffer_size = 0;\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\tqueue_cfg++;\n \t}\n-\n+\tmemset(&args, 0, sizeof(args));\n \targs.ops = I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES;\n-\targs.in_args = (u8 *)queue_info;\n-\targs.in_args_size = len;\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-\terr = i40evf_execute_vf_cmd(dev, &args);\n-\tif (err)\n-\t\tPMD_DRV_LOG(ERR, \"fail to execute command \"\n-\t\t\t\t\"OP_CONFIG_VSI_QUEUES\\n\");\n-\trte_free(queue_info);\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 err;\n+\treturn ret;\n+}\n+\n+/* It configures VSI queues to co-work with DPDK PF host */\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\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}\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, \"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",
    "prefixes": [
        "dpdk-dev",
        "2/3"
    ]
}