|
@@ -246,6 +246,34 @@ static int efx_ef10_get_mac_address_vf(struct efx_nic *efx, u8 *mac_address)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static ssize_t efx_ef10_show_link_control_flag(struct device *dev,
|
|
|
|
+ struct device_attribute *attr,
|
|
|
|
+ char *buf)
|
|
|
|
+{
|
|
|
|
+ struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
|
|
|
|
+
|
|
|
|
+ return sprintf(buf, "%d\n",
|
|
|
|
+ ((efx->mcdi->fn_flags) &
|
|
|
|
+ (1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_LINKCTRL))
|
|
|
|
+ ? 1 : 0);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static ssize_t efx_ef10_show_primary_flag(struct device *dev,
|
|
|
|
+ struct device_attribute *attr,
|
|
|
|
+ char *buf)
|
|
|
|
+{
|
|
|
|
+ struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
|
|
|
|
+
|
|
|
|
+ return sprintf(buf, "%d\n",
|
|
|
|
+ ((efx->mcdi->fn_flags) &
|
|
|
|
+ (1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_PRIMARY))
|
|
|
|
+ ? 1 : 0);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static DEVICE_ATTR(link_control_flag, 0444, efx_ef10_show_link_control_flag,
|
|
|
|
+ NULL);
|
|
|
|
+static DEVICE_ATTR(primary_flag, 0444, efx_ef10_show_primary_flag, NULL);
|
|
|
|
+
|
|
static int efx_ef10_probe(struct efx_nic *efx)
|
|
static int efx_ef10_probe(struct efx_nic *efx)
|
|
{
|
|
{
|
|
struct efx_ef10_nic_data *nic_data;
|
|
struct efx_ef10_nic_data *nic_data;
|
|
@@ -315,30 +343,39 @@ static int efx_ef10_probe(struct efx_nic *efx)
|
|
if (rc)
|
|
if (rc)
|
|
goto fail3;
|
|
goto fail3;
|
|
|
|
|
|
- rc = efx_ef10_get_pf_index(efx);
|
|
|
|
|
|
+ rc = device_create_file(&efx->pci_dev->dev,
|
|
|
|
+ &dev_attr_link_control_flag);
|
|
if (rc)
|
|
if (rc)
|
|
goto fail3;
|
|
goto fail3;
|
|
|
|
|
|
|
|
+ rc = device_create_file(&efx->pci_dev->dev, &dev_attr_primary_flag);
|
|
|
|
+ if (rc)
|
|
|
|
+ goto fail4;
|
|
|
|
+
|
|
|
|
+ rc = efx_ef10_get_pf_index(efx);
|
|
|
|
+ if (rc)
|
|
|
|
+ goto fail5;
|
|
|
|
+
|
|
rc = efx_ef10_init_datapath_caps(efx);
|
|
rc = efx_ef10_init_datapath_caps(efx);
|
|
if (rc < 0)
|
|
if (rc < 0)
|
|
- goto fail3;
|
|
|
|
|
|
+ goto fail5;
|
|
|
|
|
|
efx->rx_packet_len_offset =
|
|
efx->rx_packet_len_offset =
|
|
ES_DZ_RX_PREFIX_PKTLEN_OFST - ES_DZ_RX_PREFIX_SIZE;
|
|
ES_DZ_RX_PREFIX_PKTLEN_OFST - ES_DZ_RX_PREFIX_SIZE;
|
|
|
|
|
|
rc = efx_mcdi_port_get_number(efx);
|
|
rc = efx_mcdi_port_get_number(efx);
|
|
if (rc < 0)
|
|
if (rc < 0)
|
|
- goto fail3;
|
|
|
|
|
|
+ goto fail5;
|
|
efx->port_num = rc;
|
|
efx->port_num = rc;
|
|
net_dev->dev_port = rc;
|
|
net_dev->dev_port = rc;
|
|
|
|
|
|
rc = efx->type->get_mac_address(efx, efx->net_dev->perm_addr);
|
|
rc = efx->type->get_mac_address(efx, efx->net_dev->perm_addr);
|
|
if (rc)
|
|
if (rc)
|
|
- goto fail3;
|
|
|
|
|
|
+ goto fail5;
|
|
|
|
|
|
rc = efx_ef10_get_sysclk_freq(efx);
|
|
rc = efx_ef10_get_sysclk_freq(efx);
|
|
if (rc < 0)
|
|
if (rc < 0)
|
|
- goto fail3;
|
|
|
|
|
|
+ goto fail5;
|
|
efx->timer_quantum_ns = 1536000 / rc; /* 1536 cycles */
|
|
efx->timer_quantum_ns = 1536000 / rc; /* 1536 cycles */
|
|
|
|
|
|
/* Check whether firmware supports bug 35388 workaround.
|
|
/* Check whether firmware supports bug 35388 workaround.
|
|
@@ -357,7 +394,7 @@ static int efx_ef10_probe(struct efx_nic *efx)
|
|
nic_data->workaround_35388 = enabled &
|
|
nic_data->workaround_35388 = enabled &
|
|
MC_CMD_GET_WORKAROUNDS_OUT_BUG35388;
|
|
MC_CMD_GET_WORKAROUNDS_OUT_BUG35388;
|
|
} else if (rc != -ENOSYS && rc != -ENOENT) {
|
|
} else if (rc != -ENOSYS && rc != -ENOENT) {
|
|
- goto fail3;
|
|
|
|
|
|
+ goto fail5;
|
|
}
|
|
}
|
|
netif_dbg(efx, probe, efx->net_dev,
|
|
netif_dbg(efx, probe, efx->net_dev,
|
|
"workaround for bug 35388 is %sabled\n",
|
|
"workaround for bug 35388 is %sabled\n",
|
|
@@ -365,12 +402,16 @@ static int efx_ef10_probe(struct efx_nic *efx)
|
|
|
|
|
|
rc = efx_mcdi_mon_probe(efx);
|
|
rc = efx_mcdi_mon_probe(efx);
|
|
if (rc && rc != -EPERM)
|
|
if (rc && rc != -EPERM)
|
|
- goto fail3;
|
|
|
|
|
|
+ goto fail5;
|
|
|
|
|
|
efx_ptp_probe(efx, NULL);
|
|
efx_ptp_probe(efx, NULL);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
|
|
+fail5:
|
|
|
|
+ device_remove_file(&efx->pci_dev->dev, &dev_attr_primary_flag);
|
|
|
|
+fail4:
|
|
|
|
+ device_remove_file(&efx->pci_dev->dev, &dev_attr_link_control_flag);
|
|
fail3:
|
|
fail3:
|
|
efx_mcdi_fini(efx);
|
|
efx_mcdi_fini(efx);
|
|
fail2:
|
|
fail2:
|
|
@@ -613,6 +654,9 @@ static void efx_ef10_remove(struct efx_nic *efx)
|
|
if (!nic_data->must_restore_piobufs)
|
|
if (!nic_data->must_restore_piobufs)
|
|
efx_ef10_free_piobufs(efx);
|
|
efx_ef10_free_piobufs(efx);
|
|
|
|
|
|
|
|
+ device_remove_file(&efx->pci_dev->dev, &dev_attr_primary_flag);
|
|
|
|
+ device_remove_file(&efx->pci_dev->dev, &dev_attr_link_control_flag);
|
|
|
|
+
|
|
efx_mcdi_fini(efx);
|
|
efx_mcdi_fini(efx);
|
|
efx_nic_free_buffer(efx, &nic_data->mcdi_buf);
|
|
efx_nic_free_buffer(efx, &nic_data->mcdi_buf);
|
|
kfree(nic_data);
|
|
kfree(nic_data);
|