Skip to content

Commit

Permalink
Merge branch 'qlcnic'
Browse files Browse the repository at this point in the history
Shahed Shaikh says:

====================
This patch series contains -
* Enhanced PVID handling for 84xx adapters by
  not indicating PVID configuration to VF driver and
  keeping VF driver in no VLAN configuration mode becasue
  adapter supports VLAN stripping.
* Removed inappropriate usage of inline keyword.
* Enhanced minidump feature by using firmware recommended
  dump capture mask and using CAMRAM register to store
  firmware dump state.
* AER handling support for 83xx adapter.
* Added support for per port eswitch configuration.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Sep 1, 2013
2 parents eb3c0d8 + 693dcd2 commit ba39767
Show file tree
Hide file tree
Showing 11 changed files with 535 additions and 185 deletions.
29 changes: 24 additions & 5 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@

#define _QLCNIC_LINUX_MAJOR 5
#define _QLCNIC_LINUX_MINOR 3
#define _QLCNIC_LINUX_SUBVERSION 49
#define QLCNIC_LINUX_VERSIONID "5.3.49"
#define _QLCNIC_LINUX_SUBVERSION 50
#define QLCNIC_LINUX_VERSIONID "5.3.50"
#define QLCNIC_DRV_IDC_VER 0x01
#define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\
(_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
Expand Down Expand Up @@ -392,7 +392,7 @@ struct qlcnic_dump_template_hdr {

struct qlcnic_fw_dump {
u8 clr; /* flag to indicate if dump is cleared */
u8 enable; /* enable/disable dump */
bool enable; /* enable/disable dump */
u32 size; /* total size of the dump */
void *data; /* dump data area */
struct qlcnic_dump_template_hdr *tmpl_hdr;
Expand Down Expand Up @@ -463,7 +463,7 @@ struct qlcnic_hardware_context {
struct qlcnic_fdt fdt;
struct qlc_83xx_reset reset;
struct qlc_83xx_idc idc;
struct qlc_83xx_fw_info fw_info;
struct qlc_83xx_fw_info *fw_info;
struct qlcnic_intrpt_config *intr_tbl;
struct qlcnic_sriov *sriov;
u32 *reg_tbl;
Expand Down Expand Up @@ -837,6 +837,7 @@ struct qlcnic_mac_list_s {
#define QLCNIC_FW_CAP2_HW_LRO_IPV6 BIT_3
#define QLCNIC_FW_CAPABILITY_SET_DRV_VER BIT_5
#define QLCNIC_FW_CAPABILITY_2_BEACON BIT_7
#define QLCNIC_FW_CAPABILITY_2_PER_PORT_ESWITCH_CFG BIT_8

/* module types */
#define LINKEVENT_MODULE_NOT_PRESENT 1
Expand Down Expand Up @@ -1184,6 +1185,7 @@ struct qlcnic_pci_info {
};

struct qlcnic_npar_info {
bool eswitch_status;
u16 pvid;
u16 min_bw;
u16 max_bw;
Expand Down Expand Up @@ -1403,7 +1405,6 @@ struct qlcnic_esw_statistics {
struct __qlcnic_esw_statistics tx;
};

#define QLCNIC_DUMP_MASK_DEF 0x1f
#define QLCNIC_FORCE_FW_DUMP_KEY 0xdeadfeed
#define QLCNIC_ENABLE_FW_DUMP 0xaddfeed
#define QLCNIC_DISABLE_FW_DUMP 0xbadfeed
Expand Down Expand Up @@ -1478,6 +1479,12 @@ int qlcnic_wol_supported(struct qlcnic_adapter *adapter);
void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter);
void qlcnic_delete_lb_filters(struct qlcnic_adapter *adapter);
int qlcnic_dump_fw(struct qlcnic_adapter *);
int qlcnic_enable_fw_dump_state(struct qlcnic_adapter *);
bool qlcnic_check_fw_dump_state(struct qlcnic_adapter *);
pci_ers_result_t qlcnic_82xx_io_error_detected(struct pci_dev *,
pci_channel_state_t);
pci_ers_result_t qlcnic_82xx_io_slot_reset(struct pci_dev *);
void qlcnic_82xx_io_resume(struct pci_dev *);

/* Functions from qlcnic_init.c */
void qlcnic_schedule_work(struct qlcnic_adapter *, work_func_t, int);
Expand Down Expand Up @@ -1723,6 +1730,10 @@ struct qlcnic_hardware_ops {
void (*set_mac_filter_count) (struct qlcnic_adapter *);
void (*free_mac_list) (struct qlcnic_adapter *);
int (*read_phys_port_id) (struct qlcnic_adapter *);
pci_ers_result_t (*io_error_detected) (struct pci_dev *,
pci_channel_state_t);
pci_ers_result_t (*io_slot_reset) (struct pci_dev *);
void (*io_resume) (struct pci_dev *);
};

extern struct qlcnic_nic_template qlcnic_vf_ops;
Expand Down Expand Up @@ -2069,6 +2080,14 @@ static inline bool qlcnic_82xx_check(struct qlcnic_adapter *adapter)
return (device == PCI_DEVICE_ID_QLOGIC_QLE824X) ? true : false;
}

static inline bool qlcnic_84xx_check(struct qlcnic_adapter *adapter)
{
unsigned short device = adapter->pdev->device;

return ((device == PCI_DEVICE_ID_QLOGIC_QLE844X) ||
(device == PCI_DEVICE_ID_QLOGIC_VF_QLE844X)) ? true : false;
}

static inline bool qlcnic_83xx_check(struct qlcnic_adapter *adapter)
{
unsigned short device = adapter->pdev->device;
Expand Down
84 changes: 71 additions & 13 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <linux/ipv6.h>
#include <linux/ethtool.h>
#include <linux/interrupt.h>
#include <linux/aer.h>

#define QLCNIC_MAX_TX_QUEUES 1
#define RSS_HASHTYPE_IP_TCP 0x3
Expand Down Expand Up @@ -177,6 +178,10 @@ static struct qlcnic_hardware_ops qlcnic_83xx_hw_ops = {
.get_board_info = qlcnic_83xx_get_port_info,
.set_mac_filter_count = qlcnic_83xx_set_mac_filter_count,
.free_mac_list = qlcnic_82xx_free_mac_list,
.io_error_detected = qlcnic_83xx_io_error_detected,
.io_slot_reset = qlcnic_83xx_io_slot_reset,
.io_resume = qlcnic_83xx_io_resume,

};

static struct qlcnic_nic_template qlcnic_83xx_ops = {
Expand Down Expand Up @@ -723,9 +728,8 @@ void qlcnic_dump_mbx(struct qlcnic_adapter *adapter,
pr_info("\n");
}

static inline void
qlcnic_83xx_poll_for_mbx_completion(struct qlcnic_adapter *adapter,
struct qlcnic_cmd_args *cmd)
static void qlcnic_83xx_poll_for_mbx_completion(struct qlcnic_adapter *adapter,
struct qlcnic_cmd_args *cmd)
{
struct qlcnic_hardware_context *ahw = adapter->ahw;
int opcode = LSW(cmd->req.arg[0]);
Expand Down Expand Up @@ -2327,7 +2331,7 @@ int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *adapter,
pci_info->tx_max_bw, pci_info->mac);
}
if (ahw->op_mode == QLCNIC_MGMT_FUNC)
dev_info(dev, "Max vNIC functions = %d, active vNIC functions = %d\n",
dev_info(dev, "Max functions = %d, active functions = %d\n",
ahw->max_pci_func, ahw->act_pci_func);

} else {
Expand Down Expand Up @@ -3544,7 +3548,7 @@ qlcnic_83xx_notify_cmd_completion(struct qlcnic_adapter *adapter,
complete(&cmd->completion);
}

static inline void qlcnic_83xx_flush_mbx_queue(struct qlcnic_adapter *adapter)
static void qlcnic_83xx_flush_mbx_queue(struct qlcnic_adapter *adapter)
{
struct qlcnic_mailbox *mbx = adapter->ahw->mailbox;
struct list_head *head = &mbx->cmd_q;
Expand All @@ -3564,7 +3568,7 @@ static inline void qlcnic_83xx_flush_mbx_queue(struct qlcnic_adapter *adapter)
spin_unlock(&mbx->queue_lock);
}

static inline int qlcnic_83xx_check_mbx_status(struct qlcnic_adapter *adapter)
static int qlcnic_83xx_check_mbx_status(struct qlcnic_adapter *adapter)
{
struct qlcnic_hardware_context *ahw = adapter->ahw;
struct qlcnic_mailbox *mbx = ahw->mailbox;
Expand Down Expand Up @@ -3592,8 +3596,8 @@ static inline void qlcnic_83xx_signal_mbx_cmd(struct qlcnic_adapter *adapter,
QLCWRX(adapter->ahw, QLCNIC_FW_MBX_CTRL, QLCNIC_CLR_OWNER);
}

static inline void qlcnic_83xx_dequeue_mbx_cmd(struct qlcnic_adapter *adapter,
struct qlcnic_cmd_args *cmd)
static void qlcnic_83xx_dequeue_mbx_cmd(struct qlcnic_adapter *adapter,
struct qlcnic_cmd_args *cmd)
{
struct qlcnic_mailbox *mbx = adapter->ahw->mailbox;

Expand Down Expand Up @@ -3653,9 +3657,9 @@ void qlcnic_83xx_detach_mailbox_work(struct qlcnic_adapter *adapter)
qlcnic_83xx_flush_mbx_queue(adapter);
}

static inline int qlcnic_83xx_enqueue_mbx_cmd(struct qlcnic_adapter *adapter,
struct qlcnic_cmd_args *cmd,
unsigned long *timeout)
static int qlcnic_83xx_enqueue_mbx_cmd(struct qlcnic_adapter *adapter,
struct qlcnic_cmd_args *cmd,
unsigned long *timeout)
{
struct qlcnic_mailbox *mbx = adapter->ahw->mailbox;

Expand All @@ -3680,8 +3684,8 @@ static inline int qlcnic_83xx_enqueue_mbx_cmd(struct qlcnic_adapter *adapter,
return -EBUSY;
}

static inline int qlcnic_83xx_check_mac_rcode(struct qlcnic_adapter *adapter,
struct qlcnic_cmd_args *cmd)
static int qlcnic_83xx_check_mac_rcode(struct qlcnic_adapter *adapter,
struct qlcnic_cmd_args *cmd)
{
u8 mac_cmd_rcode;
u32 fw_data;
Expand Down Expand Up @@ -3820,3 +3824,57 @@ int qlcnic_83xx_init_mailbox_work(struct qlcnic_adapter *adapter)
set_bit(QLC_83XX_MBX_READY, &mbx->status);
return 0;
}

pci_ers_result_t qlcnic_83xx_io_error_detected(struct pci_dev *pdev,
pci_channel_state_t state)
{
struct qlcnic_adapter *adapter = pci_get_drvdata(pdev);

if (state == pci_channel_io_perm_failure)
return PCI_ERS_RESULT_DISCONNECT;

if (state == pci_channel_io_normal)
return PCI_ERS_RESULT_RECOVERED;

set_bit(__QLCNIC_AER, &adapter->state);
set_bit(__QLCNIC_RESETTING, &adapter->state);

qlcnic_83xx_aer_stop_poll_work(adapter);

pci_save_state(pdev);
pci_disable_device(pdev);

return PCI_ERS_RESULT_NEED_RESET;
}

pci_ers_result_t qlcnic_83xx_io_slot_reset(struct pci_dev *pdev)
{
struct qlcnic_adapter *adapter = pci_get_drvdata(pdev);
int err = 0;

pdev->error_state = pci_channel_io_normal;
err = pci_enable_device(pdev);
if (err)
goto disconnect;

pci_set_power_state(pdev, PCI_D0);
pci_set_master(pdev);
pci_restore_state(pdev);

err = qlcnic_83xx_aer_reset(adapter);
if (err == 0)
return PCI_ERS_RESULT_RECOVERED;
disconnect:
clear_bit(__QLCNIC_AER, &adapter->state);
clear_bit(__QLCNIC_RESETTING, &adapter->state);
return PCI_ERS_RESULT_DISCONNECT;
}

void qlcnic_83xx_io_resume(struct pci_dev *pdev)
{
struct qlcnic_adapter *adapter = pci_get_drvdata(pdev);

pci_cleanup_aer_uncorrect_error_status(pdev);
if (test_and_clear_bit(__QLCNIC_AER, &adapter->state))
qlcnic_83xx_aer_start_poll_work(adapter);
}
16 changes: 11 additions & 5 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,7 @@ struct qlcnic_macvlan_mbx {

struct qlc_83xx_fw_info {
const struct firmware *fw;
u16 major_fw_version;
u8 minor_fw_version;
u8 sub_fw_version;
u8 fw_build_num;
u8 load_from_file;
char fw_file_name[QLC_FW_FILE_NAME_LEN];
};

struct qlc_83xx_reset {
Expand All @@ -297,6 +293,7 @@ struct qlc_83xx_reset {

#define QLC_83XX_IDC_DISABLE_FW_RESET_RECOVERY 0x1
#define QLC_83XX_IDC_GRACEFULL_RESET 0x2
#define QLC_83XX_IDC_DISABLE_FW_DUMP 0x4
#define QLC_83XX_IDC_TIMESTAMP 0
#define QLC_83XX_IDC_DURATION 1
#define QLC_83XX_IDC_INIT_TIMEOUT_SECS 30
Expand Down Expand Up @@ -414,6 +411,7 @@ enum qlcnic_83xx_states {
#define QLC_83XX_GET_HW_LRO_CAPABILITY(val) (val & 0x400)
#define QLC_83XX_GET_VLAN_ALIGN_CAPABILITY(val) (val & 0x4000)
#define QLC_83XX_GET_FW_LRO_MSS_CAPABILITY(val) (val & 0x20000)
#define QLC_83XX_ESWITCH_CAPABILITY BIT_23
#define QLC_83XX_VIRTUAL_NIC_MODE 0xFF
#define QLC_83XX_DEFAULT_MODE 0x0
#define QLC_83XX_SRIOV_MODE 0x1
Expand Down Expand Up @@ -628,6 +626,7 @@ int qlcnic_83xx_config_vnic_opmode(struct qlcnic_adapter *);
int qlcnic_83xx_get_vnic_vport_info(struct qlcnic_adapter *,
struct qlcnic_info *, u8);
int qlcnic_83xx_get_vnic_pf_info(struct qlcnic_adapter *, struct qlcnic_info *);
int qlcnic_83xx_enable_port_eswitch(struct qlcnic_adapter *, int);

void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *);
void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data);
Expand Down Expand Up @@ -656,4 +655,11 @@ int qlcnic_83xx_idc_init(struct qlcnic_adapter *);
int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *);
int qlcnic_83xx_set_vnic_opmode(struct qlcnic_adapter *);
int qlcnic_83xx_check_vnic_state(struct qlcnic_adapter *);
void qlcnic_83xx_aer_stop_poll_work(struct qlcnic_adapter *);
int qlcnic_83xx_aer_reset(struct qlcnic_adapter *);
void qlcnic_83xx_aer_start_poll_work(struct qlcnic_adapter *);
pci_ers_result_t qlcnic_83xx_io_error_detected(struct pci_dev *,
pci_channel_state_t);
pci_ers_result_t qlcnic_83xx_io_slot_reset(struct pci_dev *);
void qlcnic_83xx_io_resume(struct pci_dev *);
#endif
Loading

0 comments on commit ba39767

Please sign in to comment.