Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
0002 /* Copyright 2017-2019 NXP */
0003 
0004 #include "enetc.h"
0005 #include <linux/phylink.h>
0006 
0007 #define ENETC_PF_NUM_RINGS  8
0008 
0009 enum enetc_mac_addr_type {UC, MC, MADDR_TYPE};
0010 #define ENETC_MAX_NUM_MAC_FLT   ((ENETC_MAX_NUM_VFS + 1) * MADDR_TYPE)
0011 
0012 #define ENETC_MADDR_HASH_TBL_SZ 64
0013 struct enetc_mac_filter {
0014     union {
0015         char mac_addr[ETH_ALEN];
0016         DECLARE_BITMAP(mac_hash_table, ENETC_MADDR_HASH_TBL_SZ);
0017     };
0018     int mac_addr_cnt;
0019 };
0020 
0021 #define ENETC_VLAN_HT_SIZE  64
0022 
0023 enum enetc_vf_flags {
0024     ENETC_VF_FLAG_PF_SET_MAC    = BIT(0),
0025 };
0026 
0027 struct enetc_vf_state {
0028     enum enetc_vf_flags flags;
0029 };
0030 
0031 struct enetc_pf {
0032     struct enetc_si *si;
0033     int num_vfs; /* number of active VFs, after sriov_init */
0034     int total_vfs; /* max number of VFs, set for PF at probe */
0035     struct enetc_vf_state *vf_state;
0036 
0037     struct enetc_mac_filter mac_filter[ENETC_MAX_NUM_MAC_FLT];
0038 
0039     struct enetc_msg_swbd rxmsg[ENETC_MAX_NUM_VFS];
0040     struct work_struct msg_task;
0041     char msg_int_name[ENETC_INT_NAME_MAX];
0042 
0043     char vlan_promisc_simap; /* bitmap of SIs in VLAN promisc mode */
0044     DECLARE_BITMAP(vlan_ht_filter, ENETC_VLAN_HT_SIZE);
0045     DECLARE_BITMAP(active_vlans, VLAN_N_VID);
0046 
0047     struct mii_bus *mdio; /* saved for cleanup */
0048     struct mii_bus *imdio;
0049     struct phylink_pcs *pcs;
0050 
0051     phy_interface_t if_mode;
0052     struct phylink_config phylink_config;
0053 };
0054 
0055 #define phylink_to_enetc_pf(config) \
0056     container_of((config), struct enetc_pf, phylink_config)
0057 
0058 int enetc_msg_psi_init(struct enetc_pf *pf);
0059 void enetc_msg_psi_free(struct enetc_pf *pf);
0060 void enetc_msg_handle_rxmsg(struct enetc_pf *pf, int mbox_id, u16 *status);