Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / net / ethernet / meta / fbnic / fbnic_netdev.h
blobb8417b30077887cb4ee5b555b2e1f30f9793524b
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) Meta Platforms, Inc. and affiliates. */
4 #ifndef _FBNIC_NETDEV_H_
5 #define _FBNIC_NETDEV_H_
7 #include <linux/types.h>
8 #include <linux/phylink.h>
10 #include "fbnic_csr.h"
11 #include "fbnic_rpc.h"
12 #include "fbnic_txrx.h"
14 struct fbnic_net {
15 struct fbnic_ring *tx[FBNIC_MAX_TXQS];
16 struct fbnic_ring *rx[FBNIC_MAX_RXQS];
18 struct net_device *netdev;
19 struct fbnic_dev *fbd;
21 u32 txq_size;
22 u32 hpq_size;
23 u32 ppq_size;
24 u32 rcq_size;
26 u16 num_napi;
28 struct phylink *phylink;
29 struct phylink_config phylink_config;
30 struct phylink_pcs phylink_pcs;
32 /* TBD: Remove these when phylink supports FEC and lane config */
33 u8 fec;
34 u8 link_mode;
36 /* Cached top bits of the HW time counter for 40b -> 64b conversion */
37 u32 time_high;
38 /* Protect readers of @time_offset, writers take @time_lock. */
39 struct u64_stats_sync time_seq;
40 /* Offset in ns between free running NIC PHC and time set via PTP
41 * clock callbacks
43 s64 time_offset;
45 u16 num_tx_queues;
46 u16 num_rx_queues;
48 u8 indir_tbl[FBNIC_RPC_RSS_TBL_COUNT][FBNIC_RPC_RSS_TBL_SIZE];
49 u32 rss_key[FBNIC_RPC_RSS_KEY_DWORD_LEN];
50 u32 rss_flow_hash[FBNIC_NUM_HASH_OPT];
52 /* Storage for stats after ring destruction */
53 struct fbnic_queue_stats tx_stats;
54 struct fbnic_queue_stats rx_stats;
55 u64 link_down_events;
57 /* Time stampinn filter config */
58 struct kernel_hwtstamp_config hwtstamp_config;
60 struct list_head napis;
63 int __fbnic_open(struct fbnic_net *fbn);
64 void fbnic_up(struct fbnic_net *fbn);
65 void fbnic_down(struct fbnic_net *fbn);
67 struct net_device *fbnic_netdev_alloc(struct fbnic_dev *fbd);
68 void fbnic_netdev_free(struct fbnic_dev *fbd);
69 int fbnic_netdev_register(struct net_device *netdev);
70 void fbnic_netdev_unregister(struct net_device *netdev);
71 void fbnic_reset_queues(struct fbnic_net *fbn,
72 unsigned int tx, unsigned int rx);
73 void fbnic_set_ethtool_ops(struct net_device *dev);
75 int fbnic_ptp_setup(struct fbnic_dev *fbd);
76 void fbnic_ptp_destroy(struct fbnic_dev *fbd);
77 void fbnic_time_init(struct fbnic_net *fbn);
78 int fbnic_time_start(struct fbnic_net *fbn);
79 void fbnic_time_stop(struct fbnic_net *fbn);
81 void __fbnic_set_rx_mode(struct net_device *netdev);
82 void fbnic_clear_rx_mode(struct net_device *netdev);
84 int fbnic_phylink_init(struct net_device *netdev);
85 #endif /* _FBNIC_NETDEV_H_ */