Skip to content

Commit 953fb4d

Browse files
SandyWinterdavem330
authored andcommitted
s390/qeth: Consider dependency on SWITCHDEV module
Without the SWITCHDEV module, the bridgeport attribute LEARNING_SYNC of the physical device (self) does not provide any functionality. Instead of calling the no-op stub version of the switchdev functions, fail the setting of the attribute with an appropriate message. While at it, also add an error message for the 'not supported by HW' case. Signed-off-by: Alexandra Winter <[email protected]> Reviewed-by: Julian Wiedmann <[email protected]> Signed-off-by: Julian Wiedmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bb7032d commit 953fb4d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/s390/net/qeth_l2_main.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,6 @@ static int qeth_l2_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
805805

806806
if (!netif_device_present(dev))
807807
return -ENODEV;
808-
if (!(priv->brport_hw_features))
809-
return -EOPNOTSUPP;
810808

811809
nlmsg_for_each_attr(attr, nlh, sizeof(struct ifinfomsg), rem1) {
812810
if (nla_type(attr) == IFLA_PROTINFO) {
@@ -832,6 +830,16 @@ static int qeth_l2_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
832830
return 0;
833831
if (!bp_tb[IFLA_BRPORT_LEARNING_SYNC])
834832
return -EINVAL;
833+
if (!(priv->brport_hw_features & BR_LEARNING_SYNC)) {
834+
NL_SET_ERR_MSG_ATTR(extack, bp_tb[IFLA_BRPORT_LEARNING_SYNC],
835+
"Operation not supported by HW");
836+
return -EOPNOTSUPP;
837+
}
838+
if (!IS_ENABLED(CONFIG_NET_SWITCHDEV)) {
839+
NL_SET_ERR_MSG_ATTR(extack, bp_tb[IFLA_BRPORT_LEARNING_SYNC],
840+
"Requires NET_SWITCHDEV");
841+
return -EOPNOTSUPP;
842+
}
835843
enable = !!nla_get_u8(bp_tb[IFLA_BRPORT_LEARNING_SYNC]);
836844

837845
if (enable == !!(priv->brport_features & BR_LEARNING_SYNC))

0 commit comments

Comments
 (0)