[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKgT0UdtF9=Tm29UVZcGMsNFzwcDuohchec-DFjTVptsjmbGbQ@mail.gmail.com>
Date: Tue, 25 Jun 2024 16:13:14 -0700
From: Alexander Duyck <alexander.duyck@...il.com>
To: Joe Damato <jdamato@...tly.com>, Alexander Duyck <alexander.duyck@...il.com>,
netdev@...r.kernel.org, Alexander Duyck <alexanderduyck@...com>, kuba@...nel.org,
davem@...emloft.net, pabeni@...hat.com
Subject: Re: [net-next PATCH v2 07/15] eth: fbnic: Allocate a netdevice and
napi vectors with queues
On Tue, Jun 25, 2024 at 2:18 PM Joe Damato <jdamato@...tly.com> wrote:
>
> On Tue, Jun 25, 2024 at 07:36:03AM -0700, Alexander Duyck wrote:
> > From: Alexander Duyck <alexanderduyck@...com>
>
> [...]
>
> > +int fbnic_alloc_napi_vectors(struct fbnic_net *fbn)
> > +{
> > + unsigned int txq_idx = 0, rxq_idx = 0, v_idx = FBNIC_NON_NAPI_VECTORS;
> > + unsigned int num_tx = fbn->num_tx_queues;
> > + unsigned int num_rx = fbn->num_rx_queues;
> > + unsigned int num_napi = fbn->num_napi;
> > + struct fbnic_dev *fbd = fbn->fbd;
> > + int err;
> > +
> > + /* Allocate 1 Tx queue per napi vector */
> > + if (num_napi < FBNIC_MAX_TXQS && num_napi == num_tx + num_rx) {
> > + while (num_tx) {
> > + err = fbnic_alloc_napi_vector(fbd, fbn,
> > + num_napi, v_idx,
> > + 1, txq_idx, 0, 0);
> > + if (err)
> > + goto free_vectors;
> > +
> > + /* Update counts and index */
> > + num_tx--;
> > + txq_idx++;
> > +
> > + v_idx++;
> > + }
> > + }
> > +
> > + /* Allocate Tx/Rx queue pairs per vector, or allocate remaining Rx */
> > + while (num_rx | num_tx) {
> > + int tqpv = DIV_ROUND_UP(num_tx, num_napi - txq_idx);
> > + int rqpv = DIV_ROUND_UP(num_rx, num_napi - rxq_idx);
> > +
> > + err = fbnic_alloc_napi_vector(fbd, fbn, num_napi, v_idx,
> > + tqpv, txq_idx, rqpv, rxq_idx);
>
> Mostly a nit / suggestion (and not a reason to hold this back): In
> the future, adding support for netif_queue_set_napi would be great,
> as would netif_napi_set_irq.
>
> Apologies if you've already added that in a future patch that I
> missed.
I haven't added that as we weren't doing much with busy polling so it
was overlooked. I should be able to add that for the v3 of the patch
set.
Thanks for calling that out.
- Alex
Powered by blists - more mailing lists