mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-27 03:49:57 -04:00
net: dsa: propagate extack to port_lag_join
Drivers could refuse to offload a LAG configuration for a variety of reasons, mainly having to do with its TX type. Additionally, since DSA masters may now also be LAG interfaces, and this will translate into a call to port_lag_join on the CPU ports, there may be extra restrictions there. Propagate the netlink extack to this DSA method in order for drivers to give a meaningful error message back to the user. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
committed by
Paolo Abeni
parent
13eccc1bbb
commit
2e359b00a1
@@ -1017,7 +1017,8 @@ int qca8k_port_vlan_del(struct dsa_switch *ds, int port,
|
||||
|
||||
static bool qca8k_lag_can_offload(struct dsa_switch *ds,
|
||||
struct dsa_lag lag,
|
||||
struct netdev_lag_upper_info *info)
|
||||
struct netdev_lag_upper_info *info,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct dsa_port *dp;
|
||||
int members = 0;
|
||||
@@ -1029,15 +1030,24 @@ static bool qca8k_lag_can_offload(struct dsa_switch *ds,
|
||||
/* Includes the port joining the LAG */
|
||||
members++;
|
||||
|
||||
if (members > QCA8K_NUM_PORTS_FOR_LAG)
|
||||
if (members > QCA8K_NUM_PORTS_FOR_LAG) {
|
||||
NL_SET_ERR_MSG_MOD(extack,
|
||||
"Cannot offload more than 4 LAG ports");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (info->tx_type != NETDEV_LAG_TX_TYPE_HASH)
|
||||
if (info->tx_type != NETDEV_LAG_TX_TYPE_HASH) {
|
||||
NL_SET_ERR_MSG_MOD(extack,
|
||||
"Can only offload LAG using hash TX type");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (info->hash_type != NETDEV_LAG_HASH_L2 &&
|
||||
info->hash_type != NETDEV_LAG_HASH_L23)
|
||||
info->hash_type != NETDEV_LAG_HASH_L23) {
|
||||
NL_SET_ERR_MSG_MOD(extack,
|
||||
"Can only offload L2 or L2+L3 TX hash");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1160,11 +1170,12 @@ static int qca8k_lag_refresh_portmap(struct dsa_switch *ds, int port,
|
||||
}
|
||||
|
||||
int qca8k_port_lag_join(struct dsa_switch *ds, int port, struct dsa_lag lag,
|
||||
struct netdev_lag_upper_info *info)
|
||||
struct netdev_lag_upper_info *info,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!qca8k_lag_can_offload(ds, lag, info))
|
||||
if (!qca8k_lag_can_offload(ds, lag, info, extack))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
ret = qca8k_lag_setup_hash(ds, lag, info);
|
||||
|
||||
Reference in New Issue
Block a user