Commit 3521b419 authored by Yuval Mintz's avatar Yuval Mintz Committed by David S. Miller

bnx2x: Add Private Flags Support

Utilize ethtool's callback `get_priv_flags' - shed more light on the
feasibility of devices as storage interfaces.

CC: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarYuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: default avatarAriel Elior <ariele@broadcom.com>
Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
Acked-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 340611ab
...@@ -2137,6 +2137,8 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, ...@@ -2137,6 +2137,8 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id,
#define ATTN_HARD_WIRED_MASK 0xff00 #define ATTN_HARD_WIRED_MASK 0xff00
#define ATTENTION_ID 4 #define ATTENTION_ID 4
#define IS_MF_STORAGE_ONLY(bp) (IS_MF_STORAGE_SD(bp) || \
IS_MF_FCOE_AFEX(bp))
/* stuff added to make the code fit 80Col */ /* stuff added to make the code fit 80Col */
......
...@@ -1921,6 +1921,19 @@ static const char bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF][ETH_GSTRING_LEN] = { ...@@ -1921,6 +1921,19 @@ static const char bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF][ETH_GSTRING_LEN] = {
"link_test (online) " "link_test (online) "
}; };
enum {
BNX2X_PRI_FLAG_ISCSI,
BNX2X_PRI_FLAG_FCOE,
BNX2X_PRI_FLAG_STORAGE,
BNX2X_PRI_FLAG_LEN,
};
static const char bnx2x_private_arr[BNX2X_PRI_FLAG_LEN][ETH_GSTRING_LEN] = {
"iSCSI offload support",
"FCoE offload support",
"Storage only interface"
};
static u32 bnx2x_eee_to_adv(u32 eee_adv) static u32 bnx2x_eee_to_adv(u32 eee_adv)
{ {
u32 modes = 0; u32 modes = 0;
...@@ -2978,32 +2991,47 @@ static int bnx2x_num_stat_queues(struct bnx2x *bp) ...@@ -2978,32 +2991,47 @@ static int bnx2x_num_stat_queues(struct bnx2x *bp)
static int bnx2x_get_sset_count(struct net_device *dev, int stringset) static int bnx2x_get_sset_count(struct net_device *dev, int stringset)
{ {
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
int i, num_stats; int i, num_strings = 0;
switch (stringset) { switch (stringset) {
case ETH_SS_STATS: case ETH_SS_STATS:
if (is_multi(bp)) { if (is_multi(bp)) {
num_stats = bnx2x_num_stat_queues(bp) * num_strings = bnx2x_num_stat_queues(bp) *
BNX2X_NUM_Q_STATS; BNX2X_NUM_Q_STATS;
} else } else
num_stats = 0; num_strings = 0;
if (IS_MF_MODE_STAT(bp)) { if (IS_MF_MODE_STAT(bp)) {
for (i = 0; i < BNX2X_NUM_STATS; i++) for (i = 0; i < BNX2X_NUM_STATS; i++)
if (IS_FUNC_STAT(i)) if (IS_FUNC_STAT(i))
num_stats++; num_strings++;
} else } else
num_stats += BNX2X_NUM_STATS; num_strings += BNX2X_NUM_STATS;
return num_stats; return num_strings;
case ETH_SS_TEST: case ETH_SS_TEST:
return BNX2X_NUM_TESTS(bp); return BNX2X_NUM_TESTS(bp);
case ETH_SS_PRIV_FLAGS:
return BNX2X_PRI_FLAG_LEN;
default: default:
return -EINVAL; return -EINVAL;
} }
} }
static u32 bnx2x_get_private_flags(struct net_device *dev)
{
struct bnx2x *bp = netdev_priv(dev);
u32 flags = 0;
flags |= (!(bp->flags & NO_ISCSI_FLAG) ? 1 : 0) << BNX2X_PRI_FLAG_ISCSI;
flags |= (!(bp->flags & NO_FCOE_FLAG) ? 1 : 0) << BNX2X_PRI_FLAG_FCOE;
flags |= (!!IS_MF_STORAGE_ONLY(bp)) << BNX2X_PRI_FLAG_STORAGE;
return flags;
}
static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
{ {
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
...@@ -3045,6 +3073,12 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) ...@@ -3045,6 +3073,12 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
start = 4; start = 4;
memcpy(buf, bnx2x_tests_str_arr + start, memcpy(buf, bnx2x_tests_str_arr + start,
ETH_GSTRING_LEN * BNX2X_NUM_TESTS(bp)); ETH_GSTRING_LEN * BNX2X_NUM_TESTS(bp));
break;
case ETH_SS_PRIV_FLAGS:
memcpy(buf, bnx2x_private_arr,
ETH_GSTRING_LEN * BNX2X_PRI_FLAG_LEN);
break;
} }
} }
...@@ -3445,6 +3479,7 @@ static const struct ethtool_ops bnx2x_ethtool_ops = { ...@@ -3445,6 +3479,7 @@ static const struct ethtool_ops bnx2x_ethtool_ops = {
.set_pauseparam = bnx2x_set_pauseparam, .set_pauseparam = bnx2x_set_pauseparam,
.self_test = bnx2x_self_test, .self_test = bnx2x_self_test,
.get_sset_count = bnx2x_get_sset_count, .get_sset_count = bnx2x_get_sset_count,
.get_priv_flags = bnx2x_get_private_flags,
.get_strings = bnx2x_get_strings, .get_strings = bnx2x_get_strings,
.set_phys_id = bnx2x_set_phys_id, .set_phys_id = bnx2x_set_phys_id,
.get_ethtool_stats = bnx2x_get_ethtool_stats, .get_ethtool_stats = bnx2x_get_ethtool_stats,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment