aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/et131x/et131x.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-10-03staging: et131x: Remove et131x driver from drivers/stagingMark Einon1-4121/+0
The current version of the et131x driver has been accepted into the main tree at /drivers/net/ethernet, so it can now be removed from staging. The MAINTAINERS entry has not been touched here, as the patch to add the driver to drivers/net modifies it correctly. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-29staging: et131x: Simplify for loop in et131x_init_send()Mark Einon1-2/+4
The for loop in this function increments two variables and has an unusual starting index of 1 (not 0). Make it look more familiar. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-29staging: et131x: Audit and update commentsMark Einon1-307/+21
Many of the functions and variables in the driver have been renamed and are now more understandable, as well as defines added for various constants. Update / remove some comments to reflect this. Also many comments were unnecessary dialogue describing what is evident from the code, or comments were just plain incorrect. Remove these too. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-28staging: et131x: Remove unnecessary parenthesesMark Einon1-3/+3
Reported-by: Joe Perches <joe@perches.com> Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-28staging: et131x: Remove unnecessary OOM messageMark Einon1-3/+1
Reported-by: Joe Perches <joe@perches.com> Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-28staging: et131x: Cat some lines less than 80 columnsMark Einon1-6/+6
Some split lines are less than 80 chars if rejoined, so rejoin them. Reported-by: Joe Perches <joe@perches.com> Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-28staging: et131x: Use ether_addr_copy when copying ethernet addressesMark Einon1-7/+5
Reported-by: Joe Perches <joe@perches.com> Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: et131x: Remove unnecessary defines to enable driver PMMark Einon1-5/+2
The Power Management functions can be conditional by assigning pm ops directly to .driver.pm, instead of using #ifdef's, saving some lines of code. Reported-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: et131x: Add space after { in pci ID tableMark Einon1-1/+1
Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: et131x: don't cast a void* to a struct pointerMark Einon1-1/+1
Casting a void* popinter to a struct pointer is unnecessary, don't do it. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: et131x: zero allocation of fbr to prevent random address accessMark Einon1-2/+2
If et131x_rx_dma_memory_alloc() allocates rx_ring->fbr[0] but fails to allocate rx_ring->fbr[1], this leaves fbr[0]->ring_virtaddr with the possibility of being accessed in et131x_rx_dma_memory_free() as it contains a random value, potentially causing an oops. Fix this by zeroing the fbr memory on allocation. Subsequent frees of this fbr memory explicitly zeros the ring_virtaddr value. Reported-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: et131x: Reduce split lines by renaming flowcontrolMark Einon1-19/+14
Rename adapter->flowcontrol to adapter->flow, reducing split lines. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: et131x: Use braces on all arms of if/else in et131x_handle_recv_pktsMark Einon1-2/+4
The 'if' blocks have braces, so the 'else' blocks should too. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: et131x: Reduce split lines by renaming some psr variablesMark Einon1-22/+17
Modify some packet status ring associated variables to save a few split lines: pktstat_ringsize -> psr_size psr_num_entries -> psr_entries index -> ii Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: et131x: Reduce split lines in et131x_rx_dma_memory_alloc()Mark Einon1-10/+7
Modify temporary variables so that split lines can be reduced: index -> k fbr_tmp_physaddr -> fbr_physaddr Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: et131x: Remove unused ce_stats struct memberMark Einon1-1/+0
This ce_stats struct member is no longer used. Remove it. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: et131x: Remove unused MP_TCB definesMark Einon1-4/+0
These two defines are not used, so remove them. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: et131x: Remove unused et131x_adapter struct membersMark Einon1-7/+0
These two adapter struct members are not used, remove them. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: logical continuations should be on the previous lineMark Einon1-4/+4
Fix two occurrences of the checkpatch check: CHECK: Logical continuations should be on the previous line Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Fix 'else is not generally useful after a break or return'Mark Einon1-2/+2
Fix this checkpatch warning: WARNING: else is not generally useful after a break or return Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Use variable names instead of types in sizeofMark Einon1-3/+3
A few calls to sizeof() in et131x.c give the type as a parameter - use the equivalent variable name instead. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Use braces on all arms of if/else statementsMark Einon1-3/+6
In some places in et131x.c, one arm of am if/else statement has braces and the other not - put braces on both arms where this happens. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Remove spaces after castsMark Einon1-3/+3
In three places in et131x.c, spaces exist after a cast. Remove them. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Add spinlock definition commentsMark Einon1-4/+3
Checkpatch --strict advises that spinlocks should be described when defined, seems a good idea so this change does that. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Remove useless assignment to NULLMark Einon1-1/+0
The stack variable skb is no longer used after it's set to NULL. Don't set it to NULL. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Remove send_hw_lock spinlockMark Einon1-14/+1
We don't need to use this lock - the tx path is protected by the networking subsystem xmit_lock, so we don't also need it in nic_send_packet(). The other use of this spinlock in et1310_enable_phy_coma() to protect a low power flag makes no sense, so can just be removed. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Simplify unlocking tcb_send_qlock in et131x_tx_timeout()Mark Einon1-8/+2
The tcb_send_qlock spinlock is unlocked in all three paths at the end of et131x_tx_timeout(). We can call it once before entering any of the paths, saving ourselves a few lines of code. This change puts tcb->count++ outside of the lock, but et131x_tx_timeout() itself is protected by the tx_global_lock, so this shouldn't matter. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Remove blank lines form et131x.cMark Einon1-11/+0
Remove some unecessary blank lines from et131x.c Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Simplify code in nic_rx_pkts() for multicast_pkts_rcvdMark Einon1-52/+2
In nic_rx_pkts(), we check that a multicast packet received (when using a multicast list) is one that was requested - despite setting the list up with the hardware. We shouldn't expect to get a mc packet we didn't ask for, so remove these extra checks. This also means that the surrounding code can be tiedied up a little. Tested somewhat with omping, with no adverse effects seen. Also remove this item from the TODO list. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Combine two if statements with same effectMark Einon1-4/+2
Both these if statements have the same effect when true, so combine them and save a few lines. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Remove struct tcb->flagsMark Einon1-16/+2
'struct tcb' member 'flags' was only used to collect tx stats, now we are no longer collecting those particular stats, we no longer need tcb->flags or the code used to peek into the skb to set it's value. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Remove ununsed statisticsMark Einon1-20/+0
From struct ce_stats; unicast_pkts_rcvd, unicast_pkts_xmtd, multicast_pkts_xmtd, broadcast_pkts_rcvd and broadcast_pkts_xmtd are not returned or used for anything meaningful - remove the code that collects them, and the struct members too. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Tidy up rx/tx dropped & bytes statsMark Einon1-10/+2
Remove some fairly useless comments regarding rx/tx _bytes and _dropped, and use rcvd_pkts_dropped stat value to provide rx_dropped. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: In et131x_tx(), don't return NETDEV_TX_BUSY, just drop the packetMark Einon1-36/+15
Memory allocation errors do not denote NETDEV_TX_BUSY, simply drop the packet silently with kfree_skb() and return NETDEV_TX_OK. Also remove this item from the TODO list. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19staging: et131x: Remove et131x_send_packets() functionMark Einon1-47/+29
Remove et131x_send_packets() and replace the only use in et131x_tx with the removed function's body. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-08staging: et131x: Fix whitespace - alignment matching open parenthesisMark Einon1-63/+67
Fix occurrences in et131x.c of: CHECK: Alignment should match open parenthesis Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-08staging: et131x: Add auto-negotiation and 1000BT_Half as supported protocolsMark Einon1-8/+10
The driver supports auto-negotiation and 100BaetT_Half but doesn't advertise or list it in it's phydev. Fix that. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-08staging: et131x: Remove spinlock fbr_lockMark Einon1-6/+0
The spinlock fbr_lock is only used in a single call sequence staring from et131x_poll. As this call is already locked by napi->poll_lock, we can remove it. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-08staging: et131x: Remove dead code in isrMark Einon1-10/+8
Dan Carpenter reports: The patch c2ebf58ba089: "staging: et131x: Implement NAPI support" from Aug 21, 2014, leads to the following static checker warning: drivers/staging/et131x/et131x.c:4004 et131x_isr() warn: we tested 'status' before and it was 'true' We don't actually need the dead code, as we're now using NAPI to handle enabling interrupts - but we do need to enable interrupts if NAPI is not scheduled - so enable interrupts if this is the case. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-02staging: et131x: et131x.c: sparse warning of incompatible typesSudip Mukherjee1-2/+2
fixed sparse warning: incompatible types in comparison expression (different address spaces) wolw and reg both are being used only for the initialization of the __iomem area. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-31Merge 3.17-rc3 into staging-nextGreg Kroah-Hartman1-41/+27
We want the staging bugfixes in this branch as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: et131x: Implement NAPI supportMark Einon1-62/+50
This implements NAPI support for et131x by: -adding a napi_struct to the private adapter struct -changing netfif_rx_skb() call to netif_receive_skb() -changing et131x_handle_recv_interrupt() to et131x_handle_recv_pkts() and taking a budget allocation. -changing et131x_handle_send_interrupt() to et131x_handle_send_pkts() -replacing bottom half workqueue with poll function which handles send & receive of skbs. -adding various other necessary standard napi calls. Also remove this item from the README TODO list. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: et131x: Fix ET_INTR_TXDMA_ISR register name typoMark Einon1-1/+1
We actually mean to clear the ET_INTR_TXDMA_ISR reg after handling a completed transfer, not the ET_INTR_TXDMA_ERR reg, which should get handled immediately after. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: et131x: Rename NUM_PACKETS_HANDLED to MAX_PACKETS_HANDLEDMark Einon1-3/+3
To better describe it's use as a hard limit. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: et131x: Remove unnecessary i2c_wack variableMark Einon1-4/+1
i2c_wack is only used to implement a while(1) loop, so let's remove it. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: et131x: Use for loop to initialise contiguous macstat registers to zeroMark Einon1-53/+6
Replace a long list of contiguous writel() calls with a for loop iterating over the same address values. Also remove redundant comments on the macstat registers, the variable names are good enough. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: et131x: Use for loop to initialise contiguous registers to zeroMark Einon1-24/+3
Replace a long list of contiguous writel() calls with a for loop iterating over the same values. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: et131x: Don't handle rx/tx packets when changing mtuMark Einon1-2/+0
There's no need to handle any rx/tx interrupts in the middle of an mtu change, so don't. After this change, receive and transmit interrupts are only handled in one place, which paves the way to using NAPI. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: et131x: Use eth_mac_addr() instead of duplicating the functionalityMark Einon1-52/+1
There's already working code to set the mac address, so let's use it. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-17staging: et131x: Fix errors caused by phydev->addr accesses before initialisationMark Einon1-41/+27
Fix two reported bugs, caused by et131x_adapter->phydev->addr being accessed before it is initialised, by: - letting et131x_mii_write() take a phydev address, instead of using the one stored in adapter by default. This is so et131x_mdio_write() can use it's own addr value. - removing implementation of et131x_mdio_reset(), as it's not needed. - moving a call to et131x_disable_phy_coma() in et131x_pci_setup(), which uses phydev->addr, until after the mdiobus has been registered. Link: https://bugzilla.kernel.org/show_bug.cgi?id=80751 Link: https://bugzilla.kernel.org/show_bug.cgi?id=77121 Cc: stable@vger.kernel.org Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>