Re: [PATCH net-next v1 2/5] hinic: add support to set and get irq coalesce

From: Jakub Kicinski
Date: Mon Jun 22 2020 - 18:08:50 EST


On Sat, 20 Jun 2020 17:42:55 +0800 Luo bin wrote:
> +static int is_coalesce_exceed_limit(struct net_device *netdev,
> + const struct ethtool_coalesce *coal)
> +{
> + struct hinic_dev *nic_dev = netdev_priv(netdev);
> +
> + if (coal->rx_coalesce_usecs > COALESCE_MAX_TIMER_CFG) {
> + netif_err(nic_dev, drv, netdev,
> + "Rx_coalesce_usecs out of range[%d-%d]\n", 0,
> + COALESCE_MAX_TIMER_CFG);
> + return -EOPNOTSUPP;
> + }
> +
> + if (coal->rx_max_coalesced_frames > COALESCE_MAX_PENDING_LIMIT) {
> + netif_err(nic_dev, drv, netdev,
> + "Rx_max_coalesced_frames out of range[%d-%d]\n", 0,
> + COALESCE_MAX_PENDING_LIMIT);
> + return -EOPNOTSUPP;
> + }
> +
> + if (coal->tx_coalesce_usecs > COALESCE_MAX_TIMER_CFG) {
> + netif_err(nic_dev, drv, netdev,
> + "Tx_coalesce_usecs out of range[%d-%d]\n", 0,
> + COALESCE_MAX_TIMER_CFG);
> + return -EOPNOTSUPP;
> + }
> +
> + if (coal->tx_max_coalesced_frames > COALESCE_MAX_PENDING_LIMIT) {
> + netif_err(nic_dev, drv, netdev,
> + "Tx_max_coalesced_frames out of range[%d-%d]\n", 0,
> + COALESCE_MAX_PENDING_LIMIT);
> + return -EOPNOTSUPP;
> + }
> +
> + return 0;
> +}

I think ERANGE is a more appropriate error code in these?