Skip to content

Commit

Permalink
netxen_nic: Allow only useful and recommended firmware dump capture m…
Browse files Browse the repository at this point in the history
…ask values

o 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F and 0xFF are the allowed capture masks.

Signed-off-by: Manish chopra <manish.chopra@qlogic.com>
Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Manish chopra authored and David S. Miller committed May 10, 2012
1 parent 458c285 commit d8c3e77
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions drivers/net/ethernet/qlogic/netxen/netxen_nic.h
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,9 @@ typedef struct {
#define NX_FORCE_FW_RESET 0xdeaddead


/* Fw dump levels */
static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };

/* Flash read/write address */
#define NX_FW_DUMP_REG1 0x00130060
#define NX_FW_DUMP_REG2 0x001e0000
Expand Down
18 changes: 10 additions & 8 deletions drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ netxen_get_dump_flag(struct net_device *netdev, struct ethtool_dump *dump)
static int
netxen_set_dump(struct net_device *netdev, struct ethtool_dump *val)
{
int ret = 0;
int i;
struct netxen_adapter *adapter = netdev_priv(netdev);
struct netxen_minidump *mdump = &adapter->mdump;

Expand All @@ -844,7 +844,7 @@ netxen_set_dump(struct net_device *netdev, struct ethtool_dump *val)
mdump->md_enabled = 1;
if (adapter->fw_mdump_rdy) {
netdev_info(netdev, "Previous dump not cleared, not forcing dump\n");
return ret;
return 0;
}
netdev_info(netdev, "Forcing a fw dump\n");
nx_dev_request_reset(adapter);
Expand All @@ -867,19 +867,21 @@ netxen_set_dump(struct net_device *netdev, struct ethtool_dump *val)
adapter->flags &= ~NETXEN_FW_RESET_OWNER;
break;
default:
if (val->flag <= NX_DUMP_MASK_MAX &&
val->flag >= NX_DUMP_MASK_MIN) {
mdump->md_capture_mask = val->flag & 0xff;
netdev_info(netdev, "Driver mask changed to: 0x%x\n",
for (i = 0; i < ARRAY_SIZE(FW_DUMP_LEVELS); i++) {
if (val->flag == FW_DUMP_LEVELS[i]) {
mdump->md_capture_mask = val->flag;
netdev_info(netdev,
"Driver mask changed to: 0x%x\n",
mdump->md_capture_mask);
break;
return 0;
}
}
netdev_info(netdev,
"Invalid dump level: 0x%x\n", val->flag);
return -EINVAL;
}

return ret;
return 0;
}

static int
Expand Down

0 comments on commit d8c3e77

Please sign in to comment.