diff mbox series

[v4] net/af_packet: improve Tx statistics accuracy

Message ID 1571408671-29209-1-git-send-email-flavia.musatescu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series [v4] net/af_packet: improve Tx statistics accuracy | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-compilation success Compile Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Flavia Musatescu Oct. 18, 2019, 2:24 p.m. UTC
When sendto call fails and ENOBUFS/EAGAIN error is being set
some of the packets are actually successfully transmitted.
There is no available count of those packets, so in order to
make the statistics more accurate, all the previously enqueued
packets will be considered successful, even though this is not
entirely correct.

Statistics numbers before this update:

Pktgen:
   Total Rx Pkts:               1360084
         Tx Pkts:               2000000
testpmd:
   RX-packets: 1408346  RX-missed: 0       RX-bytes:  84503418
   TX-packets: 526486   TX-errors: 881851  TX-bytes:  31589724

Statistics numbers after this update:

Pktgen:
   Total Rx Pkts:               1329872
         Tx Pkts:               2000000
testpmd:
   RX-packets: 1389156  RX-missed: 0       RX-bytes:  83349360
   TX-packets: 1389156  TX-errors: 0       TX-bytes:  83349360

Fixes: 74b7fc0a0ff1 ("net/af_packet: fix packet bytes counting")
Cc: ciwillia@brocade.com
Cc: stable@dpdk.org

Signed-off-by: Flavia Musatescu <flavia.musatescu@intel.com>

---
v2:
* Changed the comment.

v3:
* Same applied for EAGAIN error.

v4:
* Updated the statistics in the commit message
---
 drivers/net/af_packet/rte_eth_af_packet.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Ferruh Yigit Oct. 18, 2019, 3:15 p.m. UTC | #1
On 10/18/2019 3:24 PM, Flavia Musatescu wrote:
> When sendto call fails and ENOBUFS/EAGAIN error is being set
> some of the packets are actually successfully transmitted.
> There is no available count of those packets, so in order to
> make the statistics more accurate, all the previously enqueued
> packets will be considered successful, even though this is not
> entirely correct.
> 
> Statistics numbers before this update:
> 
> Pktgen:
>    Total Rx Pkts:               1360084
>          Tx Pkts:               2000000
> testpmd:
>    RX-packets: 1408346  RX-missed: 0       RX-bytes:  84503418
>    TX-packets: 526486   TX-errors: 881851  TX-bytes:  31589724
> 
> Statistics numbers after this update:
> 
> Pktgen:
>    Total Rx Pkts:               1329872
>          Tx Pkts:               2000000
> testpmd:
>    RX-packets: 1389156  RX-missed: 0       RX-bytes:  83349360
>    TX-packets: 1389156  TX-errors: 0       TX-bytes:  83349360
> 
> Fixes: 74b7fc0a0ff1 ("net/af_packet: fix packet bytes counting")
> Cc: ciwillia@brocade.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Flavia Musatescu <flavia.musatescu@intel.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Ferruh Yigit Oct. 21, 2019, 6:15 p.m. UTC | #2
On 10/18/2019 4:15 PM, Ferruh Yigit wrote:
> On 10/18/2019 3:24 PM, Flavia Musatescu wrote:
>> When sendto call fails and ENOBUFS/EAGAIN error is being set
>> some of the packets are actually successfully transmitted.
>> There is no available count of those packets, so in order to
>> make the statistics more accurate, all the previously enqueued
>> packets will be considered successful, even though this is not
>> entirely correct.
>>
>> Statistics numbers before this update:
>>
>> Pktgen:
>>    Total Rx Pkts:               1360084
>>          Tx Pkts:               2000000
>> testpmd:
>>    RX-packets: 1408346  RX-missed: 0       RX-bytes:  84503418
>>    TX-packets: 526486   TX-errors: 881851  TX-bytes:  31589724
>>
>> Statistics numbers after this update:
>>
>> Pktgen:
>>    Total Rx Pkts:               1329872
>>          Tx Pkts:               2000000
>> testpmd:
>>    RX-packets: 1389156  RX-missed: 0       RX-bytes:  83349360
>>    TX-packets: 1389156  TX-errors: 0       TX-bytes:  83349360
>>
>> Fixes: 74b7fc0a0ff1 ("net/af_packet: fix packet bytes counting")
>> Cc: ciwillia@brocade.com
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Flavia Musatescu <flavia.musatescu@intel.com>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 

Applied to dpdk-next-net/master, thanks.
diff mbox series

Patch

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 6df09f2..5592626 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -244,8 +244,14 @@  eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	}
 
 	/* kick-off transmits */
-	if (sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0) == -1) {
-		/* error sending -- no packets transmitted */
+	if (sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0) == -1 &&
+			errno != ENOBUFS && errno != EAGAIN) {
+		/*
+		 * In case of a ENOBUFS/EAGAIN error all of the enqueued
+		 * packets will be considered successful even though only some
+		 * are sent.
+		 */
+
 		num_tx = 0;
 		num_tx_bytes = 0;
 	}