1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) Meta Platforms, Inc. and affiliates. */
7 #include <linux/types.h>
11 #define FBNIC_MAX_JUMBO_FRAME_SIZE 9742
14 FBNIC_LINK_EVENT_NONE
= 0,
15 FBNIC_LINK_EVENT_UP
= 1,
16 FBNIC_LINK_EVENT_DOWN
= 2,
19 /* Treat the FEC bits as a bitmask laid out as follows:
21 * Bit 1: BASER(Firecode) Enabled
22 * Bit 2: Retrieve FEC from FW
31 #define FBNIC_FEC_MODE_MASK (FBNIC_FEC_AUTO - 1)
33 /* Treat the link modes as a set of modulation/lanes bitmask:
34 * Bit 0: Lane Count, 0 = R1, 1 = R2
35 * Bit 1: Modulation, 0 = NRZ, 1 = PAM4
36 * Bit 2: Retrieve link mode from FW
46 #define FBNIC_LINK_MODE_R2 (FBNIC_LINK_50R2)
47 #define FBNIC_LINK_MODE_PAM4 (FBNIC_LINK_50R1)
48 #define FBNIC_LINK_MODE_MASK (FBNIC_LINK_AUTO - 1)
50 enum fbnic_sensor_id
{
51 FBNIC_SENSOR_TEMP
, /* Temp in millidegrees Centigrade */
52 FBNIC_SENSOR_VOLTAGE
, /* Voltage in millivolts */
55 /* This structure defines the interface hooks for the MAC. The MAC hooks
56 * will be configured as a const struct provided with a set of function
59 * void (*init_regs)(struct fbnic_dev *fbd);
60 * Initialize MAC registers to enable Tx/Rx paths and FIFOs.
62 * void (*pcs_enable)(struct fbnic_dev *fbd);
63 * Configure and enable PCS to enable link if not already enabled
64 * void (*pcs_disable)(struct fbnic_dev *fbd);
65 * Shutdown the link if we are the only consumer of it.
66 * bool (*pcs_get_link)(struct fbnic_dev *fbd);
67 * Check PCS link status
68 * int (*pcs_get_link_event)(struct fbnic_dev *fbd)
69 * Get the current link event status, reports true if link has
70 * changed to either FBNIC_LINK_EVENT_DOWN or FBNIC_LINK_EVENT_UP
72 * void (*link_down)(struct fbnic_dev *fbd);
73 * Configure MAC for link down event
74 * void (*link_up)(struct fbnic_dev *fbd, bool tx_pause, bool rx_pause);
75 * Configure MAC for link up event;
79 void (*init_regs
)(struct fbnic_dev
*fbd
);
81 int (*pcs_enable
)(struct fbnic_dev
*fbd
);
82 void (*pcs_disable
)(struct fbnic_dev
*fbd
);
83 bool (*pcs_get_link
)(struct fbnic_dev
*fbd
);
84 int (*pcs_get_link_event
)(struct fbnic_dev
*fbd
);
86 void (*get_eth_mac_stats
)(struct fbnic_dev
*fbd
, bool reset
,
87 struct fbnic_eth_mac_stats
*mac_stats
);
89 void (*link_down
)(struct fbnic_dev
*fbd
);
90 void (*link_up
)(struct fbnic_dev
*fbd
, bool tx_pause
, bool rx_pause
);
92 int (*get_sensor
)(struct fbnic_dev
*fbd
, int id
, long *val
);
95 int fbnic_mac_init(struct fbnic_dev
*fbd
);
96 #endif /* _FBNIC_MAC_H_ */