From: "Yuval Mintz" <yuvalmin@broadcom.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: eilong@broadcom.com, ariele@broadcom.com,
"Yuval Mintz" <yuvalmin@broadcom.com>
Subject: [PATCH net-next 02/13] bnx2x: Set ethtool ops for vfs
Date: Mon, 11 Mar 2013 17:17:42 +0200 [thread overview]
Message-ID: <1363015073-25743-3-git-send-email-yuvalmin@broadcom.com> (raw)
In-Reply-To: <1363015073-25743-1-git-send-email-yuvalmin@broadcom.com>
From: Ariel Elior <ariele@broadcom.com>
Virtual functions don't have access to HW registers, therefore most ethtool ops
are forbidden to them. Instead of checking in each op whether the device being
driven is a virtual function or a physical function, this patch creates a
separate ethtool ops struct for virtual functions and uses it to initialize
the ethtool ops of the driver in case it is driving a virtual function device.
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 2 +-
.../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 29 ++++++++++++++++++-
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 +-
3 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index 9577cce..8ddc78b 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -2285,7 +2285,7 @@ static const u32 dmae_reg_go_c[] = {
DMAE_REG_GO_C12, DMAE_REG_GO_C13, DMAE_REG_GO_C14, DMAE_REG_GO_C15
};
-void bnx2x_set_ethtool_ops(struct net_device *netdev);
+void bnx2x_set_ethtool_ops(struct bnx2x *bp, struct net_device *netdev);
void bnx2x_notify_link_changed(struct bnx2x *bp);
#define BNX2X_MF_SD_PROTOCOL(bp) \
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index edfa67a..324d691 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -3232,7 +3232,32 @@ static const struct ethtool_ops bnx2x_ethtool_ops = {
.get_ts_info = ethtool_op_get_ts_info,
};
-void bnx2x_set_ethtool_ops(struct net_device *netdev)
+static const struct ethtool_ops bnx2x_vf_ethtool_ops = {
+ .get_settings = bnx2x_get_settings,
+ .set_settings = bnx2x_set_settings,
+ .get_drvinfo = bnx2x_get_drvinfo,
+ .get_msglevel = bnx2x_get_msglevel,
+ .set_msglevel = bnx2x_set_msglevel,
+ .get_link = bnx2x_get_link,
+ .get_coalesce = bnx2x_get_coalesce,
+ .get_ringparam = bnx2x_get_ringparam,
+ .set_ringparam = bnx2x_set_ringparam,
+ .get_sset_count = bnx2x_get_sset_count,
+ .get_strings = bnx2x_get_strings,
+ .get_ethtool_stats = bnx2x_get_ethtool_stats,
+ .get_rxnfc = bnx2x_get_rxnfc,
+ .set_rxnfc = bnx2x_set_rxnfc,
+ .get_rxfh_indir_size = bnx2x_get_rxfh_indir_size,
+ .get_rxfh_indir = bnx2x_get_rxfh_indir,
+ .set_rxfh_indir = bnx2x_set_rxfh_indir,
+ .get_channels = bnx2x_get_channels,
+ .set_channels = bnx2x_set_channels,
+};
+
+void bnx2x_set_ethtool_ops(struct bnx2x *bp, struct net_device *netdev)
{
- SET_ETHTOOL_OPS(netdev, &bnx2x_ethtool_ops);
+ if (IS_PF(bp))
+ SET_ETHTOOL_OPS(netdev, &bnx2x_ethtool_ops);
+ else /* vf */
+ SET_ETHTOOL_OPS(netdev, &bnx2x_vf_ethtool_ops);
}
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index e81a747..14a7784 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -11953,7 +11953,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
dev->watchdog_timeo = TX_TIMEOUT;
dev->netdev_ops = &bnx2x_netdev_ops;
- bnx2x_set_ethtool_ops(dev);
+ bnx2x_set_ethtool_ops(bp, dev);
dev->priv_flags |= IFF_UNICAST_FLT;
--
1.7.7.2
next prev parent reply other threads:[~2013-03-11 16:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-11 15:17 [PATCH net-next 0/13] bnx2x: patch series Yuval Mintz
2013-03-11 15:17 ` [PATCH net-next 01/13] bnx2x: fix vlan-mac memory leak Yuval Mintz
2013-03-11 15:17 ` Yuval Mintz [this message]
2013-03-11 15:17 ` [PATCH net-next 03/13] bnx2x: Take chip version from MFW Yuval Mintz
2013-03-11 15:17 ` [PATCH net-next 04/13] bnx2x: Prevent "Unknown MF" print in SF mode Yuval Mintz
2013-03-11 15:17 ` [PATCH net-next 05/13] bnx2x: Add iproute2 support for vfs Yuval Mintz
2013-03-11 15:17 ` [PATCH net-next 06/13] bnx2x: Control number of vfs dynamically Yuval Mintz
2013-03-12 9:28 ` David Miller
2013-03-12 10:51 ` Ariel Elior
2013-03-12 11:50 ` David Miller
2013-03-11 15:17 ` [PATCH net-next 07/13] bnx2x: Get gso_segs from FW Yuval Mintz
2013-03-11 15:17 ` [PATCH net-next 08/13] bnx2x: Add RJ45 SFP module detection Yuval Mintz
2013-03-11 15:17 ` [PATCH net-next 09/13] bnx2x: Add EEE support for BCM84834 Yuval Mintz
2013-03-11 15:17 ` [PATCH net-next 10/13] bnx2x: Control SFP+ tap values via nvm config Yuval Mintz
2013-03-11 15:17 ` [PATCH net-next 11/13] bnx2x: Avoid using zero MAC Yuval Mintz
2013-03-11 15:17 ` [PATCH net-next 12/13] bnx2x: use FW 7.8.17 Yuval Mintz
2013-03-11 15:17 ` [PATCH net-next 13/13] bnx2x: Restore FCoE 4-port devices support Yuval Mintz
2013-03-12 11:58 ` [PATCH net-next 0/13] bnx2x: patch series 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=1363015073-25743-3-git-send-email-yuvalmin@broadcom.com \
--to=yuvalmin@broadcom.com \
--cc=ariele@broadcom.com \
--cc=davem@davemloft.net \
--cc=eilong@broadcom.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).