Message ID | 1408008560-1067-4-git-send-email-_govind@gmx.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
2014-08-14 11:29 GMT+02:00 Govindarajulu Varadarajan <_govind@gmx.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@gmx.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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 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@gmx.com> --- drivers/net/ethernet/cisco/enic/enic_ethtool.c | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)