summaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x/bnx2x_cmn.c
diff options
context:
space:
mode:
authorDmitry Kravkov2010-12-01 21:39:28 +0100
committerDavid S. Miller2010-12-01 21:39:28 +0100
commit0793f83f0ec2142d06abe53570417c8d95e0310a (patch)
tree6716837e759bb83722d07084f57bcd327167ee56 /drivers/net/bnx2x/bnx2x_cmn.c
parentinet: Turn ->remember_stamp into ->get_peer in connection AF ops. (diff)
downloadkernel-qcow2-linux-0793f83f0ec2142d06abe53570417c8d95e0310a.tar.gz
kernel-qcow2-linux-0793f83f0ec2142d06abe53570417c8d95e0310a.tar.xz
kernel-qcow2-linux-0793f83f0ec2142d06abe53570417c8d95e0310a.zip
bnx2x: Add Nic partitioning mode (57712 devices)
NIC partitioning is another flavor of multi function - having few PCI functions share the same physical port. Unlike the currently supported mode of multi-function which depends on the switch configuration and uses outer-VLAN, the NPAR mode is switch independent and uses the MAC addresses to distribute incoming packets to the different functions. This patch adds the specific HW setting of the NPAR mode and some distinctions between switch dependent (SD) and switch independent (SI) multi-function (MF) modes where the configuration is not the same. Advance driver version to 1.60.00-6 Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_cmn.c')
-rw-r--r--drivers/net/bnx2x/bnx2x_cmn.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index e20b2d378929..a4555edbe9ce 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -698,6 +698,29 @@ void bnx2x_release_phy_lock(struct bnx2x *bp)
mutex_unlock(&bp->port.phy_mutex);
}
+/* calculates MF speed according to current linespeed and MF configuration */
+u16 bnx2x_get_mf_speed(struct bnx2x *bp)
+{
+ u16 line_speed = bp->link_vars.line_speed;
+ if (IS_MF(bp)) {
+ u16 maxCfg = (bp->mf_config[BP_VN(bp)] &
+ FUNC_MF_CFG_MAX_BW_MASK) >>
+ FUNC_MF_CFG_MAX_BW_SHIFT;
+ /* Calculate the current MAX line speed limit for the DCC
+ * capable devices
+ */
+ if (IS_MF_SD(bp)) {
+ u16 vn_max_rate = maxCfg * 100;
+
+ if (vn_max_rate < line_speed)
+ line_speed = vn_max_rate;
+ } else /* IS_MF_SI(bp)) */
+ line_speed = (line_speed * maxCfg) / 100;
+ }
+
+ return line_speed;
+}
+
void bnx2x_link_report(struct bnx2x *bp)
{
if (bp->flags & MF_FUNC_DIS) {
@@ -713,17 +736,8 @@ void bnx2x_link_report(struct bnx2x *bp)
netif_carrier_on(bp->dev);
netdev_info(bp->dev, "NIC Link is Up, ");
- line_speed = bp->link_vars.line_speed;
- if (IS_MF(bp)) {
- u16 vn_max_rate;
+ line_speed = bnx2x_get_mf_speed(bp);
- vn_max_rate =
- ((bp->mf_config[BP_VN(bp)] &
- FUNC_MF_CFG_MAX_BW_MASK) >>
- FUNC_MF_CFG_MAX_BW_SHIFT) * 100;
- if (vn_max_rate < line_speed)
- line_speed = vn_max_rate;
- }
pr_cont("%d Mbps ", line_speed);
if (bp->link_vars.duplex == DUPLEX_FULL)