Commit a2122d95 authored by Rasesh Mody's avatar Rasesh Mody Committed by David S. Miller

bna: Ethtool Enhancements and Fix

Change details:
 - Add tx_skb counters and NAPI debug counters to ethtool stats.
 - Add rlb stats strings to bnad_net_stats_strings{} array. rlb_stats field
   was added to struct bfi_enet_stats {} but the corresponding name structure
   array for ethtool was not initialized with right strings, even though the
   actual name structure array got expanded. This caused a NULL pointer
   violation and a crash when doing ehtool -S <if_name>.
 - Modify dim timer stop logic to make it dependent on cfg and run flags
 - While setting the ring parameter restore the rx, vlan configuration and
   set rx mode
 - Indentation fix
Signed-off-by: default avatarGurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: default avatarRasesh Mody <rmody@brocade.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3caa1e95
...@@ -2027,7 +2027,7 @@ bnad_rx_coalescing_timeo_set(struct bnad *bnad) ...@@ -2027,7 +2027,7 @@ bnad_rx_coalescing_timeo_set(struct bnad *bnad)
/* /*
* Called with bnad->bna_lock held * Called with bnad->bna_lock held
*/ */
static int int
bnad_mac_addr_set_locked(struct bnad *bnad, u8 *mac_addr) bnad_mac_addr_set_locked(struct bnad *bnad, u8 *mac_addr)
{ {
int ret; int ret;
...@@ -2047,7 +2047,7 @@ bnad_mac_addr_set_locked(struct bnad *bnad, u8 *mac_addr) ...@@ -2047,7 +2047,7 @@ bnad_mac_addr_set_locked(struct bnad *bnad, u8 *mac_addr)
} }
/* Should be called with conf_lock held */ /* Should be called with conf_lock held */
static int int
bnad_enable_default_bcast(struct bnad *bnad) bnad_enable_default_bcast(struct bnad *bnad)
{ {
struct bnad_rx_info *rx_info = &bnad->rx_info[0]; struct bnad_rx_info *rx_info = &bnad->rx_info[0];
...@@ -2073,7 +2073,7 @@ bnad_enable_default_bcast(struct bnad *bnad) ...@@ -2073,7 +2073,7 @@ bnad_enable_default_bcast(struct bnad *bnad)
} }
/* Called with mutex_lock(&bnad->conf_mutex) held */ /* Called with mutex_lock(&bnad->conf_mutex) held */
static void void
bnad_restore_vlans(struct bnad *bnad, u32 rx_id) bnad_restore_vlans(struct bnad *bnad, u32 rx_id)
{ {
u16 vid; u16 vid;
...@@ -2826,7 +2826,7 @@ bnad_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats) ...@@ -2826,7 +2826,7 @@ bnad_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
return stats; return stats;
} }
static void void
bnad_set_rx_mode(struct net_device *netdev) bnad_set_rx_mode(struct net_device *netdev)
{ {
struct bnad *bnad = netdev_priv(netdev); struct bnad *bnad = netdev_priv(netdev);
......
...@@ -328,6 +328,12 @@ extern u32 bnad_rxqs_per_cq; ...@@ -328,6 +328,12 @@ extern u32 bnad_rxqs_per_cq;
*/ */
extern u32 *cna_get_firmware_buf(struct pci_dev *pdev); extern u32 *cna_get_firmware_buf(struct pci_dev *pdev);
/* Netdev entry point prototypes */ /* Netdev entry point prototypes */
extern void bnad_set_rx_mode(struct net_device *netdev);
extern struct net_device_stats *bnad_get_netdev_stats(
struct net_device *netdev);
extern int bnad_mac_addr_set_locked(struct bnad *bnad, u8 *mac_addr);
extern int bnad_enable_default_bcast(struct bnad *bnad);
extern void bnad_restore_vlans(struct bnad *bnad, u32 rx_id);
extern void bnad_set_ethtool_ops(struct net_device *netdev); extern void bnad_set_ethtool_ops(struct net_device *netdev);
/* Configuration & setup */ /* Configuration & setup */
...@@ -366,8 +372,4 @@ extern void bnad_netdev_hwstats_fill(struct bnad *bnad, ...@@ -366,8 +372,4 @@ extern void bnad_netdev_hwstats_fill(struct bnad *bnad,
} \ } \
} }
#define bnad_dim_timer_running(_bnad) \
(((_bnad)->cfg_flags & BNAD_CF_DIM_ENABLED) && \
(test_bit(BNAD_RF_DIM_TIMER_RUNNING, &((_bnad)->run_flags))))
#endif /* __BNAD_H__ */ #endif /* __BNAD_H__ */
...@@ -75,14 +75,25 @@ static char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = { ...@@ -75,14 +75,25 @@ static char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = {
"tcpcsum_offload", "tcpcsum_offload",
"udpcsum_offload", "udpcsum_offload",
"csum_help", "csum_help",
"csum_help_err", "tx_skb_too_short",
"tx_skb_stopping",
"tx_skb_max_vectors",
"tx_skb_mss_too_long",
"tx_skb_tso_too_short",
"tx_skb_tso_prepare",
"tx_skb_non_tso_too_long",
"tx_skb_tcp_hdr",
"tx_skb_udp_hdr",
"tx_skb_csum_err",
"tx_skb_headlen_too_long",
"tx_skb_headlen_zero",
"tx_skb_frag_zero",
"tx_skb_len_mismatch",
"hw_stats_updates", "hw_stats_updates",
"netif_rx_schedule",
"netif_rx_complete",
"netif_rx_dropped", "netif_rx_dropped",
"link_toggle", "link_toggle",
"cee_up", "cee_toggle",
"rxp_info_alloc_failed", "rxp_info_alloc_failed",
"mbox_intr_disabled", "mbox_intr_disabled",
...@@ -201,6 +212,20 @@ static char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = { ...@@ -201,6 +212,20 @@ static char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = {
"rad_rx_bcast_vlan", "rad_rx_bcast_vlan",
"rad_rx_drops", "rad_rx_drops",
"rlb_rad_rx_frames",
"rlb_rad_rx_octets",
"rlb_rad_rx_vlan_frames",
"rlb_rad_rx_ucast",
"rlb_rad_rx_ucast_octets",
"rlb_rad_rx_ucast_vlan",
"rlb_rad_rx_mcast",
"rlb_rad_rx_mcast_octets",
"rlb_rad_rx_mcast_vlan",
"rlb_rad_rx_bcast",
"rlb_rad_rx_bcast_octets",
"rlb_rad_rx_bcast_vlan",
"rlb_rad_rx_drops",
"fc_rx_ucast_octets", "fc_rx_ucast_octets",
"fc_rx_ucast", "fc_rx_ucast",
"fc_rx_ucast_vlan", "fc_rx_ucast_vlan",
...@@ -321,7 +346,7 @@ bnad_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce) ...@@ -321,7 +346,7 @@ bnad_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce)
{ {
struct bnad *bnad = netdev_priv(netdev); struct bnad *bnad = netdev_priv(netdev);
unsigned long flags; unsigned long flags;
int dim_timer_del = 0; int to_del = 0;
if (coalesce->rx_coalesce_usecs == 0 || if (coalesce->rx_coalesce_usecs == 0 ||
coalesce->rx_coalesce_usecs > coalesce->rx_coalesce_usecs >
...@@ -348,14 +373,17 @@ bnad_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce) ...@@ -348,14 +373,17 @@ bnad_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce)
} else { } else {
if (bnad->cfg_flags & BNAD_CF_DIM_ENABLED) { if (bnad->cfg_flags & BNAD_CF_DIM_ENABLED) {
bnad->cfg_flags &= ~BNAD_CF_DIM_ENABLED; bnad->cfg_flags &= ~BNAD_CF_DIM_ENABLED;
dim_timer_del = bnad_dim_timer_running(bnad); if (bnad->cfg_flags & BNAD_CF_DIM_ENABLED &&
if (dim_timer_del) { test_bit(BNAD_RF_DIM_TIMER_RUNNING,
&bnad->run_flags)) {
clear_bit(BNAD_RF_DIM_TIMER_RUNNING, clear_bit(BNAD_RF_DIM_TIMER_RUNNING,
&bnad->run_flags); &bnad->run_flags);
spin_unlock_irqrestore(&bnad->bna_lock, flags); to_del = 1;
del_timer_sync(&bnad->dim_timer);
spin_lock_irqsave(&bnad->bna_lock, flags);
} }
spin_unlock_irqrestore(&bnad->bna_lock, flags);
if (to_del)
del_timer_sync(&bnad->dim_timer);
spin_lock_irqsave(&bnad->bna_lock, flags);
bnad_rx_coalescing_timeo_set(bnad); bnad_rx_coalescing_timeo_set(bnad);
} }
} }
...@@ -407,6 +435,7 @@ bnad_set_ringparam(struct net_device *netdev, ...@@ -407,6 +435,7 @@ bnad_set_ringparam(struct net_device *netdev,
{ {
int i, current_err, err = 0; int i, current_err, err = 0;
struct bnad *bnad = netdev_priv(netdev); struct bnad *bnad = netdev_priv(netdev);
unsigned long flags;
mutex_lock(&bnad->conf_mutex); mutex_lock(&bnad->conf_mutex);
if (ringparam->rx_pending == bnad->rxq_depth && if (ringparam->rx_pending == bnad->rxq_depth &&
...@@ -430,6 +459,11 @@ bnad_set_ringparam(struct net_device *netdev, ...@@ -430,6 +459,11 @@ bnad_set_ringparam(struct net_device *netdev,
if (ringparam->rx_pending != bnad->rxq_depth) { if (ringparam->rx_pending != bnad->rxq_depth) {
bnad->rxq_depth = ringparam->rx_pending; bnad->rxq_depth = ringparam->rx_pending;
if (!netif_running(netdev)) {
mutex_unlock(&bnad->conf_mutex);
return 0;
}
for (i = 0; i < bnad->num_rx; i++) { for (i = 0; i < bnad->num_rx; i++) {
if (!bnad->rx_info[i].rx) if (!bnad->rx_info[i].rx)
continue; continue;
...@@ -437,10 +471,26 @@ bnad_set_ringparam(struct net_device *netdev, ...@@ -437,10 +471,26 @@ bnad_set_ringparam(struct net_device *netdev,
current_err = bnad_setup_rx(bnad, i); current_err = bnad_setup_rx(bnad, i);
if (current_err && !err) if (current_err && !err)
err = current_err; err = current_err;
if (!err)
bnad_restore_vlans(bnad, i);
}
if (!err && bnad->rx_info[0].rx) {
/* restore rx configuration */
bnad_enable_default_bcast(bnad);
spin_lock_irqsave(&bnad->bna_lock, flags);
bnad_mac_addr_set_locked(bnad, netdev->dev_addr);
spin_unlock_irqrestore(&bnad->bna_lock, flags);
bnad_set_rx_mode(netdev);
} }
} }
if (ringparam->tx_pending != bnad->txq_depth) { if (ringparam->tx_pending != bnad->txq_depth) {
bnad->txq_depth = ringparam->tx_pending; bnad->txq_depth = ringparam->tx_pending;
if (!netif_running(netdev)) {
mutex_unlock(&bnad->conf_mutex);
return 0;
}
for (i = 0; i < bnad->num_tx; i++) { for (i = 0; i < bnad->num_tx; i++) {
if (!bnad->tx_info[i].tx) if (!bnad->tx_info[i].tx)
continue; continue;
...@@ -578,6 +628,16 @@ bnad_get_strings(struct net_device *netdev, u32 stringset, u8 * string) ...@@ -578,6 +628,16 @@ bnad_get_strings(struct net_device *netdev, u32 stringset, u8 * string)
sprintf(string, "cq%d_hw_producer_index", sprintf(string, "cq%d_hw_producer_index",
q_num); q_num);
string += ETH_GSTRING_LEN; string += ETH_GSTRING_LEN;
sprintf(string, "cq%d_intr", q_num);
string += ETH_GSTRING_LEN;
sprintf(string, "cq%d_poll", q_num);
string += ETH_GSTRING_LEN;
sprintf(string, "cq%d_schedule", q_num);
string += ETH_GSTRING_LEN;
sprintf(string, "cq%d_keep_poll", q_num);
string += ETH_GSTRING_LEN;
sprintf(string, "cq%d_complete", q_num);
string += ETH_GSTRING_LEN;
q_num++; q_num++;
} }
} }
...@@ -660,7 +720,7 @@ static int ...@@ -660,7 +720,7 @@ static int
bnad_get_stats_count_locked(struct net_device *netdev) bnad_get_stats_count_locked(struct net_device *netdev)
{ {
struct bnad *bnad = netdev_priv(netdev); struct bnad *bnad = netdev_priv(netdev);
int i, j, count, rxf_active_num = 0, txf_active_num = 0; int i, j, count = 0, rxf_active_num = 0, txf_active_num = 0;
u32 bmap; u32 bmap;
bmap = bna_tx_rid_mask(&bnad->bna); bmap = bna_tx_rid_mask(&bnad->bna);
...@@ -718,6 +778,17 @@ bnad_per_q_stats_fill(struct bnad *bnad, u64 *buf, int bi) ...@@ -718,6 +778,17 @@ bnad_per_q_stats_fill(struct bnad *bnad, u64 *buf, int bi)
buf[bi++] = 0; /* ccb->consumer_index */ buf[bi++] = 0; /* ccb->consumer_index */
buf[bi++] = *(bnad->rx_info[i].rx_ctrl[j]. buf[bi++] = *(bnad->rx_info[i].rx_ctrl[j].
ccb->hw_producer_index); ccb->hw_producer_index);
buf[bi++] = bnad->rx_info[i].
rx_ctrl[j].rx_intr_ctr;
buf[bi++] = bnad->rx_info[i].
rx_ctrl[j].rx_poll_ctr;
buf[bi++] = bnad->rx_info[i].
rx_ctrl[j].rx_schedule;
buf[bi++] = bnad->rx_info[i].
rx_ctrl[j].rx_keep_poll;
buf[bi++] = bnad->rx_info[i].
rx_ctrl[j].rx_complete;
} }
} }
for (i = 0; i < bnad->num_rx; i++) { for (i = 0; i < bnad->num_rx; i++) {
......
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