Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/807059/?format=api
{ "id": 807059, "url": "http://patchwork.ozlabs.org/api/patches/807059/?format=api", "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/20170829113944.4073-1-sysugaozhenyu@gmail.com/", "project": { "id": 47, "url": "http://patchwork.ozlabs.org/api/projects/47/?format=api", "name": "Open vSwitch", "link_name": "openvswitch", "list_id": "ovs-dev.openvswitch.org", "list_email": "ovs-dev@openvswitch.org", "web_url": "http://openvswitch.org/", "scm_url": "git@github.com:openvswitch/ovs.git", "webscm_url": "https://github.com/openvswitch/ovs", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170829113944.4073-1-sysugaozhenyu@gmail.com>", "list_archive_url": null, "date": "2017-08-29T11:39:44", "name": "[ovs-dev,v2] netdev-dpdk: Execute QoS Checking before copying to mbuf", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "df799aca8742e19447910b436560008d66fe1069", "submitter": { "id": 70513, "url": "http://patchwork.ozlabs.org/api/people/70513/?format=api", "name": "Gao Zhenyu", "email": "sysugaozhenyu@gmail.com" }, "delegate": { "id": 70734, "url": "http://patchwork.ozlabs.org/api/users/70734/?format=api", "username": "istokes", "first_name": "Ian", "last_name": "Stokes", "email": "ian.stokes@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/20170829113944.4073-1-sysugaozhenyu@gmail.com/mbox/", "series": [ { "id": 354, "url": "http://patchwork.ozlabs.org/api/series/354/?format=api", "web_url": "http://patchwork.ozlabs.org/project/openvswitch/list/?series=354", "date": "2017-08-29T11:39:44", "name": "[ovs-dev,v2] netdev-dpdk: Execute QoS Checking before copying to mbuf", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/354/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807059/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807059/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<ovs-dev-bounces@openvswitch.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "dev@openvswitch.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "ovs-dev@mail.linuxfoundation.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Z4yqs7xn\"; dkim-atps=neutral" ], "Received": [ "from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xhRXY3RSXz9sNr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 29 Aug 2017 21:40:19 +1000 (AEST)", "from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 8F94A9AF;\n\tTue, 29 Aug 2017 11:40:15 +0000 (UTC)", "from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 97ACE5AA\n\tfor <dev@openvswitch.org>; Tue, 29 Aug 2017 11:40:14 +0000 (UTC)", "from mail-pf0-f196.google.com (mail-pf0-f196.google.com\n\t[209.85.192.196])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id 31ED3196\n\tfor <dev@openvswitch.org>; Tue, 29 Aug 2017 11:40:14 +0000 (UTC)", "by mail-pf0-f196.google.com with SMTP id a2so2167712pfj.4\n\tfor <dev@openvswitch.org>; Tue, 29 Aug 2017 04:40:14 -0700 (PDT)", "from vultr.guest ([45.77.33.88]) by smtp.gmail.com with ESMTPSA id\n\tr135sm4421346pfr.109.2017.08.29.04.40.11\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 29 Aug 2017 04:40:12 -0700 (PDT)" ], "X-Greylist": "whitelisted by SQLgrey-1.7.6", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=vOKujhSL2OAGSHO4H3VJLr34ZUWv21uPqjicax6yBgI=;\n\tb=Z4yqs7xnq51eTl6vBGj/SZrWYnUsDBaquWWaLVfm3gC1po01zyHgXYFcKLLQWyomsw\n\tda4uhxLxkXYYRkZ9oUbYnh+ya+2ydc6wtv9nnII2oSHQdRKImGTYf7D/xtw9j+bORPPD\n\tDmG8/XbG0hv++4tGTMQOcSjrYHtCSPzwSwiDzqap+e4GiO4wE6q4HnnHOlMcxB/BbXBu\n\tmTXUZ62MBrcolMraCf/klB1xa9mtxbadTHeHa5sQFAnRmQMQtwO2plI+G0use9zl/YUk\n\ti8bRSfJqu+PM6mNdYaFJHKAD9UyfcVCluR6m9eS5nDu3W1FjV8lr6yLfRVR974dRpIqb\n\tdiqA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=vOKujhSL2OAGSHO4H3VJLr34ZUWv21uPqjicax6yBgI=;\n\tb=AZIxNEjR9DtMhV0C3VPuxXNCB2YGQfo/SsKrEUwzoQN1AvzVDUPLCsk5SqWhXoA3yw\n\tuRiidxDlBBM6FY6C6p2sncqoRbsco+z97OnK+jLXwvCRNT35VcTlN8jQVLot7NV4fh/r\n\t+hcsIqTxSjuP1zeRs6BOHVxUo+qqEYDRQhzK7A1AL4xpsoYVISWOXeh/yTOknywhGwlu\n\teR+qME9CGoIMlMPA2NGGHQItMhvU72uBCVtJ7SccWBchCr9tfR75hlFLLyyKUG2JYPSK\n\tD+dZudLQQ2AjHyHFWPulCiFzlEkdqFf5vF38CUkBeL55Rd+JHrr4vfXAQJRK51oDzeCF\n\twoIw==", "X-Gm-Message-State": "AHYfb5j22Ewov5q8Pu1eSkD1Vz3F2CJEoFjEyJEFj/0d6fHW/UYfufzk\n\tOdzts6kjgL2olA==", "X-Received": "by 10.99.120.71 with SMTP id t68mr28671pgc.248.1504006813784;\n\tTue, 29 Aug 2017 04:40:13 -0700 (PDT)", "From": "Zhenyu Gao <sysugaozhenyu@gmail.com>", "To": "ian.stokes@intel.com,\n\tdev@openvswitch.org", "Date": "Tue, 29 Aug 2017 11:39:44 +0000", "Message-Id": "<20170829113944.4073-1-sysugaozhenyu@gmail.com>", "X-Mailer": "git-send-email 2.11.0", "X-Spam-Status": "No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tDKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=disabled\n\tversion=3.3.1", "X-Spam-Checker-Version": "SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org", "Subject": "[ovs-dev] [PATCH v2] netdev-dpdk: Execute QoS Checking before\n\tcopying to mbuf", "X-BeenThere": "ovs-dev@openvswitch.org", "X-Mailman-Version": "2.1.12", "Precedence": "list", "List-Id": "<ovs-dev.openvswitch.org>", "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>", "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>", "List-Post": "<mailto:ovs-dev@openvswitch.org>", "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>", "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "ovs-dev-bounces@openvswitch.org", "Errors-To": "ovs-dev-bounces@openvswitch.org" }, "content": "In dpdk_do_tx_copy function, all packets were copied to mbuf first,\nbut QoS checking may drop some of them.\nMove the QoS checking in front of copying data to mbuf, it helps to\nreduce useless copy.\n\nSigned-off-by: Zhenyu Gao <sysugaozhenyu@gmail.com>\n---\n lib/netdev-dpdk.c | 55 ++++++++++++++++++++++++++++++++++++-------------------\n 1 file changed, 36 insertions(+), 19 deletions(-)", "diff": "diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c\nindex 1aaf6f7..50874b8 100644\n--- a/lib/netdev-dpdk.c\n+++ b/lib/netdev-dpdk.c\n@@ -279,7 +279,7 @@ struct dpdk_qos_ops {\n * For all QoS implementations it should always be non-null.\n */\n int (*qos_run)(struct qos_conf *qos_conf, struct rte_mbuf **pkts,\n- int pkt_cnt);\n+ int pkt_cnt, bool may_steal);\n };\n \n /* dpdk_qos_ops for each type of user space QoS implementation */\n@@ -1501,7 +1501,8 @@ netdev_dpdk_policer_pkt_handle(struct rte_meter_srtcm *meter,\n \n static int\n netdev_dpdk_policer_run(struct rte_meter_srtcm *meter,\n- struct rte_mbuf **pkts, int pkt_cnt)\n+ struct rte_mbuf **pkts, int pkt_cnt,\n+ bool may_steal)\n {\n int i = 0;\n int cnt = 0;\n@@ -1517,7 +1518,9 @@ netdev_dpdk_policer_run(struct rte_meter_srtcm *meter,\n }\n cnt++;\n } else {\n- rte_pktmbuf_free(pkt);\n+ if (may_steal) {\n+ rte_pktmbuf_free(pkt);\n+ }\n }\n }\n \n@@ -1526,12 +1529,13 @@ netdev_dpdk_policer_run(struct rte_meter_srtcm *meter,\n \n static int\n ingress_policer_run(struct ingress_policer *policer, struct rte_mbuf **pkts,\n- int pkt_cnt)\n+ int pkt_cnt, bool may_steal)\n {\n int cnt = 0;\n \n rte_spinlock_lock(&policer->policer_lock);\n- cnt = netdev_dpdk_policer_run(&policer->in_policer, pkts, pkt_cnt);\n+ cnt = netdev_dpdk_policer_run(&policer->in_policer, pkts,\n+ pkt_cnt, may_steal);\n rte_spinlock_unlock(&policer->policer_lock);\n \n return cnt;\n@@ -1635,7 +1639,7 @@ netdev_dpdk_vhost_rxq_recv(struct netdev_rxq *rxq,\n dropped = nb_rx;\n nb_rx = ingress_policer_run(policer,\n (struct rte_mbuf **) batch->packets,\n- nb_rx);\n+ nb_rx, true);\n dropped -= nb_rx;\n }\n \n@@ -1672,7 +1676,7 @@ netdev_dpdk_rxq_recv(struct netdev_rxq *rxq, struct dp_packet_batch *batch)\n dropped = nb_rx;\n nb_rx = ingress_policer_run(policer,\n (struct rte_mbuf **) batch->packets,\n- nb_rx);\n+ nb_rx, true);\n dropped -= nb_rx;\n }\n \n@@ -1690,13 +1694,13 @@ netdev_dpdk_rxq_recv(struct netdev_rxq *rxq, struct dp_packet_batch *batch)\n \n static inline int\n netdev_dpdk_qos_run(struct netdev_dpdk *dev, struct rte_mbuf **pkts,\n- int cnt)\n+ int cnt, bool may_steal)\n {\n struct qos_conf *qos_conf = ovsrcu_get(struct qos_conf *, &dev->qos_conf);\n \n if (qos_conf) {\n rte_spinlock_lock(&qos_conf->lock);\n- cnt = qos_conf->ops->qos_run(qos_conf, pkts, cnt);\n+ cnt = qos_conf->ops->qos_run(qos_conf, pkts, cnt, may_steal);\n rte_spinlock_unlock(&qos_conf->lock);\n }\n \n@@ -1770,7 +1774,7 @@ __netdev_dpdk_vhost_send(struct netdev *netdev, int qid,\n \n cnt = netdev_dpdk_filter_packet_len(dev, cur_pkts, cnt);\n /* Check has QoS has been configured for the netdev */\n- cnt = netdev_dpdk_qos_run(dev, cur_pkts, cnt);\n+ cnt = netdev_dpdk_qos_run(dev, cur_pkts, cnt, true);\n dropped = total_pkts - cnt;\n \n do {\n@@ -1816,10 +1820,22 @@ dpdk_do_tx_copy(struct netdev *netdev, int qid, struct dp_packet_batch *batch)\n #endif\n struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);\n struct rte_mbuf *pkts[PKT_ARRAY_SIZE];\n+ int txcnt_eth = batch->count;\n int dropped = 0;\n int newcnt = 0;\n int i;\n \n+ if (dev->type != DPDK_DEV_VHOST) {\n+ /* Check if QoS has been configured for this netdev. */\n+ txcnt_eth = netdev_dpdk_qos_run(dev,\n+ (struct rte_mbuf **)batch->packets,\n+ txcnt_eth, false);\n+ if (txcnt_eth == 0) {\n+ dropped = batch->count;\n+ goto out;\n+ }\n+ }\n+\n dp_packet_batch_apply_cutlen(batch);\n \n for (i = 0; i < batch->count; i++) {\n@@ -1848,21 +1864,20 @@ dpdk_do_tx_copy(struct netdev *netdev, int qid, struct dp_packet_batch *batch)\n rte_pktmbuf_pkt_len(pkts[newcnt]) = size;\n \n newcnt++;\n+ if (dev->type != DPDK_DEV_VHOST && newcnt >= txcnt_eth) {\n+ dropped += batch->count - i - 1;\n+ break;\n+ }\n }\n \n if (dev->type == DPDK_DEV_VHOST) {\n __netdev_dpdk_vhost_send(netdev, qid, (struct dp_packet **) pkts,\n newcnt);\n } else {\n- unsigned int qos_pkts = newcnt;\n-\n- /* Check if QoS has been configured for this netdev. */\n- newcnt = netdev_dpdk_qos_run(dev, pkts, newcnt);\n-\n- dropped += qos_pkts - newcnt;\n dropped += netdev_dpdk_eth_tx_burst(dev, qid, pkts, newcnt);\n }\n \n+out:\n if (OVS_UNLIKELY(dropped)) {\n rte_spinlock_lock(&dev->stats_lock);\n dev->stats.tx_dropped += dropped;\n@@ -1915,7 +1930,7 @@ netdev_dpdk_send__(struct netdev_dpdk *dev, int qid,\n dp_packet_batch_apply_cutlen(batch);\n \n cnt = netdev_dpdk_filter_packet_len(dev, pkts, cnt);\n- cnt = netdev_dpdk_qos_run(dev, pkts, cnt);\n+ cnt = netdev_dpdk_qos_run(dev, pkts, cnt, true);\n dropped = batch->count - cnt;\n \n dropped += netdev_dpdk_eth_tx_burst(dev, qid, pkts, cnt);\n@@ -3132,13 +3147,15 @@ egress_policer_qos_is_equal(const struct qos_conf *conf,\n }\n \n static int\n-egress_policer_run(struct qos_conf *conf, struct rte_mbuf **pkts, int pkt_cnt)\n+egress_policer_run(struct qos_conf *conf, struct rte_mbuf **pkts, int pkt_cnt,\n+ bool may_steal)\n {\n int cnt = 0;\n struct egress_policer *policer =\n CONTAINER_OF(conf, struct egress_policer, qos_conf);\n \n- cnt = netdev_dpdk_policer_run(&policer->egress_meter, pkts, pkt_cnt);\n+ cnt = netdev_dpdk_policer_run(&policer->egress_meter, pkts,\n+ pkt_cnt, may_steal);\n \n return cnt;\n }\n", "prefixes": [ "ovs-dev", "v2" ] }