Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-03-06 Thread Joe Damato
On Wed, Mar 05, 2025 at 06:21:18PM -0800, Jakub Kicinski wrote: > On Wed, 5 Mar 2025 17:42:35 -0800 Joe Damato wrote: > > Two spots that come to mind are: > > - in virtnet_probe where all the other netdev ops are plumbed > >through, or > > - above virtnet_disable_queue_pair which I assume a f

Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-03-06 Thread Jakub Kicinski
On Thu, 6 Mar 2025 09:00:02 -0800 Joe Damato wrote: > +* - wrap all of the work in a lock (perhaps > vi->refill_lock?) > +* - check netif_running() and return early to avoid a race > +*/ probably netdev instance lock is better here, as it will a

Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-03-05 Thread Jakub Kicinski
On Wed, 5 Mar 2025 17:42:35 -0800 Joe Damato wrote: > Two spots that come to mind are: > - in virtnet_probe where all the other netdev ops are plumbed >through, or > - above virtnet_disable_queue_pair which I assume a future queue >API implementor would need to call for ndo_queue_stop I'

Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-03-05 Thread Joe Damato
On Mon, Mar 03, 2025 at 04:03:55PM -0800, Jakub Kicinski wrote: > On Mon, 3 Mar 2025 13:33:10 -0500 Joe Damato wrote: > > > > How about we don't use the API at all from refill_work? > > > > Patch 4 adds consistent NAPI config state and refill_work isn't a > > queue resize maybe we don't need to c

Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-03-05 Thread Jason Wang
On Thu, Mar 6, 2025 at 12:34 AM Joe Damato wrote: > > On Wed, Mar 05, 2025 at 01:11:55PM +0800, Jason Wang wrote: > > On Tue, Mar 4, 2025 at 11:09 PM Joe Damato wrote: > > > > > > On Mon, Mar 03, 2025 at 04:03:55PM -0800, Jakub Kicinski wrote: > > > > On Mon, 3 Mar 2025 13:33:10 -0500 Joe Damato

Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-03-05 Thread Joe Damato
On Wed, Mar 05, 2025 at 01:11:55PM +0800, Jason Wang wrote: > On Tue, Mar 4, 2025 at 11:09 PM Joe Damato wrote: > > > > On Mon, Mar 03, 2025 at 04:03:55PM -0800, Jakub Kicinski wrote: > > > On Mon, 3 Mar 2025 13:33:10 -0500 Joe Damato wrote: [...] > > > Middle ground would be to do what you sugg

Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-03-04 Thread Jason Wang
On Tue, Mar 4, 2025 at 11:09 PM Joe Damato wrote: > > On Mon, Mar 03, 2025 at 04:03:55PM -0800, Jakub Kicinski wrote: > > On Mon, 3 Mar 2025 13:33:10 -0500 Joe Damato wrote: > > > > > @@ -2880,6 +2880,13 @@ static void refill_work(struct work_struct > > > > > *work) > > > > > bool still_e

Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-03-04 Thread Joe Damato
On Mon, Mar 03, 2025 at 04:03:55PM -0800, Jakub Kicinski wrote: > On Mon, 3 Mar 2025 13:33:10 -0500 Joe Damato wrote: > > > > @@ -2880,6 +2880,13 @@ static void refill_work(struct work_struct *work) > > > > bool still_empty; > > > > int i; > > > > > > > > + spin_lock(&vi->ref

Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-03-03 Thread Jakub Kicinski
On Mon, 3 Mar 2025 13:33:10 -0500 Joe Damato wrote: > > > @@ -2880,6 +2880,13 @@ static void refill_work(struct work_struct *work) > > > bool still_empty; > > > int i; > > > > > > + spin_lock(&vi->refill_lock); > > > + if (!vi->refill_enabled) { > > > + sp

Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-03-03 Thread Joe Damato
On Mon, Mar 03, 2025 at 12:00:10PM -0500, Joe Damato wrote: > On Mon, Mar 03, 2025 at 11:46:10AM -0500, Joe Damato wrote: > > On Fri, Feb 28, 2025 at 06:27:59PM -0800, Jakub Kicinski wrote: > > > On Thu, 27 Feb 2025 18:50:13 + Joe Damato wrote: > > > > @@ -2870,9 +2883,15 @@ static void refill_

Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-03-03 Thread Joe Damato
On Mon, Mar 03, 2025 at 11:46:10AM -0500, Joe Damato wrote: > On Fri, Feb 28, 2025 at 06:27:59PM -0800, Jakub Kicinski wrote: > > On Thu, 27 Feb 2025 18:50:13 + Joe Damato wrote: > > > @@ -2870,9 +2883,15 @@ static void refill_work(struct work_struct *work) > > > for (i = 0; i < vi->curr_queu

Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-03-03 Thread Joe Damato
On Fri, Feb 28, 2025 at 06:27:59PM -0800, Jakub Kicinski wrote: > On Thu, 27 Feb 2025 18:50:13 + Joe Damato wrote: > > @@ -2870,9 +2883,15 @@ static void refill_work(struct work_struct *work) > > for (i = 0; i < vi->curr_queue_pairs; i++) { > > struct receive_queue *rq = &vi->rq

Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-02-28 Thread Jakub Kicinski
On Thu, 27 Feb 2025 18:50:13 + Joe Damato wrote: > @@ -2870,9 +2883,15 @@ static void refill_work(struct work_struct *work) > for (i = 0; i < vi->curr_queue_pairs; i++) { > struct receive_queue *rq = &vi->rq[i]; > > + rtnl_lock(); > virtnet_napi_d

Re: [PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-02-28 Thread Jason Wang
On Fri, Feb 28, 2025 at 2:50 AM Joe Damato wrote: > > Use netif_queue_set_napi to map NAPIs to queue IDs so that the mapping > can be accessed by user apps. Note that the netif_queue_set_napi > currently requires RTNL, so care must be taken to ensure RTNL is held on > paths where this API might be

[PATCH net-next v5 3/4] virtio-net: Map NAPIs to queues

2025-02-27 Thread Joe Damato
Use netif_queue_set_napi to map NAPIs to queue IDs so that the mapping can be accessed by user apps. Note that the netif_queue_set_napi currently requires RTNL, so care must be taken to ensure RTNL is held on paths where this API might be reached. The paths in the driver where this API can be reac