[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZBLp5G4qARbScJw0@corigine.com>
Date: Thu, 16 Mar 2023 11:05:24 +0100
From: Simon Horman <simon.horman@...igine.com>
To: Markus Schneider-Pargmann <msp@...libre.com>
Cc: Marc Kleine-Budde <mkl@...gutronix.de>,
Chandrasekar Ramakrishnan <rcsekar@...sung.com>,
Wolfgang Grandegger <wg@...ndegger.com>,
Vincent MAILHOL <mailhol.vincent@...adoo.fr>,
linux-can@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 09/16] can: m_can: Add rx coalescing ethtool support
On Wed, Mar 15, 2023 at 12:05:39PM +0100, Markus Schneider-Pargmann wrote:
> Add the possibility to set coalescing parameters with ethtool.
>
> rx-frames-irq and rx-usecs-irq can only be set and unset together as the
> implemented mechanism would not work otherwise. rx-frames-irq can't be
> greater than the RX FIFO size.
>
> Also all values can only be changed if the chip is not active.
>
> Signed-off-by: Markus Schneider-Pargmann <msp@...libre.com>
Nit below not withstanding,
Reviewed-by: Simon Horman <simon.horman@...igine.com>
> ---
> drivers/net/can/m_can/m_can.c | 46 +++++++++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
>
> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
> index 94c962ac6992..7f8decfae81e 100644
> --- a/drivers/net/can/m_can/m_can.c
> +++ b/drivers/net/can/m_can/m_can.c
...
> +static int m_can_set_coalesce(struct net_device *dev,
> + struct ethtool_coalesce *ec,
> + struct kernel_ethtool_coalesce *kec,
> + struct netlink_ext_ack *ext_ack)
> +{
> + struct m_can_classdev *cdev = netdev_priv(dev);
> +
> + if (cdev->can.state != CAN_STATE_STOPPED) {
> + netdev_err(dev, "Device is in use, please shut it down first\n");
> + return -EBUSY;
> + }
> +
> + if (ec->rx_max_coalesced_frames_irq > cdev->mcfg[MRAM_RXF0].num) {
> + netdev_err(dev, "rx-frames-irq %u greater than the RX FIFO %u\n",
> + ec->rx_max_coalesced_frames_irq,
> + cdev->mcfg[MRAM_RXF0].num);
> + return -EINVAL;
> + }
> + if ((ec->rx_max_coalesced_frames_irq == 0) != (ec->rx_coalesce_usecs_irq == 0)) {
nit: checkpatch complains about unnecessary parentheses on the line above.
drivers/net/can/m_can/m_can.c:1970: CHECK: Unnecessary parentheses around 'ec->rx_max_coalesced_frames_irq == 0'
+ if ((ec->rx_max_coalesced_frames_irq == 0) != (ec->rx_coalesce_usecs_irq == 0)) {
drivers/net/can/m_can/m_can.c:1970: CHECK: Unnecessary parentheses around 'ec->rx_coalesce_usecs_irq == 0'
+ if ((ec->rx_max_coalesced_frames_irq == 0) != (ec->rx_coalesce_usecs_irq == 0)) {
> + netdev_err(dev, "rx-frames-irq and rx-usecs-irq can only be set together\n");
> + return -EINVAL;
> + }
> +
> + cdev->rx_max_coalesced_frames_irq = ec->rx_max_coalesced_frames_irq;
> + cdev->rx_coalesce_usecs_irq = ec->rx_coalesce_usecs_irq;
> +
> + return 0;
> +}
...
Powered by blists - more mailing lists