Commit 225837a0 authored by Shahed Shaikh's avatar Shahed Shaikh Committed by David S. Miller

qlcnic: Re-factor firmware minidump template header handling

Treat firmware minidump template headers for 82xx and 83xx/84xx adapters separately,
as it may change for 82xx and 83xx/84xx adapter type independently.
Signed-off-by: default avatarShahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a1991c74
...@@ -394,7 +394,7 @@ struct qlcnic_nic_intr_coalesce { ...@@ -394,7 +394,7 @@ struct qlcnic_nic_intr_coalesce {
u32 timer_out; u32 timer_out;
}; };
struct qlcnic_dump_template_hdr { struct qlcnic_83xx_dump_template_hdr {
u32 type; u32 type;
u32 offset; u32 offset;
u32 size; u32 size;
...@@ -411,15 +411,42 @@ struct qlcnic_dump_template_hdr { ...@@ -411,15 +411,42 @@ struct qlcnic_dump_template_hdr {
u32 rsvd[0]; u32 rsvd[0];
}; };
struct qlcnic_82xx_dump_template_hdr {
u32 type;
u32 offset;
u32 size;
u32 cap_mask;
u32 num_entries;
u32 version;
u32 timestamp;
u32 checksum;
u32 drv_cap_mask;
u32 sys_info[3];
u32 saved_state[16];
u32 cap_sizes[8];
u32 rsvd[7];
u32 capabilities;
u32 rsvd1[0];
};
struct qlcnic_fw_dump { struct qlcnic_fw_dump {
u8 clr; /* flag to indicate if dump is cleared */ u8 clr; /* flag to indicate if dump is cleared */
bool enable; /* enable/disable dump */ bool enable; /* enable/disable dump */
u32 size; /* total size of the dump */ u32 size; /* total size of the dump */
u32 cap_mask; /* Current capture mask */
void *data; /* dump data area */ void *data; /* dump data area */
struct qlcnic_dump_template_hdr *tmpl_hdr; void *tmpl_hdr;
dma_addr_t phys_addr; dma_addr_t phys_addr;
void *dma_buffer; void *dma_buffer;
bool use_pex_dma; bool use_pex_dma;
/* Read only elements which are common between 82xx and 83xx
* template header. Update these values immediately after we read
* template header from Firmware
*/
u32 tmpl_hdr_size;
u32 version;
u32 num_entries;
u32 offset;
}; };
/* /*
...@@ -1769,6 +1796,12 @@ struct qlcnic_hardware_ops { ...@@ -1769,6 +1796,12 @@ struct qlcnic_hardware_ops {
struct qlcnic_host_tx_ring *); struct qlcnic_host_tx_ring *);
void (*disable_tx_intr) (struct qlcnic_adapter *, void (*disable_tx_intr) (struct qlcnic_adapter *,
struct qlcnic_host_tx_ring *); struct qlcnic_host_tx_ring *);
u32 (*get_saved_state)(void *, u32);
void (*set_saved_state)(void *, u32, u32);
void (*cache_tmpl_hdr_values)(struct qlcnic_fw_dump *);
u32 (*get_cap_size)(void *, int);
void (*set_sys_info)(void *, int, u32);
void (*store_cap_mask)(void *, u32);
}; };
extern struct qlcnic_nic_template qlcnic_vf_ops; extern struct qlcnic_nic_template qlcnic_vf_ops;
...@@ -2007,6 +2040,42 @@ static inline void qlcnic_read_phys_port_id(struct qlcnic_adapter *adapter) ...@@ -2007,6 +2040,42 @@ static inline void qlcnic_read_phys_port_id(struct qlcnic_adapter *adapter)
adapter->ahw->hw_ops->read_phys_port_id(adapter); adapter->ahw->hw_ops->read_phys_port_id(adapter);
} }
static inline u32 qlcnic_get_saved_state(struct qlcnic_adapter *adapter,
void *t_hdr, u32 index)
{
return adapter->ahw->hw_ops->get_saved_state(t_hdr, index);
}
static inline void qlcnic_set_saved_state(struct qlcnic_adapter *adapter,
void *t_hdr, u32 index, u32 value)
{
adapter->ahw->hw_ops->set_saved_state(t_hdr, index, value);
}
static inline void qlcnic_cache_tmpl_hdr_values(struct qlcnic_adapter *adapter,
struct qlcnic_fw_dump *fw_dump)
{
adapter->ahw->hw_ops->cache_tmpl_hdr_values(fw_dump);
}
static inline u32 qlcnic_get_cap_size(struct qlcnic_adapter *adapter,
void *tmpl_hdr, int index)
{
return adapter->ahw->hw_ops->get_cap_size(tmpl_hdr, index);
}
static inline void qlcnic_set_sys_info(struct qlcnic_adapter *adapter,
void *tmpl_hdr, int idx, u32 value)
{
adapter->ahw->hw_ops->set_sys_info(tmpl_hdr, idx, value);
}
static inline void qlcnic_store_cap_mask(struct qlcnic_adapter *adapter,
void *tmpl_hdr, u32 mask)
{
adapter->ahw->hw_ops->store_cap_mask(tmpl_hdr, mask);
}
static inline void qlcnic_dev_request_reset(struct qlcnic_adapter *adapter, static inline void qlcnic_dev_request_reset(struct qlcnic_adapter *adapter,
u32 key) u32 key)
{ {
......
...@@ -203,7 +203,12 @@ static struct qlcnic_hardware_ops qlcnic_83xx_hw_ops = { ...@@ -203,7 +203,12 @@ static struct qlcnic_hardware_ops qlcnic_83xx_hw_ops = {
.disable_sds_intr = qlcnic_83xx_disable_sds_intr, .disable_sds_intr = qlcnic_83xx_disable_sds_intr,
.enable_tx_intr = qlcnic_83xx_enable_tx_intr, .enable_tx_intr = qlcnic_83xx_enable_tx_intr,
.disable_tx_intr = qlcnic_83xx_disable_tx_intr, .disable_tx_intr = qlcnic_83xx_disable_tx_intr,
.get_saved_state = qlcnic_83xx_get_saved_state,
.set_saved_state = qlcnic_83xx_set_saved_state,
.cache_tmpl_hdr_values = qlcnic_83xx_cache_tmpl_hdr_values,
.get_cap_size = qlcnic_83xx_get_cap_size,
.set_sys_info = qlcnic_83xx_set_sys_info,
.store_cap_mask = qlcnic_83xx_store_cap_mask,
}; };
static struct qlcnic_nic_template qlcnic_83xx_ops = { static struct qlcnic_nic_template qlcnic_83xx_ops = {
......
...@@ -308,6 +308,8 @@ struct qlc_83xx_reset { ...@@ -308,6 +308,8 @@ struct qlc_83xx_reset {
#define QLC_83XX_IDC_FLASH_PARAM_ADDR 0x3e8020 #define QLC_83XX_IDC_FLASH_PARAM_ADDR 0x3e8020
struct qlcnic_adapter; struct qlcnic_adapter;
struct qlcnic_fw_dump;
struct qlc_83xx_idc { struct qlc_83xx_idc {
int (*state_entry) (struct qlcnic_adapter *); int (*state_entry) (struct qlcnic_adapter *);
u64 sec_counter; u64 sec_counter;
...@@ -650,4 +652,10 @@ int qlcnic_83xx_check_vnic_state(struct qlcnic_adapter *); ...@@ -650,4 +652,10 @@ int qlcnic_83xx_check_vnic_state(struct qlcnic_adapter *);
void qlcnic_83xx_aer_stop_poll_work(struct qlcnic_adapter *); void qlcnic_83xx_aer_stop_poll_work(struct qlcnic_adapter *);
int qlcnic_83xx_aer_reset(struct qlcnic_adapter *); int qlcnic_83xx_aer_reset(struct qlcnic_adapter *);
void qlcnic_83xx_aer_start_poll_work(struct qlcnic_adapter *); void qlcnic_83xx_aer_start_poll_work(struct qlcnic_adapter *);
u32 qlcnic_83xx_get_saved_state(void *, u32);
void qlcnic_83xx_set_saved_state(void *, u32, u32);
void qlcnic_83xx_cache_tmpl_hdr_values(struct qlcnic_fw_dump *);
u32 qlcnic_83xx_get_cap_size(void *, int);
void qlcnic_83xx_set_sys_info(void *, int, u32);
void qlcnic_83xx_store_cap_mask(void *, u32);
#endif #endif
...@@ -1639,14 +1639,14 @@ qlcnic_get_dump_flag(struct net_device *netdev, struct ethtool_dump *dump) ...@@ -1639,14 +1639,14 @@ qlcnic_get_dump_flag(struct net_device *netdev, struct ethtool_dump *dump)
} }
if (fw_dump->clr) if (fw_dump->clr)
dump->len = fw_dump->tmpl_hdr->size + fw_dump->size; dump->len = fw_dump->tmpl_hdr_size + fw_dump->size;
else else
dump->len = 0; dump->len = 0;
if (!qlcnic_check_fw_dump_state(adapter)) if (!qlcnic_check_fw_dump_state(adapter))
dump->flag = ETH_FW_DUMP_DISABLE; dump->flag = ETH_FW_DUMP_DISABLE;
else else
dump->flag = fw_dump->tmpl_hdr->drv_cap_mask; dump->flag = fw_dump->cap_mask;
dump->version = adapter->fw_version; dump->version = adapter->fw_version;
return 0; return 0;
...@@ -1671,9 +1671,10 @@ qlcnic_get_dump_data(struct net_device *netdev, struct ethtool_dump *dump, ...@@ -1671,9 +1671,10 @@ qlcnic_get_dump_data(struct net_device *netdev, struct ethtool_dump *dump,
netdev_info(netdev, "Dump not available\n"); netdev_info(netdev, "Dump not available\n");
return -EINVAL; return -EINVAL;
} }
/* Copy template header first */ /* Copy template header first */
copy_sz = fw_dump->tmpl_hdr->size; copy_sz = fw_dump->tmpl_hdr_size;
hdr_ptr = (u32 *) fw_dump->tmpl_hdr; hdr_ptr = (u32 *)fw_dump->tmpl_hdr;
data = buffer; data = buffer;
for (i = 0; i < copy_sz/sizeof(u32); i++) for (i = 0; i < copy_sz/sizeof(u32); i++)
*data++ = cpu_to_le32(*hdr_ptr++); *data++ = cpu_to_le32(*hdr_ptr++);
...@@ -1681,7 +1682,7 @@ qlcnic_get_dump_data(struct net_device *netdev, struct ethtool_dump *dump, ...@@ -1681,7 +1682,7 @@ qlcnic_get_dump_data(struct net_device *netdev, struct ethtool_dump *dump,
/* Copy captured dump data */ /* Copy captured dump data */
memcpy(buffer + copy_sz, fw_dump->data, fw_dump->size); memcpy(buffer + copy_sz, fw_dump->data, fw_dump->size);
dump->len = copy_sz + fw_dump->size; dump->len = copy_sz + fw_dump->size;
dump->flag = fw_dump->tmpl_hdr->drv_cap_mask; dump->flag = fw_dump->cap_mask;
/* Free dump area once data has been captured */ /* Free dump area once data has been captured */
vfree(fw_dump->data); vfree(fw_dump->data);
...@@ -1703,7 +1704,11 @@ static int qlcnic_set_dump_mask(struct qlcnic_adapter *adapter, u32 mask) ...@@ -1703,7 +1704,11 @@ static int qlcnic_set_dump_mask(struct qlcnic_adapter *adapter, u32 mask)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
fw_dump->tmpl_hdr->drv_cap_mask = mask; fw_dump->cap_mask = mask;
/* Store new capture mask in template header as well*/
qlcnic_store_cap_mask(adapter, fw_dump->tmpl_hdr, mask);
netdev_info(netdev, "Driver mask changed to: 0x%x\n", mask); netdev_info(netdev, "Driver mask changed to: 0x%x\n", mask);
return 0; return 0;
} }
......
...@@ -161,6 +161,7 @@ struct qlcnic_host_sds_ring; ...@@ -161,6 +161,7 @@ struct qlcnic_host_sds_ring;
struct qlcnic_host_tx_ring; struct qlcnic_host_tx_ring;
struct qlcnic_hardware_context; struct qlcnic_hardware_context;
struct qlcnic_adapter; struct qlcnic_adapter;
struct qlcnic_fw_dump;
int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong, int *); int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong, int *);
int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *, ulong, u32); int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *, ulong, u32);
...@@ -213,4 +214,11 @@ int qlcnic_82xx_shutdown(struct pci_dev *); ...@@ -213,4 +214,11 @@ int qlcnic_82xx_shutdown(struct pci_dev *);
int qlcnic_82xx_resume(struct qlcnic_adapter *); int qlcnic_82xx_resume(struct qlcnic_adapter *);
void qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter, u8 failed); void qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter, u8 failed);
void qlcnic_fw_poll_work(struct work_struct *work); void qlcnic_fw_poll_work(struct work_struct *work);
u32 qlcnic_82xx_get_saved_state(void *, u32);
void qlcnic_82xx_set_saved_state(void *, u32, u32);
void qlcnic_82xx_cache_tmpl_hdr_values(struct qlcnic_fw_dump *);
u32 qlcnic_82xx_get_cap_size(void *, int);
void qlcnic_82xx_set_sys_info(void *, int, u32);
void qlcnic_82xx_store_cap_mask(void *, u32);
#endif /* __QLCNIC_HW_H_ */ #endif /* __QLCNIC_HW_H_ */
...@@ -90,7 +90,6 @@ static void qlcnic_82xx_io_resume(struct pci_dev *); ...@@ -90,7 +90,6 @@ static void qlcnic_82xx_io_resume(struct pci_dev *);
static void qlcnic_82xx_set_mac_filter_count(struct qlcnic_adapter *); static void qlcnic_82xx_set_mac_filter_count(struct qlcnic_adapter *);
static pci_ers_result_t qlcnic_82xx_io_error_detected(struct pci_dev *, static pci_ers_result_t qlcnic_82xx_io_error_detected(struct pci_dev *,
pci_channel_state_t); pci_channel_state_t);
static u32 qlcnic_vlan_tx_check(struct qlcnic_adapter *adapter) static u32 qlcnic_vlan_tx_check(struct qlcnic_adapter *adapter)
{ {
struct qlcnic_hardware_context *ahw = adapter->ahw; struct qlcnic_hardware_context *ahw = adapter->ahw;
...@@ -561,6 +560,12 @@ static struct qlcnic_hardware_ops qlcnic_hw_ops = { ...@@ -561,6 +560,12 @@ static struct qlcnic_hardware_ops qlcnic_hw_ops = {
.disable_sds_intr = qlcnic_82xx_disable_sds_intr, .disable_sds_intr = qlcnic_82xx_disable_sds_intr,
.enable_tx_intr = qlcnic_82xx_enable_tx_intr, .enable_tx_intr = qlcnic_82xx_enable_tx_intr,
.disable_tx_intr = qlcnic_82xx_disable_tx_intr, .disable_tx_intr = qlcnic_82xx_disable_tx_intr,
.get_saved_state = qlcnic_82xx_get_saved_state,
.set_saved_state = qlcnic_82xx_set_saved_state,
.cache_tmpl_hdr_values = qlcnic_82xx_cache_tmpl_hdr_values,
.get_cap_size = qlcnic_82xx_get_cap_size,
.set_sys_info = qlcnic_82xx_set_sys_info,
.store_cap_mask = qlcnic_82xx_store_cap_mask,
}; };
static int qlcnic_check_multi_tx_capability(struct qlcnic_adapter *adapter) static int qlcnic_check_multi_tx_capability(struct qlcnic_adapter *adapter)
......
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