From: Shradha Shah <sshah@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-net-drivers@solarflare.com>
Subject: [PATCH net-next v3 03/15] sfc: Add sysfs entry for flags (link control and primary)
Date: Tue, 2 Jun 2015 11:37:58 +0100 [thread overview]
Message-ID: <556D8786.2090906@solarflare.com> (raw)
In-Reply-To: <556D8710.6060706@solarflare.com>
On every adapter there will be one primary PF per adaptor and
one link control PF per port.
Signed-off-by: Shradha Shah <sshah@solarflare.com>
---
drivers/net/ethernet/sfc/ef10.c | 58 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 51 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 14c5205..e659da8 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -246,6 +246,34 @@ static int efx_ef10_get_mac_address_vf(struct efx_nic *efx, u8 *mac_address)
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)
{
struct efx_ef10_nic_data *nic_data;
@@ -315,30 +343,39 @@ static int efx_ef10_probe(struct efx_nic *efx)
if (rc)
goto fail3;
- rc = efx_ef10_get_pf_index(efx);
+ rc = device_create_file(&efx->pci_dev->dev,
+ &dev_attr_link_control_flag);
if (rc)
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);
if (rc < 0)
- goto fail3;
+ goto fail5;
efx->rx_packet_len_offset =
ES_DZ_RX_PREFIX_PKTLEN_OFST - ES_DZ_RX_PREFIX_SIZE;
rc = efx_mcdi_port_get_number(efx);
if (rc < 0)
- goto fail3;
+ goto fail5;
efx->port_num = rc;
net_dev->dev_port = rc;
rc = efx->type->get_mac_address(efx, efx->net_dev->perm_addr);
if (rc)
- goto fail3;
+ goto fail5;
rc = efx_ef10_get_sysclk_freq(efx);
if (rc < 0)
- goto fail3;
+ goto fail5;
efx->timer_quantum_ns = 1536000 / rc; /* 1536 cycles */
/* 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 &
MC_CMD_GET_WORKAROUNDS_OUT_BUG35388;
} else if (rc != -ENOSYS && rc != -ENOENT) {
- goto fail3;
+ goto fail5;
}
netif_dbg(efx, probe, efx->net_dev,
"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);
if (rc && rc != -EPERM)
- goto fail3;
+ goto fail5;
efx_ptp_probe(efx, NULL);
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:
efx_mcdi_fini(efx);
fail2:
@@ -613,6 +654,9 @@ static void efx_ef10_remove(struct efx_nic *efx)
if (!nic_data->must_restore_piobufs)
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_nic_free_buffer(efx, &nic_data->mcdi_buf);
kfree(nic_data);
next prev parent reply other threads:[~2015-06-02 10:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 10:36 [PATCH net-next v3 00/15] sfc: ndo_get_phys_port_id, vadaptor stats and PF unload when Vf's assigned to guest Shradha Shah
2015-06-02 10:37 ` [PATCH net-next v3 01/15] sfc: Add code to export port_num in netdev->dev_port Shradha Shah
2015-06-02 10:37 ` [PATCH net-next v3 02/15] sfc: Add paranthesis correctly on all branches of the if statement Shradha Shah
2015-06-02 10:37 ` Shradha Shah [this message]
2015-06-02 10:38 ` [PATCH net-next v3 04/15] sfc: Implement ndo_gets_phys_port_id() for EF10 VFs Shradha Shah
2015-06-02 10:38 ` [PATCH net-next v3 05/15] sfc: add "port_" prefix to MAC stats Shradha Shah
2015-06-02 10:38 ` [PATCH net-next v3 06/15] sfc: set the port-id when calling MC_CMD_MAC_STATS Shradha Shah
2015-06-02 10:39 ` [PATCH net-next v3 07/15] sfc: display vadaptor statistics for all interfaces Shradha Shah
2015-06-02 10:39 ` [PATCH net-next v3 08/15] sfc: DMA the VF stats only when requested Shradha Shah
2015-06-02 10:39 ` [PATCH net-next v3 09/15] sfc: update netdevice statistics to use vadaptor stats Shradha Shah
2015-06-02 10:39 ` [PATCH net-next v3 10/15] sfc: suppress ENOENT error messages from MC_CMD_MAC_STATS Shradha Shah
2015-06-02 10:40 ` [PATCH net-next v3 11/15] sfc: suppress vadaptor stats when EVB is not present Shradha Shah
2015-06-02 10:40 ` [PATCH net-next v3 12/15] sfc: don't update stats on VF when called in atomic context Shradha Shah
2015-06-02 10:40 ` [PATCH net-next v3 13/15] sfc: do not allow VFs to be destroyed if assigned to guests Shradha Shah
2015-06-02 10:40 ` [PATCH net-next v3 14/15] sfc: force removal of VF and vport on driver removal Shradha Shah
2015-06-02 10:41 ` [PATCH net-next v3 15/15] sfc: leak vports if a VF is assigned during PF unload Shradha Shah
2015-06-02 20:02 ` [PATCH net-next v3 00/15] sfc: ndo_get_phys_port_id, vadaptor stats and PF unload when Vf's assigned to guest David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=556D8786.2090906@solarflare.com \
--to=sshah@solarflare.com \
--cc=davem@davemloft.net \
--cc=linux-net-drivers@solarflare.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.