mirror of
https://github.com/torvalds/linux.git
synced 2026-09-11 20:13:02 +02:00
Merge branch 'eth-fix-bugs-in-ntuple-filter-reporting'
Jakub Kicinski says: ==================== eth: fix bugs in ntuple filter reporting Looking thru some reports prompted by: Add new way to add BPF LSM hooks https://lore.kernel.org/20260831110934.241898-1-a.s.protopopov@gmail.com I/Claude noticed 3 drivers with buggy n-tuple filter dump. Fix these drivers, add a hopefully clearer mention in the doc. ==================== Link: https://patch.msgid.link/20260903032611.3000029-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
742b94967d
|
|
@ -1088,6 +1088,8 @@ static int bcm_sf2_cfp_rule_get_all(struct bcm_sf2_priv *priv,
|
|||
unsigned int index = 1, rules_cnt = 0;
|
||||
|
||||
for_each_set_bit_from(index, priv->cfp.unique, priv->num_cfp_rules) {
|
||||
if (rules_cnt == nfc->rule_cnt)
|
||||
return -EMSGSIZE;
|
||||
rule_locs[rules_cnt] = index;
|
||||
rules_cnt++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2438,6 +2438,7 @@ static int mv88e6xxx_get_rxnfc(struct dsa_switch *ds, int port,
|
|||
struct ethtool_rx_flow_spec *fs = &rxnfc->fs;
|
||||
struct mv88e6xxx_chip *chip = ds->priv;
|
||||
struct mv88e6xxx_policy *policy;
|
||||
u32 cnt = 0;
|
||||
int err;
|
||||
int id;
|
||||
|
||||
|
|
@ -2463,11 +2464,18 @@ static int mv88e6xxx_get_rxnfc(struct dsa_switch *ds, int port,
|
|||
break;
|
||||
case ETHTOOL_GRXCLSRLALL:
|
||||
rxnfc->data = 0;
|
||||
rxnfc->rule_cnt = 0;
|
||||
idr_for_each_entry(&chip->policies, policy, id)
|
||||
if (policy->port == port)
|
||||
rule_locs[rxnfc->rule_cnt++] = id;
|
||||
err = 0;
|
||||
idr_for_each_entry(&chip->policies, policy, id) {
|
||||
if (policy->port != port)
|
||||
continue;
|
||||
if (cnt == rxnfc->rule_cnt) {
|
||||
err = -EMSGSIZE;
|
||||
break;
|
||||
}
|
||||
rule_locs[cnt++] = id;
|
||||
}
|
||||
if (!err)
|
||||
rxnfc->rule_cnt = cnt;
|
||||
break;
|
||||
default:
|
||||
err = -EOPNOTSUPP;
|
||||
|
|
|
|||
|
|
@ -1421,7 +1421,8 @@ static int nfp_net_get_fs_rule(struct nfp_net *nn, struct ethtool_rxnfc *cmd)
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
static int nfp_net_get_fs_loc(struct nfp_net *nn, u32 *rule_locs)
|
||||
static int nfp_net_get_fs_loc(struct nfp_net *nn, struct ethtool_rxnfc *cmd,
|
||||
u32 *rule_locs)
|
||||
{
|
||||
struct nfp_fs_entry *entry;
|
||||
u32 count = 0;
|
||||
|
|
@ -1429,8 +1430,12 @@ static int nfp_net_get_fs_loc(struct nfp_net *nn, u32 *rule_locs)
|
|||
if (!(nn->cap_w1 & NFP_NET_CFG_CTRL_FLOW_STEER))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
list_for_each_entry(entry, &nn->fs.list, node)
|
||||
list_for_each_entry(entry, &nn->fs.list, node) {
|
||||
if (count == cmd->rule_cnt)
|
||||
return -EMSGSIZE;
|
||||
rule_locs[count++] = entry->loc;
|
||||
}
|
||||
cmd->rule_cnt = count;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1455,7 +1460,7 @@ static int nfp_net_get_rxnfc(struct net_device *netdev,
|
|||
return nfp_net_get_fs_rule(nn, cmd);
|
||||
case ETHTOOL_GRXCLSRLALL:
|
||||
cmd->data = NFP_FS_MAX_ENTRY;
|
||||
return nfp_net_get_fs_loc(nn, rule_locs);
|
||||
return nfp_net_get_fs_loc(nn, cmd, rule_locs);
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
|
@ -1698,8 +1703,14 @@ static int nfp_net_fs_add(struct nfp_net *nn, struct ethtool_rxnfc *cmd)
|
|||
|
||||
nn->fs.count--;
|
||||
err = nfp_net_fs_add_hw(nn, new);
|
||||
if (err)
|
||||
if (err) {
|
||||
/* mbox broken, adding the old rule back will
|
||||
* likely also fail.
|
||||
*/
|
||||
list_del(&entry->node);
|
||||
kfree(entry);
|
||||
goto err;
|
||||
}
|
||||
|
||||
nn->fs.count++;
|
||||
list_replace(&entry->node, &new->node);
|
||||
|
|
|
|||
|
|
@ -1057,6 +1057,12 @@ struct kernel_ethtool_ts_info {
|
|||
* @get_sset_count: Get number of strings that @get_strings will write.
|
||||
* @get_rxnfc: Get RX flow classification rules. Returns a negative
|
||||
* error code or zero.
|
||||
* Note that for %ETHTOOL_GRXCLSRLALL rule_cnt and size of the arrays
|
||||
* is user-provided, and not guaranteed to match what driver would
|
||||
* have reported via %ETHTOOL_GRXCLSRLCNT. Drivers must return -%EMSGSIZE
|
||||
* when rule_cnt is too small. rule_locs is %NULL when rule_cnt is zero.
|
||||
* On success drivers must set rule_cnt to the number of locations they
|
||||
* filled in, the core copies out exactly that many.
|
||||
* @set_rxnfc: Set RX flow classification rules. Returns a negative
|
||||
* error code or zero.
|
||||
* @flash_device: Write a firmware image to device's flash memory.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user