1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright (c) Meta Platforms, Inc. and affiliates. */ 3 4 #ifndef _FBNIC_NETDEV_H_ 5 #define _FBNIC_NETDEV_H_ 6 7 #include <linux/types.h> 8 #include <linux/phylink.h> 9 10 #include "fbnic_csr.h" 11 #include "fbnic_rpc.h" 12 #include "fbnic_txrx.h" 13 14 struct fbnic_net { 15 struct fbnic_ring *tx[FBNIC_MAX_TXQS]; 16 struct fbnic_ring *rx[FBNIC_MAX_RXQS]; 17 18 struct net_device *netdev; 19 struct fbnic_dev *fbd; 20 21 u32 txq_size; 22 u32 hpq_size; 23 u32 ppq_size; 24 u32 rcq_size; 25 26 u16 num_napi; 27 28 struct phylink *phylink; 29 struct phylink_config phylink_config; 30 struct phylink_pcs phylink_pcs; 31 32 /* TBD: Remove these when phylink supports FEC and lane config */ 33 u8 fec; 34 u8 link_mode; 35 36 u16 num_tx_queues; 37 u16 num_rx_queues; 38 39 u8 indir_tbl[FBNIC_RPC_RSS_TBL_COUNT][FBNIC_RPC_RSS_TBL_SIZE]; 40 u32 rss_key[FBNIC_RPC_RSS_KEY_DWORD_LEN]; 41 u32 rss_flow_hash[FBNIC_NUM_HASH_OPT]; 42 43 u64 link_down_events; 44 45 struct list_head napis; 46 }; 47 48 int __fbnic_open(struct fbnic_net *fbn); 49 void fbnic_up(struct fbnic_net *fbn); 50 void fbnic_down(struct fbnic_net *fbn); 51 52 struct net_device *fbnic_netdev_alloc(struct fbnic_dev *fbd); 53 void fbnic_netdev_free(struct fbnic_dev *fbd); 54 int fbnic_netdev_register(struct net_device *netdev); 55 void fbnic_netdev_unregister(struct net_device *netdev); 56 void fbnic_reset_queues(struct fbnic_net *fbn, 57 unsigned int tx, unsigned int rx); 58 59 void __fbnic_set_rx_mode(struct net_device *netdev); 60 void fbnic_clear_rx_mode(struct net_device *netdev); 61 62 int fbnic_phylink_init(struct net_device *netdev); 63 #endif /* _FBNIC_NETDEV_H_ */ 64