src/dpdk/drivers/net/cxgbe/base/t4_hw.c
int t4_link_l1cfg_core(struct port_info *pi, u32 caps, u8 sleep_ok)
{
	struct link_config *lc = &pi->link_cfg;
	struct adapter *adap = pi->adapter;
	struct fw_port_cmd cmd;
	int ret;

	memset(&cmd, 0, sizeof(cmd));
	cmd.op_to_portid = cpu_to_be32(V_FW_CMD_OP(FW_PORT_CMD) |
				       F_FW_CMD_REQUEST | F_FW_CMD_EXEC |
				       V_FW_PORT_CMD_PORTID(pi->port_id));
	cmd.action_to_len16 =
		cpu_to_be32(V_FW_PORT_CMD_ACTION(FW_PORT_ACTION_L1_CFG32) |
			    FW_LEN16(cmd));

	cmd.u.l1cfg32.rcap32 = cpu_to_be32(caps);

	if (sleep_ok)
		ret = t4_wr_mbox(adap, adap->mbox, &cmd, sizeof(cmd), NULL);
	else
		ret = t4_wr_mbox_ns(adap, adap->mbox, &cmd, sizeof(cmd), NULL);

	if (ret == FW_SUCCESS)
		lc->link_caps = caps;
	else
		dev_err(adap,
			"Requested Port Capabilities %#x rejected, error %d\n",
			caps, ret);

	return ret;
}
/**
 * t4_link_l1cfg_core - apply link configuration to MAC/PHY
 * @pi: the port info
 * @caps: link capabilities to configure
 * @sleep_ok: if true we may sleep while awaiting command completion
 *
 * Set up a port's MAC and PHY according to a desired link configuration.
 * - If the PHY can auto-negotiate first decide what to advertise, then
 *   enable/disable auto-negotiation as desired, and reset.
 * - If the PHY does not auto-negotiate just reset it.
 * - If auto-negotiation is off set the MAC to the proper speed/duplex/FC,
 *   otherwise do it later based on the outcome of auto-negotiation.
 */
apply link configuration to MAC/PHY
@pi: the port info
@caps: link capabilities to configure
@sleep_ok: if true we may sleep while awaiting command completion

Set up a port's MAC and PHY according to a desired link configuration.
- If the PHY can auto-negotiate first decide what to advertise, then
enable/disable auto-negotiation as desired, and reset.
- If the PHY does not auto-negotiate just reset it.
- If auto-negotiation is off set the MAC to the proper speed/duplex/FC,
otherwise do it later based on the outcome of auto-negotiation.
apply link configuration to MAC / PHY @pi : the port info @caps : link capabilities to configure @sleep_ok : if true we may sleep while awaiting command completion Set up a port ' s MAC and PHY according to a desired link configuration . - If the PHY can auto - negotiate first decide what to advertise then enable / disable auto - negotiation as desired and reset . - If the PHY does not auto - negotiate just reset it . - If auto - negotiation is off set the MAC to the proper speed / duplex / FC otherwise do it later based on the outcome of auto - negotiation .
int t4_link_l1cfg_core(struct port_info *pi, u32 caps, u8 sleep_ok)
{
	struct link_config *lc = &pi->link_cfg;
	struct adapter *adap = pi->adapter;
	struct fw_port_cmd cmd;
	int ret;
	memset(&cmd, 0, sizeof(cmd));
	cmd.op_to_portid = cpu_to_be32(V_FW_CMD_OP(FW_PORT_CMD) |
				       F_FW_CMD_REQUEST | F_FW_CMD_EXEC |
				       V_FW_PORT_CMD_PORTID(pi->port_id));
	cmd.action_to_len16 =
		cpu_to_be32(V_FW_PORT_CMD_ACTION(FW_PORT_ACTION_L1_CFG32) |
			    FW_LEN16(cmd));
	cmd.u.l1cfg32.rcap32 = cpu_to_be32(caps);
	if (sleep_ok)
		ret = t4_wr_mbox(adap, adap->mbox, &cmd, sizeof(cmd), NULL);
	else
		ret = t4_wr_mbox_ns(adap, adap->mbox, &cmd, sizeof(cmd), NULL);
	if (ret == FW_SUCCESS)
		lc->link_caps = caps;
	else
		dev_err(adap,
			"Requested Port Capabilities %#x rejected, error %d\n",
			caps, ret);
	return ret;
}
int t4_link_l1cfg_core ( struct port_info * pi , u32 caps , u8 sleep_ok ) { struct link_config * lc = & pi -> link_cfg ; struct adapter * adap = pi -> adapter ; struct fw_port_cmd cmd ; int ret ; memset ( & cmd , 0 , sizeof ( cmd ) ) ; cmd . op_to_portid = cpu_to_be32 ( V_FW_CMD_OP ( FW_PORT_CMD ) | F_FW_CMD_REQUEST | F_FW_CMD_EXEC | V_FW_PORT_CMD_PORTID ( pi -> port_id ) ) ; cmd . action_to_len16 = cpu_to_be32 ( V_FW_PORT_CMD_ACTION ( FW_PORT_ACTION_L1_CFG32 ) | FW_LEN16 ( cmd ) ) ; cmd . u . l1cfg32 . rcap32 = cpu_to_be32 ( caps ) ; if ( sleep_ok ) ret = t4_wr_mbox ( adap , adap -> mbox , & cmd , sizeof ( cmd ) , NULL ) ; else ret = t4_wr_mbox_ns ( adap , adap -> mbox , & cmd , sizeof ( cmd ) , NULL ) ; if ( ret == FW_SUCCESS ) lc -> link_caps = caps ; else dev_err ( adap , " \n " , caps , ret ) ; return ret ; }
t4_link_l1cfg_core - apply link configuration to MAC/PHY
 @pi: the port info
 @caps: link capabilities to configure
 @sleep_ok: if true we may sleep while awaiting command completion
t4_link_l1cfg_core - apply link configuration to MAC / PHY @pi : the port info @caps : link capabilities to configure @sleep_ok : if true we may sleep while awaiting command completion