: sfc: Cleanup requested by Andrew Morton
Subsystems (2)
cover : sfc: Cleanup requested by Andrew Morton
The following patch series addresses most of the style issues raised by Andrew Morton in <[email protected]>. We intend to deal with the remaining issues later.
Ben.
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 1/16 sfc: Use mod_timer() to set expiry and add_timer() together
--- drivers/net/sfc/boards.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
drivers/net/sfc/boards.c +3 -6
@@ -27,10 +27,8 @@ static void blink_led_timer(unsigned long context)struct efx_blinker *bl = &efx->board_info.blinker; efx->board_info.set_fault_led (efx, bl->state); bl->state = !bl->state; -if (bl->resubmit) { - bl->timer.expires = jiffies +BLINK_INTERVAL ; -add_timer (&bl->timer); - } +if (bl->resubmit) +mod_timer (&bl->timer, jiffies +BLINK_INTERVAL ); }static void board_blink (struct efx_nic *efx,int blink)
@@ -44,8 +42,7 @@ static void board_blink(struct efx_nic *efx, int blink) blinker->state =0 ;setup_timer (&blinker->timer, blink_led_timer, (unsigned long )efx); - blinker->timer.expires = jiffies +BLINK_INTERVAL ; -add_timer (&blinker->timer); +mod_timer (&blinker->timer, jiffies +BLINK_INTERVAL ); }else { blinker->resubmit =0 ;if (blinker->timer.function)
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
Re: [PATCH 01/16] sfc: Use mod_timer() to set expiry and add_timer() together
Quoted 4 lines · Ben Hutchings
Signed-off-by Ben Hutchings <[email protected]>--- drivers/net/sfc/boards.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
applied 1-16
PATCH 2/16 sfc: Removed casts to void
In reply to Ben Hutchings--- drivers/net/sfc/efx.c | 4 ++-- drivers/net/sfc/falcon.c | 2 +- drivers/net/sfc/falcon_xmac.c | 4 ++-- drivers/net/sfc/sfe4001.c | 14 +++++++------- drivers/net/sfc/tenxpress.c | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-)
drivers/net/sfc/efx.c +2 -2
@@ -265,7 +265,7 @@ void efx_process_channel_now(struct efx_channel *channel)napi_disable (&channel->napi_str);/* Poll the channel */ - (void )efx_process_channel (channel, efx->type->evq_size); +efx_process_channel (channel, efx->type->evq_size);/* Ack the eventq. This may cause an interrupt to be generated * when they are reenabled */
@@ -1688,7 +1688,7 @@ static int efx_reset(struct efx_nic *efx)if (method ==RESET_TYPE_DISABLE ) {/* Reinitialise the device anyway so the driver unload sequence * can talk to the external SRAM */ - (void )falcon_init_nic (efx); +falcon_init_nic (efx); rc = -EIO ; goto fail4; }
drivers/net/sfc/falcon.c +1 -1
@@ -2647,7 +2647,7 @@ void falcon_remove_nic(struct efx_nic *efx)falcon_free_buffer (efx, &efx->irq_status); - (void )falcon_reset_hw (efx,RESET_TYPE_ALL ); +falcon_reset_hw (efx,RESET_TYPE_ALL );/* Release the second function after the reset */ if (nic_data->pci_dev2) {
drivers/net/sfc/falcon_xmac.c +2 -2
@@ -454,7 +454,7 @@ static int falcon_check_xaui_link_up(struct efx_nic *efx)EFX_LOG (efx,"%s Clobbering XAUI (%d tries left).\n" , __func__, tries); - (void )falcon_reset_xaui (efx); +falcon_reset_xaui (efx);udelay (200 ); tries--; }
@@ -572,7 +572,7 @@ int falcon_check_xmac(struct efx_nic *efx) xaui_link_ok =falcon_xaui_link_ok (efx);if (EFX_WORKAROUND_5147 (efx) && !xaui_link_ok) - (void )falcon_reset_xaui (efx); +falcon_reset_xaui (efx);/* Call the PHY check_hw routine */ rc = efx->phy_op->check_hw (efx);
drivers/net/sfc/sfe4001.c +7 -7
@@ -116,18 +116,18 @@ void sfe4001_poweroff(struct efx_nic *efx)/* Turn off all power rails */ out =0xff ; - (void )efx_i2c_write (i2c,PCA9539 ,P0_OUT , &out,1 ); +efx_i2c_write (i2c,PCA9539 ,P0_OUT , &out,1 );/* Disable port 1 outputs on IO expander */ cfg =0xff ; - (void )efx_i2c_write (i2c,PCA9539 ,P1_CONFIG , &cfg,1 ); +efx_i2c_write (i2c,PCA9539 ,P1_CONFIG , &cfg,1 );/* Disable port 0 outputs on IO expander */ cfg =0xff ; - (void )efx_i2c_write (i2c,PCA9539 ,P0_CONFIG , &cfg,1 ); +efx_i2c_write (i2c,PCA9539 ,P0_CONFIG , &cfg,1 );/* Clear any over-temperature alert */ - (void )efx_i2c_read (i2c,MAX6647 ,RSL , &in,1 ); +efx_i2c_read (i2c,MAX6647 ,RSL , &in,1 ); }/* The P0_EN_3V3X line on SFE4001 boards (from A2 onward) is connected
@@ -253,14 +253,14 @@ done: fail3:/* Turn off all power rails */ out =0xff ; - (void )efx_i2c_write (i2c,PCA9539 ,P0_OUT , &out,1 ); +efx_i2c_write (i2c,PCA9539 ,P0_OUT , &out,1 );/* Disable port 1 outputs on IO expander */ out =0xff ; - (void )efx_i2c_write (i2c,PCA9539 ,P1_CONFIG , &out,1 ); +efx_i2c_write (i2c,PCA9539 ,P1_CONFIG , &out,1 ); fail2:/* Disable port 0 outputs on IO expander */ out =0xff ; - (void )efx_i2c_write (i2c,PCA9539 ,P0_CONFIG , &out,1 ); +efx_i2c_write (i2c,PCA9539 ,P0_CONFIG , &out,1 ); fail1:return rc; }
drivers/net/sfc/tenxpress.c +1 -1
@@ -376,7 +376,7 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx)* perform a special software reset */ if ((phy_data->tx_disabled && !efx->tx_disabled) || loop_change) { - (void )tenxpress_special_reset (efx); +tenxpress_special_reset (efx);falcon_reset_xaui (efx); }
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 3/16 sfc: Simplified efx_rx_calc_buffer_size() using get_order()
In reply to Ben HutchingsMerged it into its only caller, efx_init_channels().
--- drivers/net/sfc/efx.c | 29 ++++++++--------------------- 1 files changed, 8 insertions(+), 21 deletions(-)
drivers/net/sfc/efx.c +8 -21
@@ -317,26 +317,6 @@ static void efx_remove_eventq(struct efx_channel *channel)* *************************************************************************/ -/* Setup per-NIC RX buffer parameters. -* Calculate the rx buffer allocation parameters required to support -* the current MTU, including padding for header alignment and overruns. -*/ -static void efx_calc_rx_buffer_params (struct efx_nic *efx) -{ -unsigned int order, len; - - len = (max (EFX_PAGE_IP_ALIGN ,NET_IP_ALIGN ) + -EFX_MAX_FRAME_LEN (efx->net_dev->mtu) + - efx->type->rx_buffer_padding); - -/* Calculate page-order */ -for (order =0 ; ((1u << order) *PAGE_SIZE ) < len; ++order) - ; - - efx->rx_buffer_len = len; - efx->rx_buffer_order = order; -} -static int efx_probe_channel (struct efx_channel *channel) {struct efx_tx_queue *tx_queue;
@@ -387,7 +367,14 @@ static int efx_init_channels(struct efx_nic *efx)struct efx_channel *channel;int rc =0 ; -efx_calc_rx_buffer_params (efx); +/* Calculate the rx buffer allocation parameters required to +* support the current MTU, including padding for header +* alignment and overruns. +*/ + efx->rx_buffer_len = (max (EFX_PAGE_IP_ALIGN ,NET_IP_ALIGN ) + +EFX_MAX_FRAME_LEN (efx->net_dev->mtu) + + efx->type->rx_buffer_padding); + efx->rx_buffer_order =get_order (efx->rx_buffer_len);/* Initialise the channels */ efx_for_each_channel (channel, efx) {
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 4/16 sfc: Removed unncesssary UL suffixes on 0 literals
In reply to Ben Hutchings--- drivers/net/sfc/efx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/sfc/efx.c +2 -2
@@ -793,7 +793,7 @@ static int efx_init_io(struct efx_nic *efx) fail4:release_mem_region (efx->membase_phys, efx->type->mem_map_size); fail3: - efx->membase_phys =0UL ; + efx->membase_phys =0 ; fail2:pci_disable_device (efx->pci_dev); fail1:
@@ -811,7 +811,7 @@ static void efx_fini_io(struct efx_nic *efx)if (efx->membase_phys) {pci_release_region (efx->pci_dev, efx->type->mem_bar); - efx->membase_phys =0UL ; + efx->membase_phys =0 ; }pci_disable_device (efx->pci_dev);
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 5/16 sfc: Added and removed braces to comply with kernel style
In reply to Ben Hutchings--- drivers/net/sfc/efx.c | 6 +++--- drivers/net/sfc/falcon.c | 3 ++- drivers/net/sfc/rx.c | 3 ++- drivers/net/sfc/tx.c | 9 ++++++--- 4 files changed, 13 insertions(+), 8 deletions(-)
drivers/net/sfc/efx.c +3 -3
@@ -1060,9 +1060,8 @@ static void efx_flush_all(struct efx_nic *efx)cancel_delayed_work_sync (&efx->monitor_work);/* Ensure that all RX slow refills are complete. */ -efx_for_each_rx_queue (rx_queue, efx) { +efx_for_each_rx_queue (rx_queue, efx)cancel_delayed_work_sync (&rx_queue->work); - }/* Stop scheduled port reconfigurations */ cancel_work_sync (&efx->reconfigure_work);
@@ -1088,9 +1087,10 @@ static void efx_stop_all(struct efx_nic *efx)falcon_disable_interrupts (efx);if (efx->legacy_irq)synchronize_irq (efx->legacy_irq); -efx_for_each_channel_with_interrupt (channel, efx) +efx_for_each_channel_with_interrupt (channel, efx) {if (channel->irq)synchronize_irq (channel->irq); + }/* Stop all NAPI processing and synchronous rx refills */ efx_for_each_channel (channel, efx)
drivers/net/sfc/falcon.c +2 -1
@@ -1636,9 +1636,10 @@ void falcon_fini_interrupt(struct efx_nic *efx)efx_oword_t reg;/* Disable MSI/MSI-X interrupts */ -efx_for_each_channel_with_interrupt (channel, efx) +efx_for_each_channel_with_interrupt (channel, efx) {if (channel->irq)free_irq (channel->irq, channel); + }/* ACK legacy interrupt */ if (FALCON_REV (efx) >=FALCON_REV_B0 )
drivers/net/sfc/rx.c +2 -1
@@ -400,9 +400,10 @@ static int __efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue,return 0 ;/* Record minimum fill level */ -if (unlikely (fill_level < rx_queue->min_fill)) +if (unlikely (fill_level < rx_queue->min_fill)) {if (fill_level) rx_queue->min_fill = fill_level; + }/* Acquire RX add lock. If this lock is contended, then a fast * fill must already be in progress (e.g. in the refill
drivers/net/sfc/tx.c +6 -3
@@ -639,11 +639,12 @@ static void efx_tsoh_block_free(struct efx_tx_queue *tx_queue, base_dma = tsoh->dma_addr &PAGE_MASK ; p = &tx_queue->tso_headers_free; -while (*p !=NULL ) +while (*p !=NULL ) {if (((unsigned long )*p &PAGE_MASK ) == base_kva) *p = (*p)->next;else p = &(*p)->next; + }pci_free_consistent (pci_dev,PAGE_SIZE , (void *)base_kva, base_dma); }
@@ -939,9 +940,10 @@ static inline int tso_start_new_packet(struct efx_tx_queue *tx_queue,/* Allocate a DMA-mapped header buffer. */ if (likely (TSOH_SIZE (st->p.header_length) <=TSOH_STD_SIZE )) { -if (tx_queue->tso_headers_free ==NULL ) +if (tx_queue->tso_headers_free ==NULL ) {if (efx_tsoh_block_alloc (tx_queue))return -1 ; + }EFX_BUG_ON_PARANOID (!tx_queue->tso_headers_free); tsoh = tx_queue->tso_headers_free; tx_queue->tso_headers_free = tsoh->next;
@@ -1106,9 +1108,10 @@ static void efx_fini_tso(struct efx_tx_queue *tx_queue) {unsigned i; -if (tx_queue->buffer) +if (tx_queue->buffer) {for (i =0 ; i <= tx_queue->efx->type->txd_ring_mask; ++i)efx_tsoh_free (tx_queue, &tx_queue->buffer[i]); + }while (tx_queue->tso_headers_free !=NULL ) efx_tsoh_block_free(tx_queue, tx_queue->tso_headers_free,
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 6/16 sfc: Replaced various macros with inline functions
In reply to Ben Hutchings--- drivers/net/sfc/bitfield.h | 4 +- drivers/net/sfc/efx.c | 8 +++--- drivers/net/sfc/falcon.c | 46 ++++++++++++++++++++-------------------- drivers/net/sfc/falcon.h | 5 +++- drivers/net/sfc/falcon_io.h | 29 ++++++++++++++++++------- drivers/net/sfc/falcon_xmac.c | 6 ++-- drivers/net/sfc/net_driver.h | 31 ++++++++++++++++----------- drivers/net/sfc/rx.c | 39 +++++++++++++++++++++------------- drivers/net/sfc/selftest.c | 8 +++--- drivers/net/sfc/tx.c | 2 +- drivers/net/sfc/workarounds.h | 2 +- 11 files changed, 105 insertions(+), 75 deletions(-)
drivers/net/sfc/bitfield.h +2 -2
@@ -483,7 +483,7 @@ typedef union efx_oword {#endif #define EFX_SET_OWORD_FIELD_VER (efx, oword, field, value) do { \ - if (FALCON_REV(efx) >= FALCON_REV_B0) { \ + if (falcon_rev(efx) >= FALCON_REV_B0) { \ EFX_SET_OWORD_FIELD((oword), field##_B0, (value)); \ } else { \ EFX_SET_OWORD_FIELD((oword), field##_A1, (value)); \
@@ -491,7 +491,7 @@ typedef union efx_oword { } while (0)#define EFX_QWORD_FIELD_VER (efx, qword, field) \ - (FALCON_REV(efx) >= FALCON_REV_B0 ? \ + (falcon_rev(efx) >= FALCON_REV_B0 ? \ EFX_QWORD_FIELD((qword), field##_B0) : \ EFX_QWORD_FIELD((qword), field##_A1))
drivers/net/sfc/efx.c +4 -4
@@ -691,7 +691,7 @@ static void efx_stop_port(struct efx_nic *efx)mutex_unlock (&efx->mac_lock);/* Serialise against efx_set_multicast_list() */ -if (NET_DEV_REGISTERED (efx)) { +if (efx_dev_registered (efx)) {netif_tx_lock_bh (efx->net_dev);netif_tx_unlock_bh (efx->net_dev); }
@@ -1030,7 +1030,7 @@ static void efx_start_all(struct efx_nic *efx)return ;if ((efx->state !=STATE_RUNNING ) && (efx->state !=STATE_INIT ))return ; -if (NET_DEV_REGISTERED (efx) && !netif_running (efx->net_dev)) +if (efx_dev_registered (efx) && !netif_running (efx->net_dev))return ;/* Mark the port as enabled so port reconfigurations can start, then
@@ -1112,7 +1112,7 @@ static void efx_stop_all(struct efx_nic *efx)/* Stop the kernel transmit interface late, so the watchdog * timer isn't ticking over the flush */ efx_stop_queue (efx); -if (NET_DEV_REGISTERED (efx)) { +if (efx_dev_registered (efx)) {netif_tx_lock_bh (efx->net_dev);netif_tx_unlock_bh (efx->net_dev); }
@@ -1550,7 +1550,7 @@ static void efx_unregister_netdev(struct efx_nic *efx)efx_for_each_tx_queue (tx_queue, efx)efx_release_tx_buffers (tx_queue); -if (NET_DEV_REGISTERED (efx)) { +if (efx_dev_registered (efx)) {strlcpy (efx->name,pci_name (efx->pci_dev),sizeof (efx->name));unregister_netdev (efx->net_dev); }
drivers/net/sfc/falcon.c +23 -23
180 lines not on this page · raw message
drivers/net/sfc/falcon.h +4 -1
@@ -23,7 +23,10 @@ enum falcon_revision { FALCON_REV_B0 = 2, }; -#define FALCON_REV (efx) ((efx)->pci_dev->revision) +static inline int falcon_rev (struct efx_nic *efx) +{ +return efx->pci_dev->revision; +}extern struct efx_nic_type falcon_a_nic_type;extern struct efx_nic_type falcon_b_nic_type;
drivers/net/sfc/falcon_io.h +21 -8
@@ -56,14 +56,27 @@#define FALCON_USE_QWORD_IO 1#endif -#define _falcon_writeq (efx, value, reg) \ - __raw_writeq((__force u64) (value), (efx)->membase + (reg)) -#define _falcon_writel (efx, value, reg) \ - __raw_writel((__force u32) (value), (efx)->membase + (reg)) -#define _falcon_readq (efx, reg) \ - ((__force __le64) __raw_readq((efx)->membase + (reg))) -#define _falcon_readl (efx, reg) \ - ((__force __le32) __raw_readl((efx)->membase + (reg))) +#ifdef FALCON_USE_QWORD_IO +static inline void _falcon_writeq (struct efx_nic *efx,__le64 value, +unsigned int reg) +{ +__raw_writeq ((__force u64 )value, efx->membase + reg); +} +static inline __le64 _falcon_readq (struct efx_nic *efx,unsigned int reg) +{ +return (__force __le64 )__raw_readq (efx->membase + reg); +} +#endif + +static inline void _falcon_writel (struct efx_nic *efx,__le32 value, +unsigned int reg) +{ +__raw_writel ((__force u32 )value, efx->membase + reg); +} +static inline __le32 _falcon_readl (struct efx_nic *efx,unsigned int reg) +{ +return (__force __le32 )__raw_readl (efx->membase + reg); +}/* Writes to a normal 16-byte Falcon register, locking as appropriate. */ static inline void falcon_write(struct efx_nic *efx, efx_oword_t *value,
drivers/net/sfc/falcon_xmac.c +3 -3
@@ -221,7 +221,7 @@ static int falcon_xgmii_status(struct efx_nic *efx) {efx_dword_t reg; -if (FALCON_REV (efx) <FALCON_REV_B0 ) +if (falcon_rev (efx) <FALCON_REV_B0 )return 1 ;/* The ISR latches, so clear it and re-read */
@@ -241,7 +241,7 @@ static void falcon_mask_status_intr(struct efx_nic *efx, int enable) {efx_dword_t reg; -if ((FALCON_REV (efx) <FALCON_REV_B0 ) ||LOOPBACK_INTERNAL (efx)) +if ((falcon_rev (efx) <FALCON_REV_B0 ) ||LOOPBACK_INTERNAL (efx))return ;/* Flush the ISR */
@@ -639,7 +639,7 @@ int falcon_xmac_set_pause(struct efx_nic *efx, enum efx_fc_type flow_control) reset = ((flow_control &EFX_FC_TX ) && !(efx->flow_control &EFX_FC_TX ));if (EFX_WORKAROUND_11482 (efx) && reset) { -if (FALCON_REV (efx) >=FALCON_REV_B0 ) { +if (falcon_rev (efx) >=FALCON_REV_B0 ) {/* Recover by resetting the EM block */ if (efx->link_up)falcon_drain_tx_fifo (efx);
drivers/net/sfc/net_driver.h +18 -13
@@ -52,28 +52,19 @@#define EFX_WARN_ON_PARANOID (x) do {} while (0)#endif -#define NET_DEV_REGISTERED (efx) \ - ((efx)->net_dev->reg_state == NETREG_REGISTERED) - -/* Include net device name in log messages if it has been registered. -* Use efx->name not efx->net_dev->name so that races with (un)registration -* are harmless. -*/ -#define NET_DEV_NAME (efx) (NET_DEV_REGISTERED(efx) ? (efx)->name : "") -/* Un-rate-limited logging */ #define EFX_ERR(efx, fmt, args...) \ -dev_err(&((efx)->pci_dev->dev), "ERR: %s " fmt, NET_DEV_NAME(efx), ##args) +dev_err(&((efx)->pci_dev->dev), "ERR: %s " fmt, efx_dev_name(efx), ##args) #define EFX_INFO(efx, fmt, args...) \ -dev_info(&((efx)->pci_dev->dev), "INFO: %s " fmt, NET_DEV_NAME(efx), ##args) +dev_info(&((efx)->pci_dev->dev), "INFO: %s " fmt, efx_dev_name(efx), ##args)#ifdef EFX_ENABLE_DEBUG #define EFX_LOG(efx, fmt, args...) \ -dev_info(&((efx)->pci_dev->dev), "DBG: %s " fmt, NET_DEV_NAME(efx), ##args) +dev_info(&((efx)->pci_dev->dev), "DBG: %s " fmt, efx_dev_name(efx), ##args)#else #define EFX_LOG(efx, fmt, args...) \ -dev_dbg(&((efx)->pci_dev->dev), "DBG: %s " fmt, NET_DEV_NAME(efx), ##args) +dev_dbg(&((efx)->pci_dev->dev), "DBG: %s " fmt, efx_dev_name(efx), ##args)#endif #define EFX_TRACE(efx, fmt, args...) do {} while (0)
@@ -760,6 +751,20 @@ struct efx_nic {void *loopback_selftest; }; +static inline int efx_dev_registered (struct efx_nic *efx) +{ +return efx->net_dev->reg_state ==NETREG_REGISTERED ; +} + +/* Net device name, for inclusion in log messages if it has been registered. +* Use efx->name not efx->net_dev->name so that races with (un)registration +* are harmless. +*/ +static inline const char *efx_dev_name (struct efx_nic *efx) +{ +return efx_dev_registered (efx) ? efx->name :"" ; +} +/** * struct efx_nic_type - Efx device type definition * @mem_bar: Memory BAR number
drivers/net/sfc/rx.c +24 -15
@@ -86,14 +86,21 @@ static unsigned int rx_refill_limit = 95;*/ #define EFX_RXD_HEAD_ROOM 2 -/* Macros for zero-order pages (potentially) containing multiple RX buffers */ -#define RX_DATA_OFFSET (_data) \ - (((unsigned long) (_data)) & (PAGE_SIZE-1)) -#define RX_BUF_OFFSET (_rx_buf) \ - RX_DATA_OFFSET((_rx_buf)->data) - -#define RX_PAGE_SIZE (_efx) \ - (PAGE_SIZE * (1u << (_efx)->rx_buffer_order)) +static inline unsigned int efx_page_offset (void *p) +{ +return (__force unsigned int )p & (PAGE_SIZE -1 ); +} +static inline unsigned int efx_rx_buf_offset (struct efx_rx_buffer *buf) +{ +/* Offset is always within one page, so we don't need to consider +* the page order. +*/ +return efx_page_offset (buf->data); +} +static inline unsigned int efx_rx_buf_size (struct efx_nic *efx) +{ +return PAGE_SIZE << efx->rx_buffer_order; +}/**************************************************************************
@@ -269,7 +276,7 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue,return -ENOMEM ; dma_addr =pci_map_page (efx->pci_dev, rx_buf->page, -0 ,RX_PAGE_SIZE (efx), +0 ,efx_rx_buf_size (efx),PCI_DMA_FROMDEVICE );if (unlikely (pci_dma_mapping_error (dma_addr))) {
@@ -284,7 +291,7 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue, EFX_PAGE_IP_ALIGN); } - offset =RX_DATA_OFFSET (rx_queue->buf_data); + offset =efx_page_offset (rx_queue->buf_data); rx_buf->len = bytes; rx_buf->dma_addr = rx_queue->buf_dma_addr + offset; rx_buf->data = rx_queue->buf_data;
@@ -295,7 +302,7 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue, rx_queue->buf_data += ((bytes +0x1ff ) & ~0x1ff ); offset += ((bytes +0x1ff ) & ~0x1ff ); - space =RX_PAGE_SIZE (efx) - offset; + space =efx_rx_buf_size (efx) - offset;if (space >= bytes) {/* Refs dropped on kernel releasing each skb */ get_page (rx_queue->buf_page);
@@ -344,7 +351,8 @@ static inline void efx_unmap_rx_buffer(struct efx_nic *efx,EFX_BUG_ON_PARANOID (rx_buf->skb);if (rx_buf->unmap_addr) {pci_unmap_page (efx->pci_dev, rx_buf->unmap_addr, -RX_PAGE_SIZE (efx),PCI_DMA_FROMDEVICE ); +efx_rx_buf_size (efx), +PCI_DMA_FROMDEVICE ); rx_buf->unmap_addr =0 ; } }else if (likely (rx_buf->skb)) {
@@ -553,7 +561,7 @@ static inline void efx_rx_packet_lro(struct efx_channel *channel,struct skb_frag_struct frags; frags.page = rx_buf->page; - frags.page_offset =RX_BUF_OFFSET (rx_buf); + frags.page_offset =efx_rx_buf_offset (rx_buf); frags.size = rx_buf->len; lro_receive_frags(lro_mgr, &frags, rx_buf->len,
@@ -598,7 +606,7 @@ static inline struct sk_buff *efx_rx_mk_skb(struct efx_rx_buffer *rx_buf,if (unlikely (rx_buf->len > hdr_len)) {struct skb_frag_struct *frag =skb_shinfo (skb)->frags; frag->page = rx_buf->page; - frag->page_offset =RX_BUF_OFFSET (rx_buf) + hdr_len; + frag->page_offset =efx_rx_buf_offset (rx_buf) + hdr_len; frag->size = skb->len - hdr_len;skb_shinfo (skb)->nr_frags =1 ; skb->data_len = frag->size;
@@ -852,7 +860,8 @@ void efx_fini_rx_queue(struct efx_rx_queue *rx_queue)/* For a page that is part-way through splitting into RX buffers */ if (rx_queue->buf_page !=NULL ) {pci_unmap_page (rx_queue->efx->pci_dev, rx_queue->buf_dma_addr, -RX_PAGE_SIZE (rx_queue->efx),PCI_DMA_FROMDEVICE ); +efx_rx_buf_size (rx_queue->efx), +PCI_DMA_FROMDEVICE );__free_pages (rx_queue->buf_page, rx_queue->efx->rx_buffer_order); rx_queue->buf_page =NULL ;
drivers/net/sfc/selftest.c +4 -4
@@ -424,10 +424,10 @@ static int efx_tx_loopback(struct efx_tx_queue *tx_queue)* interrupt handler. */ smp_wmb (); -if (NET_DEV_REGISTERED (efx)) +if (efx_dev_registered (efx))netif_tx_lock_bh (efx->net_dev); rc =efx_xmit (efx, tx_queue, skb); -if (NET_DEV_REGISTERED (efx)) +if (efx_dev_registered (efx))netif_tx_unlock_bh (efx->net_dev);if (rc !=NETDEV_TX_OK ) {
@@ -453,7 +453,7 @@ static int efx_rx_loopback(struct efx_tx_queue *tx_queue,int tx_done =0 , rx_good, rx_bad;int i, rc =0 ; -if (NET_DEV_REGISTERED (efx)) +if (efx_dev_registered (efx))netif_tx_lock_bh (efx->net_dev);/* Count the number of tx completions, and decrement the refcnt. Any
@@ -465,7 +465,7 @@ static int efx_rx_loopback(struct efx_tx_queue *tx_queue,dev_kfree_skb_any (skb); } -if (NET_DEV_REGISTERED (efx)) +if (efx_dev_registered (efx))netif_tx_unlock_bh (efx->net_dev);/* Check TX completion and received packet counts */
drivers/net/sfc/tx.c +1 -1
@@ -387,7 +387,7 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)if (unlikely (tx_queue->stopped)) { fill_level = tx_queue->insert_count - tx_queue->read_count;if (fill_level <EFX_NETDEV_TX_THRESHOLD (tx_queue)) { -EFX_BUG_ON_PARANOID (!NET_DEV_REGISTERED (efx)); +EFX_BUG_ON_PARANOID (!efx_dev_registered (efx));/* Do this under netif_tx_lock(), to avoid racing * with efx_xmit(). */
drivers/net/sfc/workarounds.h +1 -1
@@ -16,7 +16,7 @@*/ #define EFX_WORKAROUND_ALWAYS (efx) 1 -#define EFX_WORKAROUND_FALCON_A (efx) (FALCON_REV(efx) <= FALCON_REV_A1) +#define EFX_WORKAROUND_FALCON_A (efx) (falcon_rev(efx) <= FALCON_REV_A1)/* XAUI resets if link not detected */ #define EFX_WORKAROUND_5147 EFX_WORKAROUND_ALWAYS
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 7/16 sfc: Merged efx_page_offset() into efx_rx_buf_offset()
In reply to Ben Hutchings--- drivers/net/sfc/rx.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-)
drivers/net/sfc/rx.c +3 -7
@@ -86,16 +86,12 @@ static unsigned int rx_refill_limit = 95;*/ #define EFX_RXD_HEAD_ROOM 2 -static inline unsigned int efx_page_offset (void *p) -{ -return (__force unsigned int )p & (PAGE_SIZE -1 ); -}static inline unsigned int efx_rx_buf_offset (struct efx_rx_buffer *buf) {/* Offset is always within one page, so we don't need to consider * the page order. */ -return efx_page_offset (buf->data); +return (__force unsigned long ) buf->data & (PAGE_SIZE -1 ); }static inline unsigned int efx_rx_buf_size (struct efx_nic *efx) {
@@ -291,10 +287,10 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue, EFX_PAGE_IP_ALIGN); } - offset =efx_page_offset (rx_queue->buf_data); rx_buf->len = bytes; - rx_buf->dma_addr = rx_queue->buf_dma_addr + offset; rx_buf->data = rx_queue->buf_data; + offset =efx_rx_buf_offset (rx_buf); + rx_buf->dma_addr = rx_queue->buf_dma_addr + offset;/* Try to pack multiple buffers per page */ if (efx->rx_buffer_order ==0 ) {
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 8/16 sfc: Use resource_size_t for PCI bus address
In reply to Ben HutchingsThis should make the driver work on 32-bit systems with 64-bit PCI support.
--- drivers/net/sfc/efx.c | 11 ++++++----- drivers/net/sfc/net_driver.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/sfc/efx.c +6 -5
@@ -778,15 +778,16 @@ static int efx_init_io(struct efx_nic *efx) efx->membase =ioremap_nocache (efx->membase_phys, efx->type->mem_map_size);if (!efx->membase) { -EFX_ERR (efx,"could not map memory BAR %d at %lx+%x\n" , - efx->type->mem_bar, efx->membase_phys, +EFX_ERR (efx,"could not map memory BAR %d at %llx+%x\n" , + efx->type->mem_bar, + (unsigned long long )efx->membase_phys, efx->type->mem_map_size); rc = -ENOMEM ; goto fail4; } -EFX_LOG (efx,"memory BAR %u at %lx+%x (virtual %p)\n" , - efx->type->mem_bar, efx->membase_phys, efx->type->mem_map_size, - efx->membase); +EFX_LOG (efx,"memory BAR %u at %llx+%x (virtual %p)\n" , + efx->type->mem_bar, (unsigned long long )efx->membase_phys, + efx->type->mem_map_size, efx->membase);return 0 ;
drivers/net/sfc/net_driver.h +1 -1
@@ -686,7 +686,7 @@ struct efx_nic {struct workqueue_struct *workqueue;struct work_struct reset_work;struct delayed_work monitor_work; -unsigned long membase_phys; +resource_size_t membase_phys;void __iomem *membase;spinlock_t biu_lock;enum efx_int_mode interrupt_mode;
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 9/16 sfc: Correct and expand some comments
In reply to Ben HutchingsThese comments have been revised in response to questions raised by Andrew Morton in <[email protected]>.
--- drivers/net/sfc/efx.c | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-)
drivers/net/sfc/efx.c +14 -6
@@ -199,11 +199,12 @@ static inline int efx_process_channel(struct efx_channel *channel, int rx_quota)*/ static inline void efx_channel_processed (struct efx_channel *channel) { -/* Write to EVQ_RPTR_REG. If a new event arrived in a race -* with finishing processing, a new interrupt will be raised. -*/ +/* The interrupt handler for this channel may set work_pending +* as soon as we acknowledge the events we've seen. Make sure +* it's cleared before then. */ channel->work_pending =0 ; -smp_wmb ();/* Ensure channel updated before any new interrupt. */ +smp_wmb (); +falcon_eventq_read_ack (channel); }
@@ -427,9 +428,12 @@ static void efx_start_channel(struct efx_channel *channel)netif_napi_add (channel->napi_dev, &channel->napi_str, efx_poll, napi_weight); +/* The interrupt handler for this channel may set work_pending +* as soon as we enable it. Make sure it's cleared before +* then. Similarly, make sure it sees the enabled flag set. */ channel->work_pending =0 ; channel->enabled =1 ; -smp_wmb ();/* ensure channel updated before first interrupt */ +smp_wmb ();napi_enable (&channel->napi_str);
@@ -1332,13 +1336,17 @@ static int efx_net_stop(struct net_device *net_dev)return 0 ; } -/* Context: process, dev_base_lock held, non-blocking. */ +/* Context: process, dev_base_lock or RTNL held, non-blocking. */ static struct net_device_stats *efx_net_stats (struct net_device *net_dev) {struct efx_nic *efx = net_dev->priv;struct efx_mac_stats *mac_stats = &efx->mac_stats;struct net_device_stats *stats = &net_dev->stats; +/* Update stats if possible, but do not wait if another thread +* is updating them (or resetting the NIC); slightly stale +* stats are acceptable. +*/ if (!spin_trylock (&efx->stats_lock))return stats;if (efx->state ==STATE_RUNNING ) {
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 10/16 sfc: Use DMA_BIT_MASK() instead of our own DMA mask macros
In reply to Ben HutchingsAlso change type of efx_nic_type::max_dma_mask to u64, matching pci_dma_supported() parameter type.
--- drivers/net/sfc/bitfield.h | 3 --- drivers/net/sfc/falcon.c | 13 ++----------- drivers/net/sfc/net_driver.h | 2 +- 3 files changed, 3 insertions(+), 15 deletions(-)
drivers/net/sfc/bitfield.h +0 -3
@@ -501,8 +501,5 @@ typedef union efx_oword {#define DMA_ADDR_T_WIDTH (8 * sizeof(dma_addr_t))#define EFX_DMA_TYPE_WIDTH (width) \ (((width) < DMA_ADDR_T_WIDTH) ? (width) : DMA_ADDR_T_WIDTH) -#define EFX_DMA_MAX_MASK ((DMA_ADDR_T_WIDTH == 64) ? \ - ~((u64) 0) : ~((u32) 0)) -#define EFX_DMA_MASK (mask) ((mask) & EFX_DMA_MAX_MASK)#endif /* EFX_BITFIELD_H */
drivers/net/sfc/falcon.c +2 -11
@@ -116,17 +116,8 @@ MODULE_PARM_DESC(rx_xon_thresh_bytes, "RX fifo XON threshold");************************************************************************** */ -/* DMA address mask (up to 46-bit, avoiding compiler warnings) -* -* Note that it is possible to have a platform with 64-bit longs and -* 32-bit DMA addresses, or vice versa. EFX_DMA_MASK takes care of the -* platform DMA mask. -*/ -#if BITS_PER_LONG ==64 -#define FALCON_DMA_MASK EFX_DMA_MASK(0x00003fffffffffffUL) -#else -#define FALCON_DMA_MASK EFX_DMA_MASK(0x00003fffffffffffULL) -#endif +/* DMA address mask */ +#define FALCON_DMA_MASK DMA_BIT_MASK(46)/* TX DMA length mask (13-bit) */ #define FALCON_TX_DMA_MASK (4096 - 1)
drivers/net/sfc/net_driver.h +1 -1
@@ -800,7 +800,7 @@ struct efx_nic_type {unsigned int txd_ring_mask;unsigned int rxd_ring_mask;unsigned int evq_size; -dma_addr_t max_dma_mask; +u64 max_dma_mask;unsigned int tx_dma_mask;unsigned bug5391_mask;
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 11/16 sfc: Do not define inline macro
In reply to Ben Hutchings--- drivers/net/sfc/net_driver.h | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
drivers/net/sfc/net_driver.h +0 -5
@@ -81,11 +81,6 @@ do {if (net_ratelimit()) EFX_INFO(efx, fmt, ##args); } while (0) #define EFX_LOG_RL(efx, fmt, args...) \ do {if (net_ratelimit()) EFX_LOG(efx, fmt, ##args); } while (0) -/* Kernel headers may redefine inline anyway */ -#ifndef inline -#define inline inline __attribute__ ((always_inline)) -#endif -/************************************************************************** * * Efx data structures
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 12/16 sfc: Use __packed macro
In reply to Ben Hutchings--- drivers/net/sfc/falcon_hwdefs.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/sfc/falcon_hwdefs.h +2 -2
@@ -1125,7 +1125,7 @@ struct falcon_nvconfig_board_v2 {u8 port1_phy_type;__le16 asic_sub_revision;__le16 board_revision; -} __attribute__ ((packed)); +} __packed;#define NVCONFIG_BASE 0x300#define NVCONFIG_BOARD_MAGIC_NUM 0xFA1C
@@ -1144,6 +1144,6 @@ struct falcon_nvconfig {__le16 board_struct_ver;__le16 board_checksum; struct falcon_nvconfig_board_v2 board_v2; -} __attribute__ ((packed)); +} __packed;#endif /* EFX_FALCON_HWDEFS_H */
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 13/16 sfc: Change type of efx_nic::nic_data to struct falcon_nic_data *
In reply to Ben HutchingsRemove redundant casts and variable.
--- drivers/net/sfc/falcon.c | 5 +---- drivers/net/sfc/net_driver.h | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/net/sfc/falcon.c +1 -4
@@ -2411,7 +2411,7 @@ int falcon_probe_nic(struct efx_nic *efx)/* Allocate storage for hardware specific data */ nic_data =kzalloc (sizeof (*nic_data),GFP_KERNEL ); - efx->nic_data = (void *) nic_data; + efx->nic_data = nic_data;/* Determine number of ports etc. */ rc =falcon_probe_nic_variant (efx);
@@ -2481,13 +2481,10 @@ int falcon_probe_nic(struct efx_nic *efx)*/ int falcon_init_nic (struct efx_nic *efx) { -struct falcon_nic_data *data;efx_oword_t temp;unsigned thresh;int rc; - data = (struct falcon_nic_data *)efx->nic_data; -/* Set up the address region register. This is only needed * for the B0 FPGA, but since we are just pushing in the * reset defaults this may as well be unconditional. */
drivers/net/sfc/net_driver.h +1 -1
@@ -705,7 +705,7 @@ struct efx_nic {unsigned n_rx_nodesc_drop_cnt; -void *nic_data; +struct falcon_nic_data *nic_data;struct mutex mac_lock;int port_enabled;
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 14/16 sfc: Remove redundant casts to and from void *
In reply to Ben Hutchings--- drivers/net/sfc/efx.c | 2 +- drivers/net/sfc/falcon.c | 18 +++++++++--------- drivers/net/sfc/rx.c | 8 ++++---- drivers/net/sfc/selftest.c | 4 ++-- drivers/net/sfc/xfp_phy.c | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-)
drivers/net/sfc/efx.c +1 -1
@@ -1490,7 +1490,7 @@ static void efx_set_multicast_list(struct net_device *net_dev)static int efx_netdev_event (struct notifier_block *this,unsigned long event,void *ptr) { -struct net_device *net_dev = (struct net_device *)ptr; +struct net_device *net_dev = ptr;if (net_dev->open == efx_net_open && event ==NETDEV_CHANGENAME ) {struct efx_nic *efx = net_dev->priv;
drivers/net/sfc/falcon.c +9 -9
@@ -1396,7 +1396,7 @@ static inline void falcon_irq_ack_a1(struct efx_nic *efx)static irqreturn_t falcon_fatal_interrupt (struct efx_nic *efx) {struct falcon_nic_data *nic_data = efx->nic_data; -efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; +efx_oword_t *int_ker = efx->irq_status.addr;efx_oword_t fatal_intr;int error, mem_perr;static int n_int_errors;
@@ -1442,8 +1442,8 @@ out:*/ static irqreturn_t falcon_legacy_interrupt_b0 (int irq,void *dev_id) { -struct efx_nic *efx = (struct efx_nic *)dev_id; -efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; +struct efx_nic *efx = dev_id; +efx_oword_t *int_ker = efx->irq_status.addr;struct efx_channel *channel;efx_dword_t reg;u32 queues;
@@ -1480,8 +1480,8 @@ static irqreturn_t falcon_legacy_interrupt_b0(int irq, void *dev_id)static irqreturn_t falcon_legacy_interrupt_a1 (int irq,void *dev_id) { -struct efx_nic *efx = (struct efx_nic *)dev_id; -efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; +struct efx_nic *efx = dev_id; +efx_oword_t *int_ker = efx->irq_status.addr;struct efx_channel *channel;int syserr;int queues;
@@ -1533,9 +1533,9 @@ static irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id)*/ static irqreturn_t falcon_msi_interrupt (int irq,void *dev_id) { -struct efx_channel *channel = (struct efx_channel *)dev_id; +struct efx_channel *channel = dev_id;struct efx_nic *efx = channel->efx; -efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; +efx_oword_t *int_ker = efx->irq_status.addr;int syserr; efx->last_irq_cpu =raw_smp_processor_id ();
@@ -1932,7 +1932,7 @@ static int falcon_gmii_wait(struct efx_nic *efx)static void falcon_mdio_write (struct net_device *net_dev,int phy_id,int addr,int value) { -struct efx_nic *efx = (struct efx_nic *)net_dev->priv; +struct efx_nic *efx = net_dev->priv;unsigned int phy_id2 = phy_id &FALCON_PHY_ID_ID_MASK ;efx_oword_t reg;
@@ -2000,7 +2000,7 @@ static void falcon_mdio_write(struct net_device *net_dev, int phy_id,* could be read, -1 will be returned. */ static int falcon_mdio_read (struct net_device *net_dev,int phy_id,int addr) { -struct efx_nic *efx = (struct efx_nic *)net_dev->priv; +struct efx_nic *efx = net_dev->priv;unsigned int phy_addr = phy_id &FALCON_PHY_ID_ID_MASK ;efx_oword_t reg;int value =-1 ;
drivers/net/sfc/rx.c +4 -4
@@ -109,7 +109,7 @@ static inline unsigned int efx_rx_buf_size(struct efx_nic *efx)static int efx_lro_get_skb_hdr (struct sk_buff *skb,void **ip_hdr,void **tcpudp_hdr,u64 *hdr_flags,void *priv) { -struct efx_channel *channel = (struct efx_channel *)priv; +struct efx_channel *channel = priv;struct iphdr *iph;struct tcphdr *th;
@@ -134,12 +134,12 @@ static int efx_get_frag_hdr(struct skb_frag_struct *frag, void **mac_hdr, void **ip_hdr, void **tcpudp_hdr, u64 *hdr_flags, void *priv) { - struct efx_channel *channel = (struct efx_channel *)priv; + struct efx_channel *channel = priv;struct ethhdr *eh;struct iphdr *iph;/* We support EtherII and VLAN encapsulated IPv4 */ - eh = (struct ethhdr *)(page_address (frag->page) + frag->page_offset); + eh =page_address (frag->page) + frag->page_offset; *mac_hdr = eh;if (eh->h_proto ==htons (ETH_P_IP )) {
@@ -283,7 +283,7 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue, rx_queue->buf_page = rx_buf->page; rx_queue->buf_dma_addr = dma_addr; - rx_queue->buf_data = ((char *)page_address (rx_buf->page) + + rx_queue->buf_data = (page_address (rx_buf->page) +EFX_PAGE_IP_ALIGN ); }
drivers/net/sfc/selftest.c +2 -2
@@ -290,7 +290,7 @@ void efx_loopback_rx_packet(struct efx_nic *efx, payload = &state->payload; - received = (struct efx_loopback_payload *)(char *) buf_ptr; + received = (struct efx_loopback_payload *) buf_ptr; received->ip.saddr = payload->ip.saddr; received->ip.check = payload->ip.check;
@@ -700,7 +700,7 @@ int efx_offline_test(struct efx_nic *efx,* "flushing" so all inflight packets are dropped */ BUG_ON (efx->loopback_selftest); state->flush =1 ; - efx->loopback_selftest = (void *)state; + efx->loopback_selftest = state; rc =efx_test_loopbacks (efx, tests, loopback_modes);
drivers/net/sfc/xfp_phy.c +1 -1
@@ -85,7 +85,7 @@ static int xfp_phy_init(struct efx_nic *efx)int rc; phy_data =kzalloc (sizeof (struct xfp_phy_data ),GFP_KERNEL ); - efx->phy_data = (void *) phy_data; + efx->phy_data = phy_data; EFX_INFO(efx, "XFP: PHY ID reg %x (OUI %x model %x revision" " %x)\n", devid, MDIO_ID_OUI(devid), MDIO_ID_MODEL(devid),
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 15/16 sfc: Added checks for heap allocation failure
In reply to Ben Hutchings--- drivers/net/sfc/selftest.c | 2 ++ drivers/net/sfc/tenxpress.c | 2 ++ drivers/net/sfc/xfp_phy.c | 2 ++ 3 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/sfc/selftest.c +2 -0
@@ -517,6 +517,8 @@ efx_test_loopback(struct efx_tx_queue *tx_queue, state->packet_count =min (1 << (i <<2 ), state->packet_count); state->skbs =kzalloc (sizeof (state->skbs[0 ]) * state->packet_count,GFP_KERNEL ); +if (!state->skbs) +return -ENOMEM ; state->flush =0 ; EFX_LOG(efx, "TX queue %d testing %s loopback with %d "
drivers/net/sfc/tenxpress.c +2 -0
@@ -211,6 +211,8 @@ static int tenxpress_phy_init(struct efx_nic *efx)int rc =0 ; phy_data =kzalloc (sizeof (*phy_data),GFP_KERNEL ); +if (!phy_data) +return -ENOMEM ; efx->phy_data = phy_data;tenxpress_set_state (efx,TENXPRESS_STATUS_NORMAL );
drivers/net/sfc/xfp_phy.c +2 -0
@@ -85,6 +85,8 @@ static int xfp_phy_init(struct efx_nic *efx)int rc; phy_data =kzalloc (sizeof (struct xfp_phy_data ),GFP_KERNEL ); +if (!phy_data) +return -ENOMEM ; efx->phy_data = phy_data; EFX_INFO(efx, "XFP: PHY ID reg %x (OUI %x model %x revision"
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.
PATCH 16/16 sfc: Remove sub-minor component from driver version
In reply to Ben HutchingsThis driver has diverged from the out-of-tree driver to which the version number originally applied. It should be identified primarily by kernel version.
--- drivers/net/sfc/net_driver.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/sfc/net_driver.h +1 -1
@@ -42,7 +42,7 @@#ifndef EFX_DRIVER_NAME #define EFX_DRIVER_NAME "sfc"#endif -#define EFX_DRIVER_VERSION "2.2.0136" +#define EFX_DRIVER_VERSION "2.2"#ifdef EFX_ENABLE_DEBUG #define EFX_BUG_ON_PARANOID (x) BUG_ON(x)
Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job.