forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/s390/net/qeth_l3.h
....@@ -13,8 +13,6 @@
1313 #include "qeth_core.h"
1414 #include <linux/hashtable.h>
1515
16
-#define QETH_SNIFF_AVAIL 0x0008
17
-
1816 enum qeth_ip_types {
1917 QETH_IP_TYPE_NORMAL,
2018 QETH_IP_TYPE_VIPA,
....@@ -24,9 +22,7 @@
2422 struct qeth_ipaddr {
2523 struct hlist_node hnode;
2624 enum qeth_ip_types type;
27
- unsigned char mac[ETH_ALEN];
2825 u8 is_multicast:1;
29
- u8 in_progress:1;
3026 u8 disp_flag:2;
3127 u8 ipato:1; /* ucast only */
3228
....@@ -37,8 +33,8 @@
3733 enum qeth_prot_versions proto;
3834 union {
3935 struct {
40
- unsigned int addr;
41
- unsigned int mask;
36
+ __be32 addr;
37
+ __be32 mask;
4238 } a4;
4339 struct {
4440 struct in6_addr addr;
....@@ -55,6 +51,7 @@
5551 addr->type = type;
5652 addr->proto = proto;
5753 addr->disp_flag = QETH_DISP_ADDR_DO_NOTHING;
54
+ addr->ref_counter = 1;
5855 }
5956
6057 static inline bool qeth_l3_addr_match_ip(struct qeth_ipaddr *a1,
....@@ -74,12 +71,10 @@
7471 * so 'proto' and 'addr' match for sure.
7572 *
7673 * For ucast:
77
- * - 'mac' is always 0.
7874 * - 'mask'/'pfxlen' for RXIP/VIPA is always 0. For NORMAL, matching
7975 * values are required to avoid mixups in takeover eligibility.
8076 *
8177 * For mcast,
82
- * - 'mac' is mapped from the IP, and thus always matches.
8378 * - 'mask'/'pfxlen' is always 0.
8479 */
8580 if (a1->type != a2->type)
....@@ -89,33 +84,25 @@
8984 return a1->u.a4.mask == a2->u.a4.mask;
9085 }
9186
92
-static inline u64 qeth_l3_ipaddr_hash(struct qeth_ipaddr *addr)
87
+static inline u32 qeth_l3_ipaddr_hash(struct qeth_ipaddr *addr)
9388 {
94
- u64 ret = 0;
95
- u8 *point;
96
-
97
- if (addr->proto == QETH_PROT_IPV6) {
98
- point = (u8 *) &addr->u.a6.addr;
99
- ret = get_unaligned((u64 *)point) ^
100
- get_unaligned((u64 *) (point + 8));
101
- }
102
- if (addr->proto == QETH_PROT_IPV4) {
103
- point = (u8 *) &addr->u.a4.addr;
104
- ret = get_unaligned((u32 *) point);
105
- }
106
- return ret;
89
+ if (addr->proto == QETH_PROT_IPV6)
90
+ return ipv6_addr_hash(&addr->u.a6.addr);
91
+ else
92
+ return ipv4_addr_hash(addr->u.a4.addr);
10793 }
10894
10995 struct qeth_ipato_entry {
11096 struct list_head entry;
11197 enum qeth_prot_versions proto;
11298 char addr[16];
113
- int mask_bits;
99
+ unsigned int mask_bits;
114100 };
115101
116102 extern const struct attribute_group *qeth_l3_attr_groups[];
117103
118
-void qeth_l3_ipaddr_to_string(enum qeth_prot_versions, const __u8 *, char *);
104
+int qeth_l3_ipaddr_to_string(enum qeth_prot_versions proto, const u8 *addr,
105
+ char *buf);
119106 int qeth_l3_create_device_attributes(struct device *);
120107 void qeth_l3_remove_device_attributes(struct device *);
121108 int qeth_l3_setrouting_v4(struct qeth_card *);
....@@ -123,7 +110,7 @@
123110 int qeth_l3_add_ipato_entry(struct qeth_card *, struct qeth_ipato_entry *);
124111 int qeth_l3_del_ipato_entry(struct qeth_card *card,
125112 enum qeth_prot_versions proto, u8 *addr,
126
- int mask_bits);
113
+ unsigned int mask_bits);
127114 void qeth_l3_update_ipato(struct qeth_card *card);
128115 int qeth_l3_modify_hsuid(struct qeth_card *card, bool add);
129116 int qeth_l3_modify_rxip_vipa(struct qeth_card *card, bool add, const u8 *ip,