lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 22 Aug 2014 00:12:03 +0200
From:	Michał Mirosław <mirqus@...il.com>
To:	Govindarajulu Varadarajan <_govind@....com>
Cc:	David Miller <davem@...emloft.net>,
	netdev <netdev@...r.kernel.org>, ben@...adent.org.uk,
	stephen@...workplumber.org, ssujith@...co.com, benve@...co.com
Subject: Re: [PATCH net-next v3 3/3] enic: Add tunable_ops support for rx_copybreak

2014-08-14 11:29 GMT+02:00 Govindarajulu Varadarajan <_govind@....com>:
> This patch adds support for setting/getting rx_copybreak using
> tunable_ops.
>
> Defines enic_get_rx_copybreak() & enic_set_rx_copybreak() tunable_ops.
>
> Signed-off-by: Govindarajulu Varadarajan <_govind@....com>
> ---
>  drivers/net/ethernet/cisco/enic/enic_ethtool.c | 30 ++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
>
> diff --git a/drivers/net/ethernet/cisco/enic/enic_ethtool.c b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
> index 523c9ce..9bf53fc 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_ethtool.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
> @@ -379,6 +379,30 @@ static int enic_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
>         return ret;
>  }
>
> +static int enic_get_rx_copybreak(struct net_device *dev,
> +                                struct ethtool_tunable *tuna)
> +{
> +       struct enic *enic = netdev_priv(dev);
> +
> +       if (tuna->len < sizeof(tuna->data.rx_copybreak))
> +               return -ENOSPC;
> +       tuna->data.rx_copybreak = enic->rx_copybreak;
> +
> +       return 0;
> +}
> +
> +static int enic_set_rx_copybreak(struct net_device *dev,
> +                                struct ethtool_tunable *tuna)
> +{
> +       struct enic *enic = netdev_priv(dev);
> +
> +       if (tuna->len != sizeof(tuna->data.rx_copybreak))
> +               return -EINVAL;
> +       enic->rx_copybreak = tuna->data.rx_copybreak;
> +
> +       return 0;
> +}
> +
>  static const struct ethtool_ops enic_ethtool_ops = {
>         .get_settings = enic_get_settings,
>         .get_drvinfo = enic_get_drvinfo,
> @@ -391,6 +415,12 @@ static const struct ethtool_ops enic_ethtool_ops = {
>         .get_coalesce = enic_get_coalesce,
>         .set_coalesce = enic_set_coalesce,
>         .get_rxnfc = enic_get_rxnfc,
> +       .tunable_ops = {
> +               [ETHTOOL_RX_COPYBREAK] = {
> +                       .set = enic_set_rx_copybreak,
> +                       .get = enic_get_rx_copybreak,
> +               },
> +       },
>  };
>
>  void enic_set_ethtool_ops(struct net_device *netdev)

This is a lot of boilerplate code to write for such a simple variable.

BTW, there are a lot of drivers that use rx_copybreak idea. Some time
ago, I tried to unify rx packet handling, but got into too many leafs
of the theme.You could google up 'rx_copybreak handling' if you'd like
to revive the idea.

Best Regards,
Michał Mirosław
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