* [dpdk-dev] [PATCH] net/af_packet: improve Tx statistics accuracy
@ 2019-10-09 15:29 Flavia Musatescu
2019-10-09 17:26 ` Stephen Hemminger
2019-10-10 17:34 ` [dpdk-dev] [PATCH v2] " Flavia Musatescu
0 siblings, 2 replies; 9+ messages in thread
From: Flavia Musatescu @ 2019-10-09 15:29 UTC (permalink / raw)
To: dev, John W. Linville; +Cc: stable, Flavia Musatescu, ciwillia
When sendto call fails and ENOBUFS 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.
Before:
testpmd Tx statistics:
TX-packets: 7529062 TX-errors: 3702150 TX-bytes: 451743720
pktgen Rx statistics:
Total Rx Pkts: 10700700
After:
testpmd TX statistics:
TX-packets: 11510625 TX-errors: 0 TX-bytes: 690637500
pktgen Rx statistics:
Total Rx Pkts: 10974307
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>
---
drivers/net/af_packet/rte_eth_af_packet.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 6df09f2..330fa75 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -244,8 +244,16 @@ 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) {
+ /* Error sending.
+ * When sendto call fails and ENOBUFS 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 of the previously
+ * enqueued packets will be considered successful, even though
+ * this is not entirely correct.
+ */
num_tx = 0;
num_tx_bytes = 0;
}
--
2.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] net/af_packet: improve Tx statistics accuracy
2019-10-09 15:29 [dpdk-dev] [PATCH] net/af_packet: improve Tx statistics accuracy Flavia Musatescu
@ 2019-10-09 17:26 ` Stephen Hemminger
2019-10-10 17:34 ` [dpdk-dev] [PATCH v2] " Flavia Musatescu
1 sibling, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2019-10-09 17:26 UTC (permalink / raw)
To: Flavia Musatescu; +Cc: dev, John W. Linville, stable, ciwillia
On Wed, 9 Oct 2019 16:29:09 +0100
Flavia Musatescu <flavia.musatescu@intel.com> wrote:
> + if (sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0) == -1 &&
> + errno != ENOBUFS) {
> + /* Error sending.
> + * When sendto call fails and ENOBUFS 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 of the previously
> + * enqueued packets will be considered successful, even though
> + * this is not entirely correct.
> + */
Agree with the change, but please keep only add a small code comment.
Long comments are a personal pet peeve, it also tends to standout as
"some different developer who had an issue left this comment"
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v2] net/af_packet: improve Tx statistics accuracy
2019-10-09 15:29 [dpdk-dev] [PATCH] net/af_packet: improve Tx statistics accuracy Flavia Musatescu
2019-10-09 17:26 ` Stephen Hemminger
@ 2019-10-10 17:34 ` Flavia Musatescu
2019-10-10 18:35 ` Stephen Hemminger
2019-10-17 11:51 ` [dpdk-dev] [PATCH v3] " Flavia Musatescu
1 sibling, 2 replies; 9+ messages in thread
From: Flavia Musatescu @ 2019-10-10 17:34 UTC (permalink / raw)
To: dev, John W. Linville; +Cc: stable, Flavia Musatescu, ciwillia
When sendto call fails and ENOBUFS 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.
Before:
testpmd Tx statistics:
TX-packets: 7529062 TX-errors: 3702150 TX-bytes: 451743720
pktgen Rx statistics:
Total Rx Pkts: 10700700
After:
testpmd TX statistics:
TX-packets: 11510625 TX-errors: 0 TX-bytes: 690637500
pktgen Rx statistics:
Total Rx Pkts: 10974307
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
---
drivers/net/af_packet/rte_eth_af_packet.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 6df09f2..df281bf 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -244,8 +244,12 @@ 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) {
+ /*
+ * In case of a ENOBUFS error all of the enqueued packets will
+ * be considered successful even though only some are sent.
+ */
num_tx = 0;
num_tx_bytes = 0;
}
--
2.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/af_packet: improve Tx statistics accuracy
2019-10-10 17:34 ` [dpdk-dev] [PATCH v2] " Flavia Musatescu
@ 2019-10-10 18:35 ` Stephen Hemminger
2019-10-11 17:13 ` Musatescu, Flavia
2019-10-17 11:51 ` [dpdk-dev] [PATCH v3] " Flavia Musatescu
1 sibling, 1 reply; 9+ messages in thread
From: Stephen Hemminger @ 2019-10-10 18:35 UTC (permalink / raw)
To: Flavia Musatescu; +Cc: dev, John W. Linville, stable, ciwillia
On Thu, 10 Oct 2019 18:34:30 +0100
Flavia Musatescu <flavia.musatescu@intel.com> wrote:
> When sendto call fails and ENOBUFS 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.
>
> Before:
> testpmd Tx statistics:
> TX-packets: 7529062 TX-errors: 3702150 TX-bytes: 451743720
> pktgen Rx statistics:
> Total Rx Pkts: 10700700
>
> After:
> testpmd TX statistics:
> TX-packets: 11510625 TX-errors: 0 TX-bytes: 690637500
> pktgen Rx statistics:
> Total Rx Pkts: 10974307
>
> 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
> ---
> drivers/net/af_packet/rte_eth_af_packet.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
> index 6df09f2..df281bf 100644
> --- a/drivers/net/af_packet/rte_eth_af_packet.c
> +++ b/drivers/net/af_packet/rte_eth_af_packet.c
> @@ -244,8 +244,12 @@ 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) {
> + /*
> + * In case of a ENOBUFS error all of the enqueued packets will
> + * be considered successful even though only some are sent.
> + */
> num_tx = 0;
> num_tx_bytes = 0;
> }
What about EINTR or EAGAIN?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/af_packet: improve Tx statistics accuracy
2019-10-10 18:35 ` Stephen Hemminger
@ 2019-10-11 17:13 ` Musatescu, Flavia
0 siblings, 0 replies; 9+ messages in thread
From: Musatescu, Flavia @ 2019-10-11 17:13 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, John W. Linville, stable, ciwillia
On 10/10/2019 19:35, Stephen Hemminger wrote:
> On Thu, 10 Oct 2019 18:34:30 +0100
> Flavia Musatescu <flavia.musatescu@intel.com> wrote:
>
>> When sendto call fails and ENOBUFS 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.
>>
>> Before:
>> testpmd Tx statistics:
>> TX-packets: 7529062 TX-errors: 3702150 TX-bytes: 451743720
>> pktgen Rx statistics:
>> Total Rx Pkts: 10700700
>>
>> After:
>> testpmd TX statistics:
>> TX-packets: 11510625 TX-errors: 0 TX-bytes: 690637500
>> pktgen Rx statistics:
>> Total Rx Pkts: 10974307
>>
>> 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
>> ---
>> drivers/net/af_packet/rte_eth_af_packet.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
>> index 6df09f2..df281bf 100644
>> --- a/drivers/net/af_packet/rte_eth_af_packet.c
>> +++ b/drivers/net/af_packet/rte_eth_af_packet.c
>> @@ -244,8 +244,12 @@ 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) {
>> + /*
>> + * In case of a ENOBUFS error all of the enqueued packets will
>> + * be considered successful even though only some are sent.
>> + */
>> num_tx = 0;
>> num_tx_bytes = 0;
>> }
> What about EINTR or EAGAIN?
Hi Stephen,
I agree with EAGAIN error case as I was able to test this scenario and
check the statistics.
Can we get an EINTR error in case of a nonblocking operation
(MSG_DONTWAIT flag is being used)? Is this a common situation and will
the gain justify the cost of an additional check? Do you have any
suggestions for how I could test this scenario?
Thanks,
Flavia
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v3] net/af_packet: improve Tx statistics accuracy
2019-10-10 17:34 ` [dpdk-dev] [PATCH v2] " Flavia Musatescu
2019-10-10 18:35 ` Stephen Hemminger
@ 2019-10-17 11:51 ` Flavia Musatescu
2019-10-18 14:24 ` [dpdk-dev] [PATCH v4] " Flavia Musatescu
1 sibling, 1 reply; 9+ messages in thread
From: Flavia Musatescu @ 2019-10-17 11:51 UTC (permalink / raw)
To: dev, John W. Linville; +Cc: stable, Flavia Musatescu, ciwillia
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.
Before:
testpmd Tx statistics:
TX-packets: 7529062 TX-errors: 3702150 TX-bytes: 451743720
pktgen Rx statistics:
Total Rx Pkts: 10700700
After:
testpmd TX statistics:
TX-packets: 11510625 TX-errors: 0 TX-bytes: 690637500
pktgen Rx statistics:
Total Rx Pkts: 10974307
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.
---
drivers/net/af_packet/rte_eth_af_packet.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
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;
}
--
2.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v4] net/af_packet: improve Tx statistics accuracy
2019-10-17 11:51 ` [dpdk-dev] [PATCH v3] " Flavia Musatescu
@ 2019-10-18 14:24 ` Flavia Musatescu
2019-10-18 15:15 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
0 siblings, 1 reply; 9+ messages in thread
From: Flavia Musatescu @ 2019-10-18 14:24 UTC (permalink / raw)
To: dev, John W. Linville; +Cc: stable, Flavia Musatescu, ciwillia
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(-)
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;
}
--
2.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH v4] net/af_packet: improve Tx statistics accuracy
2019-10-18 14:24 ` [dpdk-dev] [PATCH v4] " Flavia Musatescu
@ 2019-10-18 15:15 ` Ferruh Yigit
2019-10-21 18:15 ` Ferruh Yigit
0 siblings, 1 reply; 9+ messages in thread
From: Ferruh Yigit @ 2019-10-18 15:15 UTC (permalink / raw)
To: Flavia Musatescu, dev, John W. Linville; +Cc: stable, ciwillia
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>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH v4] net/af_packet: improve Tx statistics accuracy
2019-10-18 15:15 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
@ 2019-10-21 18:15 ` Ferruh Yigit
0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2019-10-21 18:15 UTC (permalink / raw)
To: Flavia Musatescu, dev, John W. Linville; +Cc: stable, ciwillia
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-10-21 18:15 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09 15:29 [dpdk-dev] [PATCH] net/af_packet: improve Tx statistics accuracy Flavia Musatescu
2019-10-09 17:26 ` Stephen Hemminger
2019-10-10 17:34 ` [dpdk-dev] [PATCH v2] " Flavia Musatescu
2019-10-10 18:35 ` Stephen Hemminger
2019-10-11 17:13 ` Musatescu, Flavia
2019-10-17 11:51 ` [dpdk-dev] [PATCH v3] " Flavia Musatescu
2019-10-18 14:24 ` [dpdk-dev] [PATCH v4] " Flavia Musatescu
2019-10-18 15:15 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2019-10-21 18:15 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).