diff options
| -rw-r--r-- | include/linux/netdevice.h | 7 | ||||
| -rw-r--r-- | net/switchdev/switchdev.c | 8 |
2 files changed, 9 insertions, 6 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 8364f29e08be..607b5f41f46f 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -766,6 +766,13 @@ struct netdev_phys_item_id { | |||
| 766 | unsigned char id_len; | 766 | unsigned char id_len; |
| 767 | }; | 767 | }; |
| 768 | 768 | ||
| 769 | static inline bool netdev_phys_item_id_same(struct netdev_phys_item_id *a, | ||
| 770 | struct netdev_phys_item_id *b) | ||
| 771 | { | ||
| 772 | return a->id_len == b->id_len && | ||
| 773 | memcmp(a->id, b->id, a->id_len) == 0; | ||
| 774 | } | ||
| 775 | |||
| 769 | typedef u16 (*select_queue_fallback_t)(struct net_device *dev, | 776 | typedef u16 (*select_queue_fallback_t)(struct net_device *dev, |
| 770 | struct sk_buff *skb); | 777 | struct sk_buff *skb); |
| 771 | 778 | ||
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index 9f2add3cba26..4e5bba50ccff 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c | |||
| @@ -910,13 +910,9 @@ static struct net_device *switchdev_get_dev_by_nhs(struct fib_info *fi) | |||
| 910 | if (switchdev_port_attr_get(dev, &attr)) | 910 | if (switchdev_port_attr_get(dev, &attr)) |
| 911 | return NULL; | 911 | return NULL; |
| 912 | 912 | ||
| 913 | if (nhsel > 0) { | 913 | if (nhsel > 0 && |
| 914 | if (prev_attr.u.ppid.id_len != attr.u.ppid.id_len) | 914 | !netdev_phys_item_id_same(&prev_attr.u.ppid, &attr.u.ppid)) |
| 915 | return NULL; | 915 | return NULL; |
| 916 | if (memcmp(prev_attr.u.ppid.id, attr.u.ppid.id, | ||
| 917 | attr.u.ppid.id_len)) | ||
| 918 | return NULL; | ||
| 919 | } | ||
| 920 | 916 | ||
| 921 | prev_attr = attr; | 917 | prev_attr = attr; |
| 922 | } | 918 | } |
