diff mbox series

[ovs-dev] netdev-dpdk: Fix tx drops statistic for a down netdev.

Message ID 20220422122459.22055-1-david.marchand@redhat.com
State Accepted
Commit 8523ee2f8a2d15cb320662dcc3a7ffa9bebe704d
Headers show
Series [ovs-dev] netdev-dpdk: Fix tx drops statistic for a down netdev. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

David Marchand April 22, 2022, 12:24 p.m. UTC
Dropped packets were not counted as tx_dropped when a DPDK netdev is
down (like after calling netdev-dpdk/set-admin-state dpdk1 down).

Fixes: 3b1fb0779b87 ("netdev-dpdk: Don't call rte_dev_stop() in update_flags().")
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/netdev-dpdk.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Pai G, Sunil April 25, 2022, 1:37 p.m. UTC | #1
> -----Original Message-----
> From: dev <ovs-dev-bounces@openvswitch.org> On Behalf Of David Marchand
> Sent: Friday, April 22, 2022 5:55 PM
> To: dev@openvswitch.org
> Cc: i.maximets@ovn.org
> Subject: [ovs-dev] [PATCH] netdev-dpdk: Fix tx drops statistic for a down
> netdev.
> 
> Dropped packets were not counted as tx_dropped when a DPDK netdev is down
> (like after calling netdev-dpdk/set-admin-state dpdk1 down).
> 
> Fixes: 3b1fb0779b87 ("netdev-dpdk: Don't call rte_dev_stop() in
> update_flags().")
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  lib/netdev-dpdk.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index
> c9ef2be855..42aa6b188d 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -2843,6 +2843,9 @@ netdev_dpdk_send__(struct netdev_dpdk *dev, int qid,
>                     bool concurrent_txq)  {
>      if (OVS_UNLIKELY(!(dev->flags & NETDEV_UP))) {
> +        rte_spinlock_lock(&dev->stats_lock);
> +        dev->stats.tx_dropped += dp_packet_batch_size(batch);
> +        rte_spinlock_unlock(&dev->stats_lock);
>          dp_packet_delete_batch(batch, true);
>          return;
>      }
> --
> 2.23.0

LGTM, 
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Ilya Maximets May 4, 2022, 9:27 p.m. UTC | #2
On 4/25/22 15:37, Pai G, Sunil wrote:
> 
>> -----Original Message-----
>> From: dev <ovs-dev-bounces@openvswitch.org> On Behalf Of David Marchand
>> Sent: Friday, April 22, 2022 5:55 PM
>> To: dev@openvswitch.org
>> Cc: i.maximets@ovn.org
>> Subject: [ovs-dev] [PATCH] netdev-dpdk: Fix tx drops statistic for a down
>> netdev.
>>
>> Dropped packets were not counted as tx_dropped when a DPDK netdev is down
>> (like after calling netdev-dpdk/set-admin-state dpdk1 down).
>>
>> Fixes: 3b1fb0779b87 ("netdev-dpdk: Don't call rte_dev_stop() in
>> update_flags().")
>> Signed-off-by: David Marchand <david.marchand@redhat.com>
>> ---
>>  lib/netdev-dpdk.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index
>> c9ef2be855..42aa6b188d 100644
>> --- a/lib/netdev-dpdk.c
>> +++ b/lib/netdev-dpdk.c
>> @@ -2843,6 +2843,9 @@ netdev_dpdk_send__(struct netdev_dpdk *dev, int qid,
>>                     bool concurrent_txq)  {
>>      if (OVS_UNLIKELY(!(dev->flags & NETDEV_UP))) {
>> +        rte_spinlock_lock(&dev->stats_lock);
>> +        dev->stats.tx_dropped += dp_packet_batch_size(batch);
>> +        rte_spinlock_unlock(&dev->stats_lock);
>>          dp_packet_delete_batch(batch, true);
>>          return;
>>      }
>> --
>> 2.23.0
> 
> LGTM, 
> Acked-by: Sunil Pai G <sunil.pai.g@intel.com>


Thanks!  Applied and backported down to 2.13.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index c9ef2be855..42aa6b188d 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2843,6 +2843,9 @@  netdev_dpdk_send__(struct netdev_dpdk *dev, int qid,
                    bool concurrent_txq)
 {
     if (OVS_UNLIKELY(!(dev->flags & NETDEV_UP))) {
+        rte_spinlock_lock(&dev->stats_lock);
+        dev->stats.tx_dropped += dp_packet_batch_size(batch);
+        rte_spinlock_unlock(&dev->stats_lock);
         dp_packet_delete_batch(batch, true);
         return;
     }