ソースを参照

switchdev: rename SWITCHDEV_ATTR_* enum values to SWITCHDEV_ATTR_ID_*

To be aligned with obj.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Scott Feldman <sfeldma@gmail.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Jiri Pirko 10 年 前
コミット
1f86839874

+ 5 - 4
Documentation/networking/switchdev.txt

@@ -115,7 +115,7 @@ Switch ID
 ^^^^^^^^^
 ^^^^^^^^^
 
 
 The switchdev driver must implement the switchdev op switchdev_port_attr_get
 The switchdev driver must implement the switchdev op switchdev_port_attr_get
-for SWITCHDEV_ATTR_PORT_PARENT_ID for each port netdev, returning the same
+for SWITCHDEV_ATTR_ID_PORT_PARENT_ID for each port netdev, returning the same
 physical ID for each port of a switch.  The ID must be unique between switches
 physical ID for each port of a switch.  The ID must be unique between switches
 on the same system.  The ID does not need to be unique between switches on
 on the same system.  The ID does not need to be unique between switches on
 different systems.
 different systems.
@@ -233,8 +233,9 @@ the bridge's FDB.  It's possible, but not optimal, to enable learning on the
 device port and on the bridge port, and disable learning_sync.
 device port and on the bridge port, and disable learning_sync.
 
 
 To support learning and learning_sync port attributes, the driver implements
 To support learning and learning_sync port attributes, the driver implements
-switchdev op switchdev_port_attr_get/set for SWITCHDEV_ATTR_PORT_BRIDGE_FLAGS.
-The driver should initialize the attributes to the hardware defaults.
+switchdev op switchdev_port_attr_get/set for
+SWITCHDEV_ATTR_PORT_ID_BRIDGE_FLAGS. The driver should initialize the attributes
+to the hardware defaults.
 
 
 FDB Ageing
 FDB Ageing
 ^^^^^^^^^^
 ^^^^^^^^^^
@@ -260,7 +261,7 @@ STP State Change on Port
 Internally or with a third-party STP protocol implementation (e.g. mstpd), the
 Internally or with a third-party STP protocol implementation (e.g. mstpd), the
 bridge driver maintains the STP state for ports, and will notify the switch
 bridge driver maintains the STP state for ports, and will notify the switch
 driver of STP state change on a port using the switchdev op
 driver of STP state change on a port using the switchdev op
-switchdev_attr_port_set for SWITCHDEV_ATTR_PORT_STP_UPDATE.
+switchdev_attr_port_set for SWITCHDEV_ATTR_PORT_ID_STP_UPDATE.
 
 
 State is one of BR_STATE_*.  The switch driver can use STP state updates to
 State is one of BR_STATE_*.  The switch driver can use STP state updates to
 update ingress packet filter list for the port.  For example, if port is
 update ingress packet filter list for the port.  For example, if port is

+ 1 - 1
drivers/net/ethernet/mellanox/mlxsw/switchx2.c

