net/pcap: set queue started and stopped
PATCH 1/1 net/pcap: set queue started and stopped
Set the rx and tx queue state appropriately when the queues or device are started or stopped.
--- drivers/net/pcap/rte_eth_pcap.c | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
drivers/net/pcap/rte_eth_pcap.c +42 -0
@@ -430,6 +430,10 @@ eth_dev_start(struct rte_eth_dev *dev)return -1 ; rx->pcap = tx->pcap; } + + dev->data->tx_queue_state[0 ] =RTE_ETH_QUEUE_STATE_STARTED ; + dev->data->rx_queue_state[0 ] =RTE_ETH_QUEUE_STATE_STARTED ; + goto status_up; }
@@ -490,6 +494,8 @@ eth_dev_stop(struct rte_eth_dev *dev)pcap_close (tx->pcap); tx->pcap =NULL ; rx->pcap =NULL ; + dev->data->tx_queue_state[0 ] =RTE_ETH_QUEUE_STATE_STOPPED ; + dev->data->rx_queue_state[0 ] =RTE_ETH_QUEUE_STATE_STOPPED ; goto status_down; }
@@ -643,6 +649,38 @@ eth_tx_queue_setup(struct rte_eth_dev *dev,return 0 ; } +static int +eth_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id) +{ + dev->data->rx_queue_state[rx_queue_id] =RTE_ETH_QUEUE_STATE_STARTED ; + +return 0 ; +} + +static int +eth_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id) +{ + dev->data->tx_queue_state[tx_queue_id] =RTE_ETH_QUEUE_STATE_STARTED ; + +return 0 ; +} + +static int +eth_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id) +{ + dev->data->rx_queue_state[rx_queue_id] =RTE_ETH_QUEUE_STATE_STOPPED ; + +return 0 ; +} + +static int +eth_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id) +{ + dev->data->tx_queue_state[tx_queue_id] =RTE_ETH_QUEUE_STATE_STOPPED ; + +return 0 ; +} +static const struct eth_dev_ops ops = { .dev_start = eth_dev_start, .dev_stop = eth_dev_stop,
@@ -651,6 +689,10 @@ static const struct eth_dev_ops ops = { .dev_infos_get = eth_dev_info, .rx_queue_setup = eth_rx_queue_setup, .tx_queue_setup = eth_tx_queue_setup, + .rx_queue_start = eth_rx_queue_start, + .tx_queue_start = eth_tx_queue_start, + .rx_queue_stop = eth_rx_queue_stop, + .tx_queue_stop = eth_tx_queue_stop, .rx_queue_release = eth_queue_release, .tx_queue_release = eth_queue_release, .link_update = eth_link_update,
Signature · 1 line
2.13.6
Quoted 2 lines · Gage Eads
Set the rx and tx queue state appropriately when the queues or device are started or stopped.
Is there a specific reason to enable these dev_ops, if so can you please document in commit log?
Quoted 11 lines
Signed-off-by Gage Eads <[email protected]>--- drivers/net/pcap/rte_eth_pcap.c | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)drivers/net/pcap/rte_eth_pcap.c +0
-0
drivers/net/pcap/rte_eth_pcap.c eth_dev_start(struct rte_eth_dev *dev) · line 435
Quoted 6 lines
drivers/net/pcap/rte_eth_pcap.c +3
-0@@ -430,6 +430,10 @@ eth_dev_start(struct rte_eth_dev *dev)return -1 ; rx->pcap = tx->pcap; } + + dev->data->tx_queue_state[0 ] =RTE_ETH_QUEUE_STATE_STARTED ; + dev->data->rx_queue_state[0 ] =RTE_ETH_QUEUE_STATE_STARTED ;
pcap also supports multiple queue, instead of hardcoding the queue 0 it can be possible to iterate through dev->data->nb_rx_queues, dev->data->nb_tx_queues.
And I think it is not good to set this in "internals->single_iface" condition, it is better to do these assignments just above "status_up" after all queues initialized.
drivers/net/pcap/rte_eth_pcap.c eth_dev_stop(struct rte_eth_dev *dev) · line 498
Quoted 10 lines
drivers/net/pcap/rte_eth_pcap.c +3
-0+ goto status_up; }@@ -490,6 +494,8 @@ eth_dev_stop(struct rte_eth_dev *dev)pcap_close (tx->pcap); tx->pcap =NULL ; rx->pcap =NULL ; + dev->data->tx_queue_state[0 ] =RTE_ETH_QUEUE_STATE_STOPPED ; + dev->data->rx_queue_state[0 ] =RTE_ETH_QUEUE_STATE_STOPPED ;
same here, just above "status_down" is better place and by using dev->data->nb_[r/t]x_queues
Quoted 3 lines
drivers/net/pcap/rte_eth_pcap.c +0
-0goto status_down; }
Quoted 8 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, July 18, 2018 4:14 AM
To: Eads, Gage <[email protected]>; [email protected]
Subject: Re: [PATCH] net/pcap: set queue started and stopped
Quoted 6 lines
Quoted 2 lines · Gage Eads
Set the rx and tx queue state appropriately when the queues or device are started or stopped.
Is there a specific reason to enable these
dev_ops, if so can you please document in commit log?
Yes, the purpose of the patch is to enable the rte_eth_dev_{rx, tx}_queue_{start, stop} functions for the PCAP PMD. I'll update the message in v2.
Quoted 40 lines
Quoted 13 lines
Signed-off-by Gage Eads <[email protected]>--- drivers/net/pcap/rte_eth_pcap.c | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)(quoted diff) +0
-0
b/drivers/net/pcap/rte_eth_pcap.cindex6bd4a7d79..21e466bcd100644drivers/net/pcap/rte_eth_pcap.c eth_dev_start(struct rte_eth_dev *dev) · line 434
Quoted 5 lines
drivers/net/pcap/rte_eth_pcap.c +2
-0@@ -430,6 +430,10 @@ eth_dev_start(struct rte_eth_dev *dev)return -1 ; rx->pcap = tx->pcap; } + + dev->data->tx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STARTED;drivers/net/pcap/rte_eth_pcap.c eth_dev_start(struct rte_eth_dev *dev) · line 435
Quoted 1 line
drivers/net/pcap/rte_eth_pcap.c +1
-0+ dev->data->rx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STARTED;pcap also supports multiple queue, instead of hardcoding the queue 0 it can be possible to iterate through
dev->data->nb_rx_queues, dev->data-Quoted 1 line
nb_tx_queues.And I think it is not good to set this in "
internals->single_iface" condition, it is better to do these assignments just above "status_up" after all queues initialized.drivers/net/pcap/rte_eth_pcap.c eth_dev_stop(struct rte_eth_dev *dev) · line 497
Quoted 9 lines
drivers/net/pcap/rte_eth_pcap.c +2
-0+ goto status_up; }@@ -490,6 +494,8 @@ eth_dev_stop(struct rte_eth_dev *dev)pcap_close (tx->pcap); tx->pcap =NULL ; rx->pcap =NULL ; + dev->data->tx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STOPPED;
Quoted 5 lines
drivers/net/pcap/rte_eth_pcap.c eth_dev_stop(struct rte_eth_dev *dev) · line 498
Quoted 1 line
drivers/net/pcap/rte_eth_pcap.c +1
-0+ dev->data->rx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STOPPED;same here, just above "
status_down" is better place and by using dev->data->nb_[r/t]x_queues
Agreed, I will move the started and stopped assignments as you suggested.
Quoted 8 lines · Gage
Quoted 8 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, July 18, 2018 4:14 AM
To: Eads, Gage <[email protected]>; [email protected]
Subject: Re: [PATCH] net/pcap: set queue started and stopped
Quoted 8 lines
Quoted 6 lines · Gage Eads
Quoted 2 lines
Set the rx and tx queue state appropriately when the queues or device are started or stopped.
Is there a specific reason to enable these
dev_ops, if so can you please document in commit log?Yes, the purpose of the patch is to enable the rte_eth_dev_{rx, tx}_queue_{start, stop} functions for the PCAP PMD. I'll update the message in v2.
I guess that part is clear :) I was asking if there is a higher level reason to enable queue start/stop on these PMDs?
Is there some specific usecase not working for you when these are not enabled?
Quoted 49 lines
Quoted 41 lines
Quoted 14 lines
Signed-off-by Gage Eads <[email protected]>--- drivers/net/pcap/rte_eth_pcap.c | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)(quoted diff) +0
-0
b/drivers/net/pcap/rte_eth_pcap.cindex6bd4a7d79..21e466bcd100644drivers/net/pcap/rte_eth_pcap.c eth_dev_start(struct rte_eth_dev *dev) · line 434
Quoted 5 lines
drivers/net/pcap/rte_eth_pcap.c +2
-0@@ -430,6 +430,10 @@ eth_dev_start(struct rte_eth_dev *dev)return -1 ; rx->pcap = tx->pcap; } + + dev->data->tx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STARTED;drivers/net/pcap/rte_eth_pcap.c eth_dev_start(struct rte_eth_dev *dev) · line 435
Quoted 1 line
drivers/net/pcap/rte_eth_pcap.c +1
-0+ dev->data->rx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STARTED;pcap also supports multiple queue, instead of hardcoding the queue 0 it can be possible to iterate through
dev->data->nb_rx_queues, dev->data-Quoted 1 line
nb_tx_queues.And I think it is not good to set this in "
internals->single_iface" condition, it is better to do these assignments just above "status_up" after all queues initialized.drivers/net/pcap/rte_eth_pcap.c eth_dev_stop(struct rte_eth_dev *dev) · line 497
Quoted 9 lines
drivers/net/pcap/rte_eth_pcap.c +2
-0+ goto status_up; }@@ -490,6 +494,8 @@ eth_dev_stop(struct rte_eth_dev *dev)pcap_close (tx->pcap); tx->pcap =NULL ; rx->pcap =NULL ; + dev->data->tx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STOPPED;Quoted 5 lines
drivers/net/pcap/rte_eth_pcap.c eth_dev_stop(struct rte_eth_dev *dev) · line 498
Quoted 1 line
drivers/net/pcap/rte_eth_pcap.c +1
-0+ dev->data->rx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STOPPED;same here, just above "
status_down" is better place and by using dev->data->nb_[r/t]x_queuesAgreed, I will move the started and stopped assignments as you suggested.
Quoted 24 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, July 18, 2018 9:25 AM
To: Eads, Gage <[email protected]>; [email protected]
Subject: Re: [PATCH] net/pcap: set queue started and stoppedQuoted 15 lines · Gage
Quoted 14 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, July 18, 2018 4:14 AM
To: Eads, Gage <[email protected]>; [email protected]
Subject: Re: [PATCH] net/pcap: set queue started and stoppedQuoted 2 lines · Gage Eads
Set the rx and tx queue state appropriately when the queues or device are started or stopped.
Is there a specific reason to enable these
dev_ops, if so can you please document in commit log?
Quoted 8 lines
Quoted 1 line
Yes, the purpose of the patch is to enable the rte_eth_dev_{rx,
tx}_queue_{start, stop} functions for the PCAP PMD. I'll update the message in v2.
I guess that part is clear :) I was asking if there is a higher level reason to enable queue start/stop on these PMDs?
Is there some specific usecase not working for you when these are not enabled?
We have an application that uses the start/stop functions for deferred queue starting, and runs with a variety of PMDs. Even though the PCAP PMD doesn't have any notion "deferred start", some of the other PMDs we use do.
We've also got some local changes that, if RTE_LIBRTE_ETHDEV_DEBUG is true, will return an error if you try to receive or transmit from a queue whose state is STOPPED. Without the PCAP patch, this debug check fails. We're looking into submitting that debug code in the future, but in the meantime we wanted to make the PCAP compliant with the start/stop ethdev functions.
Quoted 50 lines
Quoted 50 lines
Quoted 42 lines
Quoted 14 lines
Signed-off-by Gage Eads <[email protected]>--- drivers/net/pcap/rte_eth_pcap.c | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)(quoted diff) +0
-0
b/drivers/net/pcap/rte_eth_pcap.cindex6bd4a7d79..21e466bcd100644drivers/net/pcap/rte_eth_pcap.c eth_dev_start(struct rte_eth_dev *dev) · line 434
Quoted 5 lines
drivers/net/pcap/rte_eth_pcap.c +2
-0@@ -430,6 +430,10 @@ eth_dev_start(struct rte_eth_dev *dev)return -1 ; rx->pcap = tx->pcap; } + + dev->data->tx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STARTED;drivers/net/pcap/rte_eth_pcap.c eth_dev_start(struct rte_eth_dev *dev) · line 435
Quoted 1 line
drivers/net/pcap/rte_eth_pcap.c +1
-0+ dev->data->rx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STARTED;pcap also supports multiple queue, instead of hardcoding the queue 0 it can be possible to iterate through
dev->data->nb_rx_queues, dev->data-Quoted 1 line
nb_tx_queues.And I think it is not good to set this in "
internals->single_iface" condition, it is better to do these assignments just above "status_up" after all queues initialized.drivers/net/pcap/rte_eth_pcap.c eth_dev_stop(struct rte_eth_dev *dev) · line 497
Quoted 9 lines
drivers/net/pcap/rte_eth_pcap.c +2
-0+ goto status_up; }@@ -490,6 +494,8 @@ eth_dev_stop(struct rte_eth_dev *dev)pcap_close (tx->pcap); tx->pcap =NULL ; rx->pcap =NULL ; + dev->data->tx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STOPPED;Quoted 5 lines
drivers/net/pcap/rte_eth_pcap.c eth_dev_stop(struct rte_eth_dev *dev) · line 498
Quoted 1 line
drivers/net/pcap/rte_eth_pcap.c +1
-0+ dev->data->rx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STOPPED;same here, just above "
status_down" is better place and by using dev->data->nb_[r/t]x_queuesAgreed, I will move the started and stopped assignments as you suggested.
Quoted 28 lines · Gage
Quoted 28 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, July 18, 2018 9:25 AM
To: Eads, Gage <[email protected]>; [email protected]
Subject: Re: [PATCH] net/pcap: set queue started and stoppedQuoted 8 lines · Gage
Quoted 8 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, July 18, 2018 4:14 AM
To: Eads, Gage <[email protected]>; [email protected]
Subject: Re: [PATCH] net/pcap: set queue started and stoppedQuoted 8 lines
Quoted 6 lines · Gage Eads
Quoted 2 lines
Set the rx and tx queue state appropriately when the queues or device are started or stopped.
Is there a specific reason to enable these
dev_ops, if so can you please document in commit log?Yes, the purpose of the patch is to enable the rte_eth_dev_{rx,
tx}_queue_{start, stop} functions for the PCAP PMD. I'll update the message in v2.
Quoted 8 lines
Quoted 4 lines
I guess that part is clear :) I was asking if there is a higher level reason to enable queue start/stop on these PMDs?
Is there some specific usecase not working for you when these are not enabled?We have an application that uses the start/stop functions for deferred queue starting, and runs with a variety of PMDs. Even though the PCAP PMD doesn't have any notion "deferred start", some of the other PMDs we use do.
We've also got some local changes that, if
RTE_LIBRTE_ETHDEV_DEBUGis true, will return an error if you try to receive or transmit from a queue whose state is STOPPED. Without the PCAP patch, this debug check fails. We're looking into submitting that debug code in the future, but in the meantime we wanted to make the PCAP compliant with the start/stop ethdev functions.
Got it, thanks for clarification.
Quoted 52 lines
Quoted 51 lines
Quoted 51 lines
Quoted 43 lines
Quoted 15 lines
Signed-off-by Gage Eads <[email protected]>--- drivers/net/pcap/rte_eth_pcap.c | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)(quoted diff) +0
-0
b/drivers/net/pcap/rte_eth_pcap.cindex6bd4a7d79..21e466bcd100644drivers/net/pcap/rte_eth_pcap.c eth_dev_start(struct rte_eth_dev *dev) · line 434
Quoted 5 lines
drivers/net/pcap/rte_eth_pcap.c +2
-0@@ -430,6 +430,10 @@ eth_dev_start(struct rte_eth_dev *dev)return -1 ; rx->pcap = tx->pcap; } + + dev->data->tx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STARTED;drivers/net/pcap/rte_eth_pcap.c eth_dev_start(struct rte_eth_dev *dev) · line 435
Quoted 1 line
drivers/net/pcap/rte_eth_pcap.c +1
-0+ dev->data->rx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STARTED;pcap also supports multiple queue, instead of hardcoding the queue 0 it can be possible to iterate through
dev->data->nb_rx_queues, dev->data-Quoted 1 line
nb_tx_queues.And I think it is not good to set this in "
internals->single_iface" condition, it is better to do these assignments just above "status_up" after all queues initialized.drivers/net/pcap/rte_eth_pcap.c eth_dev_stop(struct rte_eth_dev *dev) · line 497
Quoted 9 lines
drivers/net/pcap/rte_eth_pcap.c +2
-0+ goto status_up; }@@ -490,6 +494,8 @@ eth_dev_stop(struct rte_eth_dev *dev)pcap_close (tx->pcap); tx->pcap =NULL ; rx->pcap =NULL ; + dev->data->tx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STOPPED;Quoted 5 lines
drivers/net/pcap/rte_eth_pcap.c eth_dev_stop(struct rte_eth_dev *dev) · line 498
Quoted 1 line
drivers/net/pcap/rte_eth_pcap.c +1
-0+ dev->data->rx_queue_state[0] =
RTE_ETH_QUEUE_STATE_STOPPED;same here, just above "
status_down" is better place and by using dev->data->nb_[r/t]x_queuesAgreed, I will move the started and stopped assignments as you suggested.
PATCH v2 1/1 net/pcap: set queue started and stopped
In reply to Gage EadsSet the rx and tx queue state appropriately when the queues or device are started or stopped. This enables usage of the ethdev rx/tx queue start/stop functions with the PCAP PMD.
---
v2 changes:
- Expand the commit message
- Fix queue start/stop state setting in eth_dev_start and eth_dev_stop
drivers/net/pcap/rte_eth_pcap.c | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
drivers/net/pcap/rte_eth_pcap.c +49 -0
@@ -430,6 +430,7 @@ eth_dev_start(struct rte_eth_dev *dev)return -1 ; rx->pcap = tx->pcap; } + goto status_up; }
@@ -465,6 +466,12 @@ eth_dev_start(struct rte_eth_dev *dev) } status_up: +for (i =0 ; i < dev->data->nb_rx_queues; i++) + dev->data->rx_queue_state[i] =RTE_ETH_QUEUE_STATE_STARTED ; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) + dev->data->tx_queue_state[i] =RTE_ETH_QUEUE_STATE_STARTED ; + dev->data->dev_link.link_status =ETH_LINK_UP ;return 0 ;
@@ -517,6 +524,12 @@ eth_dev_stop(struct rte_eth_dev *dev) } status_down: +for (i =0 ; i < dev->data->nb_rx_queues; i++) + dev->data->rx_queue_state[i] =RTE_ETH_QUEUE_STATE_STOPPED ; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) + dev->data->tx_queue_state[i] =RTE_ETH_QUEUE_STATE_STOPPED ; + dev->data->dev_link.link_status =ETH_LINK_DOWN ; }
@@ -643,6 +656,38 @@ eth_tx_queue_setup(struct rte_eth_dev *dev,return 0 ; } +static int +eth_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id) +{ + dev->data->rx_queue_state[rx_queue_id] =RTE_ETH_QUEUE_STATE_STARTED ; + +return 0 ; +} + +static int +eth_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id) +{ + dev->data->tx_queue_state[tx_queue_id] =RTE_ETH_QUEUE_STATE_STARTED ; + +return 0 ; +} + +static int +eth_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id) +{ + dev->data->rx_queue_state[rx_queue_id] =RTE_ETH_QUEUE_STATE_STOPPED ; + +return 0 ; +} + +static int +eth_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id) +{ + dev->data->tx_queue_state[tx_queue_id] =RTE_ETH_QUEUE_STATE_STOPPED ; + +return 0 ; +} +static const struct eth_dev_ops ops = { .dev_start = eth_dev_start, .dev_stop = eth_dev_stop,
@@ -651,6 +696,10 @@ static const struct eth_dev_ops ops = { .dev_infos_get = eth_dev_info, .rx_queue_setup = eth_rx_queue_setup, .tx_queue_setup = eth_tx_queue_setup, + .rx_queue_start = eth_rx_queue_start, + .tx_queue_start = eth_tx_queue_start, + .rx_queue_stop = eth_rx_queue_stop, + .tx_queue_stop = eth_tx_queue_stop, .rx_queue_release = eth_queue_release, .tx_queue_release = eth_queue_release, .link_update = eth_link_update,
Signature · 1 line
2.13.6
Quoted 5 lines · Gage Eads
Set the rx and tx queue state appropriately when the queues or device are started or stopped. This enables usage of the ethdev rx/tx queue start/stop functions with the PCAP PMD.
Signed-off-by Gage Eads <[email protected]>
Ferruh Yigit
AppliedQuoted 8 lines · Ferruh Yigit
Quoted 5 lines · Gage Eads
Set the rx and tx queue state appropriately when the queues or device are started or stopped. This enables usage of the ethdev rx/tx queue start/stop functions with the PCAP PMD.
Signed-off-by Gage Eads <[email protected]>Acked-by Ferruh Yigit <[email protected]>
Applied to dpdk-next-net/master, thanks.