2010-08-24 11:24:12 +08:00
|
|
|
/*
|
2015-02-20 05:02:31 +08:00
|
|
|
* Linux network driver for QLogic BR-series Converged Network Adapter.
|
2010-08-24 11:24:12 +08:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License (GPL) Version 2 as
|
|
|
|
* published by the Free Software Foundation
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*/
|
|
|
|
/*
|
2015-02-20 05:02:31 +08:00
|
|
|
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
|
|
|
|
* Copyright (c) 2014-2015 QLogic Corporation
|
2010-08-24 11:24:12 +08:00
|
|
|
* All rights reserved
|
2015-02-20 05:02:31 +08:00
|
|
|
* www.qlogic.com
|
2010-08-24 11:24:12 +08:00
|
|
|
*/
|
|
|
|
#ifndef __BNAD_H__
|
|
|
|
#define __BNAD_H__
|
|
|
|
|
|
|
|
#include <linux/rtnetlink.h>
|
|
|
|
#include <linux/workqueue.h>
|
|
|
|
#include <linux/ipv6.h>
|
|
|
|
#include <linux/etherdevice.h>
|
|
|
|
#include <linux/mutex.h>
|
|
|
|
#include <linux/firmware.h>
|
2011-07-20 12:54:14 +08:00
|
|
|
#include <linux/if_vlan.h>
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
/* Fix for IA64 */
|
|
|
|
#include <asm/checksum.h>
|
|
|
|
#include <net/ip6_checksum.h>
|
|
|
|
|
|
|
|
#include <net/ip.h>
|
|
|
|
#include <net/tcp.h>
|
|
|
|
|
|
|
|
#include "bna.h"
|
|
|
|
|
|
|
|
#define BNAD_TXQ_DEPTH 2048
|
|
|
|
#define BNAD_RXQ_DEPTH 2048
|
|
|
|
|
2011-08-30 23:27:37 +08:00
|
|
|
#define BNAD_MAX_TX 1
|
2010-08-24 11:24:12 +08:00
|
|
|
#define BNAD_MAX_TXQ_PER_TX 8 /* 8 priority queues */
|
|
|
|
#define BNAD_TXQ_NUM 1
|
|
|
|
|
2011-08-30 23:27:37 +08:00
|
|
|
#define BNAD_MAX_RX 1
|
|
|
|
#define BNAD_MAX_RXP_PER_RX 16
|
bna: ENET and Tx Rx Redesign Enablement
Change details:
This patch contains additional structure and function definition changes
that are required to enable the new msgq/enet/txrx redesign introduced
by the previous 4 patches.
- structure and function definition changes to header files as a result
of Ethport, Enet, IOCEth, Tx, Rx redesign.
- ethtool changes to use new enet function and definitions
- Set number of Tx and Rx queues bassed on underlying hardware. Define
separate macros for maximum and supported numbers of Tx and Rx queues
based on underlying hardware. Take VLAN header into account for MTU
calculation. Default to INTx mode when pci_enable_msix() fails. Set a
bit in Rx poll routine, check and wait for that bit to be cleared in
the cleanup routine before proceeding.
- The TX and Rx coalesce settings are programmed in steps of 5 us. The value
that are not divisible by 5 are rounded to the next lower number. This was
causing the value os 1 to 4 to be rounded to 0, which is an invalid setting.
When creating Rx and Tx object, we are currently assigning the default
values of Rx and Tx coalescing_timeo. If these values are changed in the
driver to a different value, the change is lost during such operations as
MTU change. In order to avoid that, pass the configured value of
coalescing_timeo before Rx and Tx object creation. Fix
bnad_tx_coalescing_timeo_set() so it applies to all the Tx objects.
- Reorg uninitialization path in case of pci_probe failure.
- Hardware clock setup changes to pass asic generation, port modes and
asic mode as part firmware boot parameters to firmware.
- FW mailbox interface changes to defined asic specific mailbox interfaces.
h/w mailbox interfaces take 8-bit FIDs and 2-bit port id for owner. Cleaned
up mailbox definitions and usage for new and old HW. Eliminated usage of
ASIC ID. MSI-X vector assignment and programming done by firmware. Fixed
host offsets for CPE/RME queue registers.
- Implement polling mechanism for FW ready to have poll mechanism replaces
the current interrupt based FW READY method. The timer based poll routine
in IOC will query the ioc_fwstate register to see if there is a state
change in FW, and sends the READY event. Removed infrastructure needed to
support mbox READY event from fw as well as IOC code.
- Move FW init to HW init. Handle the case where PCI mapping goes away when
IOCPF state machine is waiting for semaphore.
- Add IOC mbox call back to client indicating that the command is sent.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-09 00:21:39 +08:00
|
|
|
#define BNAD_MAX_RXQ_PER_RXP 2
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Control structure pointed to ccb->ctrl, which
|
|
|
|
* determines the NAPI / LRO behavior CCB
|
|
|
|
* There is 1:1 corres. between ccb & ctrl
|
|
|
|
*/
|
|
|
|
struct bnad_rx_ctrl {
|
|
|
|
struct bna_ccb *ccb;
|
2011-08-30 23:27:39 +08:00
|
|
|
struct bnad *bnad;
|
2010-12-24 05:45:01 +08:00
|
|
|
unsigned long flags;
|
2010-08-24 11:24:12 +08:00
|
|
|
struct napi_struct napi;
|
2011-08-30 23:27:40 +08:00
|
|
|
u64 rx_intr_ctr;
|
|
|
|
u64 rx_poll_ctr;
|
|
|
|
u64 rx_schedule;
|
|
|
|
u64 rx_keep_poll;
|
|
|
|
u64 rx_complete;
|
2010-08-24 11:24:12 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define BNAD_RXMODE_PROMISC_DEFAULT BNA_RXMODE_PROMISC
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GLOBAL #defines (CONSTANTS)
|
|
|
|
*/
|
|
|
|
#define BNAD_NAME "bna"
|
|
|
|
#define BNAD_NAME_LEN 64
|
|
|
|
|
2015-02-20 05:02:32 +08:00
|
|
|
#define BNAD_VERSION "3.2.25.1"
|
2010-08-24 11:24:12 +08:00
|
|
|
|
2011-07-22 16:07:44 +08:00
|
|
|
#define BNAD_MAILBOX_MSIX_INDEX 0
|
2010-08-24 11:24:12 +08:00
|
|
|
#define BNAD_MAILBOX_MSIX_VECTORS 1
|
2011-07-22 16:07:44 +08:00
|
|
|
#define BNAD_INTX_TX_IB_BITMASK 0x1
|
|
|
|
#define BNAD_INTX_RX_IB_BITMASK 0x2
|
2010-08-24 11:24:12 +08:00
|
|
|
|
2011-07-22 16:07:41 +08:00
|
|
|
#define BNAD_STATS_TIMER_FREQ 1000 /* in msecs */
|
|
|
|
#define BNAD_DIM_TIMER_FREQ 1000 /* in msecs */
|
2010-08-24 11:24:12 +08:00
|
|
|
|
bna: ENET and Tx Rx Redesign Enablement
Change details:
This patch contains additional structure and function definition changes
that are required to enable the new msgq/enet/txrx redesign introduced
by the previous 4 patches.
- structure and function definition changes to header files as a result
of Ethport, Enet, IOCEth, Tx, Rx redesign.
- ethtool changes to use new enet function and definitions
- Set number of Tx and Rx queues bassed on underlying hardware. Define
separate macros for maximum and supported numbers of Tx and Rx queues
based on underlying hardware. Take VLAN header into account for MTU
calculation. Default to INTx mode when pci_enable_msix() fails. Set a
bit in Rx poll routine, check and wait for that bit to be cleared in
the cleanup routine before proceeding.
- The TX and Rx coalesce settings are programmed in steps of 5 us. The value
that are not divisible by 5 are rounded to the next lower number. This was
causing the value os 1 to 4 to be rounded to 0, which is an invalid setting.
When creating Rx and Tx object, we are currently assigning the default
values of Rx and Tx coalescing_timeo. If these values are changed in the
driver to a different value, the change is lost during such operations as
MTU change. In order to avoid that, pass the configured value of
coalescing_timeo before Rx and Tx object creation. Fix
bnad_tx_coalescing_timeo_set() so it applies to all the Tx objects.
- Reorg uninitialization path in case of pci_probe failure.
- Hardware clock setup changes to pass asic generation, port modes and
asic mode as part firmware boot parameters to firmware.
- FW mailbox interface changes to defined asic specific mailbox interfaces.
h/w mailbox interfaces take 8-bit FIDs and 2-bit port id for owner. Cleaned
up mailbox definitions and usage for new and old HW. Eliminated usage of
ASIC ID. MSI-X vector assignment and programming done by firmware. Fixed
host offsets for CPE/RME queue registers.
- Implement polling mechanism for FW ready to have poll mechanism replaces
the current interrupt based FW READY method. The timer based poll routine
in IOC will query the ioc_fwstate register to see if there is a state
change in FW, and sends the READY event. Removed infrastructure needed to
support mbox READY event from fw as well as IOC code.
- Move FW init to HW init. Handle the case where PCI mapping goes away when
IOCPF state machine is waiting for semaphore.
- Add IOC mbox call back to client indicating that the command is sent.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-09 00:21:39 +08:00
|
|
|
#define BNAD_IOCETH_TIMEOUT 10000
|
|
|
|
|
2012-12-11 20:24:51 +08:00
|
|
|
#define BNAD_MIN_Q_DEPTH 512
|
2013-12-18 09:07:36 +08:00
|
|
|
#define BNAD_MAX_RXQ_DEPTH 16384
|
2012-12-11 20:24:51 +08:00
|
|
|
#define BNAD_MAX_TXQ_DEPTH 2048
|
2011-08-30 23:27:46 +08:00
|
|
|
|
2010-08-24 11:24:12 +08:00
|
|
|
#define BNAD_JUMBO_MTU 9000
|
|
|
|
|
|
|
|
#define BNAD_NETIF_WAKE_THRESHOLD 8
|
|
|
|
|
|
|
|
#define BNAD_RXQ_REFILL_THRESHOLD_SHIFT 3
|
|
|
|
|
|
|
|
/* Bit positions for tcb->flags */
|
|
|
|
#define BNAD_TXQ_FREE_SENT 0
|
2010-12-24 05:45:01 +08:00
|
|
|
#define BNAD_TXQ_TX_STARTED 1
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
/* Bit positions for rcb->flags */
|
2012-12-11 20:24:51 +08:00
|
|
|
#define BNAD_RXQ_STARTED 0
|
|
|
|
#define BNAD_RXQ_POST_OK 1
|
2010-08-24 11:24:12 +08:00
|
|
|
|
bna: ENET and Tx Rx Redesign Enablement
Change details:
This patch contains additional structure and function definition changes
that are required to enable the new msgq/enet/txrx redesign introduced
by the previous 4 patches.
- structure and function definition changes to header files as a result
of Ethport, Enet, IOCEth, Tx, Rx redesign.
- ethtool changes to use new enet function and definitions
- Set number of Tx and Rx queues bassed on underlying hardware. Define
separate macros for maximum and supported numbers of Tx and Rx queues
based on underlying hardware. Take VLAN header into account for MTU
calculation. Default to INTx mode when pci_enable_msix() fails. Set a
bit in Rx poll routine, check and wait for that bit to be cleared in
the cleanup routine before proceeding.
- The TX and Rx coalesce settings are programmed in steps of 5 us. The value
that are not divisible by 5 are rounded to the next lower number. This was
causing the value os 1 to 4 to be rounded to 0, which is an invalid setting.
When creating Rx and Tx object, we are currently assigning the default
values of Rx and Tx coalescing_timeo. If these values are changed in the
driver to a different value, the change is lost during such operations as
MTU change. In order to avoid that, pass the configured value of
coalescing_timeo before Rx and Tx object creation. Fix
bnad_tx_coalescing_timeo_set() so it applies to all the Tx objects.
- Reorg uninitialization path in case of pci_probe failure.
- Hardware clock setup changes to pass asic generation, port modes and
asic mode as part firmware boot parameters to firmware.
- FW mailbox interface changes to defined asic specific mailbox interfaces.
h/w mailbox interfaces take 8-bit FIDs and 2-bit port id for owner. Cleaned
up mailbox definitions and usage for new and old HW. Eliminated usage of
ASIC ID. MSI-X vector assignment and programming done by firmware. Fixed
host offsets for CPE/RME queue registers.
- Implement polling mechanism for FW ready to have poll mechanism replaces
the current interrupt based FW READY method. The timer based poll routine
in IOC will query the ioc_fwstate register to see if there is a state
change in FW, and sends the READY event. Removed infrastructure needed to
support mbox READY event from fw as well as IOC code.
- Move FW init to HW init. Handle the case where PCI mapping goes away when
IOCPF state machine is waiting for semaphore.
- Add IOC mbox call back to client indicating that the command is sent.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-09 00:21:39 +08:00
|
|
|
/* Resource limits */
|
|
|
|
#define BNAD_NUM_TXQ (bnad->num_tx * bnad->num_txq_per_tx)
|
|
|
|
#define BNAD_NUM_RXP (bnad->num_rx * bnad->num_rxp_per_rx)
|
|
|
|
|
2013-12-18 09:07:35 +08:00
|
|
|
#define BNAD_FRAME_SIZE(_mtu) \
|
|
|
|
(ETH_HLEN + VLAN_HLEN + (_mtu) + ETH_FCS_LEN)
|
|
|
|
|
2010-08-24 11:24:12 +08:00
|
|
|
/*
|
|
|
|
* DATA STRUCTURES
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* enums */
|
|
|
|
enum bnad_intr_source {
|
|
|
|
BNAD_INTR_TX = 1,
|
|
|
|
BNAD_INTR_RX = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
enum bnad_link_state {
|
|
|
|
BNAD_LS_DOWN = 0,
|
2011-07-22 16:07:41 +08:00
|
|
|
BNAD_LS_UP = 1
|
2010-08-24 11:24:12 +08:00
|
|
|
};
|
|
|
|
|
2011-12-22 21:29:45 +08:00
|
|
|
struct bnad_iocmd_comp {
|
|
|
|
struct bnad *bnad;
|
|
|
|
struct completion comp;
|
|
|
|
int comp_status;
|
|
|
|
};
|
|
|
|
|
2010-08-24 11:24:12 +08:00
|
|
|
struct bnad_completion {
|
2011-07-22 16:07:41 +08:00
|
|
|
struct completion ioc_comp;
|
|
|
|
struct completion ucast_comp;
|
2010-08-24 11:24:12 +08:00
|
|
|
struct completion mcast_comp;
|
|
|
|
struct completion tx_comp;
|
|
|
|
struct completion rx_comp;
|
|
|
|
struct completion stats_comp;
|
bna: ENET and Tx Rx Redesign Enablement
Change details:
This patch contains additional structure and function definition changes
that are required to enable the new msgq/enet/txrx redesign introduced
by the previous 4 patches.
- structure and function definition changes to header files as a result
of Ethport, Enet, IOCEth, Tx, Rx redesign.
- ethtool changes to use new enet function and definitions
- Set number of Tx and Rx queues bassed on underlying hardware. Define
separate macros for maximum and supported numbers of Tx and Rx queues
based on underlying hardware. Take VLAN header into account for MTU
calculation. Default to INTx mode when pci_enable_msix() fails. Set a
bit in Rx poll routine, check and wait for that bit to be cleared in
the cleanup routine before proceeding.
- The TX and Rx coalesce settings are programmed in steps of 5 us. The value
that are not divisible by 5 are rounded to the next lower number. This was
causing the value os 1 to 4 to be rounded to 0, which is an invalid setting.
When creating Rx and Tx object, we are currently assigning the default
values of Rx and Tx coalescing_timeo. If these values are changed in the
driver to a different value, the change is lost during such operations as
MTU change. In order to avoid that, pass the configured value of
coalescing_timeo before Rx and Tx object creation. Fix
bnad_tx_coalescing_timeo_set() so it applies to all the Tx objects.
- Reorg uninitialization path in case of pci_probe failure.
- Hardware clock setup changes to pass asic generation, port modes and
asic mode as part firmware boot parameters to firmware.
- FW mailbox interface changes to defined asic specific mailbox interfaces.
h/w mailbox interfaces take 8-bit FIDs and 2-bit port id for owner. Cleaned
up mailbox definitions and usage for new and old HW. Eliminated usage of
ASIC ID. MSI-X vector assignment and programming done by firmware. Fixed
host offsets for CPE/RME queue registers.
- Implement polling mechanism for FW ready to have poll mechanism replaces
the current interrupt based FW READY method. The timer based poll routine
in IOC will query the ioc_fwstate register to see if there is a state
change in FW, and sends the READY event. Removed infrastructure needed to
support mbox READY event from fw as well as IOC code.
- Move FW init to HW init. Handle the case where PCI mapping goes away when
IOCPF state machine is waiting for semaphore.
- Add IOC mbox call back to client indicating that the command is sent.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-09 00:21:39 +08:00
|
|
|
struct completion enet_comp;
|
|
|
|
struct completion mtu_comp;
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
u8 ioc_comp_status;
|
|
|
|
u8 ucast_comp_status;
|
|
|
|
u8 mcast_comp_status;
|
|
|
|
u8 tx_comp_status;
|
|
|
|
u8 rx_comp_status;
|
|
|
|
u8 stats_comp_status;
|
|
|
|
u8 port_comp_status;
|
bna: ENET and Tx Rx Redesign Enablement
Change details:
This patch contains additional structure and function definition changes
that are required to enable the new msgq/enet/txrx redesign introduced
by the previous 4 patches.
- structure and function definition changes to header files as a result
of Ethport, Enet, IOCEth, Tx, Rx redesign.
- ethtool changes to use new enet function and definitions
- Set number of Tx and Rx queues bassed on underlying hardware. Define
separate macros for maximum and supported numbers of Tx and Rx queues
based on underlying hardware. Take VLAN header into account for MTU
calculation. Default to INTx mode when pci_enable_msix() fails. Set a
bit in Rx poll routine, check and wait for that bit to be cleared in
the cleanup routine before proceeding.
- The TX and Rx coalesce settings are programmed in steps of 5 us. The value
that are not divisible by 5 are rounded to the next lower number. This was
causing the value os 1 to 4 to be rounded to 0, which is an invalid setting.
When creating Rx and Tx object, we are currently assigning the default
values of Rx and Tx coalescing_timeo. If these values are changed in the
driver to a different value, the change is lost during such operations as
MTU change. In order to avoid that, pass the configured value of
coalescing_timeo before Rx and Tx object creation. Fix
bnad_tx_coalescing_timeo_set() so it applies to all the Tx objects.
- Reorg uninitialization path in case of pci_probe failure.
- Hardware clock setup changes to pass asic generation, port modes and
asic mode as part firmware boot parameters to firmware.
- FW mailbox interface changes to defined asic specific mailbox interfaces.
h/w mailbox interfaces take 8-bit FIDs and 2-bit port id for owner. Cleaned
up mailbox definitions and usage for new and old HW. Eliminated usage of
ASIC ID. MSI-X vector assignment and programming done by firmware. Fixed
host offsets for CPE/RME queue registers.
- Implement polling mechanism for FW ready to have poll mechanism replaces
the current interrupt based FW READY method. The timer based poll routine
in IOC will query the ioc_fwstate register to see if there is a state
change in FW, and sends the READY event. Removed infrastructure needed to
support mbox READY event from fw as well as IOC code.
- Move FW init to HW init. Handle the case where PCI mapping goes away when
IOCPF state machine is waiting for semaphore.
- Add IOC mbox call back to client indicating that the command is sent.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-09 00:21:39 +08:00
|
|
|
u8 mtu_comp_status;
|
2010-08-24 11:24:12 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Tx Rx Control Stats */
|
|
|
|
struct bnad_drv_stats {
|
2011-07-22 16:07:41 +08:00
|
|
|
u64 netif_queue_stop;
|
2010-08-24 11:24:12 +08:00
|
|
|
u64 netif_queue_wakeup;
|
2010-12-24 05:45:05 +08:00
|
|
|
u64 netif_queue_stopped;
|
2010-08-24 11:24:12 +08:00
|
|
|
u64 tso4;
|
|
|
|
u64 tso6;
|
|
|
|
u64 tso_err;
|
|
|
|
u64 tcpcsum_offload;
|
|
|
|
u64 udpcsum_offload;
|
|
|
|
u64 csum_help;
|
2011-08-30 23:27:40 +08:00
|
|
|
u64 tx_skb_too_short;
|
|
|
|
u64 tx_skb_stopping;
|
|
|
|
u64 tx_skb_max_vectors;
|
|
|
|
u64 tx_skb_mss_too_long;
|
|
|
|
u64 tx_skb_tso_too_short;
|
|
|
|
u64 tx_skb_tso_prepare;
|
|
|
|
u64 tx_skb_non_tso_too_long;
|
|
|
|
u64 tx_skb_tcp_hdr;
|
|
|
|
u64 tx_skb_udp_hdr;
|
|
|
|
u64 tx_skb_csum_err;
|
|
|
|
u64 tx_skb_headlen_too_long;
|
|
|
|
u64 tx_skb_headlen_zero;
|
|
|
|
u64 tx_skb_frag_zero;
|
|
|
|
u64 tx_skb_len_mismatch;
|
2015-09-16 21:27:43 +08:00
|
|
|
u64 tx_skb_map_failed;
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
u64 hw_stats_updates;
|
|
|
|
u64 netif_rx_dropped;
|
|
|
|
|
|
|
|
u64 link_toggle;
|
bna: ENET and Tx Rx Redesign Enablement
Change details:
This patch contains additional structure and function definition changes
that are required to enable the new msgq/enet/txrx redesign introduced
by the previous 4 patches.
- structure and function definition changes to header files as a result
of Ethport, Enet, IOCEth, Tx, Rx redesign.
- ethtool changes to use new enet function and definitions
- Set number of Tx and Rx queues bassed on underlying hardware. Define
separate macros for maximum and supported numbers of Tx and Rx queues
based on underlying hardware. Take VLAN header into account for MTU
calculation. Default to INTx mode when pci_enable_msix() fails. Set a
bit in Rx poll routine, check and wait for that bit to be cleared in
the cleanup routine before proceeding.
- The TX and Rx coalesce settings are programmed in steps of 5 us. The value
that are not divisible by 5 are rounded to the next lower number. This was
causing the value os 1 to 4 to be rounded to 0, which is an invalid setting.
When creating Rx and Tx object, we are currently assigning the default
values of Rx and Tx coalescing_timeo. If these values are changed in the
driver to a different value, the change is lost during such operations as
MTU change. In order to avoid that, pass the configured value of
coalescing_timeo before Rx and Tx object creation. Fix
bnad_tx_coalescing_timeo_set() so it applies to all the Tx objects.
- Reorg uninitialization path in case of pci_probe failure.
- Hardware clock setup changes to pass asic generation, port modes and
asic mode as part firmware boot parameters to firmware.
- FW mailbox interface changes to defined asic specific mailbox interfaces.
h/w mailbox interfaces take 8-bit FIDs and 2-bit port id for owner. Cleaned
up mailbox definitions and usage for new and old HW. Eliminated usage of
ASIC ID. MSI-X vector assignment and programming done by firmware. Fixed
host offsets for CPE/RME queue registers.
- Implement polling mechanism for FW ready to have poll mechanism replaces
the current interrupt based FW READY method. The timer based poll routine
in IOC will query the ioc_fwstate register to see if there is a state
change in FW, and sends the READY event. Removed infrastructure needed to
support mbox READY event from fw as well as IOC code.
- Move FW init to HW init. Handle the case where PCI mapping goes away when
IOCPF state machine is waiting for semaphore.
- Add IOC mbox call back to client indicating that the command is sent.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-09 00:21:39 +08:00
|
|
|
u64 cee_toggle;
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
u64 rxp_info_alloc_failed;
|
|
|
|
u64 mbox_intr_disabled;
|
|
|
|
u64 mbox_intr_enabled;
|
|
|
|
u64 tx_unmap_q_alloc_failed;
|
|
|
|
u64 rx_unmap_q_alloc_failed;
|
|
|
|
|
|
|
|
u64 rxbuf_alloc_failed;
|
2015-09-16 21:27:43 +08:00
|
|
|
u64 rxbuf_map_failed;
|
2010-08-24 11:24:12 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Complete driver stats */
|
|
|
|
struct bnad_stats {
|
|
|
|
struct bnad_drv_stats drv_stats;
|
|
|
|
struct bna_stats *bna_stats;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Tx / Rx Resources */
|
|
|
|
struct bnad_tx_res_info {
|
|
|
|
struct bna_res_info res_info[BNA_TX_RES_T_MAX];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct bnad_rx_res_info {
|
|
|
|
struct bna_res_info res_info[BNA_RX_RES_T_MAX];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct bnad_tx_info {
|
|
|
|
struct bna_tx *tx; /* 1:1 between tx_info & tx */
|
|
|
|
struct bna_tcb *tcb[BNAD_MAX_TXQ_PER_TX];
|
bna: ENET and Tx Rx Redesign Enablement
Change details:
This patch contains additional structure and function definition changes
that are required to enable the new msgq/enet/txrx redesign introduced
by the previous 4 patches.
- structure and function definition changes to header files as a result
of Ethport, Enet, IOCEth, Tx, Rx redesign.
- ethtool changes to use new enet function and definitions
- Set number of Tx and Rx queues bassed on underlying hardware. Define
separate macros for maximum and supported numbers of Tx and Rx queues
based on underlying hardware. Take VLAN header into account for MTU
calculation. Default to INTx mode when pci_enable_msix() fails. Set a
bit in Rx poll routine, check and wait for that bit to be cleared in
the cleanup routine before proceeding.
- The TX and Rx coalesce settings are programmed in steps of 5 us. The value
that are not divisible by 5 are rounded to the next lower number. This was
causing the value os 1 to 4 to be rounded to 0, which is an invalid setting.
When creating Rx and Tx object, we are currently assigning the default
values of Rx and Tx coalescing_timeo. If these values are changed in the
driver to a different value, the change is lost during such operations as
MTU change. In order to avoid that, pass the configured value of
coalescing_timeo before Rx and Tx object creation. Fix
bnad_tx_coalescing_timeo_set() so it applies to all the Tx objects.
- Reorg uninitialization path in case of pci_probe failure.
- Hardware clock setup changes to pass asic generation, port modes and
asic mode as part firmware boot parameters to firmware.
- FW mailbox interface changes to defined asic specific mailbox interfaces.
h/w mailbox interfaces take 8-bit FIDs and 2-bit port id for owner. Cleaned
up mailbox definitions and usage for new and old HW. Eliminated usage of
ASIC ID. MSI-X vector assignment and programming done by firmware. Fixed
host offsets for CPE/RME queue registers.
- Implement polling mechanism for FW ready to have poll mechanism replaces
the current interrupt based FW READY method. The timer based poll routine
in IOC will query the ioc_fwstate register to see if there is a state
change in FW, and sends the READY event. Removed infrastructure needed to
support mbox READY event from fw as well as IOC code.
- Move FW init to HW init. Handle the case where PCI mapping goes away when
IOCPF state machine is waiting for semaphore.
- Add IOC mbox call back to client indicating that the command is sent.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-09 00:21:39 +08:00
|
|
|
u32 tx_id;
|
2012-04-04 13:43:18 +08:00
|
|
|
struct delayed_work tx_cleanup_work;
|
2010-08-24 11:24:12 +08:00
|
|
|
} ____cacheline_aligned;
|
|
|
|
|
|
|
|
struct bnad_rx_info {
|
|
|
|
struct bna_rx *rx; /* 1:1 between rx_info & rx */
|
|
|
|
|
2011-08-30 23:27:37 +08:00
|
|
|
struct bnad_rx_ctrl rx_ctrl[BNAD_MAX_RXP_PER_RX];
|
bna: ENET and Tx Rx Redesign Enablement
Change details:
This patch contains additional structure and function definition changes
that are required to enable the new msgq/enet/txrx redesign introduced
by the previous 4 patches.
- structure and function definition changes to header files as a result
of Ethport, Enet, IOCEth, Tx, Rx redesign.
- ethtool changes to use new enet function and definitions
- Set number of Tx and Rx queues bassed on underlying hardware. Define
separate macros for maximum and supported numbers of Tx and Rx queues
based on underlying hardware. Take VLAN header into account for MTU
calculation. Default to INTx mode when pci_enable_msix() fails. Set a
bit in Rx poll routine, check and wait for that bit to be cleared in
the cleanup routine before proceeding.
- The TX and Rx coalesce settings are programmed in steps of 5 us. The value
that are not divisible by 5 are rounded to the next lower number. This was
causing the value os 1 to 4 to be rounded to 0, which is an invalid setting.
When creating Rx and Tx object, we are currently assigning the default
values of Rx and Tx coalescing_timeo. If these values are changed in the
driver to a different value, the change is lost during such operations as
MTU change. In order to avoid that, pass the configured value of
coalescing_timeo before Rx and Tx object creation. Fix
bnad_tx_coalescing_timeo_set() so it applies to all the Tx objects.
- Reorg uninitialization path in case of pci_probe failure.
- Hardware clock setup changes to pass asic generation, port modes and
asic mode as part firmware boot parameters to firmware.
- FW mailbox interface changes to defined asic specific mailbox interfaces.
h/w mailbox interfaces take 8-bit FIDs and 2-bit port id for owner. Cleaned
up mailbox definitions and usage for new and old HW. Eliminated usage of
ASIC ID. MSI-X vector assignment and programming done by firmware. Fixed
host offsets for CPE/RME queue registers.
- Implement polling mechanism for FW ready to have poll mechanism replaces
the current interrupt based FW READY method. The timer based poll routine
in IOC will query the ioc_fwstate register to see if there is a state
change in FW, and sends the READY event. Removed infrastructure needed to
support mbox READY event from fw as well as IOC code.
- Move FW init to HW init. Handle the case where PCI mapping goes away when
IOCPF state machine is waiting for semaphore.
- Add IOC mbox call back to client indicating that the command is sent.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-09 00:21:39 +08:00
|
|
|
u32 rx_id;
|
2012-04-04 13:43:18 +08:00
|
|
|
struct work_struct rx_cleanup_work;
|
2010-08-24 11:24:12 +08:00
|
|
|
} ____cacheline_aligned;
|
|
|
|
|
2012-12-11 20:24:51 +08:00
|
|
|
struct bnad_tx_vector {
|
|
|
|
DEFINE_DMA_UNMAP_ADDR(dma_addr);
|
2013-12-18 09:07:40 +08:00
|
|
|
DEFINE_DMA_UNMAP_LEN(dma_len);
|
2012-12-11 20:24:51 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct bnad_tx_unmap {
|
2010-08-24 11:24:12 +08:00
|
|
|
struct sk_buff *skb;
|
2012-12-11 20:24:51 +08:00
|
|
|
u32 nvecs;
|
|
|
|
struct bnad_tx_vector vectors[BFI_TX_MAX_VECTORS_PER_WI];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct bnad_rx_vector {
|
2011-02-02 12:37:02 +08:00
|
|
|
DEFINE_DMA_UNMAP_ADDR(dma_addr);
|
2012-12-11 20:24:51 +08:00
|
|
|
u32 len;
|
2010-08-24 11:24:12 +08:00
|
|
|
};
|
|
|
|
|
2012-12-11 20:24:51 +08:00
|
|
|
struct bnad_rx_unmap {
|
2012-12-11 20:24:53 +08:00
|
|
|
struct page *page;
|
2012-12-11 20:24:51 +08:00
|
|
|
struct sk_buff *skb;
|
|
|
|
struct bnad_rx_vector vector;
|
2013-12-18 09:07:36 +08:00
|
|
|
u32 page_offset;
|
2010-08-24 11:24:12 +08:00
|
|
|
};
|
|
|
|
|
2012-12-11 20:24:53 +08:00
|
|
|
enum bnad_rxbuf_type {
|
|
|
|
BNAD_RXBUF_NONE = 0,
|
2013-12-18 09:07:35 +08:00
|
|
|
BNAD_RXBUF_SK_BUFF = 1,
|
2012-12-11 20:24:53 +08:00
|
|
|
BNAD_RXBUF_PAGE = 2,
|
2013-12-18 09:07:35 +08:00
|
|
|
BNAD_RXBUF_MULTI_BUFF = 3
|
2012-12-11 20:24:53 +08:00
|
|
|
};
|
|
|
|
|
2013-12-18 09:07:35 +08:00
|
|
|
#define BNAD_RXBUF_IS_SK_BUFF(_type) ((_type) == BNAD_RXBUF_SK_BUFF)
|
|
|
|
#define BNAD_RXBUF_IS_MULTI_BUFF(_type) ((_type) == BNAD_RXBUF_MULTI_BUFF)
|
2012-12-11 20:24:53 +08:00
|
|
|
|
|
|
|
struct bnad_rx_unmap_q {
|
|
|
|
int reuse_pi;
|
|
|
|
int alloc_order;
|
|
|
|
u32 map_size;
|
|
|
|
enum bnad_rxbuf_type type;
|
2013-12-18 09:07:36 +08:00
|
|
|
struct bnad_rx_unmap unmap[0] ____cacheline_aligned;
|
2012-12-11 20:24:53 +08:00
|
|
|
};
|
|
|
|
|
2013-12-18 09:07:35 +08:00
|
|
|
#define BNAD_PCI_DEV_IS_CAT2(_bnad) \
|
|
|
|
((_bnad)->pcidev->device == BFA_PCI_DEVICE_ID_CT2)
|
|
|
|
|
2010-08-24 11:24:12 +08:00
|
|
|
/* Bit mask values for bnad->cfg_flags */
|
|
|
|
#define BNAD_CF_DIM_ENABLED 0x01 /* DIM */
|
|
|
|
#define BNAD_CF_PROMISC 0x02
|
|
|
|
#define BNAD_CF_ALLMULTI 0x04
|
2013-12-18 09:07:34 +08:00
|
|
|
#define BNAD_CF_DEFAULT 0x08
|
|
|
|
#define BNAD_CF_MSIX 0x10 /* If in MSIx mode */
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
/* Defines for run_flags bit-mask */
|
|
|
|
/* Set, tested & cleared using xxx_bit() functions */
|
|
|
|
/* Values indicated bit positions */
|
bna: ENET and Tx Rx Redesign Enablement
Change details:
This patch contains additional structure and function definition changes
that are required to enable the new msgq/enet/txrx redesign introduced
by the previous 4 patches.
- structure and function definition changes to header files as a result
of Ethport, Enet, IOCEth, Tx, Rx redesign.
- ethtool changes to use new enet function and definitions
- Set number of Tx and Rx queues bassed on underlying hardware. Define
separate macros for maximum and supported numbers of Tx and Rx queues
based on underlying hardware. Take VLAN header into account for MTU
calculation. Default to INTx mode when pci_enable_msix() fails. Set a
bit in Rx poll routine, check and wait for that bit to be cleared in
the cleanup routine before proceeding.
- The TX and Rx coalesce settings are programmed in steps of 5 us. The value
that are not divisible by 5 are rounded to the next lower number. This was
causing the value os 1 to 4 to be rounded to 0, which is an invalid setting.
When creating Rx and Tx object, we are currently assigning the default
values of Rx and Tx coalescing_timeo. If these values are changed in the
driver to a different value, the change is lost during such operations as
MTU change. In order to avoid that, pass the configured value of
coalescing_timeo before Rx and Tx object creation. Fix
bnad_tx_coalescing_timeo_set() so it applies to all the Tx objects.
- Reorg uninitialization path in case of pci_probe failure.
- Hardware clock setup changes to pass asic generation, port modes and
asic mode as part firmware boot parameters to firmware.
- FW mailbox interface changes to defined asic specific mailbox interfaces.
h/w mailbox interfaces take 8-bit FIDs and 2-bit port id for owner. Cleaned
up mailbox definitions and usage for new and old HW. Eliminated usage of
ASIC ID. MSI-X vector assignment and programming done by firmware. Fixed
host offsets for CPE/RME queue registers.
- Implement polling mechanism for FW ready to have poll mechanism replaces
the current interrupt based FW READY method. The timer based poll routine
in IOC will query the ioc_fwstate register to see if there is a state
change in FW, and sends the READY event. Removed infrastructure needed to
support mbox READY event from fw as well as IOC code.
- Move FW init to HW init. Handle the case where PCI mapping goes away when
IOCPF state machine is waiting for semaphore.
- Add IOC mbox call back to client indicating that the command is sent.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-09 00:21:39 +08:00
|
|
|
#define BNAD_RF_CEE_RUNNING 0
|
|
|
|
#define BNAD_RF_MTU_SET 1
|
2010-12-24 05:45:01 +08:00
|
|
|
#define BNAD_RF_MBOX_IRQ_DISABLED 2
|
bna: ENET and Tx Rx Redesign Enablement
Change details:
This patch contains additional structure and function definition changes
that are required to enable the new msgq/enet/txrx redesign introduced
by the previous 4 patches.
- structure and function definition changes to header files as a result
of Ethport, Enet, IOCEth, Tx, Rx redesign.
- ethtool changes to use new enet function and definitions
- Set number of Tx and Rx queues bassed on underlying hardware. Define
separate macros for maximum and supported numbers of Tx and Rx queues
based on underlying hardware. Take VLAN header into account for MTU
calculation. Default to INTx mode when pci_enable_msix() fails. Set a
bit in Rx poll routine, check and wait for that bit to be cleared in
the cleanup routine before proceeding.
- The TX and Rx coalesce settings are programmed in steps of 5 us. The value
that are not divisible by 5 are rounded to the next lower number. This was
causing the value os 1 to 4 to be rounded to 0, which is an invalid setting.
When creating Rx and Tx object, we are currently assigning the default
values of Rx and Tx coalescing_timeo. If these values are changed in the
driver to a different value, the change is lost during such operations as
MTU change. In order to avoid that, pass the configured value of
coalescing_timeo before Rx and Tx object creation. Fix
bnad_tx_coalescing_timeo_set() so it applies to all the Tx objects.
- Reorg uninitialization path in case of pci_probe failure.
- Hardware clock setup changes to pass asic generation, port modes and
asic mode as part firmware boot parameters to firmware.
- FW mailbox interface changes to defined asic specific mailbox interfaces.
h/w mailbox interfaces take 8-bit FIDs and 2-bit port id for owner. Cleaned
up mailbox definitions and usage for new and old HW. Eliminated usage of
ASIC ID. MSI-X vector assignment and programming done by firmware. Fixed
host offsets for CPE/RME queue registers.
- Implement polling mechanism for FW ready to have poll mechanism replaces
the current interrupt based FW READY method. The timer based poll routine
in IOC will query the ioc_fwstate register to see if there is a state
change in FW, and sends the READY event. Removed infrastructure needed to
support mbox READY event from fw as well as IOC code.
- Move FW init to HW init. Handle the case where PCI mapping goes away when
IOCPF state machine is waiting for semaphore.
- Add IOC mbox call back to client indicating that the command is sent.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-09 00:21:39 +08:00
|
|
|
#define BNAD_RF_NETDEV_REGISTERED 3
|
2010-12-24 05:45:01 +08:00
|
|
|
#define BNAD_RF_DIM_TIMER_RUNNING 4
|
|
|
|
#define BNAD_RF_STATS_TIMER_RUNNING 5
|
bna: ENET and Tx Rx Redesign Enablement
Change details:
This patch contains additional structure and function definition changes
that are required to enable the new msgq/enet/txrx redesign introduced
by the previous 4 patches.
- structure and function definition changes to header files as a result
of Ethport, Enet, IOCEth, Tx, Rx redesign.
- ethtool changes to use new enet function and definitions
- Set number of Tx and Rx queues bassed on underlying hardware. Define
separate macros for maximum and supported numbers of Tx and Rx queues
based on underlying hardware. Take VLAN header into account for MTU
calculation. Default to INTx mode when pci_enable_msix() fails. Set a
bit in Rx poll routine, check and wait for that bit to be cleared in
the cleanup routine before proceeding.
- The TX and Rx coalesce settings are programmed in steps of 5 us. The value
that are not divisible by 5 are rounded to the next lower number. This was
causing the value os 1 to 4 to be rounded to 0, which is an invalid setting.
When creating Rx and Tx object, we are currently assigning the default
values of Rx and Tx coalescing_timeo. If these values are changed in the
driver to a different value, the change is lost during such operations as
MTU change. In order to avoid that, pass the configured value of
coalescing_timeo before Rx and Tx object creation. Fix
bnad_tx_coalescing_timeo_set() so it applies to all the Tx objects.
- Reorg uninitialization path in case of pci_probe failure.
- Hardware clock setup changes to pass asic generation, port modes and
asic mode as part firmware boot parameters to firmware.
- FW mailbox interface changes to defined asic specific mailbox interfaces.
h/w mailbox interfaces take 8-bit FIDs and 2-bit port id for owner. Cleaned
up mailbox definitions and usage for new and old HW. Eliminated usage of
ASIC ID. MSI-X vector assignment and programming done by firmware. Fixed
host offsets for CPE/RME queue registers.
- Implement polling mechanism for FW ready to have poll mechanism replaces
the current interrupt based FW READY method. The timer based poll routine
in IOC will query the ioc_fwstate register to see if there is a state
change in FW, and sends the READY event. Removed infrastructure needed to
support mbox READY event from fw as well as IOC code.
- Move FW init to HW init. Handle the case where PCI mapping goes away when
IOCPF state machine is waiting for semaphore.
- Add IOC mbox call back to client indicating that the command is sent.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-09 00:21:39 +08:00
|
|
|
#define BNAD_RF_TX_PRIO_SET 6
|
|
|
|
|
2010-08-24 11:24:12 +08:00
|
|
|
struct bnad {
|
2011-07-22 16:07:41 +08:00
|
|
|
struct net_device *netdev;
|
2011-12-22 21:29:45 +08:00
|
|
|
u32 id;
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
/* Data path */
|
2011-08-30 23:27:37 +08:00
|
|
|
struct bnad_tx_info tx_info[BNAD_MAX_TX];
|
|
|
|
struct bnad_rx_info rx_info[BNAD_MAX_RX];
|
2010-08-24 11:24:12 +08:00
|
|
|
|
2011-07-20 12:54:14 +08:00
|
|
|
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
|
2010-08-24 11:24:12 +08:00
|
|
|
/*
|
|
|
|
* These q numbers are global only because
|
|
|
|
* they are used to calculate MSIx vectors.
|
|
|
|
* Actually the exact # of queues are per Tx/Rx
|
|
|
|
* object.
|
|
|
|
*/
|
|
|
|
u32 num_tx;
|
|
|
|
u32 num_rx;
|
|
|
|
u32 num_txq_per_tx;
|
|
|
|
u32 num_rxp_per_rx;
|
|
|
|
|
|
|
|
u32 txq_depth;
|
|
|
|
u32 rxq_depth;
|
|
|
|
|
|
|
|
u8 tx_coalescing_timeo;
|
|
|
|
u8 rx_coalescing_timeo;
|
|
|
|
|
2012-12-11 20:24:50 +08:00
|
|
|
struct bna_rx_config rx_config[BNAD_MAX_RX] ____cacheline_aligned;
|
|
|
|
struct bna_tx_config tx_config[BNAD_MAX_TX] ____cacheline_aligned;
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
void __iomem *bar0; /* BAR0 address */
|
|
|
|
|
|
|
|
struct bna bna;
|
|
|
|
|
|
|
|
u32 cfg_flags;
|
|
|
|
unsigned long run_flags;
|
|
|
|
|
2011-07-22 16:07:41 +08:00
|
|
|
struct pci_dev *pcidev;
|
2010-08-24 11:24:12 +08:00
|
|
|
u64 mmio_start;
|
|
|
|
u64 mmio_len;
|
|
|
|
|
|
|
|
u32 msix_num;
|
|
|
|
struct msix_entry *msix_table;
|
|
|
|
|
|
|
|
struct mutex conf_mutex;
|
|
|
|
spinlock_t bna_lock ____cacheline_aligned;
|
|
|
|
|
|
|
|
/* Timers */
|
|
|
|
struct timer_list ioc_timer;
|
|
|
|
struct timer_list dim_timer;
|
|
|
|
struct timer_list stats_timer;
|
|
|
|
|
|
|
|
/* Control path resources, memory & irq */
|
|
|
|
struct bna_res_info res_info[BNA_RES_T_MAX];
|
bna: ENET and Tx Rx Redesign Enablement
Change details:
This patch contains additional structure and function definition changes
that are required to enable the new msgq/enet/txrx redesign introduced
by the previous 4 patches.
- structure and function definition changes to header files as a result
of Ethport, Enet, IOCEth, Tx, Rx redesign.
- ethtool changes to use new enet function and definitions
- Set number of Tx and Rx queues bassed on underlying hardware. Define
separate macros for maximum and supported numbers of Tx and Rx queues
based on underlying hardware. Take VLAN header into account for MTU
calculation. Default to INTx mode when pci_enable_msix() fails. Set a
bit in Rx poll routine, check and wait for that bit to be cleared in
the cleanup routine before proceeding.
- The TX and Rx coalesce settings are programmed in steps of 5 us. The value
that are not divisible by 5 are rounded to the next lower number. This was
causing the value os 1 to 4 to be rounded to 0, which is an invalid setting.
When creating Rx and Tx object, we are currently assigning the default
values of Rx and Tx coalescing_timeo. If these values are changed in the
driver to a different value, the change is lost during such operations as
MTU change. In order to avoid that, pass the configured value of
coalescing_timeo before Rx and Tx object creation. Fix
bnad_tx_coalescing_timeo_set() so it applies to all the Tx objects.
- Reorg uninitialization path in case of pci_probe failure.
- Hardware clock setup changes to pass asic generation, port modes and
asic mode as part firmware boot parameters to firmware.
- FW mailbox interface changes to defined asic specific mailbox interfaces.
h/w mailbox interfaces take 8-bit FIDs and 2-bit port id for owner. Cleaned
up mailbox definitions and usage for new and old HW. Eliminated usage of
ASIC ID. MSI-X vector assignment and programming done by firmware. Fixed
host offsets for CPE/RME queue registers.
- Implement polling mechanism for FW ready to have poll mechanism replaces
the current interrupt based FW READY method. The timer based poll routine
in IOC will query the ioc_fwstate register to see if there is a state
change in FW, and sends the READY event. Removed infrastructure needed to
support mbox READY event from fw as well as IOC code.
- Move FW init to HW init. Handle the case where PCI mapping goes away when
IOCPF state machine is waiting for semaphore.
- Add IOC mbox call back to client indicating that the command is sent.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-09 00:21:39 +08:00
|
|
|
struct bna_res_info mod_res_info[BNA_MOD_RES_T_MAX];
|
2011-08-30 23:27:37 +08:00
|
|
|
struct bnad_tx_res_info tx_res_info[BNAD_MAX_TX];
|
|
|
|
struct bnad_rx_res_info rx_res_info[BNAD_MAX_RX];
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
struct bnad_completion bnad_completions;
|
|
|
|
|
|
|
|
/* Burnt in MAC address */
|
2015-06-11 21:52:14 +08:00
|
|
|
u8 perm_addr[ETH_ALEN];
|
2010-08-24 11:24:12 +08:00
|
|
|
|
2012-04-04 13:43:18 +08:00
|
|
|
struct workqueue_struct *work_q;
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
/* Statistics */
|
|
|
|
struct bnad_stats stats;
|
|
|
|
|
|
|
|
struct bnad_diag *diag;
|
|
|
|
|
|
|
|
char adapter_name[BNAD_NAME_LEN];
|
2011-07-22 16:07:41 +08:00
|
|
|
char port_name[BNAD_NAME_LEN];
|
2010-08-24 11:24:12 +08:00
|
|
|
char mbox_irq_name[BNAD_NAME_LEN];
|
2012-04-04 13:43:18 +08:00
|
|
|
char wq_name[BNAD_NAME_LEN];
|
2011-12-22 21:30:19 +08:00
|
|
|
|
|
|
|
/* debugfs specific data */
|
|
|
|
char *regdata;
|
|
|
|
u32 reglen;
|
|
|
|
struct dentry *bnad_dentry_files[5];
|
|
|
|
struct dentry *port_debugfs_root;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct bnad_drvinfo {
|
|
|
|
struct bfa_ioc_attr ioc_attr;
|
|
|
|
struct bfa_cee_attr cee_attr;
|
|
|
|
struct bfa_flash_attr flash_attr;
|
|
|
|
u32 cee_status;
|
|
|
|
u32 flash_status;
|
2010-08-24 11:24:12 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* EXTERN VARIABLES
|
|
|
|
*/
|
2012-01-04 21:02:24 +08:00
|
|
|
extern const struct firmware *bfi_fw;
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* EXTERN PROTOTYPES
|
|
|
|
*/
|
2013-09-24 06:11:34 +08:00
|
|
|
u32 *cna_get_firmware_buf(struct pci_dev *pdev);
|
2010-08-24 11:24:12 +08:00
|
|
|
/* Netdev entry point prototypes */
|
2013-09-24 06:11:34 +08:00
|
|
|
void bnad_set_rx_mode(struct net_device *netdev);
|
|
|
|
struct net_device_stats *bnad_get_netdev_stats(struct net_device *netdev);
|
2015-06-18 00:41:57 +08:00
|
|
|
int bnad_mac_addr_set_locked(struct bnad *bnad, const u8 *mac_addr);
|
2013-09-24 06:11:34 +08:00
|
|
|
int bnad_enable_default_bcast(struct bnad *bnad);
|
|
|
|
void bnad_restore_vlans(struct bnad *bnad, u32 rx_id);
|
|
|
|
void bnad_set_ethtool_ops(struct net_device *netdev);
|
|
|
|
void bnad_cb_completion(void *arg, enum bfa_status status);
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
/* Configuration & setup */
|
2013-09-24 06:11:34 +08:00
|
|
|
void bnad_tx_coalescing_timeo_set(struct bnad *bnad);
|
|
|
|
void bnad_rx_coalescing_timeo_set(struct bnad *bnad);
|
2010-08-24 11:24:12 +08:00
|
|
|
|
2013-09-24 06:11:34 +08:00
|
|
|
int bnad_setup_rx(struct bnad *bnad, u32 rx_id);
|
|
|
|
int bnad_setup_tx(struct bnad *bnad, u32 tx_id);
|
|
|
|
void bnad_destroy_tx(struct bnad *bnad, u32 tx_id);
|
|
|
|
void bnad_destroy_rx(struct bnad *bnad, u32 rx_id);
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
/* Timer start/stop protos */
|
2013-09-24 06:11:34 +08:00
|
|
|
void bnad_dim_timer_start(struct bnad *bnad);
|
2010-08-24 11:24:12 +08:00
|
|
|
|
|
|
|
/* Statistics */
|
2013-09-24 06:11:34 +08:00
|
|
|
void bnad_netdev_qstats_fill(struct bnad *bnad,
|
|
|
|
struct rtnl_link_stats64 *stats);
|
|
|
|
void bnad_netdev_hwstats_fill(struct bnad *bnad,
|
|
|
|
struct rtnl_link_stats64 *stats);
|
2010-08-24 11:24:12 +08:00
|
|
|
|
2011-12-22 21:30:19 +08:00
|
|
|
/* Debugfs */
|
2013-09-24 06:11:34 +08:00
|
|
|
void bnad_debugfs_init(struct bnad *bnad);
|
|
|
|
void bnad_debugfs_uninit(struct bnad *bnad);
|
2011-12-22 21:30:19 +08:00
|
|
|
|
2012-07-10 18:56:59 +08:00
|
|
|
/* MACROS */
|
2010-08-24 11:24:12 +08:00
|
|
|
/* To set & get the stats counters */
|
|
|
|
#define BNAD_UPDATE_CTR(_bnad, _ctr) \
|
|
|
|
(((_bnad)->stats.drv_stats._ctr)++)
|
|
|
|
|
|
|
|
#define BNAD_GET_CTR(_bnad, _ctr) ((_bnad)->stats.drv_stats._ctr)
|
|
|
|
|
|
|
|
#define bnad_enable_rx_irq_unsafe(_ccb) \
|
|
|
|
{ \
|
2011-08-30 23:27:40 +08:00
|
|
|
if (likely(test_bit(BNAD_RXQ_STARTED, &(_ccb)->rcb[0]->flags))) {\
|
2010-12-24 05:45:01 +08:00
|
|
|
bna_ib_coalescing_timer_set((_ccb)->i_dbell, \
|
|
|
|
(_ccb)->rx_coalescing_timeo); \
|
|
|
|
bna_ib_ack((_ccb)->i_dbell, 0); \
|
|
|
|
} \
|
2010-08-24 11:24:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __BNAD_H__ */
|