Show a patch.

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

{
    "id": 376,
    "url": "https://patches.dpdk.org/api/patches/376/",
    "web_url": "https://patches.dpdk.org/patch/376/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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-3-git-send-email-helin.zhang@intel.com>",
    "date": "2014-09-14T14:48:26",
    "name": "[dpdk-dev,v2,2/5] i40e: renaming and code style fix",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5628202cac3ded1759745f3ccedbf0ca581b0708",
    "submitter": {
        "id": 14,
        "url": "https://patches.dpdk.org/api/people/14/",
        "name": "Helin Zhang",
        "email": "helin.zhang@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/376/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/376/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/376/checks/",
    "tags": {},
    "headers": {
        "Delivered-To": "patchwork@dpdk.org",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-Original-To": "patchwork@dpdk.org",
        "Date": "Sun, 14 Sep 2014 22:48:26 +0800",
        "In-Reply-To": "<1410706109-30448-1-git-send-email-helin.zhang@intel.com>",
        "Precedence": "list",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<1410706109-30448-1-git-send-email-helin.zhang@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "To": "dev@dpdk.org",
        "Errors-To": "dev-bounces@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 8916F68FD;\n\tSun, 14 Sep 2014 16:43:17 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id E75256891\n\tfor <dev@dpdk.org>; Sun, 14 Sep 2014 16:43:14 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga103.fm.intel.com with ESMTP; 14 Sep 2014 07:39:56 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga001.fm.intel.com with ESMTP; 14 Sep 2014 07:48:40 -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 s8EEmcg5018781;\n\tSun, 14 Sep 2014 22:48:38 +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 s8EEmad8030497; Sun, 14 Sep 2014 22:48:38 +0800",
            "(from hzhan75@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s8EEmagq030493; \n\tSun, 14 Sep 2014 22:48:36 +0800"
        ],
        "From": "Helin Zhang <helin.zhang@intel.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "X-ExtLoop1": "1",
        "Message-Id": "<1410706109-30448-3-git-send-email-helin.zhang@intel.com>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH v2 2/5] i40e: renaming and code style fix",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,521,1406617200\"; d=\"scan'208\";a=\"591103954\"",
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "Rename some local variables in i40e_pf.c and\ni40e_ethdev_vf.c, to express more accurately and briefly.\nFix several issues in i40e_pf.c reported by checkpatch.pl.\nLine warpping for some source lines which has more than 80\ncharacters, and merge lines together for those source lines\nwhich does not need any line wrapping actually.\n\nv2 changes:\n* Put all the renaming and code style fixes into a patch.\n* Add several more code style fixes for i40e_pf.c.\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 | 75 ++++++++++++++++++------------------\n lib/librte_pmd_i40e/i40e_pf.c        | 53 +++++++++++--------------\n 2 files changed, 61 insertions(+), 67 deletions(-)",
    "diff": "diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c\nindex d8552ad..113bff8 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c\n+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c\n@@ -527,27 +527,27 @@ 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-\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+\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 \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+\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+\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+\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@@ -557,48 +557,49 @@ i40evf_configure_queues(struct rte_eth_dev *dev)\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+\tfor (i = 0; i < nb_qp; 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\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\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\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\tqueue_cfg->txq.ring_len = 0;\n-\t\t\tqueue_cfg->txq.dma_ring_addr = 0;\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\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\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\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\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\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\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.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}\n-\t\tqueue_cfg++;\n+\t\tvc_qpi++;\n \t}\n \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+\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-\trte_free(queue_info);\n+\trte_free(vc_vqci);\n \n-\treturn err;\n+\treturn ret;\n }\n \n static int\ndiff --git a/lib/librte_pmd_i40e/i40e_pf.c b/lib/librte_pmd_i40e/i40e_pf.c\nindex e8b154d..1583021 100644\n--- a/lib/librte_pmd_i40e/i40e_pf.c\n+++ b/lib/librte_pmd_i40e/i40e_pf.c\n@@ -415,29 +415,28 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,\n {\n \tstruct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);\n \tstruct i40e_vsi *vsi = vf->vsi;\n-\tint ret = I40E_SUCCESS;\n-\tstruct i40e_virtchnl_vsi_queue_config_info *qconfig =\n-\t    (struct i40e_virtchnl_vsi_queue_config_info *)msg;\n-\tint i;\n-\tstruct i40e_virtchnl_queue_pair_info *qpair;\n+\tstruct i40e_virtchnl_vsi_queue_config_info *vc_vqci =\n+\t\t(struct i40e_virtchnl_vsi_queue_config_info *)msg;\n+\tstruct i40e_virtchnl_queue_pair_info *vc_qpi;\n+\tint i, ret = I40E_SUCCESS;\n \n-\tif (msg == NULL || msglen <= sizeof(*qconfig) ||\n-\t\tqconfig->num_queue_pairs > vsi->nb_qps) {\n+\tif (msg == NULL || msglen <= sizeof(*vc_vqci) ||\n+\t\tvc_vqci->num_queue_pairs > vsi->nb_qps) {\n \t\tPMD_DRV_LOG(ERR, \"vsi_queue_config_info argument wrong\\n\");\n \t\tret = I40E_ERR_PARAM;\n \t\tgoto send_msg;\n \t}\n \n-\tqpair = qconfig->qpair;\n-\tfor (i = 0; i < qconfig->num_queue_pairs; i++) {\n-\t\tif (qpair[i].rxq.queue_id > vsi->nb_qps - 1 ||\n-\t\t\tqpair[i].txq.queue_id > vsi->nb_qps - 1) {\n+\tvc_qpi = vc_vqci->qpair;\n+\tfor (i = 0; i < vc_vqci->num_queue_pairs; i++) {\n+\t\tif (vc_qpi[i].rxq.queue_id > vsi->nb_qps - 1 ||\n+\t\t\tvc_qpi[i].txq.queue_id > vsi->nb_qps - 1) {\n \t\t\tret = I40E_ERR_PARAM;\n \t\t\tgoto send_msg;\n \t\t}\n \n \t\t/* Apply VF RX queue setting to HMC */\n-\t\tif (i40e_pf_host_hmc_config_rxq(hw, vf, &qpair[i].rxq)\n+\t\tif (i40e_pf_host_hmc_config_rxq(hw, vf, &vc_qpi[i].rxq)\n \t\t\t!= I40E_SUCCESS) {\n \t\t\tPMD_DRV_LOG(ERR, \"Configure RX queue HMC failed\");\n \t\t\tret = I40E_ERR_PARAM;\n@@ -445,8 +444,8 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,\n \t\t}\n \n \t\t/* Apply VF TX queue setting to HMC */\n-\t\tif (i40e_pf_host_hmc_config_txq(hw, vf, &qpair[i].txq)\n-\t\t\t!= I40E_SUCCESS) {\n+\t\tif (i40e_pf_host_hmc_config_txq(hw, vf,\n+\t\t\t&vc_qpi[i].txq) != I40E_SUCCESS) {\n \t\t\tPMD_DRV_LOG(ERR, \"Configure TX queue HMC failed\");\n \t\t\tret = I40E_ERR_PARAM;\n \t\t\tgoto send_msg;\n@@ -857,11 +856,11 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,\n \t}\n \n \tswitch (opcode) {\n-\tcase I40E_VIRTCHNL_OP_VERSION :\n+\tcase I40E_VIRTCHNL_OP_VERSION:\n \t\tPMD_DRV_LOG(INFO, \"OP_VERSION received\\n\");\n \t\ti40e_pf_host_process_cmd_version(vf);\n \t\tbreak;\n-\tcase I40E_VIRTCHNL_OP_RESET_VF :\n+\tcase I40E_VIRTCHNL_OP_RESET_VF:\n \t\tPMD_DRV_LOG(INFO, \"OP_RESET_VF received\\n\");\n \t\ti40e_pf_host_process_cmd_reset_vf(vf);\n \t\tbreak;\n@@ -871,8 +870,7 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,\n \t\tbreak;\n \tcase I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES:\n \t\tPMD_DRV_LOG(INFO, \"OP_CONFIG_VSI_QUEUES received\\n\");\n-\t\ti40e_pf_host_process_cmd_config_vsi_queues(vf,\n-\t\t\t\t\t\tmsg, msglen);\n+\t\ti40e_pf_host_process_cmd_config_vsi_queues(vf, msg, msglen);\n \t\tbreak;\n \tcase I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP:\n \t\tPMD_DRV_LOG(INFO, \"OP_CONFIG_IRQ_MAP received\\n\");\n@@ -880,23 +878,19 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,\n \t\tbreak;\n \tcase I40E_VIRTCHNL_OP_ENABLE_QUEUES:\n \t\tPMD_DRV_LOG(INFO, \"OP_ENABLE_QUEUES received\\n\");\n-\t\ti40e_pf_host_process_cmd_enable_queues(vf,\n-\t\t\t\t\t\tmsg, msglen);\n+\t\ti40e_pf_host_process_cmd_enable_queues(vf, msg, msglen);\n \t\tbreak;\n \tcase I40E_VIRTCHNL_OP_DISABLE_QUEUES:\n \t\tPMD_DRV_LOG(INFO, \"OP_DISABLE_QUEUE received\\n\");\n-\t\ti40e_pf_host_process_cmd_disable_queues(vf,\n-\t\t\t\t\t\tmsg, msglen);\n+\t\ti40e_pf_host_process_cmd_disable_queues(vf, msg, msglen);\n \t\tbreak;\n \tcase I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS:\n \t\tPMD_DRV_LOG(INFO, \"OP_ADD_ETHER_ADDRESS received\\n\");\n-\t\ti40e_pf_host_process_cmd_add_ether_address(vf,\n-\t\t\t\t\t\tmsg, msglen);\n+\t\ti40e_pf_host_process_cmd_add_ether_address(vf, msg, msglen);\n \t\tbreak;\n \tcase I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS:\n \t\tPMD_DRV_LOG(INFO, \"OP_DEL_ETHER_ADDRESS received\\n\");\n-\t\ti40e_pf_host_process_cmd_del_ether_address(vf,\n-\t\t\t\t\t\tmsg, msglen);\n+\t\ti40e_pf_host_process_cmd_del_ether_address(vf, msg, msglen);\n \t\tbreak;\n \tcase I40E_VIRTCHNL_OP_ADD_VLAN:\n \t\tPMD_DRV_LOG(INFO, \"OP_ADD_VLAN received\\n\");\n@@ -932,10 +926,9 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,\n \tcase I40E_VIRTCHNL_OP_FCOE:\n \t\tPMD_DRV_LOG(ERR, \"OP_FCOE received, not supported\\n\");\n \tdefault:\n-\t\tPMD_DRV_LOG(ERR, \"%u received, not supported\\n\",\n-\t\t\t\t\t\t\topcode);\n-\t\ti40e_pf_host_send_msg_to_vf(vf, opcode,\n-\t\t\t\tI40E_ERR_PARAM, NULL, 0);\n+\t\tPMD_DRV_LOG(ERR, \"%u received, not supported\\n\", opcode);\n+\t\ti40e_pf_host_send_msg_to_vf(vf, opcode, I40E_ERR_PARAM,\n+\t\t\t\t\t\t\t\tNULL, 0);\n \t\tbreak;\n \t}\n }\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "2/5"
    ]
}