History log of /drivers/net/ethernet/brocade/bna/bnad.c
Revision Date Author Comments
41de8d4cff21a2e81e3d9ff66f5f7c903f9c3ab1 29-Jan-2012 Joe Perches <joe@perches.com> drivers/net: Remove alloc_etherdev error messages

alloc_etherdev has a generic OOM/unable to alloc message.
Remove the duplicative messages after alloc_etherdev calls.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
e1e0918fcaea7b8100ed9f96f3ecd9eb9b867102 04-Jan-2012 stephen hemminger <shemminger@vyatta.com> bna: fix sparse warnings/errors

This fixes a several sparse warnings.
* the __iomem tag was being used incorrectly (needs to be a prefix)
* several variables should have been static since local to one file
* the firmware was not being forwared declared
and was const one place and not the other

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7afc5dbde09104b023ce04465ba71aaba0fc4346 22-Dec-2011 Krishna Gudipati <kgudipat@brocade.com> bna: Add debugfs interface.

Change details:
- Add debugfs support to obtain firmware trace, saved firmware trace on
an IOC crash, driver info and read/write to registers.

- debugfs hierarchy:
bna/pci_dev:<pci_name>
where the pci_name corresponds to the one under /sys/bus/pci/drivers/bna

- Following are the new debugfs entries added:
fwtrc: collect current firmware trace.
fwsave: collect last saved fw trace as a result of firmware crash.
regwr: write one word to chip register
regrd: read one or more words from chip register.
drvinfo: collect the driver information.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
72a9730b3f556e18912f3e1b494a7aee7ae3dd91 22-Dec-2011 Krishna Gudipati <kgudipat@brocade.com> bna: Added flash sub-module and ethtool eeprom entry points.

Change details:
- The patch adds flash sub-module to the bna driver.
- Added ethtool set_eeprom() and get_eeprom() entry points to
support flash partition read/write operations.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3db1cd5c05f35fb43eb134df6f321de4e63141f2 19-Dec-2011 Rusty Russell <rusty@rustcorp.com.au> net: fix assignment of 0/1 to bool variables.

DaveM said:
Please, this kind of stuff rots forever and not using bool properly
drives me crazy.

Joe Perches <joe@perches.com> gave me the spatch script:

@@
bool b;
@@
-b = 0
+b = false
@@
bool b;
@@
-b = 1
+b = true

I merely installed coccinelle, read the documentation and took credit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
8e586137e6b63af1e881b328466ab5ffbe562510 09-Dec-2011 Jiri Pirko <jpirko@redhat.com> net: make vlan ndo_vlan_rx_[add/kill]_vid return error value

Let caller know the result of adding/removing vlan id to/from vlan
filter.

In some drivers I make those functions to just return 0. But in those
where there is able to see if hw setup went correctly, return value is
set appropriately.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9d9779e723a5d23b94abbe5bb7d1197921f6f3dd 03-Jul-2011 Paul Gortmaker <paul.gortmaker@windriver.com> drivers/net: Add module.h to drivers who were implicitly using it

The device.h header was including module.h, making it present for
most of these drivers. But we want to clean that up. Call out the
include of module.h in the modular network drivers.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
9e903e085262ffbf1fc44a17ac06058aca03524a 18-Oct-2011 Eric Dumazet <eric.dumazet@gmail.com> net: add skb frag size accessors

To ease skb->truesize sanitization, its better to be able to localize
all references to skb frags size.

Define accessors : skb_frag_size() to fetch frag size, and
skb_frag_size_{set|add|sub}() to manipulate it.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5bcf6ac036556fcb4f9b5637f61e1227b66416cc 27-Sep-2011 Rasesh Mody <rmody@brocade.com> bna: Add Callback to Fix RXQ Stop

Change details:
- Add a callback in the BNA, which is called before sending FW command to stop
RxQs. After this callback is called, driver should not post anymore Rx
buffers to the RxQ. This addresses a small window where driver posts Rx
buffers while FW is stopping/has stopped the RxQ.
- Registering callback function, rx_stall_cbfn, during bna_rx_create.
Invoking callback function, rx_stall_cbfn, before sending rx_cfg_clr
command to FW
- Bnad_cb_rx_stall implementation - set a flag in the Rxq to mark buffer
posting disabled state. While posting buffers check for the above flag.

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
586b2816e3eaf187341f75c4f4e27404f943cb29 27-Sep-2011 Rasesh Mody <rmody@brocade.com> bna: Brocade 1860 HW Enablement

