Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/26042/?format=api
http://patches.dpdk.org/api/patches/26042/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1498764950-30821-1-git-send-email-ciwillia@brocade.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": "<1498764950-30821-1-git-send-email-ciwillia@brocade.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1498764950-30821-1-git-send-email-ciwillia@brocade.com", "date": "2017-06-29T19:35:50", "name": "[dpdk-dev] net/vmxnet3: avoid code duplication", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "976fa276e5b74000c04814710180a9710a64fa48", "submitter": { "id": 424, "url": "http://patches.dpdk.org/api/people/424/?format=api", "name": "Chas Williams", "email": "ciwillia@brocade.com" }, "delegate": { "id": 319, "url": "http://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1498764950-30821-1-git-send-email-ciwillia@brocade.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/26042/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/26042/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 F1FA57D17;\n\tThu, 29 Jun 2017 21:36:54 +0200 (CEST)", "from mx0a-000f0801.pphosted.com (mx0b-000f0801.pphosted.com\n\t[67.231.152.113]) by dpdk.org (Postfix) with ESMTP id C8D3C2C2A\n\tfor <dev@dpdk.org>; Thu, 29 Jun 2017 21:36:15 +0200 (CEST)", "from pps.filterd (m0048192.ppops.net [127.0.0.1])\n\tby mx0b-000f0801.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id\n\tv5TJNiN4017989; Thu, 29 Jun 2017 12:36:15 -0700", "from brmwp-exmb11.corp.brocade.com ([208.47.132.227])\n\tby mx0b-000f0801.pphosted.com with ESMTP id 2bd7jdr1p1-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); \n\tThu, 29 Jun 2017 12:36:15 -0700", "from confsjhq2-2-001.brocade.com (10.252.70.2) by\n\tBRMWP-EXMB11.corp.brocade.com (172.16.59.77) with Microsoft SMTP\n\tServer (TLS) id 15.0.1293.2; Thu, 29 Jun 2017 13:36:11 -0600" ], "From": "\"Charles (Chas) Williams\" <ciwillia@brocade.com>", "To": "<dev@dpdk.org>", "CC": "<skhare@vmware.com>, \"Charles (Chas) Williams\" <ciwillia@brocade.com>", "Date": "Thu, 29 Jun 2017 15:35:50 -0400", "Message-ID": "<1498764950-30821-1-git-send-email-ciwillia@brocade.com>", "X-Mailer": "git-send-email 2.1.4", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-ClientProxiedBy": "hq1wp-excas11.corp.brocade.com (10.70.36.102) To\n\tBRMWP-EXMB11.corp.brocade.com (172.16.59.77)", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-06-29_13:, , signatures=0", "X-Proofpoint-Spam-Details": "rule=notspam policy=default score=0\n\tpriorityscore=1501 malwarescore=0\n\tsuspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015\n\tlowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam\n\tadjust=0\n\treason=mlx scancount=1 engine=8.0.1-1703280000\n\tdefinitions=main-1706290307", "Subject": "[dpdk-dev] [PATCH] net/vmxnet3: avoid code duplication", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <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": "Refactor vmxnet3_post_rx_bufs() to call vmxnet3_renew_desc()\nto update the newly allocated mbufs. While here, relocate the\nrelevant comments to vmxnet3_renew_desc().\n\nSigned-off-by: Chas Williams <ciwillia@brocade.com>\n---\n drivers/net/vmxnet3/vmxnet3_rxtx.c | 61 +++++++++++++-------------------------\n 1 file changed, 21 insertions(+), 40 deletions(-)", "diff": "diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c\nindex 13c73f6..d9cf437 100644\n--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c\n+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c\n@@ -593,24 +593,40 @@ static inline void\n vmxnet3_renew_desc(vmxnet3_rx_queue_t *rxq, uint8_t ring_id,\n \t\t struct rte_mbuf *mbuf)\n {\n-\tuint32_t val = 0;\n+\tuint32_t val;\n \tstruct vmxnet3_cmd_ring *ring = &rxq->cmd_ring[ring_id];\n \tstruct Vmxnet3_RxDesc *rxd =\n \t\t(struct Vmxnet3_RxDesc *)(ring->base + ring->next2fill);\n \tvmxnet3_buf_info_t *buf_info = &ring->buf_info[ring->next2fill];\n \n-\tif (ring_id == 0)\n+\tif (ring_id == 0) {\n+\t\t/* Usually: One HEAD type buf per packet\n+\t\t * val = (ring->next2fill % rxq->hw->bufs_per_pkt) ?\n+\t\t * VMXNET3_RXD_BTYPE_BODY : VMXNET3_RXD_BTYPE_HEAD;\n+\t\t */\n+\n+\t\t/* We use single packet buffer so all heads here */\n \t\tval = VMXNET3_RXD_BTYPE_HEAD;\n-\telse\n+\t} else {\n+\t\t/* All BODY type buffers for 2nd ring */\n \t\tval = VMXNET3_RXD_BTYPE_BODY;\n+\t}\n \n+\t/*\n+\t * Load mbuf pointer into buf_info[ring_size]\n+\t * buf_info structure is equivalent to cookie for virtio-virtqueue\n+\t */\n \tbuf_info->m = mbuf;\n \tbuf_info->len = (uint16_t)(mbuf->buf_len - RTE_PKTMBUF_HEADROOM);\n \tbuf_info->bufPA = rte_mbuf_data_dma_addr_default(mbuf);\n \n+\t/* Load Rx Descriptor with the buffer's GPA */\n \trxd->addr = buf_info->bufPA;\n+\n+\t/* After this point rxd->addr MUST not be NULL */\n \trxd->btype = val;\n \trxd->len = buf_info->len;\n+\t/* Flip gen bit at the end to change ownership */\n \trxd->gen = ring->gen;\n \n \tvmxnet3_cmd_ring_adv_next2fill(ring);\n@@ -629,28 +645,11 @@ static int\n vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t *rxq, uint8_t ring_id)\n {\n \tint err = 0;\n-\tuint32_t i = 0, val = 0;\n+\tuint32_t i = 0;\n \tstruct vmxnet3_cmd_ring *ring = &rxq->cmd_ring[ring_id];\n \n-\tif (ring_id == 0) {\n-\t\t/* Usually: One HEAD type buf per packet\n-\t\t * val = (ring->next2fill % rxq->hw->bufs_per_pkt) ?\n-\t\t * VMXNET3_RXD_BTYPE_BODY : VMXNET3_RXD_BTYPE_HEAD;\n-\t\t */\n-\n-\t\t/* We use single packet buffer so all heads here */\n-\t\tval = VMXNET3_RXD_BTYPE_HEAD;\n-\t} else {\n-\t\t/* All BODY type buffers for 2nd ring */\n-\t\tval = VMXNET3_RXD_BTYPE_BODY;\n-\t}\n-\n \twhile (vmxnet3_cmd_ring_desc_avail(ring) > 0) {\n-\t\tstruct Vmxnet3_RxDesc *rxd;\n \t\tstruct rte_mbuf *mbuf;\n-\t\tvmxnet3_buf_info_t *buf_info = &ring->buf_info[ring->next2fill];\n-\n-\t\trxd = (struct Vmxnet3_RxDesc *)(ring->base + ring->next2fill);\n \n \t\t/* Allocate blank mbuf for the current Rx Descriptor */\n \t\tmbuf = rte_mbuf_raw_alloc(rxq->mp);\n@@ -661,25 +660,7 @@ vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t *rxq, uint8_t ring_id)\n \t\t\tbreak;\n \t\t}\n \n-\t\t/*\n-\t\t * Load mbuf pointer into buf_info[ring_size]\n-\t\t * buf_info structure is equivalent to cookie for virtio-virtqueue\n-\t\t */\n-\t\tbuf_info->m = mbuf;\n-\t\tbuf_info->len = (uint16_t)(mbuf->buf_len -\n-\t\t\t\t\t RTE_PKTMBUF_HEADROOM);\n-\t\tbuf_info->bufPA = rte_mbuf_data_dma_addr_default(mbuf);\n-\n-\t\t/* Load Rx Descriptor with the buffer's GPA */\n-\t\trxd->addr = buf_info->bufPA;\n-\n-\t\t/* After this point rxd->addr MUST not be NULL */\n-\t\trxd->btype = val;\n-\t\trxd->len = buf_info->len;\n-\t\t/* Flip gen bit at the end to change ownership */\n-\t\trxd->gen = ring->gen;\n-\n-\t\tvmxnet3_cmd_ring_adv_next2fill(ring);\n+\t\tvmxnet3_renew_desc(rxq, ring_id, mbuf);\n \t\ti++;\n \t}\n \n", "prefixes": [ "dpdk-dev" ] }{ "id": 26042, "url": "