1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ 2 /* Copyright 2017-2019 NXP */ 3 4 #include "enetc.h" 5 6 #define ENETC_PF_NUM_RINGS 8 7 8 enum enetc_mac_addr_type {UC, MC, MADDR_TYPE}; 9 #define ENETC_MAX_NUM_MAC_FLT ((ENETC_MAX_NUM_VFS + 1) * MADDR_TYPE) 10 11 #define ENETC_MADDR_HASH_TBL_SZ 64 12 struct enetc_mac_filter { 13 union { 14 char mac_addr[ETH_ALEN]; 15 DECLARE_BITMAP(mac_hash_table, ENETC_MADDR_HASH_TBL_SZ); 16 }; 17 int mac_addr_cnt; 18 }; 19 20 #define ENETC_VLAN_HT_SIZE 64 21 22 enum enetc_vf_flags { 23 ENETC_VF_FLAG_PF_SET_MAC = BIT(0), 24 }; 25 26 struct enetc_vf_state { 27 enum enetc_vf_flags flags; 28 }; 29 30 struct enetc_pf { 31 struct enetc_si *si; 32 int num_vfs; /* number of active VFs, after sriov_init */ 33 int total_vfs; /* max number of VFs, set for PF at probe */ 34 struct enetc_vf_state *vf_state; 35 36 struct enetc_mac_filter mac_filter[ENETC_MAX_NUM_MAC_FLT]; 37 38 struct enetc_msg_swbd rxmsg[ENETC_MAX_NUM_VFS]; 39 struct work_struct msg_task; 40 char msg_int_name[ENETC_INT_NAME_MAX]; 41 42 char vlan_promisc_simap; /* bitmap of SIs in VLAN promisc mode */ 43 DECLARE_BITMAP(vlan_ht_filter, ENETC_VLAN_HT_SIZE); 44 DECLARE_BITMAP(active_vlans, VLAN_N_VID); 45 46 struct mii_bus *mdio; /* saved for cleanup */ 47 struct mii_bus *imdio; 48 struct phy_device *pcs; 49 50 struct device_node *phy_node; 51 phy_interface_t if_mode; 52 }; 53 54 int enetc_msg_psi_init(struct enetc_pf *pf); 55 void enetc_msg_psi_free(struct enetc_pf *pf); 56 void enetc_msg_handle_rxmsg(struct enetc_pf *pf, int mbox_id, u16 *status); 57