This patch enables new HW Brocade 1860. Add BFA_CM_NIC capability mask to
bfa_ioc_attr, Sub-System Device ID Info and support for Brocade 1860 device
ID to bfa_ioc.c and bnad.c.

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1bf9fd70dd7411372e80fdb8b4b3d5c36236e7b7 27-Sep-2011 Rasesh Mody <rmody@brocade.com> bna: Implement FW Download for New HW

Add new device ID 0x22 and new asic generation BFI_ASIC_GEN_CT2 for 1860.
Implement FW download from user space for new Brocade HW.

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3fc72370186be2f9d4d6ef06d99e1caa5d92c564 22-Sep-2011 Rasesh Mody <rmody@brocade.com> bna: PCI Probe Conf Lock Fix

If register_netdev() fails now, then we call mutex_unlock(&bnad->conf_mutex);
on the error path, but it's already unlocked. So we acquire the lock in error
path which will be later unlocked after the cleanup.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b9fa1fbf98178c8bbda23ff1d3ed0731bb3c0bd1 16-Sep-2011 Rasesh Mody <rmody@brocade.com> bna: Eliminate Small Race Condition Window in RX Path

Change details:
- In a continuous sequence of ifconfig up/down operations, there is a small
window of race between bnad_set_rx_mode() and bnad_cleanup_rx() while the
former tries to access rx_info->rx & the latter sets it to NULL. This race
could lead to bna_rx_mode_set() being called with a NULL (rx_info->rx)
pointer and a crash.
- Hold bnad->bna_lock while setting / unsetting rx_info->rx in bnad_setup_rx()
& bnad_cleanup_rx(), thereby eliminating the race described above.

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
d91d25d537af07ba71ed9751d5319daa8eee5066 16-Sep-2011 stephen hemminger <shemminger@vyatta.com> bna: make function tables cont

To prevent malicious usage, all tables of pointers must be const.

Compile tested only.
Gleaned for PAX.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
938fa48843b8d020a1dfc9cf340e09347132b7c4 30-Aug-2011 Rasesh Mody <rmody@brocade.com> bna: SKB PCI UNMAP Fix

Change details:
- Found a leak in sk_buff unmapping of PCI dma addresses where boundary
conditions are not properly handled in freeing all Tx buffers. Freeing
of all Tx buffers is done considering sk_buffs data and fragments can
be mapped at the boundary.

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
dfee325ad23ff4714981c9d2a4df6386493a4475 30-Aug-2011 Rasesh Mody <rmody@brocade.com> bna: MBOX IRQ Flag Check after Locking

Change details:
- Check the BNAD_RF_MBOX_IRQ_DISABLED flag after acquiring the bna_lock,
since checking the flag and executing bna_mbox_handler needs to be atomic.
If not, it opens up window where flag is reset when it was checked, but got
set while spinning on the lock by the other thread which is actually
holding the lock

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
a2122d95be5bab420741167913a9f39af673d11c 30-Aug-2011 Rasesh Mody <rmody@brocade.com> bna: Ethtool Enhancements and Fix

Change details:
- Add tx_skb counters and NAPI debug counters to ethtool stats.
- Add rlb stats strings to bnad_net_stats_strings{} array. rlb_stats field
was added to struct bfi_enet_stats {} but the corresponding name structure
array for ethtool was not initialized with right strings, even though the
actual name structure array got expanded. This caused a NULL pointer
violation and a crash when doing ehtool -S <if_name>.
- Modify dim timer stop logic to make it dependent on cfg and run flags
- While setting the ring parameter restore the rx, vlan configuration and
set rx mode
- Indentation fix

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3caa1e9556087ecee27bfddc7beb5758213a4507 30-Aug-2011 Rasesh Mody <rmody@brocade.com> bna: Initialization and Locking Fix

Change details:
- Initialize rx_id to 0 for bnad_cleanup_rx
- Return -ENOMEM in case if bna_rx_create fails
- Count the Rx buffer allocation failures in bnad_alloc_n_post_rxbufs()
- Remove unnecessary initialization of using_dac to false in bnad_pci_probe
- Release lock if error while doing bna_num_txq_set in bnad_pci_probe

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
19dbff9feea4f31ab3cdae53b98ef4484b554592 30-Aug-2011 Rasesh Mody <rmody@brocade.com> bna: Formatting and Code Cleanup

