Skip to content

Commit 37d3453

Browse files
kuba-mooNipaLocal
authored andcommitted
eth: gianfar: migrate to new RXFH callbacks
Migrate to new callbacks added by commit 9bb0078 ("net: ethtool: add dedicated callbacks for getting and setting rxfh fields"). Uniquely, this driver supports only the SET operation. It does not support GET at all. The SET callback also always returns 0, even tho it checks a bunch of conditions, and if my quick reading is right, expects the user to insert filtering rules for given flow type first? Long story short it seems too convoluted to easily add the GET as part of the conversion. Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent f6f7ca6 commit 37d3453

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

drivers/net/ethernet/freescale/gianfar_ethtool.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -781,14 +781,26 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow,
781781
return ret;
782782
}
783783

784-
static int gfar_set_hash_opts(struct gfar_private *priv,
785-
struct ethtool_rxnfc *cmd)
784+
static int gfar_set_rxfh_fields(struct net_device *dev,
785+
const struct ethtool_rxfh_fields *cmd,
786+
struct netlink_ext_ack *extack)
786787
{
788+
struct gfar_private *priv = netdev_priv(dev);
789+
int ret;
790+
791+
if (test_bit(GFAR_RESETTING, &priv->state))
792+
return -EBUSY;
793+
794+
mutex_lock(&priv->rx_queue_access);
795+
796+
ret = 0;
787797
/* write the filer rules here */
788798
if (!gfar_ethflow_to_filer_table(priv, cmd->data, cmd->flow_type))
789-
return -EINVAL;
799+
ret = -EINVAL;
790800

791-
return 0;
801+
mutex_unlock(&priv->rx_queue_access);
802+
803+
return ret;
792804
}
793805

794806
static int gfar_check_filer_hardware(struct gfar_private *priv)
@@ -1398,9 +1410,6 @@ static int gfar_set_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
13981410
mutex_lock(&priv->rx_queue_access);
13991411

14001412
switch (cmd->cmd) {
1401-
case ETHTOOL_SRXFH:
1402-
ret = gfar_set_hash_opts(priv, cmd);
1403-
break;
14041413
case ETHTOOL_SRXCLSRLINS:
14051414
if ((cmd->fs.ring_cookie != RX_CLS_FLOW_DISC &&
14061415
cmd->fs.ring_cookie >= priv->num_rx_queues) ||
@@ -1508,6 +1517,7 @@ const struct ethtool_ops gfar_ethtool_ops = {
15081517
#endif
15091518
.set_rxnfc = gfar_set_nfc,
15101519
.get_rxnfc = gfar_get_nfc,
1520+
.set_rxfh_fields = gfar_set_rxfh_fields,
15111521
.get_ts_info = gfar_get_ts_info,
15121522
.get_link_ksettings = phy_ethtool_get_link_ksettings,
15131523
.set_link_ksettings = phy_ethtool_set_link_ksettings,

0 commit comments

Comments
 (0)