mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	switchdev: skip over ports returning -EOPNOTSUPP when recursing ports
This allows us to recurse over all the ports, skipping over unsupporting ports. Without the change, the recursion would stop at first unsupported port. Signed-off-by: Scott Feldman <sfeldma@gmail.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									f55ac58ae6
								
							
						
					
					
						commit
						464314ea6c
					
				
					 2 changed files with 9 additions and 1 deletions
				
			
		| 
						 | 
					@ -16,6 +16,7 @@
 | 
				
			||||||
#include <linux/list.h>
 | 
					#include <linux/list.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define SWITCHDEV_F_NO_RECURSE		BIT(0)
 | 
					#define SWITCHDEV_F_NO_RECURSE		BIT(0)
 | 
				
			||||||
 | 
					#define SWITCHDEV_F_SKIP_EOPNOTSUPP	BIT(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct switchdev_trans_item {
 | 
					struct switchdev_trans_item {
 | 
				
			||||||
	struct list_head list;
 | 
						struct list_head list;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -147,7 +147,7 @@ static int __switchdev_port_attr_set(struct net_device *dev,
 | 
				
			||||||
		return ops->switchdev_port_attr_set(dev, attr, trans);
 | 
							return ops->switchdev_port_attr_set(dev, attr, trans);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (attr->flags & SWITCHDEV_F_NO_RECURSE)
 | 
						if (attr->flags & SWITCHDEV_F_NO_RECURSE)
 | 
				
			||||||
		return err;
 | 
							goto done;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Switch device port(s) may be stacked under
 | 
						/* Switch device port(s) may be stacked under
 | 
				
			||||||
	 * bond/team/vlan dev, so recurse down to set attr on
 | 
						 * bond/team/vlan dev, so recurse down to set attr on
 | 
				
			||||||
| 
						 | 
					@ -156,10 +156,17 @@ static int __switchdev_port_attr_set(struct net_device *dev,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	netdev_for_each_lower_dev(dev, lower_dev, iter) {
 | 
						netdev_for_each_lower_dev(dev, lower_dev, iter) {
 | 
				
			||||||
		err = __switchdev_port_attr_set(lower_dev, attr, trans);
 | 
							err = __switchdev_port_attr_set(lower_dev, attr, trans);
 | 
				
			||||||
 | 
							if (err == -EOPNOTSUPP &&
 | 
				
			||||||
 | 
							    attr->flags & SWITCHDEV_F_SKIP_EOPNOTSUPP)
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
		if (err)
 | 
							if (err)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					done:
 | 
				
			||||||
 | 
						if (err == -EOPNOTSUPP && attr->flags & SWITCHDEV_F_SKIP_EOPNOTSUPP)
 | 
				
			||||||
 | 
							err = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue