Lines Matching refs:ale_entry
54 static inline int cpsw_ale_get_field(u32 *ale_entry, u32 start, u32 bits) in cpsw_ale_get_field() argument
61 return (ale_entry[idx] >> start) & BITMASK(bits); in cpsw_ale_get_field()
64 static inline void cpsw_ale_set_field(u32 *ale_entry, u32 start, u32 bits, in cpsw_ale_set_field() argument
73 ale_entry[idx] &= ~(BITMASK(bits) << start); in cpsw_ale_set_field()
74 ale_entry[idx] |= (value << start); in cpsw_ale_set_field()
78 static inline int cpsw_ale_get_##name(u32 *ale_entry) \
80 return cpsw_ale_get_field(ale_entry, start, bits); \
82 static inline void cpsw_ale_set_##name(u32 *ale_entry, u32 value) \
84 cpsw_ale_set_field(ale_entry, start, bits, value); \
103 static inline void cpsw_ale_get_addr(u32 *ale_entry, u8 *addr) in cpsw_ale_get_addr() argument
108 addr[i] = cpsw_ale_get_field(ale_entry, 40 - 8*i, 8); in cpsw_ale_get_addr()
111 static inline void cpsw_ale_set_addr(u32 *ale_entry, u8 *addr) in cpsw_ale_set_addr() argument
116 cpsw_ale_set_field(ale_entry, 40 - 8*i, 8, addr[i]); in cpsw_ale_set_addr()
119 static int cpsw_ale_read(struct cpsw_ale *ale, int idx, u32 *ale_entry) in cpsw_ale_read() argument
128 ale_entry[i] = __raw_readl(ale->params.ale_regs + in cpsw_ale_read()
134 static int cpsw_ale_write(struct cpsw_ale *ale, int idx, u32 *ale_entry) in cpsw_ale_write() argument
141 __raw_writel(ale_entry[i], ale->params.ale_regs + in cpsw_ale_write()
152 u32 ale_entry[ALE_ENTRY_WORDS]; in cpsw_ale_match_addr() local
158 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_match_addr()
159 type = cpsw_ale_get_entry_type(ale_entry); in cpsw_ale_match_addr()
162 cpsw_ale_get_addr(ale_entry, entry_addr); in cpsw_ale_match_addr()
171 u32 ale_entry[ALE_ENTRY_WORDS]; in cpsw_ale_match_free() local
175 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_match_free()
176 type = cpsw_ale_get_entry_type(ale_entry); in cpsw_ale_match_free()
185 u32 ale_entry[ALE_ENTRY_WORDS]; in cpsw_ale_find_ageable() local
189 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_find_ageable()
190 type = cpsw_ale_get_entry_type(ale_entry); in cpsw_ale_find_ageable()
193 if (cpsw_ale_get_mcast(ale_entry)) in cpsw_ale_find_ageable()
195 type = cpsw_ale_get_ucast_type(ale_entry); in cpsw_ale_find_ageable()
203 static void cpsw_ale_flush_mcast(struct cpsw_ale *ale, u32 *ale_entry, in cpsw_ale_flush_mcast() argument
208 mask = cpsw_ale_get_port_mask(ale_entry); in cpsw_ale_flush_mcast()
215 cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE); in cpsw_ale_flush_mcast()
217 cpsw_ale_set_port_mask(ale_entry, mask); in cpsw_ale_flush_mcast()
220 static void cpsw_ale_flush_ucast(struct cpsw_ale *ale, u32 *ale_entry, in cpsw_ale_flush_ucast() argument
225 port = cpsw_ale_get_port_num(ale_entry); in cpsw_ale_flush_ucast()
228 cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE); in cpsw_ale_flush_ucast()
233 u32 ale_entry[ALE_ENTRY_WORDS]; in cpsw_ale_flush() local
237 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_flush()
238 ret = cpsw_ale_get_entry_type(ale_entry); in cpsw_ale_flush()
242 if (cpsw_ale_get_mcast(ale_entry)) in cpsw_ale_flush()
243 cpsw_ale_flush_mcast(ale, ale_entry, port_mask); in cpsw_ale_flush()
245 cpsw_ale_flush_ucast(ale, ale_entry, port_mask); in cpsw_ale_flush()
247 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_flush()
254 u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0}; in cpsw_ale_add_ucast() local
257 cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_ADDR); in cpsw_ale_add_ucast()
258 cpsw_ale_set_addr(ale_entry, addr); in cpsw_ale_add_ucast()
259 cpsw_ale_set_ucast_type(ale_entry, ALE_UCAST_PERSISTANT); in cpsw_ale_add_ucast()
260 cpsw_ale_set_secure(ale_entry, (flags & ALE_SECURE) ? 1 : 0); in cpsw_ale_add_ucast()
261 cpsw_ale_set_blocked(ale_entry, (flags & ALE_BLOCKED) ? 1 : 0); in cpsw_ale_add_ucast()
262 cpsw_ale_set_port_num(ale_entry, port); in cpsw_ale_add_ucast()
272 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_add_ucast()
278 u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0}; in cpsw_ale_del_ucast() local
285 cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE); in cpsw_ale_del_ucast()
286 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_del_ucast()
293 u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0}; in cpsw_ale_add_mcast() local
298 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_add_mcast()
300 cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_ADDR); in cpsw_ale_add_mcast()
301 cpsw_ale_set_addr(ale_entry, addr); in cpsw_ale_add_mcast()
302 cpsw_ale_set_super(ale_entry, super); in cpsw_ale_add_mcast()
303 cpsw_ale_set_mcast_state(ale_entry, mcast_state); in cpsw_ale_add_mcast()
305 mask = cpsw_ale_get_port_mask(ale_entry); in cpsw_ale_add_mcast()
307 cpsw_ale_set_port_mask(ale_entry, port_mask); in cpsw_ale_add_mcast()
316 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_add_mcast()
322 u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0}; in cpsw_ale_del_mcast() local
329 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_del_mcast()
332 cpsw_ale_set_port_mask(ale_entry, port_mask); in cpsw_ale_del_mcast()
334 cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE); in cpsw_ale_del_mcast()
336 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_del_mcast()