hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/drivers/net/ethernet/ti/cpsw_ale.h
....@@ -1,16 +1,9 @@
1
+/* SPDX-License-Identifier: GPL-2.0 */
12 /*
23 * Texas Instruments N-Port Ethernet Switch Address Lookup Engine APIs
34 *
45 * Copyright (C) 2012 Texas Instruments
56 *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License as
8
- * published by the Free Software Foundation version 2.
9
- *
10
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11
- * kind, whether express or implied; without even the implied warranty
12
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
147 */
158 #ifndef __TI_CPSW_ALE_H__
169 #define __TI_CPSW_ALE_H__
....@@ -31,18 +24,24 @@
3124 * pass it from caller.
3225 */
3326 u32 major_ver_mask;
27
+ const char *dev_id;
28
+ unsigned long bus_freq;
3429 };
30
+
31
+struct ale_entry_fld;
3532
3633 struct cpsw_ale {
3734 struct cpsw_ale_params params;
3835 struct timer_list timer;
3936 unsigned long ageout;
40
- int allmulti;
4137 u32 version;
38
+ u32 features;
4239 /* These bits are different on NetCP NU Switch ALE */
4340 u32 port_mask_bits;
4441 u32 port_num_bits;
4542 u32 vlan_field_bits;
43
+ unsigned long *p0_untag_vid_mask;
44
+ const struct ale_entry_fld *vlan_entry_tbl;
4645 };
4746
4847 enum cpsw_ale_control {
....@@ -69,8 +68,12 @@
6968 ALE_PORT_UNKNOWN_MCAST_FLOOD,
7069 ALE_PORT_UNKNOWN_REG_MCAST_FLOOD,
7170 ALE_PORT_UNTAGGED_EGRESS,
71
+ ALE_PORT_MACONLY,
72
+ ALE_PORT_MACONLY_CAF,
7273 ALE_PORT_BCAST_LIMIT,
7374 ALE_PORT_MCAST_LIMIT,
75
+ ALE_DEFAULT_THREAD_ID,
76
+ ALE_DEFAULT_THREAD_ENABLE,
7477 ALE_NUM_CONTROLS,
7578 };
7679
....@@ -105,22 +108,33 @@
105108 void cpsw_ale_stop(struct cpsw_ale *ale);
106109
107110 int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid);
108
-int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port,
111
+int cpsw_ale_add_ucast(struct cpsw_ale *ale, const u8 *addr, int port,
109112 int flags, u16 vid);
110
-int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port,
113
+int cpsw_ale_del_ucast(struct cpsw_ale *ale, const u8 *addr, int port,
111114 int flags, u16 vid);
112
-int cpsw_ale_add_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
115
+int cpsw_ale_add_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask,
113116 int flags, u16 vid, int mcast_state);
114
-int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
117
+int cpsw_ale_del_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask,
115118 int flags, u16 vid);
116119 int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag,
117120 int reg_mcast, int unreg_mcast);
118121 int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port);
119
-void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti);
122
+void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti, int port);
120123
121124 int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control);
122125 int cpsw_ale_control_set(struct cpsw_ale *ale, int port,
123126 int control, int value);
124127 void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data);
128
+u32 cpsw_ale_get_num_entries(struct cpsw_ale *ale);
129
+
130
+static inline int cpsw_ale_get_vlan_p0_untag(struct cpsw_ale *ale, u16 vid)
131
+{
132
+ return test_bit(vid, ale->p0_untag_vid_mask);
133
+}
134
+
135
+int cpsw_ale_vlan_add_modify(struct cpsw_ale *ale, u16 vid, int port_mask,
136
+ int untag_mask, int reg_mcast, int unreg_mcast);
137
+void cpsw_ale_set_unreg_mcast(struct cpsw_ale *ale, int unreg_mcast_mask,
138
+ bool add);
125139
126140 #endif