al: Replace boolean_t with either al_bool or bool.

Use al_bool for interfaces and structures defined in the
OS-independent HAL in sys/contrib, and use plain bool for
FreeBSD-specific APIs and structures in sys/dev/al_eth.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D39923
This commit is contained in:
John Baldwin 2023-05-04 12:32:40 -07:00
parent 65c92e48c4
commit 463edaf441
5 changed files with 156 additions and 156 deletions

View File

@ -664,7 +664,7 @@ al_eth_mac_table_broadcast_add(struct al_eth_adapter *adapter,
static void
al_eth_mac_table_promiscuous_set(struct al_eth_adapter *adapter,
boolean_t promiscuous)
bool promiscuous)
{
struct al_eth_fwd_mac_table_entry entry = { { 0 } };
@ -856,7 +856,7 @@ al_eth_board_params_init(struct al_eth_adapter *adapter)
return (-1);
}
adapter->phy_exist = params.phy_exist == TRUE;
adapter->phy_exist = params.phy_exist == true;
adapter->phy_addr = params.phy_mdio_addr;
adapter->an_en = params.autoneg_enable;
adapter->lt_en = params.kr_lt_enable;
@ -904,7 +904,7 @@ al_eth_board_params_init(struct al_eth_adapter *adapter)
switch (params.media_type) {
case AL_ETH_BOARD_MEDIA_TYPE_RGMII:
if (params.sfp_plus_module_exist == TRUE)
if (params.sfp_plus_module_exist == true)
/* Backward compatibility */
adapter->mac_mode = AL_ETH_MAC_MODE_SGMII;
else
@ -921,12 +921,12 @@ al_eth_board_params_init(struct al_eth_adapter *adapter)
adapter->use_lm = true;
break;
case AL_ETH_BOARD_MEDIA_TYPE_AUTO_DETECT:
adapter->sfp_detection_needed = TRUE;
adapter->sfp_detection_needed = true;
adapter->auto_speed = false;
adapter->use_lm = true;
break;
case AL_ETH_BOARD_MEDIA_TYPE_AUTO_DETECT_AUTO_SPEED:
adapter->sfp_detection_needed = TRUE;
adapter->sfp_detection_needed = true;
adapter->auto_speed = true;
adapter->mac_mode_set = false;
adapter->use_lm = true;
@ -943,9 +943,9 @@ al_eth_board_params_init(struct al_eth_adapter *adapter)
device_printf(adapter->dev,
"Board info: phy exist %s. phy addr %d. mdio freq %u Khz. "
"SFP connected %s. media %d\n",
params.phy_exist == TRUE ? "Yes" : "No",
params.phy_exist ? "Yes" : "No",
params.phy_mdio_addr, adapter->mdio_freq,
params.sfp_plus_module_exist == TRUE ? "Yes" : "No",
params.sfp_plus_module_exist ? "Yes" : "No",
params.media_type);
}
@ -1299,7 +1299,7 @@ al_eth_xmit_mbuf(struct al_eth_ring *tx_ring, struct mbuf *m)
bus_dma_segment_t segs[AL_ETH_PKT_MAX_BUFS + 1];
struct al_eth_pkt *hal_pkt;
struct al_buf *al_buf;
boolean_t remap;
bool remap;
/* Check if queue is ready */
if (unlikely(tx_ring->stall) != 0) {
@ -1333,7 +1333,7 @@ al_eth_xmit_mbuf(struct al_eth_ring *tx_ring, struct mbuf *m)
return;
}
remap = TRUE;
remap = true;
/* Map packets for DMA */
retry:
error = bus_dmamap_load_mbuf_sg(tx_ring->dma_buf_tag, tx_info->dma_map,
@ -1343,8 +1343,8 @@ al_eth_xmit_mbuf(struct al_eth_ring *tx_ring, struct mbuf *m)
if (error == EFBIG) {
/* Try it again? - one try */
if (remap == TRUE) {
remap = FALSE;
if (remap == true) {
remap = false;
m_new = m_defrag(m, M_NOWAIT);
if (m_new == NULL) {
device_printf(tx_ring->dev,
@ -1846,7 +1846,7 @@ al_eth_hw_init(struct al_eth_adapter *adapter)
if ((adapter->mac_mode == AL_ETH_MAC_MODE_SGMII) ||
(adapter->mac_mode == AL_ETH_MAC_MODE_RGMII &&
adapter->phy_exist == FALSE)) {
adapter->phy_exist == false)) {
rc = al_eth_mac_link_config(&adapter->hal_adapter,
adapter->link_config.force_1000_base_x,
adapter->link_config.autoneg,
@ -1861,7 +1861,7 @@ al_eth_hw_init(struct al_eth_adapter *adapter)
}
rc = al_eth_mdio_config(&adapter->hal_adapter,
AL_ETH_MDIO_TYPE_CLAUSE_22, TRUE /* shared_mdio_if */,
AL_ETH_MDIO_TYPE_CLAUSE_22, AL_TRUE /* shared_mdio_if */,
adapter->ref_clk_freq, adapter->mdio_freq);
if (rc != 0) {
device_printf(adapter->dev, "%s failed at mdio config!\n",
@ -2551,7 +2551,7 @@ al_eth_setup_rx_resources(struct al_eth_adapter *adapter, unsigned int qid)
} else {
device_printf_dbg(adapter->dev,
"RX Soft LRO[%d] Initialized\n", qid);
rx_ring->lro_enabled = TRUE;
rx_ring->lro_enabled = true;
rx_ring->lro.ifp = adapter->netdev;
}
}
@ -2971,9 +2971,9 @@ al_eth_config_rx_fwd(struct al_eth_adapter *adapter)
entry.queue_sel_1 = AL_ETH_CTRL_TABLE_QUEUE_SEL_1_THASH_TABLE;
entry.queue_sel_2 = AL_ETH_CTRL_TABLE_QUEUE_SEL_2_NO_PRIO;
entry.udma_sel = AL_ETH_CTRL_TABLE_UDMA_SEL_MAC_TABLE;
entry.filter = FALSE;
entry.filter = false;
al_eth_ctrl_table_def_set(&adapter->hal_adapter, FALSE, &entry);
al_eth_ctrl_table_def_set(&adapter->hal_adapter, AL_FALSE, &entry);
/*
* By default set the mac table to forward all unicast packets to our

View File

@ -177,8 +177,8 @@ struct al_eth_link_config {
uint8_t flow_ctrl_supported;
/* the following are not relevant to RGMII */
boolean_t force_1000_base_x;
boolean_t autoneg;
bool force_1000_base_x;
bool autoneg;
};
/* SFP detection event */
@ -196,18 +196,18 @@ enum al_eth_sfp_detect_evt {
/* SFP detection status */
struct al_eth_sfp_detect_stat {
/* Status is valid (i.e. rest of fields are valid) */
boolean_t valid;
boolean_t connected;
bool valid;
bool connected;
uint8_t sfp_10g;
uint8_t sfp_1g;
uint8_t sfp_cable_tech;
boolean_t lt_en;
boolean_t an_en;
bool lt_en;
bool an_en;
enum al_eth_mac_mode mac_mode;
};
struct al_eth_retimer_params {
boolean_t exist;
bool exist;
uint8_t bus_id;
uint8_t i2c_addr;
enum al_eth_retimer_channel channel;
@ -304,10 +304,10 @@ struct al_eth_adapter {
struct al_eth_mac_stats mac_stats;
enum al_eth_mac_mode mac_mode;
boolean_t mac_mode_set; /* Relevant only when 'auto_speed' is set */
bool mac_mode_set; /* Relevant only when 'auto_speed' is set */
uint8_t mac_addr[ETHER_ADDR_LEN];
/* mdio and phy*/
boolean_t phy_exist;
bool phy_exist;
struct mii_bus *mdio_bus;
struct phy_device *phydev;
uint8_t phy_addr;
@ -328,28 +328,28 @@ struct al_eth_adapter {
struct task link_status_task;
uint32_t link_poll_interval; /* task interval in mSec */
boolean_t serdes_init;
bool serdes_init;
struct al_serdes_grp_obj serdes_obj;
uint8_t serdes_grp;
uint8_t serdes_lane;
boolean_t an_en; /* run kr auto-negotiation */
boolean_t lt_en; /* run kr link-training */
bool an_en; /* run kr auto-negotiation */
bool lt_en; /* run kr link-training */
boolean_t sfp_detection_needed; /* true if need to run sfp detection */
boolean_t auto_speed; /* true if allowed to change SerDes speed configuration */
bool sfp_detection_needed; /* true if need to run sfp detection */
bool auto_speed; /* true if allowed to change SerDes speed configuration */
uint8_t i2c_adapter_id; /* identifier for the i2c adapter to use to access SFP+ module */
enum al_eth_ref_clk_freq ref_clk_freq; /* reference clock frequency */
unsigned int mdio_freq; /* MDIO frequency [Khz] */
boolean_t up;
bool up;
boolean_t last_link;
boolean_t last_establish_failed;
bool last_link;
bool last_establish_failed;
struct al_eth_lm_context lm_context;
boolean_t use_lm;
bool use_lm;
boolean_t dont_override_serdes; /* avoid overriding serdes parameters
bool dont_override_serdes; /* avoid overriding serdes parameters
to preset static values */
struct mtx serdes_config_lock;
struct mtx if_rx_lock;

View File

@ -131,9 +131,9 @@ al_eth_kr_an_run(struct al_eth_kr_data *kr_data, struct al_eth_an_adv *an_adv,
struct al_eth_an_adv *an_partner_adv)
{
int rc;
boolean_t page_received = FALSE;
boolean_t an_completed = FALSE;
boolean_t error = FALSE;
al_bool page_received = AL_FALSE;
al_bool an_completed = AL_FALSE;
al_bool error = AL_FALSE;
int timeout = AL_ETH_KR_AN_TIMEOUT;
rc = al_eth_kr_an_init(kr_data->adapter, an_adv);
@ -144,7 +144,7 @@ al_eth_kr_an_run(struct al_eth_kr_data *kr_data, struct al_eth_an_adv *an_adv,
}
rc = al_eth_kr_an_start(kr_data->adapter, AL_ETH_AN__LT_LANE_0,
FALSE, TRUE);
AL_FALSE, AL_TRUE);
if (rc != 0) {
al_err("%s %s autonegotiation enable failed\n",
kr_data->adapter->name, __func__);
@ -163,7 +163,7 @@ al_eth_kr_an_run(struct al_eth_kr_data *kr_data, struct al_eth_an_adv *an_adv,
al_eth_kr_an_status_check(kr_data->adapter, &page_received,
&an_completed, &error);
} while (page_received == FALSE);
} while (page_received == AL_FALSE);
if (error != 0) {
al_info("%s %s autonegotiation failed (status error)\n",
@ -273,7 +273,7 @@ al_eth_kr_lt_receiver_task_init(struct al_eth_kr_data *kr_data)
sizeof(struct al_eth_kr_status_report_data));
}
static boolean_t
static bool
al_eth_lp_coeff_up_change(struct al_eth_kr_data *kr_data,
struct al_eth_kr_coef_up_data *lpcoeff)
{
@ -281,12 +281,12 @@ al_eth_lp_coeff_up_change(struct al_eth_kr_data *kr_data,
if (al_memcmp(last_lpcoeff, lpcoeff,
sizeof(struct al_eth_kr_coef_up_data)) == 0) {
return (FALSE);
return (false);
}
al_memcpy(last_lpcoeff, lpcoeff, sizeof(struct al_eth_kr_coef_up_data));
return (TRUE);
return (true);
}
/*
@ -361,17 +361,17 @@ al_eth_kr_lt_transmitter_task_init(struct al_eth_kr_data *kr_data)
return (0);
}
static boolean_t
static bool
al_eth_kr_lt_all_not_updated(struct al_eth_kr_status_report_data *report)
{
if ((report->c_zero == C72_CSTATE_NOT_UPDATED) &&
(report->c_minus == C72_CSTATE_NOT_UPDATED) &&
(report->c_plus == C72_CSTATE_NOT_UPDATED)) {
return (TRUE);
return (true);
}
return (FALSE);
return (false);
}
static void
@ -461,7 +461,7 @@ al_eth_kr_lt_transmitter_task_run(struct al_eth_kr_data *kr_data)
/* Wait for not_updated for all coefficients from remote */
if (al_eth_kr_lt_all_not_updated(&report) != 0) {
ldcoeff.preset = TRUE;
ldcoeff.preset = AL_TRUE;
nextstate = DO_PRESET;
}
break;
@ -474,7 +474,7 @@ al_eth_kr_lt_transmitter_task_run(struct al_eth_kr_data *kr_data)
nextstate = DO_HOLD;
else /* as long as the lp didn't response to the preset
* we should continue sending it */
ldcoeff.preset = TRUE;
ldcoeff.preset = AL_TRUE;
break;
case DO_HOLD:
/*
@ -645,7 +645,7 @@ al_eth_kr_lt_transmitter_task_run(struct al_eth_kr_data *kr_data)
* our receiver is ready for data.
* no training will occur any more.
*/
kr_data->status_report.receiver_ready = TRUE;
kr_data->status_report.receiver_ready = AL_TRUE;
/*
* in addition to the status we transmit, we also must tell our
* local hardware state-machine that we are done, so the
@ -698,15 +698,15 @@ al_eth_kr_run_lt(struct al_eth_kr_data *kr_data)
{
unsigned int cnt;
int ret = 0;
boolean_t page_received = FALSE;
boolean_t an_completed = FALSE;
boolean_t error = FALSE;
boolean_t training_failure = FALSE;
al_bool page_received = AL_FALSE;
al_bool an_completed = AL_FALSE;
al_bool error = AL_FALSE;
al_bool training_failure = AL_FALSE;
al_eth_kr_lt_initialize(kr_data->adapter, AL_ETH_AN__LT_LANE_0);
if (al_eth_kr_lt_frame_lock_wait(kr_data->adapter, AL_ETH_AN__LT_LANE_0,
AL_ETH_KR_FRAME_LOCK_TIMEOUT) == TRUE) {
AL_ETH_KR_FRAME_LOCK_TIMEOUT) == AL_TRUE) {
/*
* when locked, for the first time initialize the receiver and
* transmitter tasks to prepare it for detecting coefficient
@ -768,7 +768,7 @@ al_eth_kr_run_lt(struct al_eth_kr_data *kr_data)
al_eth_kr_lt_stop(kr_data->adapter, AL_ETH_AN__LT_LANE_0);
cnt = AL_ETH_KR_LT_DONE_TIMEOUT;
while (an_completed == FALSE) {
while (an_completed == AL_FALSE) {
al_eth_kr_an_status_check(kr_data->adapter, &page_received,
&an_completed, &error);
DELAY(1);
@ -806,7 +806,7 @@ int al_eth_an_lt_execute(struct al_hal_eth_adapter *adapter,
* the link training progress will run rx equalization so need to make
* sure rx parameters is not been override
*/
rx_params.override = FALSE;
rx_params.override = AL_FALSE;
kr_data.serdes_obj->rx_advanced_params_set(
kr_data.serdes_obj,
kr_data.lane,

View File

@ -206,18 +206,18 @@ static struct retimer_config_reg retimer_ds25_10g_mode[] = {
static int al_eth_lm_retimer_boost_config(struct al_eth_lm_context *lm_context);
static int al_eth_lm_retimer_ds25_full_config(struct al_eth_lm_context *lm_context);
static al_bool al_eth_lm_retimer_ds25_signal_detect(
static bool al_eth_lm_retimer_ds25_signal_detect(
struct al_eth_lm_context *lm_context, uint32_t channel);
static int al_eth_lm_retimer_ds25_cdr_reset(struct al_eth_lm_context *lm_context, uint32_t channel);
static al_bool al_eth_lm_retimer_ds25_cdr_lock(
static bool al_eth_lm_retimer_ds25_cdr_lock(
struct al_eth_lm_context *lm_context, uint32_t channel);
static int al_eth_lm_retimer_25g_rx_adaptation(struct al_eth_lm_context *lm_context);
struct al_eth_lm_retimer {
int (*config)(struct al_eth_lm_context *lm_context);
int (*reset)(struct al_eth_lm_context *lm_context, uint32_t channel);
int (*signal_detect)(struct al_eth_lm_context *lm_context, uint32_t channel);
int (*cdr_lock)(struct al_eth_lm_context *lm_context, uint32_t channel);
bool (*signal_detect)(struct al_eth_lm_context *lm_context, uint32_t channel);
bool (*cdr_lock)(struct al_eth_lm_context *lm_context, uint32_t channel);
int (*rx_adaptation)(struct al_eth_lm_context *lm_context);
};
@ -438,7 +438,7 @@ al_eth_module_detect(struct al_eth_lm_context *lm_context,
}
static struct al_serdes_adv_tx_params da_tx_params = {
.override = TRUE,
.override = AL_TRUE,
.amp = 0x1,
.total_driver_units = 0x13,
.c_plus_1 = 0x2,
@ -448,7 +448,7 @@ static struct al_serdes_adv_tx_params da_tx_params = {
};
static struct al_serdes_adv_rx_params da_rx_params = {
.override = TRUE,
.override = AL_TRUE,
.dcgain = 0x4,
.dfe_3db_freq = 0x4,
.dfe_gain = 0x3,
@ -462,7 +462,7 @@ static struct al_serdes_adv_rx_params da_rx_params = {
};
static struct al_serdes_adv_tx_params optic_tx_params = {
.override = TRUE,
.override = AL_TRUE,
.amp = 0x1,
.total_driver_units = 0x13,
.c_plus_1 = 0x2,
@ -472,7 +472,7 @@ static struct al_serdes_adv_tx_params optic_tx_params = {
};
static struct al_serdes_adv_rx_params optic_rx_params = {
.override = TRUE,
.override = AL_TRUE,
.dcgain = 0x0,
.dfe_3db_freq = 0x7,
.dfe_gain = 0x0,
@ -495,7 +495,7 @@ al_eth_serdes_static_tx_params_set(struct al_eth_lm_context *lm_context)
if (lm_context->serdes_tx_params_valid != 0) {
lm_context->tx_param_dirty = 0;
lm_context->tx_params_override.override = TRUE;
lm_context->tx_params_override.override = AL_TRUE;
if ((lm_context->serdes_obj->tx_advanced_params_set) == 0) {
al_err("tx_advanced_params_set is not supported for this serdes group\n");
@ -539,7 +539,7 @@ al_eth_serdes_static_rx_params_set(struct al_eth_lm_context *lm_context)
if (lm_context->serdes_rx_params_valid != 0) {
lm_context->rx_param_dirty = 0;
lm_context->rx_params_override.override = TRUE;
lm_context->rx_params_override.override = AL_TRUE;
if ((lm_context->serdes_obj->rx_advanced_params_set) == 0) {
al_err("rx_advanced_params_set is not supported for this serdes group\n");
@ -583,7 +583,7 @@ al_eth_rx_equal_run(struct al_eth_lm_context *lm_context)
int best_score = -1;
int test_score = -1;
rx_params.override = FALSE;
rx_params.override = AL_FALSE;
lm_context->serdes_obj->rx_advanced_params_set(lm_context->serdes_obj,
lm_context->lane, &rx_params);
@ -647,7 +647,7 @@ al_eth_rx_equal_run(struct al_eth_lm_context *lm_context)
}
rx_params.precal_code_sel = 0;
rx_params.override = TRUE;
rx_params.override = AL_TRUE;
lm_context->serdes_obj->rx_advanced_params_set(
lm_context->serdes_obj,
lm_context->lane,
@ -848,7 +848,7 @@ static int al_eth_lm_retimer_ds25_cdr_reset(struct al_eth_lm_context *lm_context
return rc;
}
static al_bool al_eth_lm_retimer_ds25_signal_detect(struct al_eth_lm_context *lm_context,
static bool al_eth_lm_retimer_ds25_signal_detect(struct al_eth_lm_context *lm_context,
uint32_t channel)
{
int rc = 0;
@ -868,17 +868,17 @@ static al_bool al_eth_lm_retimer_ds25_signal_detect(struct al_eth_lm_context *lm
goto config_error;
if (reg & LM_DS25_SIGNAL_DETECT_MASK)
return TRUE;
return true;
return FALSE;
return false;
config_error:
al_err("%s: failed to access to the retimer\n", __func__);
return FALSE;
return false;
}
static al_bool al_eth_lm_retimer_ds25_cdr_lock(struct al_eth_lm_context *lm_context,
static bool al_eth_lm_retimer_ds25_cdr_lock(struct al_eth_lm_context *lm_context,
uint32_t channel)
{
int rc = 0;
@ -898,23 +898,23 @@ static al_bool al_eth_lm_retimer_ds25_cdr_lock(struct al_eth_lm_context *lm_cont
goto config_error;
if (reg & LM_DS25_CDR_LOCK_MASK)
return TRUE;
return true;
return FALSE;
return false;
config_error:
al_err("%s: failed to access to the retimer\n", __func__);
return FALSE;
return false;
}
static boolean_t al_eth_lm_wait_for_lock(struct al_eth_lm_context *lm_context,
static bool al_eth_lm_wait_for_lock(struct al_eth_lm_context *lm_context,
uint32_t channel)
{
uint32_t timeout = AL_ETH_LM_RETIMER_WAIT_FOR_LOCK;
al_bool lock = AL_FALSE;
bool lock = false;
while ((timeout > 0) && (lock == FALSE)) {
while ((timeout > 0) && (!lock)) {
al_msleep(10);
timeout -= 10;
@ -930,16 +930,16 @@ static boolean_t al_eth_lm_wait_for_lock(struct al_eth_lm_context *lm_context,
static void al_eth_lm_retimer_signal_lock_check(struct al_eth_lm_context *lm_context,
uint32_t channel,
boolean_t *ready)
bool *ready)
{
al_bool signal_detect = TRUE;
al_bool cdr_lock = TRUE;
bool signal_detect = true;
bool cdr_lock = true;
if (retimer[lm_context->retimer_type].signal_detect) {
if (!retimer[lm_context->retimer_type].signal_detect(lm_context, channel)) {
lm_debug("no signal detected on retimer channel %d\n", channel);
signal_detect = AL_FALSE;
signal_detect = false;
} else {
if (retimer[lm_context->retimer_type].cdr_lock) {
cdr_lock = retimer[lm_context->retimer_type].cdr_lock(
@ -961,13 +961,13 @@ static void al_eth_lm_retimer_signal_lock_check(struct al_eth_lm_context *lm_con
al_info("%s: (channel %d) signal %d cdr lock %d\n",
__func__, channel, signal_detect, (signal_detect) ? cdr_lock : 0);
*ready = ((cdr_lock == TRUE) && (signal_detect == TRUE));
*ready = (cdr_lock && signal_detect);
}
static int al_eth_lm_retimer_ds25_full_config(struct al_eth_lm_context *lm_context)
{
int rc = 0;
al_bool ready;
bool ready;
struct retimer_config_reg *config_tx;
uint32_t config_tx_size;
struct retimer_config_reg *config_rx;
@ -1006,7 +1006,7 @@ static int al_eth_lm_retimer_ds25_full_config(struct al_eth_lm_context *lm_conte
if (lm_context->serdes_obj->type_get() == AL_SRDS_TYPE_25G) {
lm_debug("%s: serdes 25G - perform tx and rx gearbox reset\n", __func__);
al_eth_gearbox_reset(lm_context->adapter, TRUE, TRUE);
al_eth_gearbox_reset(lm_context->adapter, AL_TRUE, AL_TRUE);
DELAY(AL_ETH_LM_GEARBOX_RESET_DELAY);
}
@ -1025,7 +1025,7 @@ static int al_eth_lm_retimer_ds25_full_config(struct al_eth_lm_context *lm_conte
static int al_eth_lm_retimer_25g_rx_adaptation(struct al_eth_lm_context *lm_context)
{
int rc = 0;
al_bool ready;
bool ready;
al_eth_lm_retimer_signal_lock_check(lm_context, lm_context->retimer_channel, &ready);
@ -1041,7 +1041,7 @@ static int al_eth_lm_retimer_25g_rx_adaptation(struct al_eth_lm_context *lm_cont
return 0;
}
static int al_eth_lm_check_for_link(struct al_eth_lm_context *lm_context, boolean_t *link_up)
static int al_eth_lm_check_for_link(struct al_eth_lm_context *lm_context, bool *link_up)
{
struct al_eth_link_status status;
int ret = 0;
@ -1053,7 +1053,7 @@ static int al_eth_lm_check_for_link(struct al_eth_lm_context *lm_context, boolea
lm_debug("%s: >>>> Link state DOWN ==> UP\n", __func__);
al_eth_led_set(lm_context->adapter, AL_TRUE);
lm_context->link_state = AL_ETH_LM_LINK_UP;
*link_up = AL_TRUE;
*link_up = true;
return 0;
} else if (status.local_fault) {
@ -1070,7 +1070,7 @@ static int al_eth_lm_check_for_link(struct al_eth_lm_context *lm_context, boolea
ret = 0;
}
*link_up = AL_FALSE;
*link_up = false;
return ret;
}
@ -1107,10 +1107,10 @@ al_eth_lm_init(struct al_eth_lm_context *lm_context,
lm_context->get_random_byte = params->get_random_byte;
/* eeprom_read must be provided if sfp_detection is true */
al_assert((lm_context->sfp_detection == FALSE) ||
al_assert((lm_context->sfp_detection == false) ||
(lm_context->i2c_read != NULL));
al_assert((lm_context->retimer_exist == FALSE) ||
al_assert((lm_context->retimer_exist == false) ||
(lm_context->i2c_write != NULL));
lm_context->local_adv.selector_field = 1;
@ -1122,8 +1122,8 @@ al_eth_lm_init(struct al_eth_lm_context *lm_context,
lm_context->local_adv.fec_capability = params->kr_fec_enable;
lm_context->mode = AL_ETH_LM_MODE_DISCONNECTED;
lm_context->serdes_tx_params_valid = FALSE;
lm_context->serdes_rx_params_valid = FALSE;
lm_context->serdes_tx_params_valid = false;
lm_context->serdes_rx_params_valid = false;
lm_context->rx_param_dirty = 1;
lm_context->tx_param_dirty = 1;
@ -1138,7 +1138,7 @@ al_eth_lm_init(struct al_eth_lm_context *lm_context,
lm_context->led_config = params->led_config;
lm_context->retimer_configured = FALSE;
lm_context->retimer_configured = false;
lm_context->link_state = AL_ETH_LM_LINK_DOWN;
@ -1147,7 +1147,7 @@ al_eth_lm_init(struct al_eth_lm_context *lm_context,
int
al_eth_lm_link_detection(struct al_eth_lm_context *lm_context,
boolean_t *link_fault, enum al_eth_lm_link_mode *old_mode,
bool *link_fault, enum al_eth_lm_link_mode *old_mode,
enum al_eth_lm_link_mode *new_mode)
{
int err;
@ -1163,14 +1163,14 @@ al_eth_lm_link_detection(struct al_eth_lm_context *lm_context,
* if the link wasn't up.
*/
if (lm_context->lm_pause != NULL) {
boolean_t lm_pause = lm_context->lm_pause(lm_context->i2c_context);
if (lm_pause == TRUE) {
bool lm_pause = lm_context->lm_pause(lm_context->i2c_context);
if (lm_pause == true) {
*new_mode = AL_ETH_LM_MODE_DISCONNECTED;
if (link_fault != NULL) {
if (lm_context->link_state == AL_ETH_LM_LINK_UP)
*link_fault = FALSE;
*link_fault = false;
else
*link_fault = TRUE;
*link_fault = true;
}
return 0;
@ -1181,7 +1181,7 @@ al_eth_lm_link_detection(struct al_eth_lm_context *lm_context,
*new_mode = lm_context->mode;
if (link_fault != NULL)
*link_fault = TRUE;
*link_fault = true;
switch (lm_context->link_state) {
case AL_ETH_LM_LINK_UP:
@ -1189,9 +1189,9 @@ al_eth_lm_link_detection(struct al_eth_lm_context *lm_context,
if (status.link_up) {
if (link_fault != NULL)
*link_fault = FALSE;
*link_fault = false;
al_eth_led_set(lm_context->adapter, TRUE);
al_eth_led_set(lm_context->adapter, AL_TRUE);
return (0);
} else if (status.local_fault) {
@ -1211,7 +1211,7 @@ al_eth_lm_link_detection(struct al_eth_lm_context *lm_context,
lm_context->link_state = AL_ETH_LM_LINK_DOWN;
break;
} else if (status.remote_fault == FALSE) {
} else if (status.remote_fault == AL_FALSE) {
lm_debug("%s: >>>> Link state DOWN_RF ==> UP\n", __func__);
lm_context->link_state = AL_ETH_LM_LINK_UP;
}
@ -1221,7 +1221,7 @@ al_eth_lm_link_detection(struct al_eth_lm_context *lm_context,
break;
};
al_eth_led_set(lm_context->adapter, FALSE);
al_eth_led_set(lm_context->adapter, AL_FALSE);
if (lm_context->sfp_detection) {
err = al_eth_module_detect(lm_context, new_mode);
@ -1244,7 +1244,7 @@ al_eth_lm_link_detection(struct al_eth_lm_context *lm_context,
lm_context->rx_param_dirty = 1;
lm_context->tx_param_dirty = 1;
lm_context->new_port = TRUE;
lm_context->new_port = true;
if ((*new_mode != AL_ETH_LM_MODE_DISCONNECTED) && (lm_context->led_config)) {
struct al_eth_lm_led_config_data data = {0};
@ -1272,19 +1272,19 @@ al_eth_lm_link_detection(struct al_eth_lm_context *lm_context,
}
int
al_eth_lm_link_establish(struct al_eth_lm_context *lm_context, boolean_t *link_up)
al_eth_lm_link_establish(struct al_eth_lm_context *lm_context, bool *link_up)
{
boolean_t signal_detected;
bool signal_detected;
int ret = 0;
switch (lm_context->link_state) {
case AL_ETH_LM_LINK_UP:
*link_up = TRUE;
*link_up = true;
lm_debug("%s: return link up\n", __func__);
return (0);
case AL_ETH_LM_LINK_DOWN_RF:
*link_up = FALSE;
*link_up = false;
lm_debug("%s: return link down (DOWN_RF)\n", __func__);
return (0);
@ -1297,9 +1297,9 @@ al_eth_lm_link_establish(struct al_eth_lm_context *lm_context, boolean_t *link_u
* finished. in this case link will not be established until LM will be enable again.
*/
if (lm_context->lm_pause) {
boolean_t lm_pause = lm_context->lm_pause(lm_context->i2c_context);
if (lm_pause == TRUE) {
*link_up = FALSE;
bool lm_pause = lm_context->lm_pause(lm_context->i2c_context);
if (lm_pause == true) {
*link_up = false;
return (0);
}
@ -1316,11 +1316,11 @@ al_eth_lm_link_establish(struct al_eth_lm_context *lm_context, boolean_t *link_u
if (retimer[lm_context->retimer_type].config(lm_context)) {
al_info("%s: failed to configure the retimer\n", __func__);
*link_up = FALSE;
*link_up = false;
return (1);
}
lm_context->new_port = FALSE;
lm_context->new_port = false;
DELAY(1000);
}
@ -1331,7 +1331,7 @@ al_eth_lm_link_establish(struct al_eth_lm_context *lm_context, boolean_t *link_u
if (ret != 0) {
lm_debug("retimer rx is not ready\n");
*link_up = FALSE;
*link_up = false;
return (0);
}
@ -1342,16 +1342,16 @@ al_eth_lm_link_establish(struct al_eth_lm_context *lm_context, boolean_t *link_u
lm_context->serdes_obj,
lm_context->lane);
if (signal_detected == FALSE) {
if (signal_detected == false) {
/* if no signal detected there is nothing to do */
lm_debug("serdes signal is down\n");
*link_up = AL_FALSE;
*link_up = false;
return 0;
}
if (lm_context->serdes_obj->type_get() == AL_SRDS_TYPE_25G) {
lm_debug("%s: serdes 25G - perform rx gearbox reset\n", __func__);
al_eth_gearbox_reset(lm_context->adapter, FALSE, TRUE);
al_eth_gearbox_reset(lm_context->adapter, AL_FALSE, AL_TRUE);
DELAY(AL_ETH_LM_GEARBOX_RESET_DELAY);
}
@ -1400,11 +1400,11 @@ al_eth_lm_link_establish(struct al_eth_lm_context *lm_context, boolean_t *link_u
lm_context->serdes_obj->pma_hard_reset_lane(
lm_context->serdes_obj,
lm_context->lane,
TRUE);
AL_TRUE);
lm_context->serdes_obj->pma_hard_reset_lane(
lm_context->serdes_obj,
lm_context->lane,
FALSE);
AL_FALSE);
lm_context->link_training_failures = 0;
}
}
@ -1437,7 +1437,7 @@ al_eth_lm_link_establish(struct al_eth_lm_context *lm_context, boolean_t *link_u
return (0);
}
*link_up = FALSE;
*link_up = false;
return (1);
}
@ -1450,13 +1450,13 @@ al_eth_lm_static_parameters_override(struct al_eth_lm_context *lm_context,
if (tx_params != NULL) {
lm_context->tx_params_override = *tx_params;
lm_context->tx_param_dirty = 1;
lm_context->serdes_tx_params_valid = TRUE;
lm_context->serdes_tx_params_valid = true;
}
if (rx_params != NULL) {
lm_context->rx_params_override = *rx_params;
lm_context->rx_param_dirty = 1;
lm_context->serdes_rx_params_valid = TRUE;
lm_context->serdes_rx_params_valid = true;
}
return (0);
@ -1464,13 +1464,13 @@ al_eth_lm_static_parameters_override(struct al_eth_lm_context *lm_context,
int
al_eth_lm_static_parameters_override_disable(struct al_eth_lm_context *lm_context,
boolean_t tx_params, boolean_t rx_params)
bool tx_params, bool rx_params)
{
if (tx_params != 0)
lm_context->serdes_tx_params_valid = FALSE;
if (rx_params != 0)
lm_context->serdes_tx_params_valid = FALSE;
if (tx_params)
lm_context->serdes_tx_params_valid = false;
if (rx_params)
lm_context->serdes_tx_params_valid = false;
return (0);
}
@ -1526,7 +1526,7 @@ al_eth_lm_mode_convert_to_str(enum al_eth_lm_link_mode val)
void
al_eth_lm_debug_mode_set(struct al_eth_lm_context *lm_context,
boolean_t enable)
bool enable)
{
lm_context->debug = enable;

View File

@ -140,11 +140,11 @@ struct al_eth_lm_context {
uint32_t link_training_failures;
boolean_t tx_param_dirty;
boolean_t serdes_tx_params_valid;
bool tx_param_dirty;
bool serdes_tx_params_valid;
struct al_serdes_adv_tx_params tx_params_override;
boolean_t rx_param_dirty;
boolean_t serdes_rx_params_valid;
bool rx_param_dirty;
bool serdes_rx_params_valid;
struct al_serdes_adv_rx_params rx_params_override;
struct al_eth_an_adv local_adv;
@ -152,20 +152,20 @@ struct al_eth_lm_context {
enum al_eth_lm_link_mode mode;
uint8_t da_len;
boolean_t debug;
bool debug;
/* configurations */
boolean_t sfp_detection;
bool sfp_detection;
uint8_t sfp_bus_id;
uint8_t sfp_i2c_addr;
enum al_eth_lm_link_mode default_mode;
uint8_t default_dac_len;
boolean_t link_training;
boolean_t rx_equal;
boolean_t static_values;
bool link_training;
bool rx_equal;
bool static_values;
boolean_t retimer_exist;
bool retimer_exist;
enum al_eth_retimer_type retimer_type;
uint8_t retimer_bus_id;
uint8_t retimer_i2c_addr;
@ -183,16 +183,16 @@ struct al_eth_lm_context {
uint32_t gpio_present;
enum al_eth_retimer_channel retimer_tx_channel;
boolean_t retimer_configured;
bool retimer_configured;
enum al_eth_lm_max_speed max_speed;
boolean_t sfp_detect_force_mode;
bool sfp_detect_force_mode;
enum al_eth_lm_link_state link_state;
boolean_t new_port;
bool new_port;
boolean_t (*lm_pause)(void *handle);
bool (*lm_pause)(void *handle);
void (*led_config)(void *handle, struct al_eth_lm_led_config_data *data);
};
@ -209,7 +209,7 @@ struct al_eth_lm_init_params {
* set to true to perform sfp detection if the link is down.
* when set to true, eeprom_read below should NOT be NULL.
*/
boolean_t sfp_detection;
bool sfp_detection;
/* i2c bus id of the SFP for this port */
uint8_t sfp_bus_id;
/* i2c addr of the SFP for this port */
@ -238,13 +238,13 @@ struct al_eth_lm_init_params {
* - if rx_equal is set serdes equalization will be run to configure the rx parameters.
* - if static_values is set, tx and rx values will be set based on static values.
*/
boolean_t retimer_exist;
boolean_t link_training;
boolean_t rx_equal;
boolean_t static_values;
bool retimer_exist;
bool link_training;
bool rx_equal;
bool static_values;
/* enable / disable fec capabilities in AN */
boolean_t kr_fec_enable;
bool kr_fec_enable;
/*
* pointer to function that's read 1 byte from eeprom
@ -267,12 +267,12 @@ struct al_eth_lm_init_params {
/* in case force mode is true - the default mode will be set regardless to
* the SFP EEPROM content */
boolean_t sfp_detect_force_mode;
bool sfp_detect_force_mode;
/* lm pause callback - in case it return true the LM will try to preserve
* the current link status and will not try to establish new link (and will not
* access to i2c bus) */
boolean_t (*lm_pause)(void *handle);
bool (*lm_pause)(void *handle);
/* config ethernet LEDs according to data. can be NULL if no configuration needed */
void (*led_config)(void *handle, struct al_eth_lm_led_config_data *data);
@ -300,7 +300,7 @@ int al_eth_lm_init(struct al_eth_lm_context *lm_context,
* @return 0 in case of success. otherwise on failure.
*/
int al_eth_lm_link_detection(struct al_eth_lm_context *lm_context,
boolean_t *link_fault, enum al_eth_lm_link_mode *old_mode,
bool *link_fault, enum al_eth_lm_link_mode *old_mode,
enum al_eth_lm_link_mode *new_mode);
/**
@ -313,7 +313,7 @@ int al_eth_lm_link_detection(struct al_eth_lm_context *lm_context,
* @return < 0 in case link was failed to be established
*/
int al_eth_lm_link_establish(struct al_eth_lm_context *lm_context,
boolean_t *link_up);
bool *link_up);
/**
* override the default static parameters
@ -338,7 +338,7 @@ int al_eth_lm_static_parameters_override(struct al_eth_lm_context *lm_context,
* @return 0 in case of success. otherwise on failure.
**/
int al_eth_lm_static_parameters_override_disable(struct al_eth_lm_context *lm_context,
boolean_t tx_params, boolean_t rx_params);
bool tx_params, bool rx_params);
/**
* get the static parameters that are being used
@ -371,5 +371,5 @@ const char *al_eth_lm_mode_convert_to_str(enum al_eth_lm_link_mode val);
* @param enable set to true to enable debug mode
*/
void al_eth_lm_debug_mode_set(struct al_eth_lm_context *lm_context,
boolean_t enable);
bool enable);
#endif