static int ethtool_check_flow_types(struct net_device *dev, u32 input_xfrm)
{
const struct ethtool_ops *ops = dev->ethtool_ops;
- struct ethtool_rxnfc info = {
- .cmd = ETHTOOL_GRXFH,
- };
int err;
u32 i;
for (i = 0; i < __FLOW_TYPE_COUNT; i++) {
+ struct ethtool_rxfh_fields fields = {
+ .flow_type = i,
+ };
+
if (!flow_type_hashable(i))
continue;
- info.flow_type = i;
-
- if (ops->get_rxfh_fields) {
- struct ethtool_rxfh_fields fields = {
- .flow_type = info.flow_type,
- };
-
- if (ops->get_rxfh_fields(dev, &fields))
- continue;
-
- info.data = fields.data;
- } else {
- if (ops->get_rxnfc(dev, &info, NULL))
- continue;
- }
+ if (ops->get_rxfh_fields(dev, &fields))
+ continue;
- err = ethtool_check_xfrm_rxfh(input_xfrm, info.data);
+ err = ethtool_check_xfrm_rxfh(input_xfrm, fields.data);
if (err)
return err;
}
size_t info_size = sizeof(info);
int rc;
- if (!ops->set_rxnfc && !ops->set_rxfh_fields)
+ if (!ops->set_rxfh_fields)
return -EOPNOTSUPP;
rc = ethtool_rxnfc_copy_struct(cmd, &info, &info_size, useraddr);
return rc;
}
- if (!ops->set_rxfh_fields)
- return ops->set_rxnfc(dev, &info);
-
fields.data = info.data;
fields.flow_type = info.flow_type & ~FLOW_RSS;
if (info.flow_type & FLOW_RSS)
struct ethtool_rxnfc info;
size_t info_size = sizeof(info);
const struct ethtool_ops *ops = dev->ethtool_ops;
+ struct ethtool_rxfh_fields fields = {};
int ret;
- if (!ops->get_rxnfc && !ops->get_rxfh_fields)
+ if (!ops->get_rxfh_fields)
return -EOPNOTSUPP;
ret = ethtool_rxnfc_copy_struct(cmd, &info, &info_size, useraddr);
!ops->rxfh_per_ctx_fields)
return -EINVAL;
- if (ops->get_rxfh_fields) {
- struct ethtool_rxfh_fields fields = {
- .flow_type = info.flow_type & ~FLOW_RSS,
- };
-
- if (info.flow_type & FLOW_RSS)
- fields.rss_context = info.rss_context;
+ fields.flow_type = info.flow_type & ~FLOW_RSS;
+ if (info.flow_type & FLOW_RSS)
+ fields.rss_context = info.rss_context;
- ret = ops->get_rxfh_fields(dev, &fields);
- if (ret < 0)
- return ret;
+ ret = ops->get_rxfh_fields(dev, &fields);
+ if (ret < 0)
+ return ret;
- info.data = fields.data;
- } else {
- ret = ops->get_rxnfc(dev, &info, NULL);
- if (ret < 0)
- return ret;
- }
+ info.data = fields.data;
return ethtool_rxnfc_copy_to_user(useraddr, &info, info_size, NULL);
}
u8 *rss_config;
int ret;
- if ((!ops->get_rxnfc && !ops->get_rxfh_fields) || !ops->set_rxfh)
+ if (!ops->get_rxnfc || !ops->get_rxfh_fields || !ops->set_rxfh)
return -EOPNOTSUPP;
if (ops->get_rxfh_indir_size)