On Tue, Aug 18, 2020 at 12:44:00PM -0700, David Awogbemila wrote:
> From: Kuo Zhao <[email protected]>
> 
> This adds support for getting and setting the RX copybreak
> value via ethtool.
> 
> Reviewed-by: Yangchun Fu <[email protected]>
> Signed-off-by: Kuo Zhao <[email protected]>
> Signed-off-by: David Awogbemila <[email protected]>
> ---
>  drivers/net/ethernet/google/gve/gve_ethtool.c | 34 +++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/drivers/net/ethernet/google/gve/gve_ethtool.c 
> b/drivers/net/ethernet/google/gve/gve_ethtool.c
> index d8fa816f4473..469d3332bcd6 100644
> --- a/drivers/net/ethernet/google/gve/gve_ethtool.c
> +++ b/drivers/net/ethernet/google/gve/gve_ethtool.c
> @@ -230,6 +230,38 @@ static int gve_user_reset(struct net_device *netdev, u32 
> *flags)
>       return -EOPNOTSUPP;
>  }


Hi David.

> +static int gve_get_tunable(struct net_device *netdev,
> +                        const struct ethtool_tunable *etuna, void *value)
> +{
> +     struct gve_priv *priv = netdev_priv(netdev);
> +
> +     switch (etuna->id) {
> +     case ETHTOOL_RX_COPYBREAK:
> +             *(u32 *)value = priv->rx_copybreak;
> +             return 0;
> +     default:
> +             return -EINVAL;

EOPNOTSUPP would be better. Other tunables are not invalid, they are
simply not supported by this driver.

> +     }
> +}
> +
> +static int gve_set_tunable(struct net_device *netdev,
> +                        const struct ethtool_tunable *etuna, const void 
> *value)
> +{
> +     struct gve_priv *priv = netdev_priv(netdev);
> +     u32 len;
> +
> +     switch (etuna->id) {
> +     case ETHTOOL_RX_COPYBREAK:
> +             len = *(u32 *)value;
> +             if (len > PAGE_SIZE / 2)
> +                     return -EINVAL;
> +             priv->rx_copybreak = len;
> +             return 0;
> +     default:
> +             return -EINVAL;

Same here.

     Andrew

Reply via email to