@@ -868,7 +868,7 @@ static int mlxsw_sx_port_attr_get(struct net_device *dev,
 	struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx;
 	struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx;
 
 
 	switch (attr->id) {
 	switch (attr->id) {
-	case SWITCHDEV_ATTR_PORT_PARENT_ID:
+	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
 		attr->u.ppid.id_len = sizeof(mlxsw_sx->hw_id);
 		attr->u.ppid.id_len = sizeof(mlxsw_sx->hw_id);
 		memcpy(&attr->u.ppid.id, &mlxsw_sx->hw_id, attr->u.ppid.id_len);
 		memcpy(&attr->u.ppid.id, &mlxsw_sx->hw_id, attr->u.ppid.id_len);
 		break;
 		break;

+ 4 - 4
drivers/net/ethernet/rocker/rocker.c

@@ -4329,11 +4329,11 @@ static int rocker_port_attr_get(struct net_device *dev,
 	const struct rocker *rocker = rocker_port->rocker;
 	const struct rocker *rocker = rocker_port->rocker;
 
 
 	switch (attr->id) {
 	switch (attr->id) {
-	case SWITCHDEV_ATTR_PORT_PARENT_ID:
+	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
 		attr->u.ppid.id_len = sizeof(rocker->hw.id);
 		attr->u.ppid.id_len = sizeof(rocker->hw.id);
 		memcpy(&attr->u.ppid.id, &rocker->hw.id, attr->u.ppid.id_len);
 		memcpy(&attr->u.ppid.id, &rocker->hw.id, attr->u.ppid.id_len);
 		break;
 		break;
-	case SWITCHDEV_ATTR_PORT_BRIDGE_FLAGS:
+	case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
 		attr->u.brport_flags = rocker_port->brport_flags;
 		attr->u.brport_flags = rocker_port->brport_flags;
 		break;
 		break;
 	default:
 	default:
@@ -4369,12 +4369,12 @@ static int rocker_port_attr_set(struct net_device *dev,
 	int err = 0;
 	int err = 0;
 
 
 	switch (attr->id) {
 	switch (attr->id) {
-	case SWITCHDEV_ATTR_PORT_STP_STATE:
+	case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
 		err = rocker_port_stp_update(rocker_port, trans,
 		err = rocker_port_stp_update(rocker_port, trans,
 					     ROCKER_OP_FLAG_NOWAIT,
 					     ROCKER_OP_FLAG_NOWAIT,
 					     attr->u.stp_state);
 					     attr->u.stp_state);
 		break;
 		break;
-	case SWITCHDEV_ATTR_PORT_BRIDGE_FLAGS:
+	case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
 		err = rocker_port_brport_flags_set(rocker_port, trans,
 		err = rocker_port_brport_flags_set(rocker_port, trans,
 						   attr->u.brport_flags);
 						   attr->u.brport_flags);
 		break;
 		break;

+ 4 - 4
include/net/switchdev.h

@@ -39,10 +39,10 @@ static inline bool switchdev_trans_ph_commit(struct switchdev_trans *trans)
 }
 }
 
 
 enum switchdev_attr_id {
 enum switchdev_attr_id {
-	SWITCHDEV_ATTR_UNDEFINED,
-	SWITCHDEV_ATTR_PORT_PARENT_ID,
-	SWITCHDEV_ATTR_PORT_STP_STATE,
-	SWITCHDEV_ATTR_PORT_BRIDGE_FLAGS,
+	SWITCHDEV_ATTR_ID_UNDEFINED,
+	SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
+	SWITCHDEV_ATTR_ID_PORT_STP_STATE,
+	SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
 };
 };
 
 
 struct switchdev_attr {
 struct switchdev_attr {

+ 1 - 1
net/bridge/br_stp.c

@@ -40,7 +40,7 @@ void br_log_state(const struct net_bridge_port *p)
 void br_set_state(struct net_bridge_port *p, unsigned int state)
 void br_set_state(struct net_bridge_port *p, unsigned int state)
 {
 {
 	struct switchdev_attr attr = {
 	struct switchdev_attr attr = {
-		.id = SWITCHDEV_ATTR_PORT_STP_STATE,
+		.id = SWITCHDEV_ATTR_ID_PORT_STP_STATE,
 		.u.stp_state = state,
 		.u.stp_state = state,
 	};
 	};
 	int err;
 	int err;

+ 1 - 1
net/core/net-sysfs.c

@@ -471,7 +471,7 @@ static ssize_t phys_switch_id_show(struct device *dev,
 
 
 	if (dev_isalive(netdev)) {
 	if (dev_isalive(netdev)) {
 		struct switchdev_attr attr = {
 		struct switchdev_attr attr = {
-			.id = SWITCHDEV_ATTR_PORT_PARENT_ID,
+			.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
 			.flags = SWITCHDEV_F_NO_RECURSE,
 			.flags = SWITCHDEV_F_NO_RECURSE,
 		};
 		};
 
 

+ 1 - 1
net/core/rtnetlink.c

@@ -1025,7 +1025,7 @@ static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
 {
 {
 	int err;
 	int err;
 	struct switchdev_attr attr = {
 	struct switchdev_attr attr = {
-		.id = SWITCHDEV_ATTR_PORT_PARENT_ID,
+		.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
 		.flags = SWITCHDEV_F_NO_RECURSE,
 		.flags = SWITCHDEV_F_NO_RECURSE,
 	};
 	};
 
 

+ 2 - 2
net/dsa/slave.c

@@ -458,7 +458,7 @@ static int dsa_slave_port_attr_set(struct net_device *dev,
 	int ret;
 	int ret;
 
 
 	switch (attr->id) {
 	switch (attr->id) {
-	case SWITCHDEV_ATTR_PORT_STP_STATE:
+	case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
 		if (switchdev_trans_ph_prepare(trans))
 		if (switchdev_trans_ph_prepare(trans))
 			ret = ds->drv->port_stp_update ? 0 : -EOPNOTSUPP;
 			ret = ds->drv->port_stp_update ? 0 : -EOPNOTSUPP;
 		else
 		else
@@ -584,7 +584,7 @@ static int dsa_slave_port_attr_get(struct net_device *dev,
 	struct dsa_switch *ds = p->parent;
 	struct dsa_switch *ds = p->parent;
 
 
 	switch (attr->id) {
 	switch (attr->id) {
-	case SWITCHDEV_ATTR_PORT_PARENT_ID:
+	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
 		attr->u.ppid.id_len = sizeof(ds->index);
 		attr->u.ppid.id_len = sizeof(ds->index);
 		memcpy(&attr->u.ppid.id, &ds->index, attr->u.ppid.id_len);
 		memcpy(&attr->u.ppid.id, &ds->index, attr->u.ppid.id_len);
 		break;
 		break;

+ 7 - 7
net/switchdev/switchdev.c

@@ -104,7 +104,7 @@ int switchdev_port_attr_get(struct net_device *dev, struct switchdev_attr *attr)
 	struct net_device *lower_dev;
 	struct net_device *lower_dev;
 	struct list_head *iter;
 	struct list_head *iter;
 	struct switchdev_attr first = {
 	struct switchdev_attr first = {
-		.id = SWITCHDEV_ATTR_UNDEFINED
+		.id = SWITCHDEV_ATTR_ID_UNDEFINED
 	};
 	};
 	int err = -EOPNOTSUPP;
 	int err = -EOPNOTSUPP;
 
 
@@ -124,7 +124,7 @@ int switchdev_port_attr_get(struct net_device *dev, struct switchdev_attr *attr)
 		err = switchdev_port_attr_get(lower_dev, attr);
 		err = switchdev_port_attr_get(lower_dev, attr);
 		if (err)
 		if (err)
 			break;
 			break;
-		if (first.id == SWITCHDEV_ATTR_UNDEFINED)
+		if (first.id == SWITCHDEV_ATTR_ID_UNDEFINED)
 			first = *attr;
 			first = *attr;
 		else if (memcmp(&first, attr, sizeof(*attr)))
 		else if (memcmp(&first, attr, sizeof(*attr)))
 			return -ENODATA;
 			return -ENODATA;
@@ -611,7 +611,7 @@ int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 				  int nlflags)
 				  int nlflags)
 {
 {
 	struct switchdev_attr attr = {
 	struct switchdev_attr attr = {
-		.id = SWITCHDEV_ATTR_PORT_BRIDGE_FLAGS,
+		.id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
 	};
 	};
 	u16 mode = BRIDGE_MODE_UNDEF;
 	u16 mode = BRIDGE_MODE_UNDEF;
 	u32 mask = BR_LEARNING | BR_LEARNING_SYNC;
 	u32 mask = BR_LEARNING | BR_LEARNING_SYNC;
@@ -632,7 +632,7 @@ static int switchdev_port_br_setflag(struct net_device *dev,
 				     unsigned long brport_flag)
 				     unsigned long brport_flag)
 {
 {
 	struct switchdev_attr attr = {
 	struct switchdev_attr attr = {
-		.id = SWITCHDEV_ATTR_PORT_BRIDGE_FLAGS,
+		.id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
 	};
 	};
 	u8 flag = nla_get_u8(nlattr);
 	u8 flag = nla_get_u8(nlattr);
 	int err;
 	int err;
@@ -958,7 +958,7 @@ static struct net_device *switchdev_get_lowest_dev(struct net_device *dev)
 static struct net_device *switchdev_get_dev_by_nhs(struct fib_info *fi)
 static struct net_device *switchdev_get_dev_by_nhs(struct fib_info *fi)
 {
 {
 	struct switchdev_attr attr = {
 	struct switchdev_attr attr = {
-		.id = SWITCHDEV_ATTR_PORT_PARENT_ID,
+		.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
 	};
 	};
 	struct switchdev_attr prev_attr;
 	struct switchdev_attr prev_attr;
 	struct net_device *dev = NULL;
 	struct net_device *dev = NULL;
@@ -1107,11 +1107,11 @@ static bool switchdev_port_same_parent_id(struct net_device *a,
 					  struct net_device *b)
 					  struct net_device *b)
 {
 {
 	struct switchdev_attr a_attr = {
 	struct switchdev_attr a_attr = {
-		.id = SWITCHDEV_ATTR_PORT_PARENT_ID,
+		.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
 		.flags = SWITCHDEV_F_NO_RECURSE,
 		.flags = SWITCHDEV_F_NO_RECURSE,
 	};
 	};
 	struct switchdev_attr b_attr = {
 	struct switchdev_attr b_attr = {
-		.id = SWITCHDEV_ATTR_PORT_PARENT_ID,
+		.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
 		.flags = SWITCHDEV_F_NO_RECURSE,
 		.flags = SWITCHDEV_F_NO_RECURSE,
 	};
 	};