hc
2024-05-10 ee930fffee469d076998274a2ca55e13dc1efb67
kernel/include/net/bonding.h
....@@ -38,6 +38,15 @@
3838 #define __long_aligned __attribute__((aligned((sizeof(long)))))
3939 #endif
4040
41
+#define slave_info(bond_dev, slave_dev, fmt, ...) \
42
+ netdev_info(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__)
43
+#define slave_warn(bond_dev, slave_dev, fmt, ...) \
44
+ netdev_warn(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__)
45
+#define slave_dbg(bond_dev, slave_dev, fmt, ...) \
46
+ netdev_dbg(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__)
47
+#define slave_err(bond_dev, slave_dev, fmt, ...) \
48
+ netdev_err(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__)
49
+
4150 #define BOND_MODE(bond) ((bond)->params.mode)
4251
4352 /* slave list primitives */
....@@ -77,6 +86,9 @@
7786 #define bond_for_each_slave_rcu(bond, pos, iter) \
7887 netdev_for_each_lower_private_rcu((bond)->dev, pos, iter)
7988
89
+#define BOND_XFRM_FEATURES (NETIF_F_HW_ESP | NETIF_F_HW_ESP_TX_CSUM | \
90
+ NETIF_F_GSO_ESP)
91
+
8092 #ifdef CONFIG_NET_POLL_CONTROLLER
8193 extern atomic_t netpoll_block_tx;
8294
....@@ -114,6 +126,7 @@
114126 int fail_over_mac;
115127 int updelay;
116128 int downdelay;
129
+ int peer_notif_delay;
117130 int lacp_fast;
118131 unsigned int min_links;
119132 int ad_select;
....@@ -178,13 +191,18 @@
178191 struct bond_up_slave {
179192 unsigned int count;
180193 struct rcu_head rcu;
181
- struct slave *arr[0];
194
+ struct slave *arr[];
182195 };
183196
184197 /*
185198 * Link pseudo-state only used internally by monitors
186199 */
187200 #define BOND_LINK_NOCHANGE -1
201
+
202
+struct bond_ipsec {
203
+ struct list_head list;
204
+ struct xfrm_state *xs;
205
+};
188206
189207 /*
190208 * Here are the locking policies for the two bonding locks:
....@@ -195,9 +213,10 @@
195213 struct slave __rcu *curr_active_slave;
196214 struct slave __rcu *current_arp_slave;
197215 struct slave __rcu *primary_slave;
198
- struct bond_up_slave __rcu *slave_arr; /* Array of usable slaves */
216
+ struct bond_up_slave __rcu *usable_slaves;
217
+ struct bond_up_slave __rcu *all_slaves;
199218 bool force_primary;
200
- u32 nest_level;
219
+ bool notifier_ctx;
201220 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */
202221 int (*recv_probe)(const struct sk_buff *, struct bonding *,
203222 struct slave *);
....@@ -233,6 +252,11 @@
233252 struct dentry *debug_dir;
234253 #endif /* CONFIG_DEBUG_FS */
235254 struct rtnl_link_stats64 bond_stats;
255
+#ifdef CONFIG_XFRM_OFFLOAD
256
+ struct list_head ipsec_list;
257
+ /* protecting ipsec_list */
258
+ spinlock_t ipsec_lock;
259
+#endif /* CONFIG_XFRM_OFFLOAD */
236260 };
237261
238262 #define bond_slave_get_rcu(dev) \
....@@ -500,18 +524,17 @@
500524 }
501525
502526 #ifdef CONFIG_NET_POLL_CONTROLLER
503
-static inline void bond_netpoll_send_skb(const struct slave *slave,
527
+static inline netdev_tx_t bond_netpoll_send_skb(const struct slave *slave,
504528 struct sk_buff *skb)
505529 {
506
- struct netpoll *np = slave->np;
507
-
508
- if (np)
509
- netpoll_send_skb(np, skb);
530
+ return netpoll_send_skb(slave->np, skb);
510531 }
511532 #else
512
-static inline void bond_netpoll_send_skb(const struct slave *slave,
533
+static inline netdev_tx_t bond_netpoll_send_skb(const struct slave *slave,
513534 struct sk_buff *skb)
514535 {
536
+ BUG();
537
+ return NETDEV_TX_OK;
515538 }
516539 #endif
517540
....@@ -605,7 +628,7 @@
605628 };
606629
607630 int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave);
608
-void bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
631
+netdev_tx_t bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
609632 int bond_create(struct net *net, const char *name);
610633 int bond_create_sysfs(struct bond_net *net);
611634 void bond_destroy_sysfs(struct bond_net *net);
....@@ -675,37 +698,14 @@
675698 }
676699
677700 /* Caller must hold rcu_read_lock() for read */
678
-static inline struct slave *bond_slave_has_mac_rcu(struct bonding *bond,
679
- const u8 *mac)
701
+static inline bool bond_slave_has_mac_rcu(struct bonding *bond, const u8 *mac)
680702 {
681703 struct list_head *iter;
682704 struct slave *tmp;
683705
684706 bond_for_each_slave_rcu(bond, tmp, iter)
685707 if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr))
686
- return tmp;
687
-
688
- return NULL;
689
-}
690
-
691
-/* Caller must hold rcu_read_lock() for read */
692
-static inline bool bond_slave_has_mac_rx(struct bonding *bond, const u8 *mac)
693
-{
694
- struct list_head *iter;
695
- struct slave *tmp;
696
- struct netdev_hw_addr *ha;
697
-
698
- bond_for_each_slave_rcu(bond, tmp, iter)
699
- if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr))
700708 return true;
701
-
702
- if (netdev_uc_empty(bond->dev))
703
- return false;
704
-
705
- netdev_for_each_uc_addr(ha, bond->dev)
706
- if (ether_addr_equal_64bits(mac, ha->addr))
707
- return true;
708
-
709709 return false;
710710 }
711711
....@@ -741,10 +741,14 @@
741741 /* exported from bond_sysfs_slave.c */
742742 extern const struct sysfs_ops slave_sysfs_ops;
743743
744
-static inline void bond_tx_drop(struct net_device *dev, struct sk_buff *skb)
744
+/* exported from bond_3ad.c */
745
+extern const u8 lacpdu_mcast_addr[];
746
+
747
+static inline netdev_tx_t bond_tx_drop(struct net_device *dev, struct sk_buff *skb)
745748 {
746749 atomic_long_inc(&dev->tx_dropped);
747750 dev_kfree_skb_any(skb);
751
+ return NET_XMIT_DROP;
748752 }
749753
750754 #endif /* _NET_BONDING_H */