memset(esmp, 0, sizeof(*esmp));
}
+static uint32_t
+sfc_phy_cap_from_link_speeds(uint32_t speeds)
+{
+ uint32_t phy_caps = 0;
+
+ if (~speeds & ETH_LINK_SPEED_FIXED) {
+ phy_caps |= (1 << EFX_PHY_CAP_AN);
+ /*
+ * If no speeds are specified in the mask, any supported
+ * may be negotiated
+ */
+ if (speeds == ETH_LINK_SPEED_AUTONEG)
+ phy_caps |=
+ (1 << EFX_PHY_CAP_1000FDX) |
+ (1 << EFX_PHY_CAP_10000FDX) |
+ (1 << EFX_PHY_CAP_40000FDX);
+ }
+ if (speeds & ETH_LINK_SPEED_1G)
+ phy_caps |= (1 << EFX_PHY_CAP_1000FDX);
+ if (speeds & ETH_LINK_SPEED_10G)
+ phy_caps |= (1 << EFX_PHY_CAP_10000FDX);
+ if (speeds & ETH_LINK_SPEED_40G)
+ phy_caps |= (1 << EFX_PHY_CAP_40000FDX);
+
+ return phy_caps;
+}
+
/*
* Check requested device level configuration.
* Receive and transmit configuration is checked in corresponding
const struct rte_eth_conf *conf = &sa->eth_dev->data->dev_conf;
int rc = 0;
- if (conf->link_speeds != ETH_LINK_SPEED_AUTONEG) {
- sfc_err(sa, "Manual link speed/duplex choice not supported");
+ sa->port.phy_adv_cap =
+ sfc_phy_cap_from_link_speeds(conf->link_speeds) &
+ sa->port.phy_adv_cap_mask;
+ if ((sa->port.phy_adv_cap & ~(1 << EFX_PHY_CAP_AN)) == 0) {
+ sfc_err(sa, "No link speeds from mask %#x are supported",
+ conf->link_speeds);
rc = EINVAL;
}
if (rc != 0)
goto fail_intr_attach;
+ efx_phy_adv_cap_get(sa->nic, EFX_PHY_CAP_PERM,
+ &sa->port.phy_adv_cap_mask);
+
sfc_log_init(sa, "fini nic");
efx_nic_fini(enp);
dev_info->pci_dev = RTE_DEV_TO_PCI(dev->device);
dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX;
+ /* Autonegotiation may be disabled */
+ dev_info->speed_capa = ETH_LINK_SPEED_FIXED;
+ if (sa->port.phy_adv_cap_mask & EFX_PHY_CAP_1000FDX)
+ dev_info->speed_capa |= ETH_LINK_SPEED_1G;
+ if (sa->port.phy_adv_cap_mask & EFX_PHY_CAP_10000FDX)
+ dev_info->speed_capa |= ETH_LINK_SPEED_10G;
+ if (sa->port.phy_adv_cap_mask & EFX_PHY_CAP_40000FDX)
+ dev_info->speed_capa |= ETH_LINK_SPEED_40G;
+
dev_info->max_rx_queues = sa->rxq_max;
dev_info->max_tx_queues = sa->txq_max;
if (rc != 0)
goto fail_mac_fcntl_set;
+ sfc_log_init(sa, "set phy adv caps to %#x", port->phy_adv_cap);
+ rc = efx_phy_adv_cap_set(sa->nic, port->phy_adv_cap);
+ if (rc != 0)
+ goto fail_phy_adv_cap_set;
+
sfc_log_init(sa, "set MAC PDU %u", (unsigned int)port->pdu);
rc = efx_mac_pdu_set(sa->nic, port->pdu);
if (rc != 0)
fail_mac_filter_set:
fail_mac_addr_set:
fail_mac_pdu_set:
+fail_phy_adv_cap_set:
fail_mac_fcntl_set:
efx_port_fini(sa->nic);