On Mon, 13 Jul 2020 15:56:08 +0300 Claudiu Manoil wrote:
> +static int enetc_get_coalesce(struct net_device *ndev,
> +                           struct ethtool_coalesce *ic)
> +{
> +     struct enetc_ndev_priv *priv = netdev_priv(ndev);
> +     struct enetc_int_vector *v = priv->int_vector[0];
> +
> +     memset(ic, 0, sizeof(*ic));

nit: no need to zero this out

> +     ic->tx_coalesce_usecs = enetc_cycles_to_usecs(v->tx_ictt);
> +     ic->rx_coalesce_usecs = enetc_cycles_to_usecs(v->rx_ictt);
> +
> +     ic->tx_max_coalesced_frames = ENETC_TXIC_PKTTHR;
> +     ic->rx_max_coalesced_frames = ENETC_RXIC_PKTTHR;
> +
> +     return 0;
> +}
> +
> +static int enetc_set_coalesce(struct net_device *ndev,
> +                           struct ethtool_coalesce *ic)
> +{
> +     struct enetc_ndev_priv *priv = netdev_priv(ndev);
> +     u32 rx_ictt, tx_ictt;
> +     int i, ic_mode;
> +
> +     tx_ictt = enetc_usecs_to_cycles(ic->tx_coalesce_usecs);
> +     rx_ictt = enetc_usecs_to_cycles(ic->rx_coalesce_usecs);
> +
> +     if (!ic->rx_max_coalesced_frames)

Isn't it better to check != ENETC_RXIC_PKTTHR, rather than != 0?

> +             netif_warn(priv, hw, ndev, "rx-frames fixed to %d\n",
> +                        ENETC_RXIC_PKTTHR);
> +
> +     if (!ic->tx_max_coalesced_frames)
> +             netif_warn(priv, hw, ndev, "tx-frames fixed to %d\n",
> +                        ENETC_TXIC_PKTTHR);

Reply via email to