diff mbox series

[ovs-dev,v2,09/12] netdev-dpdk: Minor cleanup of netdev_dpdk_send__.

Message ID 1505913181-82547-10-git-send-email-bhanuprakash.bodireddy@intel.com
State Accepted
Headers show
Series Use packet batch macro and APIs. | expand

Commit Message

Bodireddy, Bhanuprakash Sept. 20, 2017, 1:12 p.m. UTC
The variable 'cnt' is initialized and reused in multiple function calls
inside netdev_dpdk_send__() and is confusing sometimes. Instead introduce
'batch_cnt' to hold the original packet count and 'tx_cnt' to store
the final packet count resulting after filtering and qos operations.

Finally 'tx_cnt' packets gets transmitted on the respective 'qid'.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
---
 lib/netdev-dpdk.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Darrell Ball Sept. 22, 2017, 9:44 a.m. UTC | #1
I applied the patch to dpdk_merge here

https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_darball_ovs_commits_dpdk-5Fmerge&d=DwIGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=A2_FCacqbp2moAo3HGFlTuxsjONUGhlN42OBcAuQQ6w&s=b6btPKhgvOFr2GOUYvktND6kaC6jc3fXI-mXfvNgXOU&e=


On 9/20/17, 6:29 AM, "ovs-dev-bounces@openvswitch.org on behalf of Bhanuprakash Bodireddy" <ovs-dev-bounces@openvswitch.org on behalf of bhanuprakash.bodireddy@intel.com> wrote:

    The variable 'cnt' is initialized and reused in multiple function calls
    inside netdev_dpdk_send__() and is confusing sometimes. Instead introduce
    'batch_cnt' to hold the original packet count and 'tx_cnt' to store
    the final packet count resulting after filtering and qos operations.
    
    Finally 'tx_cnt' packets gets transmitted on the respective 'qid'.
    
    Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
    ---
     lib/netdev-dpdk.c | 12 ++++++------
     1 file changed, 6 insertions(+), 6 deletions(-)
    
    diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
    index 60887e5..3ff79c1 100644
    --- a/lib/netdev-dpdk.c
    +++ b/lib/netdev-dpdk.c
    @@ -1938,17 +1938,17 @@ netdev_dpdk_send__(struct netdev_dpdk *dev, int qid,
             dpdk_do_tx_copy(netdev, qid, batch);
             dp_packet_delete_batch(batch, may_steal);
         } else {
    -        int dropped;
    -        int cnt = batch->count;
    +        int tx_cnt, dropped;
    +        int batch_cnt = dp_packet_batch_size(batch);
             struct rte_mbuf **pkts = (struct rte_mbuf **) batch->packets;
     
             dp_packet_batch_apply_cutlen(batch);
     
    -        cnt = netdev_dpdk_filter_packet_len(dev, pkts, cnt);
    -        cnt = netdev_dpdk_qos_run(dev, pkts, cnt, true);
    -        dropped = batch->count - cnt;
    +        tx_cnt = netdev_dpdk_filter_packet_len(dev, pkts, batch_cnt);
    +        tx_cnt = netdev_dpdk_qos_run(dev, pkts, tx_cnt, true);
    +        dropped = batch_cnt - tx_cnt;
     
    -        dropped += netdev_dpdk_eth_tx_burst(dev, qid, pkts, cnt);
    +        dropped += netdev_dpdk_eth_tx_burst(dev, qid, pkts, tx_cnt);
     
             if (OVS_UNLIKELY(dropped)) {
                 rte_spinlock_lock(&dev->stats_lock);
    -- 
    2.4.11
    
    _______________________________________________
    dev mailing list
    dev@openvswitch.org
    https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=94xvksxdcL0BYyKG9ub9r_JkAoF4zpW2FVu_-reGIsE&s=ZsShQg3zIb1bSyp1NEtQvzQOX7UjQKQqNk-OoJ8q0GI&e=
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 60887e5..3ff79c1 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1938,17 +1938,17 @@  netdev_dpdk_send__(struct netdev_dpdk *dev, int qid,
         dpdk_do_tx_copy(netdev, qid, batch);
         dp_packet_delete_batch(batch, may_steal);
     } else {
-        int dropped;
-        int cnt = batch->count;
+        int tx_cnt, dropped;
+        int batch_cnt = dp_packet_batch_size(batch);
         struct rte_mbuf **pkts = (struct rte_mbuf **) batch->packets;
 
         dp_packet_batch_apply_cutlen(batch);
 
-        cnt = netdev_dpdk_filter_packet_len(dev, pkts, cnt);
-        cnt = netdev_dpdk_qos_run(dev, pkts, cnt, true);
-        dropped = batch->count - cnt;
+        tx_cnt = netdev_dpdk_filter_packet_len(dev, pkts, batch_cnt);
+        tx_cnt = netdev_dpdk_qos_run(dev, pkts, tx_cnt, true);
+        dropped = batch_cnt - tx_cnt;
 
-        dropped += netdev_dpdk_eth_tx_burst(dev, qid, pkts, cnt);
+        dropped += netdev_dpdk_eth_tx_burst(dev, qid, pkts, tx_cnt);
 
         if (OVS_UNLIKELY(dropped)) {
             rte_spinlock_lock(&dev->stats_lock);