Re: [RFC net-next v2 2/2] igc: Link queues to NAPI instances

From: Joe Damato
Date: Mon Oct 14 2024 - 23:44:46 EST


On Mon, Oct 14, 2024 at 06:51:57PM -0700, Vinicius Costa Gomes wrote:
> Joe Damato <jdamato@xxxxxxxxxx> writes:

[...]

> > +void igc_set_queue_napi(struct igc_adapter *adapter, int q_idx,
> > + struct napi_struct *napi)
> > +{
> > + if (adapter->flags & IGC_FLAG_QUEUE_PAIRS) {
> > + netif_queue_set_napi(adapter->netdev, q_idx,
> > + NETDEV_QUEUE_TYPE_RX, napi);
> > + netif_queue_set_napi(adapter->netdev, q_idx,
> > + NETDEV_QUEUE_TYPE_TX, napi);
> > + } else {
> > + if (q_idx < adapter->num_rx_queues) {
> > + netif_queue_set_napi(adapter->netdev, q_idx,
> > + NETDEV_QUEUE_TYPE_RX, napi);
> > + } else {
> > + q_idx -= adapter->num_rx_queues;
> > + netif_queue_set_napi(adapter->netdev, q_idx,
> > + NETDEV_QUEUE_TYPE_TX, napi);
> > + }
> > + }
> > +}
> > +
> > +void igc_unset_queue_napi(struct igc_adapter *adapter, int q_idx)
> > +{
> > + struct net_device *netdev = adapter->netdev;
> > +
> > + if (adapter->flags & IGC_FLAG_QUEUE_PAIRS) {
> > + netif_queue_set_napi(netdev, q_idx, NETDEV_QUEUE_TYPE_RX,
> > + NULL);
> > + netif_queue_set_napi(netdev, q_idx, NETDEV_QUEUE_TYPE_TX,
> > + NULL);
> > + } else {
> > + if (q_idx < adapter->num_rx_queues) {
> > + netif_queue_set_napi(adapter->netdev, q_idx,
> > + NETDEV_QUEUE_TYPE_RX, NULL);
> > + } else {
> > + q_idx -= adapter->num_rx_queues;
> > + netif_queue_set_napi(adapter->netdev, q_idx,
> > + NETDEV_QUEUE_TYPE_TX, NULL);
> > + }
> > + }
> > +}
>
> It seems that igc_unset_queue_napi() is igc_set_queue_napi(x, y, NULL),
> so I would suggest either implementing "unset" in terms of "set", or
> using igc_set_queue_napi(x, y, NULL) directly in the "unlink" case (I
> have a slight preference for the second option).

Ah, yes, of course. That is much simpler; I'll go with the second
option for the v3. Thank you for catching that in your review.

Unless any other significant feedback comes in, I'll likely send the
v3 as a PATCH instead of an RFC later this week.