1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
2 /* Copyright 2017-2019 NXP */
5 #include <linux/phylink.h>
7 #define ENETC_PF_NUM_RINGS 8
9 enum enetc_mac_addr_type {UC, MC, MADDR_TYPE};
10 #define ENETC_MAX_NUM_MAC_FLT ((ENETC_MAX_NUM_VFS + 1) * MADDR_TYPE)
12 #define ENETC_MADDR_HASH_TBL_SZ 64
13 struct enetc_mac_filter {
15 char mac_addr[ETH_ALEN];
16 DECLARE_BITMAP(mac_hash_table, ENETC_MADDR_HASH_TBL_SZ);
21 #define ENETC_VLAN_HT_SIZE 64
24 ENETC_VF_FLAG_PF_SET_MAC = BIT(0),
27 struct enetc_vf_state {
28 enum enetc_vf_flags flags;
33 int num_vfs; /* number of active VFs, after sriov_init */
34 int total_vfs; /* max number of VFs, set for PF at probe */
35 struct enetc_vf_state *vf_state;
37 struct enetc_mac_filter mac_filter[ENETC_MAX_NUM_MAC_FLT];
39 struct enetc_msg_swbd rxmsg[ENETC_MAX_NUM_VFS];
40 struct work_struct msg_task;
41 char msg_int_name[ENETC_INT_NAME_MAX];
43 char vlan_promisc_simap; /* bitmap of SIs in VLAN promisc mode */
44 DECLARE_BITMAP(vlan_ht_filter, ENETC_VLAN_HT_SIZE);
45 DECLARE_BITMAP(active_vlans, VLAN_N_VID);
47 struct mii_bus *mdio; /* saved for cleanup */
48 struct mii_bus *imdio;
49 struct phylink_pcs *pcs;
51 phy_interface_t if_mode;
52 struct phylink_config phylink_config;
55 #define phylink_to_enetc_pf(config) \
56 container_of((config), struct enetc_pf, phylink_config)
58 int enetc_msg_psi_init(struct enetc_pf *pf);
59 void enetc_msg_psi_free(struct enetc_pf *pf);
60 void enetc_msg_handle_rxmsg(struct enetc_pf *pf, int mbox_id, u16 *status);