Change details:
- Print log messages when running with reduced number of MSI-X vectors
and when defaulting to INTx mode.
- Remove BUG_ONs and header file inclusion that are not needed
- Comments addition/cleanup
- Unused code cleanup
- Add New Line to Print msg in bfa_sm_fault
- Formatting fix

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
271e8b794700022fcd93d37967fa999ddee47698 30-Aug-2011 Rasesh Mody <rmody@brocade.com> bna: TX Path and RX Path Changes

Change details:
- Add bnad_pci_unmap_skb() API to unmap skb from transmit path and update the
unmap index. Add more checks for illegal skbs in transmit path. Add tx_skb
counters for dropped skbs.
- The unmap_cons index used in bnad_free_txbufs() is incorrectly declared as
u16. It quickly wraps around and accesses null sk_buff ptr. So using u32 to
handle unmap_array.
- Disable and enable interrupts from the same polling context to prevent
reordering in Rx path.
- Add Rx NAPI debug counters.
- Make NAPI budget check more generic.
- Modify dim timer stop logic to make it dependent on cfg and run flags
- Handle reduced MSI-X vectors case in bnad_enable_msix.
- Check for single frame TSO skbs and send them out as non-TSO.
- Put memory barrier after bna_txq_prod_indx_doorbell().

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2be671442214402f890e367a19b5fc64cc13f878 30-Aug-2011 Rasesh Mody <rmody@brocade.com> bna: Interrupt Polling and NAPI Init Changes

Change details:
- Remove unnecessary ccb check from bnad_poll_cq
- Add bnad pointer to rx_ctrl structure, so that bnad can be accessed directly
from rx_ctrl in the NAPI poll routines, even if ccb is NULL
- Validate ccb before referencing to it in bnad_msix_rx and bnad_napi_poll_rx
- Fix the order of NAPI init / uninit in Tx / Rx setup / teardown path:
a. Kill bnad tx free tasklet ahead of call to bna_tx_destroy()
b. Call NAPI disable only after call to Rx free_irq(). This makes sure Rx
interrupt does not schedule a poll when NAPI is already disabled
- NAPI poll runs before the h/w has completed configuration. This causes a
crash. Delay enabling NAPI till after bna_rx_enable(). Split NAPI
initialization into 2 steps, bnad_napi_init() & bnad_napi_enable().

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0caa9aaec515268ec13b0939bfb7e32cf5a31a55 30-Aug-2011 Rasesh Mody <rmody@brocade.com> bna: PCI Probe Fix

Change details:
- Return error as -EIO if bnad_res_alloc fails
- Release the configuration lock before registering with net_device layer.

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
772b5235d86563b00786030d9f42af3a89fd0833 30-Aug-2011 Rasesh Mody <rmody@brocade.com> bna: Naming Change and Minor Macro Fix

Naming changes: rename devid, BNAD_MAX_TXS, BNAD_MAX_RXS,
BNAD_MAX_RXPS_PER_RX to device, BNAD_MAX_TX, BNAD_MAX_RX,
BNAD_MAX_RXP_PER_RX respectively and change all the references.

Macro Fix: Add ioc_isr_mod_set check to bfa_nw_ioc_mbox_regisr macro

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4d5b1a674e3426aa53191978631472518da71852 30-Aug-2011 Ian Campbell <Ian.Campbell@citrix.com> bna: convert to SKB paged frag API.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Rasesh Mody <rmody@brocade.com>
Cc: Debashis Dutt <ddutt@brocade.com>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
44861f4455a77beaec2e53459c77b7fb0eda91a7 24-Aug-2011 Dan Carpenter <error27@gmail.com> bna: unlock on error path in pnad_pci_probe()

We introduced a new lock here, so there was error path which needs
an unlock now.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
afc4b13df143122f99a0eb10bfefb216c2806de0 16-Aug-2011 Jiri Pirko <jpirko@redhat.com> net: remove use of ndo_set_multicast_list in drivers

replace it by ndo_set_rx_mode

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
078086f3c17fae8af6c077153773c4a10392ffbf 08-Aug-2011 Rasesh Mody <rmody@brocade.com> 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>
f844a0ead401c3ce0f01a8bb4d6cea2f0f6ad863 13-May-2011 Jeff Kirsher <jeffrey.t.kirsher@intel.com> bna: Move the Brocade driver

Moves the Brocade driver into drivers/net/ethernet/brocade/ and make
the necessary Kconfig and Makefile changes.

CC: Rasesh Mody <rmody@brocade.com>
CC: Debashis Dutt <ddutt@brocade.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>