| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Texas Instruments N-Port Ethernet Switch Address Lookup Engine APIs |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2012 Texas Instruments |
|---|
| 5 | 6 | * |
|---|
| 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. |
|---|
| 14 | 7 | */ |
|---|
| 15 | 8 | #ifndef __TI_CPSW_ALE_H__ |
|---|
| 16 | 9 | #define __TI_CPSW_ALE_H__ |
|---|
| .. | .. |
|---|
| 31 | 24 | * pass it from caller. |
|---|
| 32 | 25 | */ |
|---|
| 33 | 26 | u32 major_ver_mask; |
|---|
| 27 | + const char *dev_id; |
|---|
| 28 | + unsigned long bus_freq; |
|---|
| 34 | 29 | }; |
|---|
| 30 | + |
|---|
| 31 | +struct ale_entry_fld; |
|---|
| 35 | 32 | |
|---|
| 36 | 33 | struct cpsw_ale { |
|---|
| 37 | 34 | struct cpsw_ale_params params; |
|---|
| 38 | 35 | struct timer_list timer; |
|---|
| 39 | 36 | unsigned long ageout; |
|---|
| 40 | | - int allmulti; |
|---|
| 41 | 37 | u32 version; |
|---|
| 38 | + u32 features; |
|---|
| 42 | 39 | /* These bits are different on NetCP NU Switch ALE */ |
|---|
| 43 | 40 | u32 port_mask_bits; |
|---|
| 44 | 41 | u32 port_num_bits; |
|---|
| 45 | 42 | u32 vlan_field_bits; |
|---|
| 43 | + unsigned long *p0_untag_vid_mask; |
|---|
| 44 | + const struct ale_entry_fld *vlan_entry_tbl; |
|---|
| 46 | 45 | }; |
|---|
| 47 | 46 | |
|---|
| 48 | 47 | enum cpsw_ale_control { |
|---|
| .. | .. |
|---|
| 69 | 68 | ALE_PORT_UNKNOWN_MCAST_FLOOD, |
|---|
| 70 | 69 | ALE_PORT_UNKNOWN_REG_MCAST_FLOOD, |
|---|
| 71 | 70 | ALE_PORT_UNTAGGED_EGRESS, |
|---|
| 71 | + ALE_PORT_MACONLY, |
|---|
| 72 | + ALE_PORT_MACONLY_CAF, |
|---|
| 72 | 73 | ALE_PORT_BCAST_LIMIT, |
|---|
| 73 | 74 | ALE_PORT_MCAST_LIMIT, |
|---|
| 75 | + ALE_DEFAULT_THREAD_ID, |
|---|
| 76 | + ALE_DEFAULT_THREAD_ENABLE, |
|---|
| 74 | 77 | ALE_NUM_CONTROLS, |
|---|
| 75 | 78 | }; |
|---|
| 76 | 79 | |
|---|
| .. | .. |
|---|
| 105 | 108 | void cpsw_ale_stop(struct cpsw_ale *ale); |
|---|
| 106 | 109 | |
|---|
| 107 | 110 | 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, |
|---|
| 109 | 112 | 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, |
|---|
| 111 | 114 | 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, |
|---|
| 113 | 116 | 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, |
|---|
| 115 | 118 | int flags, u16 vid); |
|---|
| 116 | 119 | int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag, |
|---|
| 117 | 120 | int reg_mcast, int unreg_mcast); |
|---|
| 118 | 121 | 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); |
|---|
| 120 | 123 | |
|---|
| 121 | 124 | int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control); |
|---|
| 122 | 125 | int cpsw_ale_control_set(struct cpsw_ale *ale, int port, |
|---|
| 123 | 126 | int control, int value); |
|---|
| 124 | 127 | 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); |
|---|
| 125 | 139 | |
|---|
| 126 | 140 | #endif |
|---|