Change the interface to ef10_nic_get_port_mode_bandwidth()
so more NIC information can be used to infer bandwidth
requirements. Huntington calculations separated out
completely.
Signed-off-by: Richard Houldsworth <rhouldsworth@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
extern __checkReturn efx_rc_t
ef10_nic_get_port_mode_bandwidth(
extern __checkReturn efx_rc_t
ef10_nic_get_port_mode_bandwidth(
- __in uint32_t port_mode,
__out uint32_t *bandwidth_mbpsp);
extern __checkReturn efx_rc_t
__out uint32_t *bandwidth_mbpsp);
extern __checkReturn efx_rc_t
__checkReturn efx_rc_t
ef10_nic_get_port_mode_bandwidth(
__checkReturn efx_rc_t
ef10_nic_get_port_mode_bandwidth(
- __in uint32_t port_mode,
__out uint32_t *bandwidth_mbpsp)
{
__out uint32_t *bandwidth_mbpsp)
{
+ uint32_t port_modes;
+ uint32_t current_mode;
uint32_t single_lane = 10000;
uint32_t dual_lane = 50000;
uint32_t quad_lane = 40000;
uint32_t bandwidth;
efx_rc_t rc;
uint32_t single_lane = 10000;
uint32_t dual_lane = 50000;
uint32_t quad_lane = 40000;
uint32_t bandwidth;
efx_rc_t rc;
+ if ((rc = efx_mcdi_get_port_modes(enp, &port_modes,
+ ¤t_mode, NULL)) != 0) {
+ /* No port mode info available. */
+ goto fail1;
+ }
+
+ switch (current_mode) {
case TLV_PORT_MODE_1x1_NA: /* mode 0 */
bandwidth = single_lane;
break;
case TLV_PORT_MODE_1x1_NA: /* mode 0 */
bandwidth = single_lane;
break;
break;
default:
rc = EINVAL;
break;
default:
rc = EINVAL;
}
*bandwidth_mbpsp = bandwidth;
return (0);
}
*bandwidth_mbpsp = bandwidth;
return (0);
+fail2:
+ EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
__out uint32_t *bandwidth_mbpsp)
{
uint32_t port_modes;
__out uint32_t *bandwidth_mbpsp)
{
uint32_t port_modes;
- uint32_t max_port_mode;
uint32_t bandwidth;
efx_rc_t rc;
uint32_t bandwidth;
efx_rc_t rc;
goto fail1;
} else {
if (port_modes & (1U << TLV_PORT_MODE_40G)) {
goto fail1;
} else {
if (port_modes & (1U << TLV_PORT_MODE_40G)) {
- max_port_mode = TLV_PORT_MODE_40G;
} else if (port_modes & (1U << TLV_PORT_MODE_10G_10G_10G_10G)) {
} else if (port_modes & (1U << TLV_PORT_MODE_10G_10G_10G_10G)) {
- max_port_mode = TLV_PORT_MODE_10G_10G_10G_10G;
} else {
/* Assume two 10G ports */
} else {
/* Assume two 10G ports */
- max_port_mode = TLV_PORT_MODE_10G_10G;
-
- if ((rc = ef10_nic_get_port_mode_bandwidth(max_port_mode,
- &bandwidth)) != 0)
- goto fail2;
-fail2:
- EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
__in efx_nic_t *enp,
__out uint32_t *bandwidth_mbpsp)
{
__in efx_nic_t *enp,
__out uint32_t *bandwidth_mbpsp)
{
- uint32_t port_modes;
- uint32_t current_mode;
uint32_t bandwidth;
efx_rc_t rc;
/* FIXME: support new Medford2 dynamic port modes */
uint32_t bandwidth;
efx_rc_t rc;
/* FIXME: support new Medford2 dynamic port modes */
- if ((rc = efx_mcdi_get_port_modes(enp, &port_modes,
- ¤t_mode, NULL)) != 0) {
- /* No port mode info available. */
- bandwidth = 0;
- goto out;
- }
-
- if ((rc = ef10_nic_get_port_mode_bandwidth(current_mode,
+ if ((rc = ef10_nic_get_port_mode_bandwidth(enp,
&bandwidth)) != 0)
goto fail1;
&bandwidth)) != 0)
goto fail1;
*bandwidth_mbpsp = bandwidth;
return (0);
*bandwidth_mbpsp = bandwidth;
return (0);
__in efx_nic_t *enp,
__out uint32_t *bandwidth_mbpsp)
{
__in efx_nic_t *enp,
__out uint32_t *bandwidth_mbpsp)
{
- uint32_t port_modes;
- uint32_t current_mode;
uint32_t bandwidth;
efx_rc_t rc;
uint32_t bandwidth;
efx_rc_t rc;
- if ((rc = efx_mcdi_get_port_modes(enp, &port_modes,
- ¤t_mode, NULL)) != 0) {
- /* No port mode info available. */
- bandwidth = 0;
- goto out;
- }
-
- if ((rc = ef10_nic_get_port_mode_bandwidth(current_mode,
+ if ((rc = ef10_nic_get_port_mode_bandwidth(enp,
&bandwidth)) != 0)
goto fail1;
&bandwidth)) != 0)
goto fail1;
*bandwidth_mbpsp = bandwidth;
return (0);
*bandwidth_mbpsp = bandwidth;
return (0);