diff options
Diffstat (limited to 'include/net/switchdev.h')
| -rw-r--r-- | include/net/switchdev.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/include/net/switchdev.h b/include/net/switchdev.h index cfcdac2e5d25..d2e69ee3019a 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * include/net/switchdev.h - Switch device API | 2 | * include/net/switchdev.h - Switch device API |
| 3 | * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us> | 3 | * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us> |
| 4 | * Copyright (c) 2014-2015 Scott Feldman <sfeldma@gmail.com> | ||
| 4 | * | 5 | * |
| 5 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
| @@ -13,6 +14,35 @@ | |||
| 13 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
| 14 | #include <linux/notifier.h> | 15 | #include <linux/notifier.h> |
| 15 | 16 | ||
| 17 | struct fib_info; | ||
| 18 | |||
| 19 | /** | ||
| 20 | * struct switchdev_ops - switchdev operations | ||
| 21 | * | ||
| 22 | * @swdev_parent_id_get: Called to get an ID of the switch chip this port | ||
| 23 | * is part of. If driver implements this, it indicates that it | ||
| 24 | * represents a port of a switch chip. | ||
| 25 | * | ||
| 26 | * @swdev_port_stp_update: Called to notify switch device port of bridge | ||
| 27 | * port STP state change. | ||
| 28 | * | ||
| 29 | * @swdev_fib_ipv4_add: Called to add/modify IPv4 route to switch device. | ||
| 30 | * | ||
| 31 | * @swdev_fib_ipv4_del: Called to delete IPv4 route from switch device. | ||
| 32 | */ | ||
| 33 | struct swdev_ops { | ||
| 34 | int (*swdev_parent_id_get)(struct net_device *dev, | ||
| 35 | struct netdev_phys_item_id *psid); | ||
| 36 | int (*swdev_port_stp_update)(struct net_device *dev, u8 state); | ||
| 37 | int (*swdev_fib_ipv4_add)(struct net_device *dev, __be32 dst, | ||
| 38 | int dst_len, struct fib_info *fi, | ||
| 39 | u8 tos, u8 type, u32 nlflags, | ||
| 40 | u32 tb_id); | ||
| 41 | int (*swdev_fib_ipv4_del)(struct net_device *dev, __be32 dst, | ||
| 42 | int dst_len, struct fib_info *fi, | ||
| 43 | u8 tos, u8 type, u32 tb_id); | ||
| 44 | }; | ||
| 45 | |||
| 16 | enum netdev_switch_notifier_type { | 46 | enum netdev_switch_notifier_type { |
| 17 | NETDEV_SWITCH_FDB_ADD = 1, | 47 | NETDEV_SWITCH_FDB_ADD = 1, |
| 18 | NETDEV_SWITCH_FDB_DEL, | 48 | NETDEV_SWITCH_FDB_DEL, |
| @@ -51,6 +81,12 @@ int ndo_dflt_netdev_switch_port_bridge_dellink(struct net_device *dev, | |||
| 51 | struct nlmsghdr *nlh, u16 flags); | 81 | struct nlmsghdr *nlh, u16 flags); |
| 52 | int ndo_dflt_netdev_switch_port_bridge_setlink(struct net_device *dev, | 82 | int ndo_dflt_netdev_switch_port_bridge_setlink(struct net_device *dev, |
| 53 | struct nlmsghdr *nlh, u16 flags); | 83 | struct nlmsghdr *nlh, u16 flags); |
| 84 | int netdev_switch_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi, | ||
| 85 | u8 tos, u8 type, u32 nlflags, u32 tb_id); | ||
| 86 | int netdev_switch_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, | ||
| 87 | u8 tos, u8 type, u32 tb_id); | ||
| 88 | void netdev_switch_fib_ipv4_abort(struct fib_info *fi); | ||
| 89 | |||
| 54 | #else | 90 | #else |
| 55 | 91 | ||
| 56 | static inline int netdev_switch_parent_id_get(struct net_device *dev, | 92 | static inline int netdev_switch_parent_id_get(struct net_device *dev, |
| @@ -109,6 +145,25 @@ static inline int ndo_dflt_netdev_switch_port_bridge_setlink(struct net_device * | |||
| 109 | return 0; | 145 | return 0; |
| 110 | } | 146 | } |
| 111 | 147 | ||
| 148 | static inline int netdev_switch_fib_ipv4_add(u32 dst, int dst_len, | ||
| 149 | struct fib_info *fi, | ||
| 150 | u8 tos, u8 type, | ||
| 151 | u32 nlflags, u32 tb_id) | ||
| 152 | { | ||
| 153 | return 0; | ||
| 154 | } | ||
| 155 | |||
| 156 | static inline int netdev_switch_fib_ipv4_del(u32 dst, int dst_len, | ||
| 157 | struct fib_info *fi, | ||
| 158 | u8 tos, u8 type, u32 tb_id) | ||
| 159 | { | ||
| 160 | return 0; | ||
| 161 | } | ||
| 162 | |||
| 163 | static inline void netdev_switch_fib_ipv4_abort(struct fib_info *fi) | ||
| 164 | { | ||
| 165 | } | ||
| 166 | |||
| 112 | #endif | 167 | #endif |
| 113 | 168 | ||
| 114 | #endif /* _LINUX_SWITCHDEV_H_ */ | 169 | #endif /* _LINUX_SWITCHDEV_H_ */ |
