Commit 92352df1 authored by David S. Miller's avatar David S. Miller

Merge branch 'qlcnic'

Rajesh Borundia says:

====================
* "qlcnic: Change 82xx adapter VLAN id endian type".
  - Adapter requires VLAN id in little endian. VLAN id was being
    converted to __le16 and then passed as a parameter. Pass VLAN id
    as u16 and then use cpu_to_le16 at appropriate places. It is
    appropriate for net-next as SR-IOV patches have a dependency on it.
* "qlcnic: Fix loopback test for SR-IOV PF".
  - It is appropriate for net-next as change is needed for SRIOV PF
    only.
* Remaining patches add enhancements to SR-IOV functionality like
  - FLR handling
  - Adapter reset recovery handling
  - iproute2 tool support for configuring MAC address, Tx rate and
    VLAN id.
  - Mailbox polling support for SR-IOV PF in case mailbox interrupts
    are disabled.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 42bbcb78 c6376278
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
#define _QLCNIC_LINUX_MAJOR 5 #define _QLCNIC_LINUX_MAJOR 5
#define _QLCNIC_LINUX_MINOR 2 #define _QLCNIC_LINUX_MINOR 2
#define _QLCNIC_LINUX_SUBVERSION 40 #define _QLCNIC_LINUX_SUBVERSION 41
#define QLCNIC_LINUX_VERSIONID "5.2.40" #define QLCNIC_LINUX_VERSIONID "5.2.41"
#define QLCNIC_DRV_IDC_VER 0x01 #define QLCNIC_DRV_IDC_VER 0x01
#define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ #define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\
(_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
...@@ -919,6 +919,7 @@ struct qlcnic_ipaddr { ...@@ -919,6 +919,7 @@ struct qlcnic_ipaddr {
#define __QLCNIC_ELB_INPROGRESS 8 #define __QLCNIC_ELB_INPROGRESS 8
#define __QLCNIC_SRIOV_ENABLE 10 #define __QLCNIC_SRIOV_ENABLE 10
#define __QLCNIC_SRIOV_CAPABLE 11 #define __QLCNIC_SRIOV_CAPABLE 11
#define __QLCNIC_MBX_POLL_ENABLE 12
#define QLCNIC_INTERRUPT_TEST 1 #define QLCNIC_INTERRUPT_TEST 1
#define QLCNIC_LOOPBACK_TEST 2 #define QLCNIC_LOOPBACK_TEST 2
...@@ -939,7 +940,7 @@ struct qlcnic_ipaddr { ...@@ -939,7 +940,7 @@ struct qlcnic_ipaddr {
struct qlcnic_filter { struct qlcnic_filter {
struct hlist_node fnode; struct hlist_node fnode;
u8 faddr[ETH_ALEN]; u8 faddr[ETH_ALEN];
__le16 vlan_id; u16 vlan_id;
unsigned long ftime; unsigned long ftime;
}; };
...@@ -976,9 +977,11 @@ struct qlcnic_adapter { ...@@ -976,9 +977,11 @@ struct qlcnic_adapter {
u8 fw_fail_cnt; u8 fw_fail_cnt;
u8 tx_timeo_cnt; u8 tx_timeo_cnt;
u8 need_fw_reset; u8 need_fw_reset;
u8 reset_ctx_cnt;
u16 is_up; u16 is_up;
u16 pvid; u16 rx_pvid;
u16 tx_pvid;
u32 irq; u32 irq;
u32 heartbeat; u32 heartbeat;
...@@ -1010,6 +1013,7 @@ struct qlcnic_adapter { ...@@ -1010,6 +1013,7 @@ struct qlcnic_adapter {
struct workqueue_struct *qlcnic_wq; struct workqueue_struct *qlcnic_wq;
struct delayed_work fw_work; struct delayed_work fw_work;
struct delayed_work idc_aen_work; struct delayed_work idc_aen_work;
struct delayed_work mbx_poll_work;
struct qlcnic_filter_hash fhash; struct qlcnic_filter_hash fhash;
struct qlcnic_filter_hash rx_fhash; struct qlcnic_filter_hash rx_fhash;
...@@ -1444,10 +1448,10 @@ void qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, ...@@ -1444,10 +1448,10 @@ void qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter,
struct qlcnic_host_rds_ring *rds_ring, u8 ring_id); struct qlcnic_host_rds_ring *rds_ring, u8 ring_id);
int qlcnic_process_rcv_ring(struct qlcnic_host_sds_ring *sds_ring, int max); int qlcnic_process_rcv_ring(struct qlcnic_host_sds_ring *sds_ring, int max);
void qlcnic_set_multi(struct net_device *netdev); void qlcnic_set_multi(struct net_device *netdev);
void __qlcnic_set_multi(struct net_device *netdev); void __qlcnic_set_multi(struct net_device *, u16);
int qlcnic_nic_add_mac(struct qlcnic_adapter *, const u8 *); int qlcnic_nic_add_mac(struct qlcnic_adapter *, const u8 *, u16);
int qlcnic_nic_del_mac(struct qlcnic_adapter *, const u8 *); int qlcnic_nic_del_mac(struct qlcnic_adapter *, const u8 *);
void qlcnic_free_mac_list(struct qlcnic_adapter *adapter); void qlcnic_82xx_free_mac_list(struct qlcnic_adapter *adapter);
int qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu); int qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu);
int qlcnic_fw_cmd_set_drv_version(struct qlcnic_adapter *); int qlcnic_fw_cmd_set_drv_version(struct qlcnic_adapter *);
...@@ -1524,13 +1528,12 @@ int qlcnic_init_pci_info(struct qlcnic_adapter *); ...@@ -1524,13 +1528,12 @@ int qlcnic_init_pci_info(struct qlcnic_adapter *);
int qlcnic_set_default_offload_settings(struct qlcnic_adapter *); int qlcnic_set_default_offload_settings(struct qlcnic_adapter *);
int qlcnic_reset_npar_config(struct qlcnic_adapter *); int qlcnic_reset_npar_config(struct qlcnic_adapter *);
int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *); int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *);
void qlcnic_add_lb_filter(struct qlcnic_adapter *, struct sk_buff *, int, void qlcnic_add_lb_filter(struct qlcnic_adapter *, struct sk_buff *, int, u16);
__le16);
int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter); int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter);
int qlcnic_read_mac_addr(struct qlcnic_adapter *); int qlcnic_read_mac_addr(struct qlcnic_adapter *);
int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *, int); int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *, int);
void qlcnic_sriov_vf_schedule_multi(struct net_device *); void qlcnic_sriov_vf_schedule_multi(struct net_device *);
void qlcnic_vf_add_mc_list(struct net_device *); void qlcnic_vf_add_mc_list(struct net_device *, u16);
/* /*
* QLOGIC Board information * QLOGIC Board information
...@@ -1595,7 +1598,7 @@ struct qlcnic_hardware_ops { ...@@ -1595,7 +1598,7 @@ struct qlcnic_hardware_ops {
int (*get_nic_info) (struct qlcnic_adapter *, struct qlcnic_info *, u8); int (*get_nic_info) (struct qlcnic_adapter *, struct qlcnic_info *, u8);
int (*get_pci_info) (struct qlcnic_adapter *, struct qlcnic_pci_info *); int (*get_pci_info) (struct qlcnic_adapter *, struct qlcnic_pci_info *);
int (*set_nic_info) (struct qlcnic_adapter *, struct qlcnic_info *); int (*set_nic_info) (struct qlcnic_adapter *, struct qlcnic_info *);
int (*change_macvlan) (struct qlcnic_adapter *, u8*, __le16, u8); int (*change_macvlan) (struct qlcnic_adapter *, u8*, u16, u8);
void (*napi_enable) (struct qlcnic_adapter *); void (*napi_enable) (struct qlcnic_adapter *);
void (*napi_disable) (struct qlcnic_adapter *); void (*napi_disable) (struct qlcnic_adapter *);
void (*config_intr_coal) (struct qlcnic_adapter *); void (*config_intr_coal) (struct qlcnic_adapter *);
...@@ -1604,8 +1607,9 @@ struct qlcnic_hardware_ops { ...@@ -1604,8 +1607,9 @@ struct qlcnic_hardware_ops {
int (*config_loopback) (struct qlcnic_adapter *, u8); int (*config_loopback) (struct qlcnic_adapter *, u8);
int (*clear_loopback) (struct qlcnic_adapter *, u8); int (*clear_loopback) (struct qlcnic_adapter *, u8);
int (*config_promisc_mode) (struct qlcnic_adapter *, u32); int (*config_promisc_mode) (struct qlcnic_adapter *, u32);
void (*change_l2_filter) (struct qlcnic_adapter *, u64 *, __le16); void (*change_l2_filter) (struct qlcnic_adapter *, u64 *, u16);
int (*get_board_info) (struct qlcnic_adapter *); int (*get_board_info) (struct qlcnic_adapter *);
void (*free_mac_list) (struct qlcnic_adapter *);
}; };
extern struct qlcnic_nic_template qlcnic_vf_ops; extern struct qlcnic_nic_template qlcnic_vf_ops;
...@@ -1746,7 +1750,7 @@ static inline int qlcnic_set_nic_info(struct qlcnic_adapter *adapter, ...@@ -1746,7 +1750,7 @@ static inline int qlcnic_set_nic_info(struct qlcnic_adapter *adapter,
} }
static inline int qlcnic_sre_macaddr_change(struct qlcnic_adapter *adapter, static inline int qlcnic_sre_macaddr_change(struct qlcnic_adapter *adapter,
u8 *addr, __le16 id, u8 cmd) u8 *addr, u16 id, u8 cmd)
{ {
return adapter->ahw->hw_ops->change_macvlan(adapter, addr, id, cmd); return adapter->ahw->hw_ops->change_macvlan(adapter, addr, id, cmd);
} }
...@@ -1805,7 +1809,7 @@ static inline int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter, ...@@ -1805,7 +1809,7 @@ static inline int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter,
} }
static inline void qlcnic_change_filter(struct qlcnic_adapter *adapter, static inline void qlcnic_change_filter(struct qlcnic_adapter *adapter,
u64 *addr, __le16 id) u64 *addr, u16 id)
{ {
adapter->ahw->hw_ops->change_l2_filter(adapter, addr, id); adapter->ahw->hw_ops->change_l2_filter(adapter, addr, id);
} }
...@@ -1815,6 +1819,11 @@ static inline int qlcnic_get_board_info(struct qlcnic_adapter *adapter) ...@@ -1815,6 +1819,11 @@ static inline int qlcnic_get_board_info(struct qlcnic_adapter *adapter)
return adapter->ahw->hw_ops->get_board_info(adapter); return adapter->ahw->hw_ops->get_board_info(adapter);
} }
static inline void qlcnic_free_mac_list(struct qlcnic_adapter *adapter)
{
return adapter->ahw->hw_ops->free_mac_list(adapter);
}
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)
{ {
...@@ -1861,6 +1870,7 @@ static inline void qlcnic_enable_int(struct qlcnic_host_sds_ring *sds_ring) ...@@ -1861,6 +1870,7 @@ static inline void qlcnic_enable_int(struct qlcnic_host_sds_ring *sds_ring)
writel(0xfbff, adapter->tgt_mask_reg); writel(0xfbff, adapter->tgt_mask_reg);
} }
extern const struct ethtool_ops qlcnic_sriov_vf_ethtool_ops;
extern const struct ethtool_ops qlcnic_ethtool_ops; extern const struct ethtool_ops qlcnic_ethtool_ops;
extern const struct ethtool_ops qlcnic_ethtool_failed_ops; extern const struct ethtool_ops qlcnic_ethtool_failed_ops;
......
...@@ -172,6 +172,7 @@ static struct qlcnic_hardware_ops qlcnic_83xx_hw_ops = { ...@@ -172,6 +172,7 @@ static struct qlcnic_hardware_ops qlcnic_83xx_hw_ops = {
.config_promisc_mode = qlcnic_83xx_nic_set_promisc, .config_promisc_mode = qlcnic_83xx_nic_set_promisc,
.change_l2_filter = qlcnic_83xx_change_l2_filter, .change_l2_filter = qlcnic_83xx_change_l2_filter,
.get_board_info = qlcnic_83xx_get_port_info, .get_board_info = qlcnic_83xx_get_port_info,
.free_mac_list = qlcnic_82xx_free_mac_list,
}; };
static struct qlcnic_nic_template qlcnic_83xx_ops = { static struct qlcnic_nic_template qlcnic_83xx_ops = {
...@@ -339,12 +340,13 @@ inline void qlcnic_83xx_enable_legacy_msix_mbx_intr(struct qlcnic_adapter ...@@ -339,12 +340,13 @@ inline void qlcnic_83xx_enable_legacy_msix_mbx_intr(struct qlcnic_adapter
writel(0, adapter->ahw->pci_base0 + mask); writel(0, adapter->ahw->pci_base0 + mask);
} }
inline void qlcnic_83xx_disable_mbx_intr(struct qlcnic_adapter *adapter) void qlcnic_83xx_disable_mbx_intr(struct qlcnic_adapter *adapter)
{ {
u32 mask; u32 mask;
mask = QLCRDX(adapter->ahw, QLCNIC_DEF_INT_MASK); mask = QLCRDX(adapter->ahw, QLCNIC_DEF_INT_MASK);
writel(1, adapter->ahw->pci_base0 + mask); writel(1, adapter->ahw->pci_base0 + mask);
QLCWRX(adapter->ahw, QLCNIC_MBX_INTR_ENBL, 0);
} }
static inline void qlcnic_83xx_get_mbx_data(struct qlcnic_adapter *adapter, static inline void qlcnic_83xx_get_mbx_data(struct qlcnic_adapter *adapter,
...@@ -400,7 +402,8 @@ static void qlcnic_83xx_poll_process_aen(struct qlcnic_adapter *adapter) ...@@ -400,7 +402,8 @@ static void qlcnic_83xx_poll_process_aen(struct qlcnic_adapter *adapter)
event = readl(QLCNIC_MBX_FW(adapter->ahw, 0)); event = readl(QLCNIC_MBX_FW(adapter->ahw, 0));
if (event & QLCNIC_MBX_ASYNC_EVENT) if (event & QLCNIC_MBX_ASYNC_EVENT)
qlcnic_83xx_process_aen(adapter); __qlcnic_83xx_process_aen(adapter);
out: out:
qlcnic_83xx_enable_legacy_msix_mbx_intr(adapter); qlcnic_83xx_enable_legacy_msix_mbx_intr(adapter);
spin_unlock_irqrestore(&adapter->ahw->mbx_lock, flags); spin_unlock_irqrestore(&adapter->ahw->mbx_lock, flags);
...@@ -453,17 +456,15 @@ irqreturn_t qlcnic_83xx_tmp_intr(int irq, void *data) ...@@ -453,17 +456,15 @@ irqreturn_t qlcnic_83xx_tmp_intr(int irq, void *data)
void qlcnic_83xx_free_mbx_intr(struct qlcnic_adapter *adapter) void qlcnic_83xx_free_mbx_intr(struct qlcnic_adapter *adapter)
{ {
u32 val = 0, num_msix = adapter->ahw->num_msix - 1; u32 num_msix;
qlcnic_83xx_disable_mbx_intr(adapter);
if (adapter->flags & QLCNIC_MSIX_ENABLED) if (adapter->flags & QLCNIC_MSIX_ENABLED)
num_msix = adapter->ahw->num_msix - 1; num_msix = adapter->ahw->num_msix - 1;
else else
num_msix = 0; num_msix = 0;
QLCWRX(adapter->ahw, QLCNIC_MBX_INTR_ENBL, val);
qlcnic_83xx_disable_mbx_intr(adapter);
msleep(20); msleep(20);
synchronize_irq(adapter->msix_entries[num_msix].vector); synchronize_irq(adapter->msix_entries[num_msix].vector);
free_irq(adapter->msix_entries[num_msix].vector, adapter); free_irq(adapter->msix_entries[num_msix].vector, adapter);
...@@ -758,7 +759,7 @@ int qlcnic_83xx_mbx_op(struct qlcnic_adapter *adapter, ...@@ -758,7 +759,7 @@ int qlcnic_83xx_mbx_op(struct qlcnic_adapter *adapter,
/* Get the FW response data */ /* Get the FW response data */
fw_data = readl(QLCNIC_MBX_FW(ahw, 0)); fw_data = readl(QLCNIC_MBX_FW(ahw, 0));
if (fw_data & QLCNIC_MBX_ASYNC_EVENT) { if (fw_data & QLCNIC_MBX_ASYNC_EVENT) {
qlcnic_83xx_process_aen(adapter); __qlcnic_83xx_process_aen(adapter);
mbx_val = QLCRDX(ahw, QLCNIC_HOST_MBX_CTRL); mbx_val = QLCRDX(ahw, QLCNIC_HOST_MBX_CTRL);
if (mbx_val) if (mbx_val)
goto poll; goto poll;
...@@ -862,7 +863,7 @@ static void qlcnic_83xx_handle_idc_comp_aen(struct qlcnic_adapter *adapter, ...@@ -862,7 +863,7 @@ static void qlcnic_83xx_handle_idc_comp_aen(struct qlcnic_adapter *adapter,
return; return;
} }
void qlcnic_83xx_process_aen(struct qlcnic_adapter *adapter) void __qlcnic_83xx_process_aen(struct qlcnic_adapter *adapter)
{ {
u32 event[QLC_83XX_MBX_AEN_CNT]; u32 event[QLC_83XX_MBX_AEN_CNT];
int i; int i;
...@@ -907,6 +908,53 @@ void qlcnic_83xx_process_aen(struct qlcnic_adapter *adapter) ...@@ -907,6 +908,53 @@ void qlcnic_83xx_process_aen(struct qlcnic_adapter *adapter)
QLCWRX(ahw, QLCNIC_FW_MBX_CTRL, QLCNIC_CLR_OWNER); QLCWRX(ahw, QLCNIC_FW_MBX_CTRL, QLCNIC_CLR_OWNER);
} }
static void qlcnic_83xx_process_aen(struct qlcnic_adapter *adapter)
{
struct qlcnic_hardware_context *ahw = adapter->ahw;
u32 resp, event;
unsigned long flags;
spin_lock_irqsave(&ahw->mbx_lock, flags);
resp = QLCRDX(ahw, QLCNIC_FW_MBX_CTRL);
if (resp & QLCNIC_SET_OWNER) {
event = readl(QLCNIC_MBX_FW(ahw, 0));
if (event & QLCNIC_MBX_ASYNC_EVENT)
__qlcnic_83xx_process_aen(adapter);
}
spin_unlock_irqrestore(&ahw->mbx_lock, flags);
}
static void qlcnic_83xx_mbx_poll_work(struct work_struct *work)
{
struct qlcnic_adapter *adapter;
adapter = container_of(work, struct qlcnic_adapter, mbx_poll_work.work);
if (!test_bit(__QLCNIC_MBX_POLL_ENABLE, &adapter->state))
return;
qlcnic_83xx_process_aen(adapter);
queue_delayed_work(adapter->qlcnic_wq, &adapter->mbx_poll_work,
(HZ / 10));
}
void qlcnic_83xx_enable_mbx_poll(struct qlcnic_adapter *adapter)
{
if (test_and_set_bit(__QLCNIC_MBX_POLL_ENABLE, &adapter->state))
return;
INIT_DELAYED_WORK(&adapter->mbx_poll_work, qlcnic_83xx_mbx_poll_work);
}
void qlcnic_83xx_disable_mbx_poll(struct qlcnic_adapter *adapter)
{
if (!test_and_clear_bit(__QLCNIC_MBX_POLL_ENABLE, &adapter->state))
return;
cancel_delayed_work_sync(&adapter->mbx_poll_work);
}
static int qlcnic_83xx_add_rings(struct qlcnic_adapter *adapter) static int qlcnic_83xx_add_rings(struct qlcnic_adapter *adapter)
{ {
int index, i, err, sds_mbx_size; int index, i, err, sds_mbx_size;
...@@ -1274,7 +1322,8 @@ static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test) ...@@ -1274,7 +1322,8 @@ static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test)
if (adapter->ahw->diag_test == QLCNIC_LOOPBACK_TEST) { if (adapter->ahw->diag_test == QLCNIC_LOOPBACK_TEST) {
/* disable and free mailbox interrupt */ /* disable and free mailbox interrupt */
qlcnic_83xx_free_mbx_intr(adapter); if (!(adapter->flags & QLCNIC_MSIX_ENABLED))
qlcnic_83xx_free_mbx_intr(adapter);
adapter->ahw->loopback_state = 0; adapter->ahw->loopback_state = 0;
adapter->ahw->hw_ops->setup_link_event(adapter, 1); adapter->ahw->hw_ops->setup_link_event(adapter, 1);
} }
...@@ -1302,12 +1351,14 @@ static void qlcnic_83xx_diag_free_res(struct net_device *netdev, ...@@ -1302,12 +1351,14 @@ static void qlcnic_83xx_diag_free_res(struct net_device *netdev,
qlcnic_detach(adapter); qlcnic_detach(adapter);
if (adapter->ahw->diag_test == QLCNIC_LOOPBACK_TEST) { if (adapter->ahw->diag_test == QLCNIC_LOOPBACK_TEST) {
err = qlcnic_83xx_setup_mbx_intr(adapter); if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) {
if (err) { err = qlcnic_83xx_setup_mbx_intr(adapter);
dev_err(&adapter->pdev->dev, if (err) {
"%s: failed to setup mbx interrupt\n", dev_err(&adapter->pdev->dev,
__func__); "%s: failed to setup mbx interrupt\n",
goto out; __func__);
goto out;
}
} }
} }
adapter->ahw->diag_test = 0; adapter->ahw->diag_test = 0;
...@@ -1556,7 +1607,9 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode) ...@@ -1556,7 +1607,9 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode)
/* Poll for link up event before running traffic */ /* Poll for link up event before running traffic */
do { do {
msleep(500); msleep(500);
qlcnic_83xx_process_aen(adapter); if (!(adapter->flags & QLCNIC_MSIX_ENABLED))
qlcnic_83xx_process_aen(adapter);
if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP) { if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP) {
dev_info(&adapter->pdev->dev, dev_info(&adapter->pdev->dev,
"Firmware didn't sent link up event to loopback request\n"); "Firmware didn't sent link up event to loopback request\n");
...@@ -1610,7 +1663,9 @@ int qlcnic_83xx_set_lb_mode(struct qlcnic_adapter *adapter, u8 mode) ...@@ -1610,7 +1663,9 @@ int qlcnic_83xx_set_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
/* Wait for Link and IDC Completion AEN */ /* Wait for Link and IDC Completion AEN */
do { do {
msleep(300); msleep(300);
qlcnic_83xx_process_aen(adapter); if (!(adapter->flags & QLCNIC_MSIX_ENABLED))
qlcnic_83xx_process_aen(adapter);
if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP) { if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"FW did not generate IDC completion AEN\n"); "FW did not generate IDC completion AEN\n");
...@@ -1650,7 +1705,9 @@ int qlcnic_83xx_clear_lb_mode(struct qlcnic_adapter *adapter, u8 mode) ...@@ -1650,7 +1705,9 @@ int qlcnic_83xx_clear_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
/* Wait for Link and IDC Completion AEN */ /* Wait for Link and IDC Completion AEN */
do { do {
msleep(300); msleep(300);
qlcnic_83xx_process_aen(adapter); if (!(adapter->flags & QLCNIC_MSIX_ENABLED))
qlcnic_83xx_process_aen(adapter);
if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP) { if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"Firmware didn't sent IDC completion AEN\n"); "Firmware didn't sent IDC completion AEN\n");
...@@ -1784,7 +1841,7 @@ static void qlcnic_83xx_set_interface_id_macaddr(struct qlcnic_adapter *adapter, ...@@ -1784,7 +1841,7 @@ static void qlcnic_83xx_set_interface_id_macaddr(struct qlcnic_adapter *adapter,
} }
int qlcnic_83xx_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr, int qlcnic_83xx_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr,
__le16 vlan_id, u8 op) u16 vlan_id, u8 op)
{ {
int err; int err;
u32 *buf, temp = 0; u32 *buf, temp = 0;
...@@ -1798,10 +1855,14 @@ int qlcnic_83xx_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr, ...@@ -1798,10 +1855,14 @@ int qlcnic_83xx_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr,
if (err) if (err)
return err; return err;
if (vlan_id)
op = (op == QLCNIC_MAC_ADD || op == QLCNIC_MAC_VLAN_ADD) ?
QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_VLAN_DEL;
cmd.req.arg[1] = op | (1 << 8); cmd.req.arg[1] = op | (1 << 8);
qlcnic_83xx_set_interface_id_macaddr(adapter, &temp); qlcnic_83xx_set_interface_id_macaddr(adapter, &temp);
cmd.req.arg[1] |= temp; cmd.req.arg[1] |= temp;
mv.vlan = le16_to_cpu(vlan_id); mv.vlan = vlan_id;
mv.mac_addr0 = addr[0]; mv.mac_addr0 = addr[0];
mv.mac_addr1 = addr[1]; mv.mac_addr1 = addr[1];
mv.mac_addr2 = addr[2]; mv.mac_addr2 = addr[2];
...@@ -1820,7 +1881,7 @@ int qlcnic_83xx_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr, ...@@ -1820,7 +1881,7 @@ int qlcnic_83xx_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr,
} }
void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr, void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr,
__le16 vlan_id) u16 vlan_id)
{ {
u8 mac[ETH_ALEN]; u8 mac[ETH_ALEN];
memcpy(&mac, addr, ETH_ALEN); memcpy(&mac, addr, ETH_ALEN);
...@@ -1920,7 +1981,7 @@ irqreturn_t qlcnic_83xx_handle_aen(int irq, void *data) ...@@ -1920,7 +1981,7 @@ irqreturn_t qlcnic_83xx_handle_aen(int irq, void *data)
event = readl(QLCNIC_MBX_FW(adapter->ahw, 0)); event = readl(QLCNIC_MBX_FW(adapter->ahw, 0));
if (event & QLCNIC_MBX_ASYNC_EVENT) if (event & QLCNIC_MBX_ASYNC_EVENT)
qlcnic_83xx_process_aen(adapter); __qlcnic_83xx_process_aen(adapter);
out: out:
mask = QLCRDX(adapter->ahw, QLCNIC_DEF_INT_MASK); mask = QLCRDX(adapter->ahw, QLCNIC_DEF_INT_MASK);
writel(0, adapter->ahw->pci_base0 + mask); writel(0, adapter->ahw->pci_base0 + mask);
......
...@@ -317,6 +317,18 @@ struct qlc_83xx_idc { ...@@ -317,6 +317,18 @@ struct qlc_83xx_idc {
char **name; char **name;
}; };
/* Device States */
enum qlcnic_83xx_states {
QLC_83XX_IDC_DEV_UNKNOWN,
QLC_83XX_IDC_DEV_COLD,
QLC_83XX_IDC_DEV_INIT,
QLC_83XX_IDC_DEV_READY,
QLC_83XX_IDC_DEV_NEED_RESET,
QLC_83XX_IDC_DEV_NEED_QUISCENT,
QLC_83XX_IDC_DEV_FAILED,
QLC_83XX_IDC_DEV_QUISCENT
};
#define QLCNIC_MBX_RSP(reg) LSW(reg) #define QLCNIC_MBX_RSP(reg) LSW(reg)
#define QLCNIC_MBX_NUM_REGS(reg) (MSW(reg) & 0x1FF) #define QLCNIC_MBX_NUM_REGS(reg) (MSW(reg) & 0x1FF)
#define QLCNIC_MBX_STATUS(reg) (((reg) >> 25) & 0x7F) #define QLCNIC_MBX_STATUS(reg) (((reg) >> 25) & 0x7F)
...@@ -501,7 +513,7 @@ int qlcnic_83xx_clear_lb_mode(struct qlcnic_adapter *, u8); ...@@ -501,7 +513,7 @@ int qlcnic_83xx_clear_lb_mode(struct qlcnic_adapter *, u8);
int qlcnic_83xx_config_hw_lro(struct qlcnic_adapter *, int); int qlcnic_83xx_config_hw_lro(struct qlcnic_adapter *, int);
int qlcnic_83xx_config_rss(struct qlcnic_adapter *, int); int qlcnic_83xx_config_rss(struct qlcnic_adapter *, int);
int qlcnic_83xx_config_intr_coalesce(struct qlcnic_adapter *); int qlcnic_83xx_config_intr_coalesce(struct qlcnic_adapter *);
void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *, u64 *, __le16); void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *, u64 *, u16);
int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info *); int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info *);
int qlcnic_83xx_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *); int qlcnic_83xx_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *);
void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *, int); void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *, int);
...@@ -523,7 +535,7 @@ int qlcnic_83xx_get_nic_info(struct qlcnic_adapter *, struct qlcnic_info *, u8); ...@@ -523,7 +535,7 @@ int qlcnic_83xx_get_nic_info(struct qlcnic_adapter *, struct qlcnic_info *, u8);
int qlcnic_83xx_setup_link_event(struct qlcnic_adapter *, int); int qlcnic_83xx_setup_link_event(struct qlcnic_adapter *, int);
void qlcnic_83xx_process_rcv_ring_diag(struct qlcnic_host_sds_ring *); void qlcnic_83xx_process_rcv_ring_diag(struct qlcnic_host_sds_ring *);
int qlcnic_83xx_config_intrpt(struct qlcnic_adapter *, bool); int qlcnic_83xx_config_intrpt(struct qlcnic_adapter *, bool);
int qlcnic_83xx_sre_macaddr_change(struct qlcnic_adapter *, u8 *, __le16, u8); int qlcnic_83xx_sre_macaddr_change(struct qlcnic_adapter *, u8 *, u16, u8);
int qlcnic_83xx_get_mac_address(struct qlcnic_adapter *, u8 *); int qlcnic_83xx_get_mac_address(struct qlcnic_adapter *, u8 *);
void qlcnic_83xx_configure_mac(struct qlcnic_adapter *, u8 *, u8, void qlcnic_83xx_configure_mac(struct qlcnic_adapter *, u8 *, u8,
struct qlcnic_cmd_args *); struct qlcnic_cmd_args *);
...@@ -536,6 +548,7 @@ void qlcnic_83xx_config_intr_coal(struct qlcnic_adapter *); ...@@ -536,6 +548,7 @@ void qlcnic_83xx_config_intr_coal(struct qlcnic_adapter *);
irqreturn_t qlcnic_83xx_handle_aen(int, void *); irqreturn_t qlcnic_83xx_handle_aen(int, void *);
int qlcnic_83xx_get_port_info(struct qlcnic_adapter *); int qlcnic_83xx_get_port_info(struct qlcnic_adapter *);
void qlcnic_83xx_enable_mbx_intrpt(struct qlcnic_adapter *); void qlcnic_83xx_enable_mbx_intrpt(struct qlcnic_adapter *);
void qlcnic_83xx_disable_mbx_intr(struct qlcnic_adapter *);
irqreturn_t qlcnic_83xx_clear_legacy_intr(struct qlcnic_adapter *); irqreturn_t qlcnic_83xx_clear_legacy_intr(struct qlcnic_adapter *);
irqreturn_t qlcnic_83xx_intr(int, void *); irqreturn_t qlcnic_83xx_intr(int, void *);
irqreturn_t qlcnic_83xx_tmp_intr(int, void *); irqreturn_t qlcnic_83xx_tmp_intr(int, void *);
...@@ -545,7 +558,7 @@ void qlcnic_83xx_disable_intr(struct qlcnic_adapter *, ...@@ -545,7 +558,7 @@ void qlcnic_83xx_disable_intr(struct qlcnic_adapter *,
struct qlcnic_host_sds_ring *); struct qlcnic_host_sds_ring *);
void qlcnic_83xx_check_vf(struct qlcnic_adapter *, void qlcnic_83xx_check_vf(struct qlcnic_adapter *,
const struct pci_device_id *); const struct pci_device_id *);
void qlcnic_83xx_process_aen(struct qlcnic_adapter *); void __qlcnic_83xx_process_aen(struct qlcnic_adapter *);
int qlcnic_83xx_get_port_config(struct qlcnic_adapter *); int qlcnic_83xx_get_port_config(struct qlcnic_adapter *);
int qlcnic_83xx_set_port_config(struct qlcnic_adapter *); int qlcnic_83xx_set_port_config(struct qlcnic_adapter *);
int qlcnic_enable_eswitch(struct qlcnic_adapter *, u8, u8); int qlcnic_enable_eswitch(struct qlcnic_adapter *, u8, u8);
...@@ -608,4 +621,6 @@ int qlcnic_83xx_enable_flash_write(struct qlcnic_adapter *); ...@@ -608,4 +621,6 @@ int qlcnic_83xx_enable_flash_write(struct qlcnic_adapter *);
int qlcnic_83xx_disable_flash_write(struct qlcnic_adapter *); int qlcnic_83xx_disable_flash_write(struct qlcnic_adapter *);
u32 qlcnic_83xx_mac_rcode(struct qlcnic_adapter *); u32 qlcnic_83xx_mac_rcode(struct qlcnic_adapter *);
u32 qlcnic_83xx_mbx_poll(struct qlcnic_adapter *); u32 qlcnic_83xx_mbx_poll(struct qlcnic_adapter *);
void qlcnic_83xx_enable_mbx_poll(struct qlcnic_adapter *);
void qlcnic_83xx_disable_mbx_poll(struct qlcnic_adapter *);
#endif #endif
...@@ -115,18 +115,6 @@ static const char *const qlc_83xx_idc_states[] = { ...@@ -115,18 +115,6 @@ static const char *const qlc_83xx_idc_states[] = {
"Quiesce" "Quiesce"
}; };
/* Device States */
enum qlcnic_83xx_states {
QLC_83XX_IDC_DEV_UNKNOWN,
QLC_83XX_IDC_DEV_COLD,
QLC_83XX_IDC_DEV_INIT,
QLC_83XX_IDC_DEV_READY,
QLC_83XX_IDC_DEV_NEED_RESET,
QLC_83XX_IDC_DEV_NEED_QUISCENT,
QLC_83XX_IDC_DEV_FAILED,
QLC_83XX_IDC_DEV_QUISCENT
};
static int static int
qlcnic_83xx_idc_check_driver_presence_reg(struct qlcnic_adapter *adapter) qlcnic_83xx_idc_check_driver_presence_reg(struct qlcnic_adapter *adapter)
{ {
...@@ -162,7 +150,8 @@ static int qlcnic_83xx_idc_update_audit_reg(struct qlcnic_adapter *adapter, ...@@ -162,7 +150,8 @@ static int qlcnic_83xx_idc_update_audit_reg(struct qlcnic_adapter *adapter,
return -EBUSY; return -EBUSY;
} }
val = adapter->portnum & 0xf; val = QLCRDX(adapter->ahw, QLC_83XX_IDC_DRV_AUDIT);
val |= (adapter->portnum & 0xf);
val |= mode << 7; val |= mode << 7;
if (mode) if (mode)
seconds = jiffies / HZ - adapter->ahw->idc.sec_counter; seconds = jiffies / HZ - adapter->ahw->idc.sec_counter;
...@@ -401,14 +390,18 @@ static void qlcnic_83xx_idc_detach_driver(struct qlcnic_adapter *adapter) ...@@ -401,14 +390,18 @@ static void qlcnic_83xx_idc_detach_driver(struct qlcnic_adapter *adapter)
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
netif_device_detach(netdev); netif_device_detach(netdev);
/* Disable mailbox interrupt */ /* Disable mailbox interrupt */
QLCWRX(adapter->ahw, QLCNIC_MBX_INTR_ENBL, 0); qlcnic_83xx_disable_mbx_intr(adapter);
qlcnic_down(adapter, netdev); qlcnic_down(adapter, netdev);
for (i = 0; i < adapter->ahw->num_msix; i++) { for (i = 0; i < adapter->ahw->num_msix; i++) {
adapter->ahw->intr_tbl[i].id = i; adapter->ahw->intr_tbl[i].id = i;
adapter->ahw->intr_tbl[i].enabled = 0; adapter->ahw->intr_tbl[i].enabled = 0;
adapter->ahw->intr_tbl[i].src = 0; adapter->ahw->intr_tbl[i].src = 0;
} }
if (qlcnic_sriov_pf_check(adapter))
qlcnic_sriov_pf_reset(adapter);
} }
/** /**
...@@ -610,9 +603,15 @@ static int qlcnic_83xx_idc_check_fan_failure(struct qlcnic_adapter *adapter) ...@@ -610,9 +603,15 @@ static int qlcnic_83xx_idc_check_fan_failure(struct qlcnic_adapter *adapter)
static int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *adapter) static int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *adapter)
{ {
int err;
/* register for NIC IDC AEN Events */ /* register for NIC IDC AEN Events */
qlcnic_83xx_register_nic_idc_func(adapter, 1); qlcnic_83xx_register_nic_idc_func(adapter, 1);
err = qlcnic_sriov_pf_reinit(adapter);
if (err)
return err;
qlcnic_83xx_enable_mbx_intrpt(adapter); qlcnic_83xx_enable_mbx_intrpt(adapter);
if (qlcnic_83xx_configure_opmode(adapter)) { if (qlcnic_83xx_configure_opmode(adapter)) {
......
...@@ -859,9 +859,11 @@ static int qlcnic_irq_test(struct net_device *netdev) ...@@ -859,9 +859,11 @@ static int qlcnic_irq_test(struct net_device *netdev)
return ret; return ret;
} }
#define QLCNIC_ILB_PKT_SIZE 64 #define QLCNIC_ILB_PKT_SIZE 64
#define QLCNIC_NUM_ILB_PKT 16 #define QLCNIC_NUM_ILB_PKT 16
#define QLCNIC_ILB_MAX_RCV_LOOP 10 #define QLCNIC_ILB_MAX_RCV_LOOP 10
#define QLCNIC_LB_PKT_POLL_DELAY_MSEC 1
#define QLCNIC_LB_PKT_POLL_COUNT 20
static void qlcnic_create_loopback_buff(unsigned char *data, u8 mac[]) static void qlcnic_create_loopback_buff(unsigned char *data, u8 mac[])
{ {
...@@ -898,9 +900,9 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode) ...@@ -898,9 +900,9 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode)
loop = 0; loop = 0;
do { do {
msleep(1); msleep(QLCNIC_LB_PKT_POLL_DELAY_MSEC);
qlcnic_process_rcv_ring_diag(sds_ring); qlcnic_process_rcv_ring_diag(sds_ring);
if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP) if (loop++ > QLCNIC_LB_PKT_POLL_COUNT)
break; break;
} while (!adapter->ahw->diag_cnt); } while (!adapter->ahw->diag_cnt);
...@@ -1539,3 +1541,25 @@ const struct ethtool_ops qlcnic_ethtool_ops = { ...@@ -1539,3 +1541,25 @@ const struct ethtool_ops qlcnic_ethtool_ops = {
.get_dump_data = qlcnic_get_dump_data, .get_dump_data = qlcnic_get_dump_data,
.set_dump = qlcnic_set_dump, .set_dump = qlcnic_set_dump,
}; };
const struct ethtool_ops qlcnic_sriov_vf_ethtool_ops = {
.get_settings = qlcnic_get_settings,
.get_drvinfo = qlcnic_get_drvinfo,
.get_regs_len = qlcnic_get_regs_len,
.get_regs = qlcnic_get_regs,
.get_link = ethtool_op_get_link,
.get_eeprom_len = qlcnic_get_eeprom_len,
.get_eeprom = qlcnic_get_eeprom,
.get_ringparam = qlcnic_get_ringparam,
.set_ringparam = qlcnic_set_ringparam,
.get_channels = qlcnic_get_channels,
.get_pauseparam = qlcnic_get_pauseparam,
.get_wol = qlcnic_get_wol,
.get_strings = qlcnic_get_strings,
.get_ethtool_stats = qlcnic_get_ethtool_stats,
.get_sset_count = qlcnic_get_sset_count,
.get_coalesce = qlcnic_get_intr_coalesce,
.set_coalesce = qlcnic_set_intr_coalesce,
.set_msglevel = qlcnic_set_msglevel,
.get_msglevel = qlcnic_get_msglevel,
};
...@@ -669,7 +669,7 @@ enum { ...@@ -669,7 +669,7 @@ enum {
#define QLCNIC_CMDPEG_CHECK_RETRY_COUNT 60 #define QLCNIC_CMDPEG_CHECK_RETRY_COUNT 60
#define QLCNIC_CMDPEG_CHECK_DELAY 500 #define QLCNIC_CMDPEG_CHECK_DELAY 500
#define QLCNIC_HEARTBEAT_PERIOD_MSECS 200 #define QLCNIC_HEARTBEAT_PERIOD_MSECS 200
#define QLCNIC_HEARTBEAT_CHECK_RETRY_COUNT 45 #define QLCNIC_HEARTBEAT_CHECK_RETRY_COUNT 10
#define QLCNIC_MAX_MC_COUNT 38 #define QLCNIC_MAX_MC_COUNT 38
#define QLCNIC_WATCHDOG_TIMEOUTVALUE 5 #define QLCNIC_WATCHDOG_TIMEOUTVALUE 5
......
...@@ -423,7 +423,7 @@ qlcnic_send_cmd_descs(struct qlcnic_adapter *adapter, ...@@ -423,7 +423,7 @@ qlcnic_send_cmd_descs(struct qlcnic_adapter *adapter,
} }
int qlcnic_82xx_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr, int qlcnic_82xx_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr,
__le16 vlan_id, u8 op) u16 vlan_id, u8 op)
{ {
struct qlcnic_nic_req req; struct qlcnic_nic_req req;
struct qlcnic_mac_req *mac_req; struct qlcnic_mac_req *mac_req;
...@@ -441,7 +441,7 @@ int qlcnic_82xx_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr, ...@@ -441,7 +441,7 @@ int qlcnic_82xx_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr,
memcpy(mac_req->mac_addr, addr, 6); memcpy(mac_req->mac_addr, addr, 6);
vlan_req = (struct qlcnic_vlan_req *)&req.words[1]; vlan_req = (struct qlcnic_vlan_req *)&req.words[1];
vlan_req->vlan_id = vlan_id; vlan_req->vlan_id = cpu_to_le16(vlan_id);
return qlcnic_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); return qlcnic_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
} }
...@@ -468,7 +468,7 @@ int qlcnic_nic_del_mac(struct qlcnic_adapter *adapter, const u8 *addr) ...@@ -468,7 +468,7 @@ int qlcnic_nic_del_mac(struct qlcnic_adapter *adapter, const u8 *addr)
return err; return err;
} }
int qlcnic_nic_add_mac(struct qlcnic_adapter *adapter, const u8 *addr) int qlcnic_nic_add_mac(struct qlcnic_adapter *adapter, const u8 *addr, u16 vlan)
{ {
struct list_head *head; struct list_head *head;
struct qlcnic_mac_list_s *cur; struct qlcnic_mac_list_s *cur;
...@@ -487,7 +487,7 @@ int qlcnic_nic_add_mac(struct qlcnic_adapter *adapter, const u8 *addr) ...@@ -487,7 +487,7 @@ int qlcnic_nic_add_mac(struct qlcnic_adapter *adapter, const u8 *addr)
memcpy(cur->mac_addr, addr, ETH_ALEN); memcpy(cur->mac_addr, addr, ETH_ALEN);
if (qlcnic_sre_macaddr_change(adapter, if (qlcnic_sre_macaddr_change(adapter,
cur->mac_addr, 0, QLCNIC_MAC_ADD)) { cur->mac_addr, vlan, QLCNIC_MAC_ADD)) {
kfree(cur); kfree(cur);
return -EIO; return -EIO;
} }
...@@ -496,7 +496,7 @@ int qlcnic_nic_add_mac(struct qlcnic_adapter *adapter, const u8 *addr) ...@@ -496,7 +496,7 @@ int qlcnic_nic_add_mac(struct qlcnic_adapter *adapter, const u8 *addr)
return 0; return 0;
} }
void __qlcnic_set_multi(struct net_device *netdev) void __qlcnic_set_multi(struct net_device *netdev, u16 vlan)
{ {
struct qlcnic_adapter *adapter = netdev_priv(netdev); struct qlcnic_adapter *adapter = netdev_priv(netdev);
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
...@@ -509,8 +509,8 @@ void __qlcnic_set_multi(struct net_device *netdev) ...@@ -509,8 +509,8 @@ void __qlcnic_set_multi(struct net_device *netdev)
return; return;
if (!qlcnic_sriov_vf_check(adapter)) if (!qlcnic_sriov_vf_check(adapter))
qlcnic_nic_add_mac(adapter, adapter->mac_addr); qlcnic_nic_add_mac(adapter, adapter->mac_addr, vlan);
qlcnic_nic_add_mac(adapter, bcast_addr); qlcnic_nic_add_mac(adapter, bcast_addr, vlan);
if (netdev->flags & IFF_PROMISC) { if (netdev->flags & IFF_PROMISC) {
if (!(adapter->flags & QLCNIC_PROMISC_DISABLED)) if (!(adapter->flags & QLCNIC_PROMISC_DISABLED))
...@@ -526,12 +526,12 @@ void __qlcnic_set_multi(struct net_device *netdev) ...@@ -526,12 +526,12 @@ void __qlcnic_set_multi(struct net_device *netdev)
if (!netdev_mc_empty(netdev) && !qlcnic_sriov_vf_check(adapter)) { if (!netdev_mc_empty(netdev) && !qlcnic_sriov_vf_check(adapter)) {
netdev_for_each_mc_addr(ha, netdev) { netdev_for_each_mc_addr(ha, netdev) {
qlcnic_nic_add_mac(adapter, ha->addr); qlcnic_nic_add_mac(adapter, ha->addr, vlan);
} }
} }
if (qlcnic_sriov_vf_check(adapter)) if (qlcnic_sriov_vf_check(adapter))
qlcnic_vf_add_mc_list(netdev); qlcnic_vf_add_mc_list(netdev, vlan);
send_fw_cmd: send_fw_cmd:
if (!qlcnic_sriov_vf_check(adapter)) { if (!qlcnic_sriov_vf_check(adapter)) {
...@@ -570,7 +570,7 @@ void qlcnic_set_multi(struct net_device *netdev) ...@@ -570,7 +570,7 @@ void qlcnic_set_multi(struct net_device *netdev)
qlcnic_sriov_vf_schedule_multi(adapter->netdev); qlcnic_sriov_vf_schedule_multi(adapter->netdev);
return; return;
} }
__qlcnic_set_multi(netdev); __qlcnic_set_multi(netdev, 0);
} }
int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32 mode) int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32 mode)
...@@ -592,7 +592,7 @@ int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32 mode) ...@@ -592,7 +592,7 @@ int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32 mode)
(struct cmd_desc_type0 *)&req, 1); (struct cmd_desc_type0 *)&req, 1);
} }
void qlcnic_free_mac_list(struct qlcnic_adapter *adapter) void qlcnic_82xx_free_mac_list(struct qlcnic_adapter *adapter)
{ {
struct qlcnic_mac_list_s *cur; struct qlcnic_mac_list_s *cur;
struct list_head *head = &adapter->mac_list; struct list_head *head = &adapter->mac_list;
......
...@@ -159,7 +159,7 @@ int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32); ...@@ -159,7 +159,7 @@ int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32);
int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter, int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter,
struct net_device *netdev); struct net_device *netdev);
void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter,
u64 *uaddr, __le16 vlan_id); u64 *uaddr, u16 vlan_id);
void qlcnic_82xx_config_intr_coalesce(struct qlcnic_adapter *adapter); void qlcnic_82xx_config_intr_coalesce(struct qlcnic_adapter *adapter);
int qlcnic_82xx_config_rss(struct qlcnic_adapter *adapter, int); int qlcnic_82xx_config_rss(struct qlcnic_adapter *adapter, int);
void qlcnic_82xx_config_ipaddr(struct qlcnic_adapter *adapter, void qlcnic_82xx_config_ipaddr(struct qlcnic_adapter *adapter,
...@@ -181,7 +181,7 @@ int qlcnic_82xx_fw_cmd_create_tx_ctx(struct qlcnic_adapter *, ...@@ -181,7 +181,7 @@ int qlcnic_82xx_fw_cmd_create_tx_ctx(struct qlcnic_adapter *,
void qlcnic_82xx_fw_cmd_del_rx_ctx(struct qlcnic_adapter *); void qlcnic_82xx_fw_cmd_del_rx_ctx(struct qlcnic_adapter *);
void qlcnic_82xx_fw_cmd_del_tx_ctx(struct qlcnic_adapter *, void qlcnic_82xx_fw_cmd_del_tx_ctx(struct qlcnic_adapter *,
struct qlcnic_host_tx_ring *); struct qlcnic_host_tx_ring *);
int qlcnic_82xx_sre_macaddr_change(struct qlcnic_adapter *, u8 *, __le16, u8); int qlcnic_82xx_sre_macaddr_change(struct qlcnic_adapter *, u8 *, u16, u8);
int qlcnic_82xx_get_mac_address(struct qlcnic_adapter *, u8*); int qlcnic_82xx_get_mac_address(struct qlcnic_adapter *, u8*);
int qlcnic_82xx_get_nic_info(struct qlcnic_adapter *, struct qlcnic_info *, u8); int qlcnic_82xx_get_nic_info(struct qlcnic_adapter *, struct qlcnic_info *, u8);
int qlcnic_82xx_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *); int qlcnic_82xx_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *);
......
...@@ -162,7 +162,7 @@ static inline int qlcnic_82xx_is_lb_pkt(u64 sts_data) ...@@ -162,7 +162,7 @@ static inline int qlcnic_82xx_is_lb_pkt(u64 sts_data)
} }
void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb, void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb,
int loopback_pkt, __le16 vlan_id) int loopback_pkt, u16 vlan_id)
{ {
struct ethhdr *phdr = (struct ethhdr *)(skb->data); struct ethhdr *phdr = (struct ethhdr *)(skb->data);
struct qlcnic_filter *fil, *tmp_fil; struct qlcnic_filter *fil, *tmp_fil;
...@@ -240,7 +240,7 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb, ...@@ -240,7 +240,7 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb,
} }
void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr, void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr,
__le16 vlan_id) u16 vlan_id)
{ {
struct cmd_desc_type0 *hwdesc; struct cmd_desc_type0 *hwdesc;
struct qlcnic_nic_req *req; struct qlcnic_nic_req *req;
...@@ -265,7 +265,7 @@ void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr, ...@@ -265,7 +265,7 @@ void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr,
memcpy(mac_req->mac_addr, &uaddr, ETH_ALEN); memcpy(mac_req->mac_addr, &uaddr, ETH_ALEN);
vlan_req = (struct qlcnic_vlan_req *)&req->words[1]; vlan_req = (struct qlcnic_vlan_req *)&req->words[1];
vlan_req->vlan_id = vlan_id; vlan_req->vlan_id = cpu_to_le16(vlan_id);
tx_ring->producer = get_next_index(producer, tx_ring->num_desc); tx_ring->producer = get_next_index(producer, tx_ring->num_desc);
smp_mb(); smp_mb();
...@@ -281,7 +281,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, ...@@ -281,7 +281,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter,
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
struct ethhdr *phdr = (struct ethhdr *)(skb->data); struct ethhdr *phdr = (struct ethhdr *)(skb->data);
u64 src_addr = 0; u64 src_addr = 0;
__le16 vlan_id = 0; u16 vlan_id = 0;
u8 hindex; u8 hindex;
if (ether_addr_equal(phdr->h_source, adapter->mac_addr)) if (ether_addr_equal(phdr->h_source, adapter->mac_addr))
...@@ -344,14 +344,14 @@ static int qlcnic_tx_pkt(struct qlcnic_adapter *adapter, ...@@ -344,14 +344,14 @@ static int qlcnic_tx_pkt(struct qlcnic_adapter *adapter,
flags = FLAGS_VLAN_OOB; flags = FLAGS_VLAN_OOB;
vlan_tci = vlan_tx_tag_get(skb); vlan_tci = vlan_tx_tag_get(skb);
} }
if (unlikely(adapter->pvid)) { if (unlikely(adapter->tx_pvid)) {
if (vlan_tci && !(adapter->flags & QLCNIC_TAGGING_ENABLED)) if (vlan_tci && !(adapter->flags & QLCNIC_TAGGING_ENABLED))
return -EIO; return -EIO;
if (vlan_tci && (adapter->flags & QLCNIC_TAGGING_ENABLED)) if (vlan_tci && (adapter->flags & QLCNIC_TAGGING_ENABLED))
goto set_flags; goto set_flags;
flags = FLAGS_VLAN_OOB; flags = FLAGS_VLAN_OOB;
vlan_tci = adapter->pvid; vlan_tci = adapter->tx_pvid;
} }
set_flags: set_flags:
qlcnic_set_tx_vlan_tci(first_desc, vlan_tci); qlcnic_set_tx_vlan_tci(first_desc, vlan_tci);
...@@ -980,10 +980,10 @@ static inline int qlcnic_check_rx_tagging(struct qlcnic_adapter *adapter, ...@@ -980,10 +980,10 @@ static inline int qlcnic_check_rx_tagging(struct qlcnic_adapter *adapter,
memmove(skb->data + VLAN_HLEN, eth_hdr, ETH_ALEN * 2); memmove(skb->data + VLAN_HLEN, eth_hdr, ETH_ALEN * 2);
skb_pull(skb, VLAN_HLEN); skb_pull(skb, VLAN_HLEN);
} }
if (!adapter->pvid) if (!adapter->rx_pvid)
return 0; return 0;
if (*vlan_tag == adapter->pvid) { if (*vlan_tag == adapter->rx_pvid) {
/* Outer vlan tag. Packet should follow non-vlan path */ /* Outer vlan tag. Packet should follow non-vlan path */
*vlan_tag = 0xffff; *vlan_tag = 0xffff;
return 0; return 0;
...@@ -1029,8 +1029,7 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter, ...@@ -1029,8 +1029,7 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter,
(adapter->flags & QLCNIC_ESWITCH_ENABLED)) { (adapter->flags & QLCNIC_ESWITCH_ENABLED)) {
t_vid = 0; t_vid = 0;
is_lb_pkt = qlcnic_82xx_is_lb_pkt(sts_data0); is_lb_pkt = qlcnic_82xx_is_lb_pkt(sts_data0);
qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, t_vid);
cpu_to_le16(t_vid));
} }
if (length > rds_ring->skb_size) if (length > rds_ring->skb_size)
...@@ -1107,8 +1106,7 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter, ...@@ -1107,8 +1106,7 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
(adapter->flags & QLCNIC_ESWITCH_ENABLED)) { (adapter->flags & QLCNIC_ESWITCH_ENABLED)) {
t_vid = 0; t_vid = 0;
is_lb_pkt = qlcnic_82xx_is_lb_pkt(sts_data0); is_lb_pkt = qlcnic_82xx_is_lb_pkt(sts_data0);
qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, t_vid);
cpu_to_le16(t_vid));
} }
if (timestamp) if (timestamp)
...@@ -1500,8 +1498,7 @@ qlcnic_83xx_process_rcv(struct qlcnic_adapter *adapter, ...@@ -1500,8 +1498,7 @@ qlcnic_83xx_process_rcv(struct qlcnic_adapter *adapter,
(adapter->flags & QLCNIC_ESWITCH_ENABLED)) { (adapter->flags & QLCNIC_ESWITCH_ENABLED)) {
t_vid = 0; t_vid = 0;
is_lb_pkt = qlcnic_83xx_is_lb_pkt(sts_data[1], 0); is_lb_pkt = qlcnic_83xx_is_lb_pkt(sts_data[1], 0);
qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, t_vid);
cpu_to_le16(t_vid));
} }
if (length > rds_ring->skb_size) if (length > rds_ring->skb_size)
...@@ -1570,8 +1567,7 @@ qlcnic_83xx_process_lro(struct qlcnic_adapter *adapter, ...@@ -1570,8 +1567,7 @@ qlcnic_83xx_process_lro(struct qlcnic_adapter *adapter,
(adapter->flags & QLCNIC_ESWITCH_ENABLED)) { (adapter->flags & QLCNIC_ESWITCH_ENABLED)) {
t_vid = 0; t_vid = 0;
is_lb_pkt = qlcnic_83xx_is_lb_pkt(sts_data[1], 1); is_lb_pkt = qlcnic_83xx_is_lb_pkt(sts_data[1], 1);
qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, t_vid);
cpu_to_le16(t_vid));
} }
if (qlcnic_83xx_is_tstamp(sts_data[1])) if (qlcnic_83xx_is_tstamp(sts_data[1]))
data_offset = l4_hdr_offset + QLCNIC_TCP_TS_HDR_SIZE; data_offset = l4_hdr_offset + QLCNIC_TCP_TS_HDR_SIZE;
......
...@@ -290,7 +290,7 @@ static int qlcnic_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], ...@@ -290,7 +290,7 @@ static int qlcnic_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
return err; return err;
if (is_unicast_ether_addr(addr)) if (is_unicast_ether_addr(addr))
err = qlcnic_nic_add_mac(adapter, addr); err = qlcnic_nic_add_mac(adapter, addr, 0);
else if (is_multicast_ether_addr(addr)) else if (is_multicast_ether_addr(addr))
err = dev_mc_add_excl(netdev, addr); err = dev_mc_add_excl(netdev, addr);
else else
...@@ -341,6 +341,12 @@ static const struct net_device_ops qlcnic_netdev_ops = { ...@@ -341,6 +341,12 @@ static const struct net_device_ops qlcnic_netdev_ops = {
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = qlcnic_poll_controller, .ndo_poll_controller = qlcnic_poll_controller,
#endif #endif
#ifdef CONFIG_QLCNIC_SRIOV
.ndo_set_vf_mac = qlcnic_sriov_set_vf_mac,
.ndo_set_vf_tx_rate = qlcnic_sriov_set_vf_tx_rate,
.ndo_get_vf_config = qlcnic_sriov_get_vf_config,
.ndo_set_vf_vlan = qlcnic_sriov_set_vf_vlan,
#endif
}; };
static const struct net_device_ops qlcnic_netdev_failed_ops = { static const struct net_device_ops qlcnic_netdev_failed_ops = {
...@@ -399,6 +405,7 @@ static struct qlcnic_hardware_ops qlcnic_hw_ops = { ...@@ -399,6 +405,7 @@ static struct qlcnic_hardware_ops qlcnic_hw_ops = {
.config_promisc_mode = qlcnic_82xx_nic_set_promisc, .config_promisc_mode = qlcnic_82xx_nic_set_promisc,
.change_l2_filter = qlcnic_82xx_change_filter, .change_l2_filter = qlcnic_82xx_change_filter,
.get_board_info = qlcnic_82xx_get_board_info, .get_board_info = qlcnic_82xx_get_board_info,
.free_mac_list = qlcnic_82xx_free_mac_list,
}; };
int qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix) int qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix)
...@@ -895,16 +902,31 @@ void qlcnic_set_vlan_config(struct qlcnic_adapter *adapter, ...@@ -895,16 +902,31 @@ void qlcnic_set_vlan_config(struct qlcnic_adapter *adapter,
else else
adapter->flags |= QLCNIC_TAGGING_ENABLED; adapter->flags |= QLCNIC_TAGGING_ENABLED;
if (esw_cfg->vlan_id) if (esw_cfg->vlan_id) {
adapter->pvid = esw_cfg->vlan_id; adapter->rx_pvid = esw_cfg->vlan_id;
else adapter->tx_pvid = esw_cfg->vlan_id;
adapter->pvid = 0; } else {
adapter->rx_pvid = 0;
adapter->tx_pvid = 0;
}
} }
static int static int
qlcnic_vlan_rx_add(struct net_device *netdev, __be16 proto, u16 vid) qlcnic_vlan_rx_add(struct net_device *netdev, __be16 proto, u16 vid)
{ {
struct qlcnic_adapter *adapter = netdev_priv(netdev); struct qlcnic_adapter *adapter = netdev_priv(netdev);
int err;
if (qlcnic_sriov_vf_check(adapter)) {
err = qlcnic_sriov_cfg_vf_guest_vlan(adapter, vid, 1);
if (err) {
netdev_err(netdev,
"Cannot add VLAN filter for VLAN id %d, err=%d",
vid, err);
return err;
}
}
set_bit(vid, adapter->vlans); set_bit(vid, adapter->vlans);
return 0; return 0;
} }
...@@ -913,6 +935,17 @@ static int ...@@ -913,6 +935,17 @@ static int
qlcnic_vlan_rx_del(struct net_device *netdev, __be16 proto, u16 vid) qlcnic_vlan_rx_del(struct net_device *netdev, __be16 proto, u16 vid)
{ {
struct qlcnic_adapter *adapter = netdev_priv(netdev); struct qlcnic_adapter *adapter = netdev_priv(netdev);
int err;
if (qlcnic_sriov_vf_check(adapter)) {
err = qlcnic_sriov_cfg_vf_guest_vlan(adapter, vid, 0);
if (err) {
netdev_err(netdev,
"Cannot delete VLAN filter for VLAN id %d, err=%d",
vid, err);
return err;
}
}
qlcnic_restore_indev_addr(netdev, NETDEV_DOWN); qlcnic_restore_indev_addr(netdev, NETDEV_DOWN);
clear_bit(vid, adapter->vlans); clear_bit(vid, adapter->vlans);
...@@ -1710,7 +1743,10 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev, ...@@ -1710,7 +1743,10 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev,
qlcnic_change_mtu(netdev, netdev->mtu); qlcnic_change_mtu(netdev, netdev->mtu);
SET_ETHTOOL_OPS(netdev, &qlcnic_ethtool_ops); if (qlcnic_sriov_vf_check(adapter))
SET_ETHTOOL_OPS(netdev, &qlcnic_sriov_vf_ethtool_ops);
else
SET_ETHTOOL_OPS(netdev, &qlcnic_ethtool_ops);
netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
NETIF_F_IPV6_CSUM | NETIF_F_GRO | NETIF_F_IPV6_CSUM | NETIF_F_GRO |
...@@ -1731,6 +1767,9 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev, ...@@ -1731,6 +1767,9 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev,
if (qlcnic_vlan_tx_check(adapter)) if (qlcnic_vlan_tx_check(adapter))
netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX); netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX);
if (qlcnic_sriov_vf_check(adapter))
netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO) if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO)
netdev->features |= NETIF_F_LRO; netdev->features |= NETIF_F_LRO;
...@@ -2112,6 +2151,7 @@ static int __qlcnic_shutdown(struct pci_dev *pdev) ...@@ -2112,6 +2151,7 @@ static int __qlcnic_shutdown(struct pci_dev *pdev)
if (netif_running(netdev)) if (netif_running(netdev))
qlcnic_down(adapter, netdev); qlcnic_down(adapter, netdev);
qlcnic_sriov_cleanup(adapter);
if (qlcnic_82xx_check(adapter)) if (qlcnic_82xx_check(adapter))
qlcnic_clr_all_drv_state(adapter, 0); qlcnic_clr_all_drv_state(adapter, 0);
...@@ -3266,8 +3306,10 @@ int qlcnic_set_max_rss(struct qlcnic_adapter *adapter, u8 data, size_t len) ...@@ -3266,8 +3306,10 @@ int qlcnic_set_max_rss(struct qlcnic_adapter *adapter, u8 data, size_t len)
qlcnic_detach(adapter); qlcnic_detach(adapter);
if (qlcnic_83xx_check(adapter)) if (qlcnic_83xx_check(adapter)) {
qlcnic_83xx_free_mbx_intr(adapter); qlcnic_83xx_free_mbx_intr(adapter);
qlcnic_83xx_enable_mbx_poll(adapter);
}
qlcnic_teardown_intr(adapter); qlcnic_teardown_intr(adapter);
err = qlcnic_setup_intr(adapter, data); err = qlcnic_setup_intr(adapter, data);
...@@ -3281,6 +3323,7 @@ int qlcnic_set_max_rss(struct qlcnic_adapter *adapter, u8 data, size_t len) ...@@ -3281,6 +3323,7 @@ int qlcnic_set_max_rss(struct qlcnic_adapter *adapter, u8 data, size_t len)
/* register for NIC IDC AEN Events */ /* register for NIC IDC AEN Events */
qlcnic_83xx_register_nic_idc_func(adapter, 1); qlcnic_83xx_register_nic_idc_func(adapter, 1);
err = qlcnic_83xx_setup_mbx_intr(adapter); err = qlcnic_83xx_setup_mbx_intr(adapter);
qlcnic_83xx_disable_mbx_poll(adapter);
if (err) { if (err) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"failed to setup mbx interrupt\n"); "failed to setup mbx interrupt\n");
......
...@@ -48,6 +48,8 @@ struct qlcnic_bc_hdr { ...@@ -48,6 +48,8 @@ struct qlcnic_bc_hdr {
enum qlcnic_bc_commands { enum qlcnic_bc_commands {
QLCNIC_BC_CMD_CHANNEL_INIT = 0x0, QLCNIC_BC_CMD_CHANNEL_INIT = 0x0,
QLCNIC_BC_CMD_CHANNEL_TERM = 0x1, QLCNIC_BC_CMD_CHANNEL_TERM = 0x1,
QLCNIC_BC_CMD_GET_ACL = 0x2,
QLCNIC_BC_CMD_CFG_GUEST_VLAN = 0x3,
}; };
#define QLC_BC_CMD 1 #define QLC_BC_CMD 1
...@@ -91,6 +93,14 @@ enum qlcnic_vf_state { ...@@ -91,6 +93,14 @@ enum qlcnic_vf_state {
QLC_BC_VF_RECV, QLC_BC_VF_RECV,
QLC_BC_VF_CHANNEL, QLC_BC_VF_CHANNEL,
QLC_BC_VF_STATE, QLC_BC_VF_STATE,
QLC_BC_VF_FLR,
QLC_BC_VF_SOFT_FLR,
};
enum qlcnic_vlan_mode {
QLC_NO_VLAN_MODE = 0,
QLC_PVID_MODE,
QLC_GUEST_VLAN_MODE,
}; };
struct qlcnic_resources { struct qlcnic_resources {
...@@ -114,6 +124,11 @@ struct qlcnic_resources { ...@@ -114,6 +124,11 @@ struct qlcnic_resources {
struct qlcnic_vport { struct qlcnic_vport {
u16 handle; u16 handle;
u16 max_tx_bw;
u16 min_tx_bw;
u8 vlan_mode;
u16 vlan;
u8 qos;
u8 mac[6]; u8 mac[6];
}; };
...@@ -124,9 +139,11 @@ struct qlcnic_vf_info { ...@@ -124,9 +139,11 @@ struct qlcnic_vf_info {
unsigned long state; unsigned long state;
struct completion ch_free_cmpl; struct completion ch_free_cmpl;
struct work_struct trans_work; struct work_struct trans_work;
struct work_struct flr_work;
/* It synchronizes commands sent from VF */ /* It synchronizes commands sent from VF */
struct mutex send_cmd_lock; struct mutex send_cmd_lock;
struct qlcnic_bc_trans *send_cmd; struct qlcnic_bc_trans *send_cmd;
struct qlcnic_bc_trans *flr_trans;
struct qlcnic_trans_list rcv_act; struct qlcnic_trans_list rcv_act;
struct qlcnic_trans_list rcv_pend; struct qlcnic_trans_list rcv_pend;
struct qlcnic_adapter *adapter; struct qlcnic_adapter *adapter;
...@@ -143,12 +160,18 @@ struct qlcnic_back_channel { ...@@ -143,12 +160,18 @@ struct qlcnic_back_channel {
u16 trans_counter; u16 trans_counter;
struct workqueue_struct *bc_trans_wq; struct workqueue_struct *bc_trans_wq;
struct workqueue_struct *bc_async_wq; struct workqueue_struct *bc_async_wq;
struct workqueue_struct *bc_flr_wq;
struct list_head async_list; struct list_head async_list;
}; };
struct qlcnic_sriov { struct qlcnic_sriov {
u16 vp_handle; u16 vp_handle;
u8 num_vfs; u8 num_vfs;
u8 any_vlan;
u8 vlan_mode;
u16 num_allowed_vlans;
u16 *allowed_vlans;
u16 vlan;
struct qlcnic_resources ff_max; struct qlcnic_resources ff_max;
struct qlcnic_back_channel bc; struct qlcnic_back_channel bc;
struct qlcnic_vf_info *vf_info; struct qlcnic_vf_info *vf_info;
...@@ -165,6 +188,12 @@ int qlcnic_sriov_channel_cfg_cmd(struct qlcnic_adapter *, u8); ...@@ -165,6 +188,12 @@ int qlcnic_sriov_channel_cfg_cmd(struct qlcnic_adapter *, u8);
void qlcnic_sriov_handle_bc_event(struct qlcnic_adapter *, u32); void qlcnic_sriov_handle_bc_event(struct qlcnic_adapter *, u32);
int qlcnic_sriov_cfg_bc_intr(struct qlcnic_adapter *, u8); int qlcnic_sriov_cfg_bc_intr(struct qlcnic_adapter *, u8);
void qlcnic_sriov_cleanup_async_list(struct qlcnic_back_channel *); void qlcnic_sriov_cleanup_async_list(struct qlcnic_back_channel *);
void qlcnic_sriov_cleanup_list(struct qlcnic_trans_list *);
int __qlcnic_sriov_add_act_list(struct qlcnic_sriov *, struct qlcnic_vf_info *,
struct qlcnic_bc_trans *);
int qlcnic_sriov_get_vf_vport_info(struct qlcnic_adapter *,
struct qlcnic_info *, u16);
int qlcnic_sriov_cfg_vf_guest_vlan(struct qlcnic_adapter *, u16, u8);
static inline bool qlcnic_sriov_enable_check(struct qlcnic_adapter *adapter) static inline bool qlcnic_sriov_enable_check(struct qlcnic_adapter *adapter)
{ {
...@@ -185,6 +214,17 @@ void qlcnic_pf_set_interface_id_del_tx_ctx(struct qlcnic_adapter *, u32 *); ...@@ -185,6 +214,17 @@ void qlcnic_pf_set_interface_id_del_tx_ctx(struct qlcnic_adapter *, u32 *);
void qlcnic_pf_set_interface_id_promisc(struct qlcnic_adapter *, u32 *); void qlcnic_pf_set_interface_id_promisc(struct qlcnic_adapter *, u32 *);
void qlcnic_pf_set_interface_id_ipaddr(struct qlcnic_adapter *, u32 *); void qlcnic_pf_set_interface_id_ipaddr(struct qlcnic_adapter *, u32 *);
void qlcnic_pf_set_interface_id_macaddr(struct qlcnic_adapter *, u32 *); void qlcnic_pf_set_interface_id_macaddr(struct qlcnic_adapter *, u32 *);
void qlcnic_sriov_pf_handle_flr(struct qlcnic_sriov *, struct qlcnic_vf_info *);
bool qlcnic_sriov_soft_flr_check(struct qlcnic_adapter *,
struct qlcnic_bc_trans *,
struct qlcnic_vf_info *);
void qlcnic_sriov_pf_reset(struct qlcnic_adapter *);
int qlcnic_sriov_pf_reinit(struct qlcnic_adapter *);
int qlcnic_sriov_set_vf_mac(struct net_device *, int, u8 *);
int qlcnic_sriov_set_vf_tx_rate(struct net_device *, int, int);
int qlcnic_sriov_get_vf_config(struct net_device *, int ,
struct ifla_vf_info *);
int qlcnic_sriov_set_vf_vlan(struct net_device *, int, u16, u8);
#else #else
static inline void qlcnic_sriov_pf_disable(struct qlcnic_adapter *adapter) {} static inline void qlcnic_sriov_pf_disable(struct qlcnic_adapter *adapter) {}
static inline void qlcnic_sriov_pf_cleanup(struct qlcnic_adapter *adapter) {} static inline void qlcnic_sriov_pf_cleanup(struct qlcnic_adapter *adapter) {}
...@@ -209,6 +249,15 @@ qlcnic_pf_set_interface_id_macaddr(struct qlcnic_adapter *adapter, u32 *int_id) ...@@ -209,6 +249,15 @@ qlcnic_pf_set_interface_id_macaddr(struct qlcnic_adapter *adapter, u32 *int_id)
static inline void static inline void
qlcnic_pf_set_interface_id_promisc(struct qlcnic_adapter *adapter, u32 *int_id) qlcnic_pf_set_interface_id_promisc(struct qlcnic_adapter *adapter, u32 *int_id)
{} {}
static inline void qlcnic_sriov_pf_handle_flr(struct qlcnic_sriov *sriov,
struct qlcnic_vf_info *vf) {}
static inline bool qlcnic_sriov_soft_flr_check(struct qlcnic_adapter *adapter,
struct qlcnic_bc_trans *trans,
struct qlcnic_vf_info *vf)
{ return false; }
static inline void qlcnic_sriov_pf_reset(struct qlcnic_adapter *adapter) {}
static inline int qlcnic_sriov_pf_reinit(struct qlcnic_adapter *adapter)
{ return 0; }
#endif #endif
#endif #endif
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