1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ 2 /* Copyright 2017-2019 NXP */ 3 4 #include "enetc.h" 5 #include <linux/phylink.h> 6 7 #define ENETC_PF_NUM_RINGS 8 8 #define ENETC_VLAN_HT_SIZE 64 9 10 enum enetc_vf_flags { 11 ENETC_VF_FLAG_PF_SET_MAC = BIT(0), 12 }; 13 14 struct enetc_vf_state { 15 struct mutex lock; /* Prevent concurrent access */ 16 enum enetc_vf_flags flags; 17 }; 18 19 struct enetc_port_caps { 20 int num_msix; 21 int num_rx_bdr; 22 int num_tx_bdr; 23 }; 24 25 struct enetc_pf; 26 27 struct enetc_pf_ops { 28 void (*set_si_primary_mac)(struct enetc_hw *hw, int si, const u8 *addr); 29 void (*get_si_primary_mac)(struct enetc_hw *hw, int si, u8 *addr); 30 struct phylink_pcs *(*create_pcs)(struct enetc_pf *pf, struct mii_bus *bus); 31 void (*destroy_pcs)(struct phylink_pcs *pcs); 32 int (*enable_psfp)(struct enetc_ndev_priv *priv); 33 }; 34 35 struct enetc_pf { 36 struct enetc_si *si; 37 int num_vfs; /* number of active VFs, after sriov_init */ 38 int total_vfs; /* max number of VFs, set for PF at probe */ 39 struct enetc_vf_state *vf_state; 40 41 struct enetc_mac_filter mac_filter[MADDR_TYPE]; 42 43 struct enetc_msg_swbd *rxmsg; 44 struct work_struct msg_task; 45 char msg_int_name[ENETC_INT_NAME_MAX]; 46 47 DECLARE_BITMAP(vlan_ht_filter, ENETC_VLAN_HT_SIZE); 48 DECLARE_BITMAP(active_vlans, VLAN_N_VID); 49 50 struct mii_bus *mdio; /* saved for cleanup */ 51 struct mii_bus *imdio; 52 struct phylink_pcs *pcs; 53 54 phy_interface_t if_mode; 55 struct phylink_config phylink_config; 56 57 struct enetc_port_caps caps; 58 const struct enetc_pf_ops *ops; 59 }; 60 61 #define phylink_to_enetc_pf(config) \ 62 container_of((config), struct enetc_pf, phylink_config) 63