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"
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
;
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 */
36 /* Cached top bits of the HW time counter for 40b -> 64b conversion */
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
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
;
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_ */