netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jiawen Wu" <jiawenwu@trustnetic.com>
To: "'Andrew Lunn'" <andrew@lunn.ch>
Cc: <netdev@vger.kernel.org>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<linux@armlinux.org.uk>, <horms@kernel.org>,
	<mengyuanlou@net-swift.com>
Subject: RE: [PATCH net-next 2/5] net: wangxun: add ethtool_ops for ring parameters
Date: Thu, 23 Nov 2023 17:25:26 +0800	[thread overview]
Message-ID: <00f801da1dee$fe4975a0$fadc60e0$@trustnetic.com> (raw)
In-Reply-To: <4a36b46d-3f71-430f-8158-da58769ae52a@lunn.ch>

> > +	new_tx_count = clamp_t(u32, ring->tx_pending, WX_MIN_TXD, WX_MAX_TXD);
> > +	new_tx_count = ALIGN(new_tx_count, WX_REQ_TX_DESCRIPTOR_MULTIPLE);
> > +
> > +	new_rx_count = clamp_t(u32, ring->rx_pending, WX_MIN_RXD, WX_MAX_RXD);
> > +	new_rx_count = ALIGN(new_rx_count, WX_REQ_RX_DESCRIPTOR_MULTIPLE);
> > +
> > +	if (new_tx_count == wx->tx_ring_count &&
> > +	    new_rx_count == wx->rx_ring_count)
> > +		return 0;
> > +
> > +	if (!netif_running(wx->netdev)) {
> > +		for (i = 0; i < wx->num_tx_queues; i++)
> > +			wx->tx_ring[i]->count = new_tx_count;
> > +		for (i = 0; i < wx->num_rx_queues; i++)
> > +			wx->rx_ring[i]->count = new_rx_count;
> > +		wx->tx_ring_count = new_tx_count;
> > +		wx->rx_ring_count = new_rx_count;
> > +
> > +		return 0;
> > +	}
> > +
> > +	txgbe_down(wx);
> > +
> > +	err = wx_set_ring(wx, new_tx_count, new_rx_count);
> > +
> > +	txgbe_up(wx);
> > +
> > +	return err;
> 
> Could most of this be moved into the library? It looks pretty similar
> for the two devices.

I tried to move them into the library, but *_down() and *_up() here
involves some different flows for the two devices, it's not easy to handle.



  reply	other threads:[~2023-11-23  9:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22 10:22 [PATCH net-next 0/5] Implement more ethtool_ops for Wangxun Jiawen Wu
2023-11-22 10:22 ` [PATCH net-next 1/5] net: wangxun: add flow control support Jiawen Wu
2023-11-22 16:15   ` Andrew Lunn
2023-11-22 16:30     ` Russell King (Oracle)
2023-11-22 17:24       ` Andrew Lunn
2023-11-22 17:26         ` Russell King (Oracle)
2023-11-23  9:20     ` Jiawen Wu
2023-11-22 10:22 ` [PATCH net-next 2/5] net: wangxun: add ethtool_ops for ring parameters Jiawen Wu
2023-11-22 16:24   ` Andrew Lunn
2023-11-23  9:25     ` Jiawen Wu [this message]
2023-11-23 15:14       ` Andrew Lunn
2023-11-30  3:32     ` Jiawen Wu
2023-11-22 10:22 ` [PATCH net-next 3/5] net: wangxun: add coalesce options support Jiawen Wu
2023-11-22 10:22 ` [PATCH net-next 4/5] net: wangxun: add ethtool_ops for channel number Jiawen Wu
2023-11-22 16:35   ` Andrew Lunn
2023-11-22 10:22 ` [PATCH net-next 5/5] net: wangxun: add ethtool_ops for msglevel Jiawen Wu
2023-11-22 16:36   ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='00f801da1dee$fe4975a0$fadc60e0$@trustnetic.com' \
    --to=jiawenwu@trustnetic.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).