Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-next-2.6

+150 -220
+1 -1
drivers/net/sfc/efx.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2005-2009 Solarflare Communications Inc. 4 + * Copyright 2005-2011 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published
+1 -1
drivers/net/sfc/efx.h
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2006-2009 Solarflare Communications Inc. 4 + * Copyright 2006-2010 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published
+23 -4
drivers/net/sfc/ethtool.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2006-2009 Solarflare Communications Inc. 4 + * Copyright 2006-2010 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published ··· 28 28 enum { 29 29 EFX_ETHTOOL_STAT_SOURCE_mac_stats, 30 30 EFX_ETHTOOL_STAT_SOURCE_nic, 31 - EFX_ETHTOOL_STAT_SOURCE_channel 31 + EFX_ETHTOOL_STAT_SOURCE_channel, 32 + EFX_ETHTOOL_STAT_SOURCE_tx_queue 32 33 } source; 33 34 unsigned offset; 34 35 u64(*get_stat) (void *field); /* Reader function */ ··· 87 86 EFX_ETHTOOL_STAT(field, channel, n_##field, \ 88 87 unsigned int, efx_get_uint_stat) 89 88 89 + #define EFX_ETHTOOL_UINT_TXQ_STAT(field) \ 90 + EFX_ETHTOOL_STAT(tx_##field, tx_queue, field, \ 91 + unsigned int, efx_get_uint_stat) 92 + 90 93 static struct efx_ethtool_stat efx_ethtool_stats[] = { 91 94 EFX_ETHTOOL_U64_MAC_STAT(tx_bytes), 92 95 EFX_ETHTOOL_U64_MAC_STAT(tx_good_bytes), ··· 121 116 EFX_ETHTOOL_ULONG_MAC_STAT(tx_non_tcpudp), 122 117 EFX_ETHTOOL_ULONG_MAC_STAT(tx_mac_src_error), 123 118 EFX_ETHTOOL_ULONG_MAC_STAT(tx_ip_src_error), 119 + EFX_ETHTOOL_UINT_TXQ_STAT(tso_bursts), 120 + EFX_ETHTOOL_UINT_TXQ_STAT(tso_long_headers), 121 + EFX_ETHTOOL_UINT_TXQ_STAT(tso_packets), 122 + EFX_ETHTOOL_UINT_TXQ_STAT(pushes), 124 123 EFX_ETHTOOL_U64_MAC_STAT(rx_bytes), 125 124 EFX_ETHTOOL_U64_MAC_STAT(rx_good_bytes), 126 125 EFX_ETHTOOL_U64_MAC_STAT(rx_bad_bytes), ··· 246 237 strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); 247 238 strlcpy(info->version, EFX_DRIVER_VERSION, sizeof(info->version)); 248 239 if (efx_nic_rev(efx) >= EFX_REV_SIENA_A0) 249 - siena_print_fwver(efx, info->fw_version, 250 - sizeof(info->fw_version)); 240 + efx_mcdi_print_fwver(efx, info->fw_version, 241 + sizeof(info->fw_version)); 251 242 strlcpy(info->bus_info, pci_name(efx->pci_dev), sizeof(info->bus_info)); 252 243 } 253 244 ··· 479 470 struct efx_mac_stats *mac_stats = &efx->mac_stats; 480 471 struct efx_ethtool_stat *stat; 481 472 struct efx_channel *channel; 473 + struct efx_tx_queue *tx_queue; 482 474 struct rtnl_link_stats64 temp; 483 475 int i; 484 476 ··· 504 494 efx_for_each_channel(channel, efx) 505 495 data[i] += stat->get_stat((void *)channel + 506 496 stat->offset); 497 + break; 498 + case EFX_ETHTOOL_STAT_SOURCE_tx_queue: 499 + data[i] = 0; 500 + efx_for_each_channel(channel, efx) { 501 + efx_for_each_channel_tx_queue(tx_queue, channel) 502 + data[i] += 503 + stat->get_stat((void *)tx_queue 504 + + stat->offset); 505 + } 507 506 break; 508 507 } 509 508 }
+6 -16
drivers/net/sfc/falcon.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2006-2009 Solarflare Communications Inc. 4 + * Copyright 2006-2010 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published ··· 1478 1478 /* RX control FIFO thresholds (32 entries) */ 1479 1479 const unsigned ctrl_xon_thr = 20; 1480 1480 const unsigned ctrl_xoff_thr = 25; 1481 - /* RX data FIFO thresholds (256-byte units; size varies) */ 1482 - int data_xon_thr = efx_nic_rx_xon_thresh >> 8; 1483 - int data_xoff_thr = efx_nic_rx_xoff_thresh >> 8; 1484 1481 efx_oword_t reg; 1485 1482 1486 1483 efx_reado(efx, &reg, FR_AZ_RX_CFG); 1487 1484 if (efx_nic_rev(efx) <= EFX_REV_FALCON_A1) { 1488 1485 /* Data FIFO size is 5.5K */ 1489 - if (data_xon_thr < 0) 1490 - data_xon_thr = 512 >> 8; 1491 - if (data_xoff_thr < 0) 1492 - data_xoff_thr = 2048 >> 8; 1493 1486 EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_DESC_PUSH_EN, 0); 1494 1487 EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_USR_BUF_SIZE, 1495 1488 huge_buf_size); 1496 - EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_XON_MAC_TH, data_xon_thr); 1497 - EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_XOFF_MAC_TH, data_xoff_thr); 1489 + EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_XON_MAC_TH, 512 >> 8); 1490 + EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_XOFF_MAC_TH, 2048 >> 8); 1498 1491 EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_XON_TX_TH, ctrl_xon_thr); 1499 1492 EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_XOFF_TX_TH, ctrl_xoff_thr); 1500 1493 } else { 1501 1494 /* Data FIFO size is 80K; register fields moved */ 1502 - if (data_xon_thr < 0) 1503 - data_xon_thr = 27648 >> 8; /* ~3*max MTU */ 1504 - if (data_xoff_thr < 0) 1505 - data_xoff_thr = 54272 >> 8; /* ~80Kb - 3*max MTU */ 1506 1495 EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_DESC_PUSH_EN, 0); 1507 1496 EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_USR_BUF_SIZE, 1508 1497 huge_buf_size); 1509 - EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XON_MAC_TH, data_xon_thr); 1510 - EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XOFF_MAC_TH, data_xoff_thr); 1498 + /* Send XON and XOFF at ~3 * max MTU away from empty/full */ 1499 + EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XON_MAC_TH, 27648 >> 8); 1500 + EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XOFF_MAC_TH, 54272 >> 8); 1511 1501 EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XON_TX_TH, ctrl_xon_thr); 1512 1502 EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XOFF_TX_TH, ctrl_xoff_thr); 1513 1503 EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_INGR_EN, 1);
+1 -1
drivers/net/sfc/falcon_boards.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 - * Copyright 2007-2009 Solarflare Communications Inc. 3 + * Copyright 2007-2010 Solarflare Communications Inc. 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 6 * under the terms of the GNU General Public License version 2 as published
+1 -1
drivers/net/sfc/falcon_xmac.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2006-2009 Solarflare Communications Inc. 4 + * Copyright 2006-2010 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published
+1 -1
drivers/net/sfc/io.h
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2006-2009 Solarflare Communications Inc. 4 + * Copyright 2006-2010 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published
+7 -16
drivers/net/sfc/mcdi.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 - * Copyright 2008-2009 Solarflare Communications Inc. 3 + * Copyright 2008-2011 Solarflare Communications Inc. 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 6 * under the terms of the GNU General Public License version 2 as published ··· 602 602 ************************************************************************** 603 603 */ 604 604 605 - int efx_mcdi_fwver(struct efx_nic *efx, u64 *version, u32 *build) 605 + void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len) 606 606 { 607 607 u8 outbuf[ALIGN(MC_CMD_GET_VERSION_V1_OUT_LEN, 4)]; 608 608 size_t outlength; ··· 616 616 if (rc) 617 617 goto fail; 618 618 619 - if (outlength == MC_CMD_GET_VERSION_V0_OUT_LEN) { 620 - *version = 0; 621 - *build = MCDI_DWORD(outbuf, GET_VERSION_OUT_FIRMWARE); 622 - return 0; 623 - } 624 - 625 619 if (outlength < MC_CMD_GET_VERSION_V1_OUT_LEN) { 626 620 rc = -EIO; 627 621 goto fail; 628 622 } 629 623 630 624 ver_words = (__le16 *)MCDI_PTR(outbuf, GET_VERSION_OUT_VERSION); 631 - *version = (((u64)le16_to_cpu(ver_words[0]) << 48) | 632 - ((u64)le16_to_cpu(ver_words[1]) << 32) | 633 - ((u64)le16_to_cpu(ver_words[2]) << 16) | 634 - le16_to_cpu(ver_words[3])); 635 - *build = MCDI_DWORD(outbuf, GET_VERSION_OUT_FIRMWARE); 636 - 637 - return 0; 625 + snprintf(buf, len, "%u.%u.%u.%u", 626 + le16_to_cpu(ver_words[0]), le16_to_cpu(ver_words[1]), 627 + le16_to_cpu(ver_words[2]), le16_to_cpu(ver_words[3])); 628 + return; 638 629 639 630 fail: 640 631 netif_err(efx, probe, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); 641 - return rc; 632 + buf[0] = 0; 642 633 } 643 634 644 635 int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,
+2 -2
drivers/net/sfc/mcdi.h
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 - * Copyright 2008-2009 Solarflare Communications Inc. 3 + * Copyright 2008-2010 Solarflare Communications Inc. 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 6 * under the terms of the GNU General Public License version 2 as published ··· 93 93 #define MCDI_EVENT_FIELD(_ev, _field) \ 94 94 EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field) 95 95 96 - extern int efx_mcdi_fwver(struct efx_nic *efx, u64 *version, u32 *build); 96 + extern void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len); 97 97 extern int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, 98 98 bool *was_attached_out); 99 99 extern int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
+1 -1
drivers/net/sfc/mcdi_mac.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 - * Copyright 2009 Solarflare Communications Inc. 3 + * Copyright 2009-2010 Solarflare Communications Inc. 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 6 * under the terms of the GNU General Public License version 2 as published
+1 -1
drivers/net/sfc/mcdi_pcol.h
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 - * Copyright 2009 Solarflare Communications Inc. 3 + * Copyright 2009-2011 Solarflare Communications Inc. 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 6 * under the terms of the GNU General Public License version 2 as published
+1 -1
drivers/net/sfc/mcdi_phy.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 - * Copyright 2009 Solarflare Communications Inc. 3 + * Copyright 2009-2010 Solarflare Communications Inc. 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 6 * under the terms of the GNU General Public License version 2 as published
+6 -28
drivers/net/sfc/mdio_10g.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 - * Copyright 2006-2009 Solarflare Communications Inc. 3 + * Copyright 2006-2011 Solarflare Communications Inc. 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 6 * under the terms of the GNU General Public License version 2 as published ··· 51 51 return spins ? spins : -ETIMEDOUT; 52 52 } 53 53 54 - static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd, int fault_fatal) 54 + static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd) 55 55 { 56 56 int status; 57 - 58 - if (LOOPBACK_INTERNAL(efx)) 59 - return 0; 60 57 61 58 if (mmd != MDIO_MMD_AN) { 62 59 /* Read MMD STATUS2 to check it is responding. */ ··· 65 68 } 66 69 } 67 70 68 - /* Read MMD STATUS 1 to check for fault. */ 69 - status = efx_mdio_read(efx, mmd, MDIO_STAT1); 70 - if (status & MDIO_STAT1_FAULT) { 71 - if (fault_fatal) { 72 - netif_err(efx, hw, efx->net_dev, 73 - "PHY MMD %d reporting fatal" 74 - " fault: status %x\n", mmd, status); 75 - return -EIO; 76 - } else { 77 - netif_dbg(efx, hw, efx->net_dev, 78 - "PHY MMD %d reporting status" 79 - " %x (expected)\n", mmd, status); 80 - } 81 - } 82 71 return 0; 83 72 } 84 73 ··· 113 130 return rc; 114 131 } 115 132 116 - int efx_mdio_check_mmds(struct efx_nic *efx, 117 - unsigned int mmd_mask, unsigned int fatal_mask) 133 + int efx_mdio_check_mmds(struct efx_nic *efx, unsigned int mmd_mask) 118 134 { 119 135 int mmd = 0, probe_mmd, devs1, devs2; 120 136 u32 devices; ··· 143 161 144 162 /* Check all required MMDs are responding and happy. */ 145 163 while (mmd_mask) { 146 - if (mmd_mask & 1) { 147 - int fault_fatal = fatal_mask & 1; 148 - if (efx_mdio_check_mmd(efx, mmd, fault_fatal)) 149 - return -EIO; 150 - } 164 + if ((mmd_mask & 1) && efx_mdio_check_mmd(efx, mmd)) 165 + return -EIO; 151 166 mmd_mask = mmd_mask >> 1; 152 - fatal_mask = fatal_mask >> 1; 153 167 mmd++; 154 168 } 155 169 ··· 315 337 "no MDIO PHY present with ID %d\n", efx->mdio.prtad); 316 338 rc = -EINVAL; 317 339 } else { 318 - rc = efx_mdio_check_mmds(efx, efx->mdio.mmds, 0); 340 + rc = efx_mdio_check_mmds(efx, efx->mdio.mmds); 319 341 } 320 342 321 343 mutex_unlock(&efx->mac_lock);
+2 -3
drivers/net/sfc/mdio_10g.h
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 - * Copyright 2006-2009 Solarflare Communications Inc. 3 + * Copyright 2006-2011 Solarflare Communications Inc. 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 6 * under the terms of the GNU General Public License version 2 as published ··· 68 68 int spins, int spintime); 69 69 70 70 /* As efx_mdio_check_mmd but for multiple MMDs */ 71 - int efx_mdio_check_mmds(struct efx_nic *efx, 72 - unsigned int mmd_mask, unsigned int fatal_mask); 71 + int efx_mdio_check_mmds(struct efx_nic *efx, unsigned int mmd_mask); 73 72 74 73 /* Check the link status of specified mmds in bit mask */ 75 74 extern bool efx_mdio_links_ok(struct efx_nic *efx, unsigned int mmd_mask);
+1 -1
drivers/net/sfc/mtd.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2006-2009 Solarflare Communications Inc. 4 + * Copyright 2006-2010 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published
+8 -6
drivers/net/sfc/net_driver.h
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2005-2009 Solarflare Communications Inc. 4 + * Copyright 2005-2011 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published ··· 41 41 * 42 42 **************************************************************************/ 43 43 44 - #define EFX_DRIVER_VERSION "3.0" 44 + #define EFX_DRIVER_VERSION "3.1" 45 45 46 46 #ifdef EFX_ENABLE_DEBUG 47 47 #define EFX_BUG_ON_PARANOID(x) BUG_ON(x) ··· 214 214 * If both this and page are %NULL, the buffer slot is currently free. 215 215 * @page: The associated page buffer, if any. 216 216 * If both this and skb are %NULL, the buffer slot is currently free. 217 - * @data: Pointer to ethernet header 218 217 * @len: Buffer length, in bytes. 218 + * @is_page: Indicates if @page is valid. If false, @skb is valid. 219 219 */ 220 220 struct efx_rx_buffer { 221 221 dma_addr_t dma_addr; 222 - struct sk_buff *skb; 223 - struct page *page; 224 - char *data; 222 + union { 223 + struct sk_buff *skb; 224 + struct page *page; 225 + } u; 225 226 unsigned int len; 227 + bool is_page; 226 228 }; 227 229 228 230 /**
+1 -21
drivers/net/sfc/nic.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2006-2009 Solarflare Communications Inc. 4 + * Copyright 2006-2011 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published ··· 40 40 41 41 #define RX_DC_ENTRIES 64 42 42 #define RX_DC_ENTRIES_ORDER 3 43 - 44 - /* RX FIFO XOFF watermark 45 - * 46 - * When the amount of the RX FIFO increases used increases past this 47 - * watermark send XOFF. Only used if RX flow control is enabled (ethtool -A) 48 - * This also has an effect on RX/TX arbitration 49 - */ 50 - int efx_nic_rx_xoff_thresh = -1; 51 - module_param_named(rx_xoff_thresh_bytes, efx_nic_rx_xoff_thresh, int, 0644); 52 - MODULE_PARM_DESC(rx_xoff_thresh_bytes, "RX fifo XOFF threshold"); 53 - 54 - /* RX FIFO XON watermark 55 - * 56 - * When the amount of the RX FIFO used decreases below this 57 - * watermark send XON. Only used if TX flow control is enabled (ethtool -A) 58 - * This also has an effect on RX/TX arbitration 59 - */ 60 - int efx_nic_rx_xon_thresh = -1; 61 - module_param_named(rx_xon_thresh_bytes, efx_nic_rx_xon_thresh, int, 0644); 62 - MODULE_PARM_DESC(rx_xon_thresh_bytes, "RX fifo XON threshold"); 63 43 64 44 /* If EFX_MAX_INT_ERRORS internal errors occur within 65 45 * EFX_INT_ERROR_EXPIRE seconds, we consider the NIC broken and
+1 -8
drivers/net/sfc/nic.h
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2006-2009 Solarflare Communications Inc. 4 + * Copyright 2006-2011 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published ··· 142 142 143 143 /** 144 144 * struct siena_nic_data - Siena NIC state 145 - * @fw_version: Management controller firmware version 146 - * @fw_build: Firmware build number 147 145 * @mcdi: Management-Controller-to-Driver Interface 148 146 * @wol_filter_id: Wake-on-LAN packet filter id 149 147 */ 150 148 struct siena_nic_data { 151 - u64 fw_version; 152 - u32 fw_build; 153 149 struct efx_mcdi_iface mcdi; 154 150 int wol_filter_id; 155 151 }; 156 - 157 - extern void siena_print_fwver(struct efx_nic *efx, char *buf, size_t len); 158 152 159 153 extern struct efx_nic_type falcon_a1_nic_type; 160 154 extern struct efx_nic_type falcon_b0_nic_type; ··· 188 194 /* MAC/PHY */ 189 195 extern void falcon_drain_tx_fifo(struct efx_nic *efx); 190 196 extern void falcon_reconfigure_mac_wrapper(struct efx_nic *efx); 191 - extern int efx_nic_rx_xoff_thresh, efx_nic_rx_xon_thresh; 192 197 193 198 /* Interrupts and test events */ 194 199 extern int efx_nic_init_interrupt(struct efx_nic *efx);
+1 -1
drivers/net/sfc/phy.h
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 - * Copyright 2007-2009 Solarflare Communications Inc. 3 + * Copyright 2007-2010 Solarflare Communications Inc. 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 6 * under the terms of the GNU General Public License version 2 as published
+1 -1
drivers/net/sfc/qt202x_phy.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 - * Copyright 2006-2009 Solarflare Communications Inc. 3 + * Copyright 2006-2010 Solarflare Communications Inc. 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 6 * under the terms of the GNU General Public License version 2 as published
+1 -1
drivers/net/sfc/regs.h
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2006-2009 Solarflare Communications Inc. 4 + * Copyright 2006-2010 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published
+72 -72
drivers/net/sfc/rx.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2005-2009 Solarflare Communications Inc. 4 + * Copyright 2005-2011 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published ··· 89 89 */ 90 90 #define EFX_RXD_HEAD_ROOM 2 91 91 92 - static inline unsigned int efx_rx_buf_offset(struct efx_rx_buffer *buf) 92 + /* Offset of ethernet header within page */ 93 + static inline unsigned int efx_rx_buf_offset(struct efx_nic *efx, 94 + struct efx_rx_buffer *buf) 93 95 { 94 96 /* Offset is always within one page, so we don't need to consider 95 97 * the page order. 96 98 */ 97 - return (__force unsigned long) buf->data & (PAGE_SIZE - 1); 99 + return (((__force unsigned long) buf->dma_addr & (PAGE_SIZE - 1)) + 100 + efx->type->rx_buffer_hash_size); 98 101 } 99 102 static inline unsigned int efx_rx_buf_size(struct efx_nic *efx) 100 103 { 101 104 return PAGE_SIZE << efx->rx_buffer_order; 102 105 } 103 106 104 - static inline u32 efx_rx_buf_hash(struct efx_rx_buffer *buf) 107 + static u8 *efx_rx_buf_eh(struct efx_nic *efx, struct efx_rx_buffer *buf) 105 108 { 109 + if (buf->is_page) 110 + return page_address(buf->u.page) + efx_rx_buf_offset(efx, buf); 111 + else 112 + return ((u8 *)buf->u.skb->data + 113 + efx->type->rx_buffer_hash_size); 114 + } 115 + 116 + static inline u32 efx_rx_buf_hash(const u8 *eh) 117 + { 118 + /* The ethernet header is always directly after any hash. */ 106 119 #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) || NET_IP_ALIGN % 4 == 0 107 - return __le32_to_cpup((const __le32 *)(buf->data - 4)); 120 + return __le32_to_cpup((const __le32 *)(eh - 4)); 108 121 #else 109 - const u8 *data = (const u8 *)(buf->data - 4); 122 + const u8 *data = eh - 4; 110 123 return ((u32)data[0] | 111 124 (u32)data[1] << 8 | 112 125 (u32)data[2] << 16 | ··· 142 129 struct efx_nic *efx = rx_queue->efx; 143 130 struct net_device *net_dev = efx->net_dev; 144 131 struct efx_rx_buffer *rx_buf; 132 + struct sk_buff *skb; 145 133 int skb_len = efx->rx_buffer_len; 146 134 unsigned index, count; 147 135 ··· 150 136 index = rx_queue->added_count & rx_queue->ptr_mask; 151 137 rx_buf = efx_rx_buffer(rx_queue, index); 152 138 153 - rx_buf->skb = netdev_alloc_skb(net_dev, skb_len); 154 - if (unlikely(!rx_buf->skb)) 139 + rx_buf->u.skb = skb = netdev_alloc_skb(net_dev, skb_len); 140 + if (unlikely(!skb)) 155 141 return -ENOMEM; 156 - rx_buf->page = NULL; 157 142 158 143 /* Adjust the SKB for padding and checksum */ 159 - skb_reserve(rx_buf->skb, NET_IP_ALIGN); 144 + skb_reserve(skb, NET_IP_ALIGN); 160 145 rx_buf->len = skb_len - NET_IP_ALIGN; 161 - rx_buf->data = (char *)rx_buf->skb->data; 162 - rx_buf->skb->ip_summed = CHECKSUM_UNNECESSARY; 146 + rx_buf->is_page = false; 147 + skb->ip_summed = CHECKSUM_UNNECESSARY; 163 148 164 149 rx_buf->dma_addr = pci_map_single(efx->pci_dev, 165 - rx_buf->data, rx_buf->len, 150 + skb->data, rx_buf->len, 166 151 PCI_DMA_FROMDEVICE); 167 152 if (unlikely(pci_dma_mapping_error(efx->pci_dev, 168 153 rx_buf->dma_addr))) { 169 - dev_kfree_skb_any(rx_buf->skb); 170 - rx_buf->skb = NULL; 154 + dev_kfree_skb_any(skb); 155 + rx_buf->u.skb = NULL; 171 156 return -EIO; 172 157 } 173 158 ··· 224 211 index = rx_queue->added_count & rx_queue->ptr_mask; 225 212 rx_buf = efx_rx_buffer(rx_queue, index); 226 213 rx_buf->dma_addr = dma_addr + EFX_PAGE_IP_ALIGN; 227 - rx_buf->skb = NULL; 228 - rx_buf->page = page; 229 - rx_buf->data = page_addr + EFX_PAGE_IP_ALIGN; 214 + rx_buf->u.page = page; 230 215 rx_buf->len = efx->rx_buffer_len - EFX_PAGE_IP_ALIGN; 216 + rx_buf->is_page = true; 231 217 ++rx_queue->added_count; 232 218 ++rx_queue->alloc_page_count; 233 219 ++state->refcnt; ··· 247 235 static void efx_unmap_rx_buffer(struct efx_nic *efx, 248 236 struct efx_rx_buffer *rx_buf) 249 237 { 250 - if (rx_buf->page) { 238 + if (rx_buf->is_page && rx_buf->u.page) { 251 239 struct efx_rx_page_state *state; 252 240 253 - EFX_BUG_ON_PARANOID(rx_buf->skb); 254 - 255 - state = page_address(rx_buf->page); 241 + state = page_address(rx_buf->u.page); 256 242 if (--state->refcnt == 0) { 257 243 pci_unmap_page(efx->pci_dev, 258 244 state->dma_addr, 259 245 efx_rx_buf_size(efx), 260 246 PCI_DMA_FROMDEVICE); 261 247 } 262 - } else if (likely(rx_buf->skb)) { 248 + } else if (!rx_buf->is_page && rx_buf->u.skb) { 263 249 pci_unmap_single(efx->pci_dev, rx_buf->dma_addr, 264 250 rx_buf->len, PCI_DMA_FROMDEVICE); 265 251 } ··· 266 256 static void efx_free_rx_buffer(struct efx_nic *efx, 267 257 struct efx_rx_buffer *rx_buf) 268 258 { 269 - if (rx_buf->page) { 270 - __free_pages(rx_buf->page, efx->rx_buffer_order); 271 - rx_buf->page = NULL; 272 - } else if (likely(rx_buf->skb)) { 273 - dev_kfree_skb_any(rx_buf->skb); 274 - rx_buf->skb = NULL; 259 + if (rx_buf->is_page && rx_buf->u.page) { 260 + __free_pages(rx_buf->u.page, efx->rx_buffer_order); 261 + rx_buf->u.page = NULL; 262 + } else if (!rx_buf->is_page && rx_buf->u.skb) { 263 + dev_kfree_skb_any(rx_buf->u.skb); 264 + rx_buf->u.skb = NULL; 275 265 } 276 266 } 277 267 ··· 287 277 static void efx_resurrect_rx_buffer(struct efx_rx_queue *rx_queue, 288 278 struct efx_rx_buffer *rx_buf) 289 279 { 290 - struct efx_rx_page_state *state = page_address(rx_buf->page); 280 + struct efx_rx_page_state *state = page_address(rx_buf->u.page); 291 281 struct efx_rx_buffer *new_buf; 292 282 unsigned fill_level, index; 293 283 ··· 302 292 } 303 293 304 294 ++state->refcnt; 305 - get_page(rx_buf->page); 295 + get_page(rx_buf->u.page); 306 296 307 297 index = rx_queue->added_count & rx_queue->ptr_mask; 308 298 new_buf = efx_rx_buffer(rx_queue, index); 309 299 new_buf->dma_addr = rx_buf->dma_addr ^ (PAGE_SIZE >> 1); 310 - new_buf->skb = NULL; 311 - new_buf->page = rx_buf->page; 312 - new_buf->data = (void *) 313 - ((__force unsigned long)rx_buf->data ^ (PAGE_SIZE >> 1)); 300 + new_buf->u.page = rx_buf->u.page; 314 301 new_buf->len = rx_buf->len; 302 + new_buf->is_page = true; 315 303 ++rx_queue->added_count; 316 304 } 317 305 ··· 323 315 struct efx_rx_buffer *new_buf; 324 316 unsigned index; 325 317 326 - if (rx_buf->page != NULL && efx->rx_buffer_len <= EFX_RX_HALF_PAGE && 327 - page_count(rx_buf->page) == 1) 318 + if (rx_buf->is_page && efx->rx_buffer_len <= EFX_RX_HALF_PAGE && 319 + page_count(rx_buf->u.page) == 1) 328 320 efx_resurrect_rx_buffer(rx_queue, rx_buf); 329 321 330 322 index = rx_queue->added_count & rx_queue->ptr_mask; 331 323 new_buf = efx_rx_buffer(rx_queue, index); 332 324 333 325 memcpy(new_buf, rx_buf, sizeof(*new_buf)); 334 - rx_buf->page = NULL; 335 - rx_buf->skb = NULL; 326 + rx_buf->u.page = NULL; 336 327 ++rx_queue->added_count; 337 328 } 338 329 ··· 435 428 * data at the end of the skb will be trashed. So 436 429 * we have no choice but to leak the fragment. 437 430 */ 438 - *leak_packet = (rx_buf->skb != NULL); 431 + *leak_packet = !rx_buf->is_page; 439 432 efx_schedule_reset(efx, RESET_TYPE_RX_RECOVERY); 440 433 } else { 441 434 if (net_ratelimit()) ··· 455 448 */ 456 449 static void efx_rx_packet_gro(struct efx_channel *channel, 457 450 struct efx_rx_buffer *rx_buf, 458 - bool checksummed) 451 + const u8 *eh, bool checksummed) 459 452 { 460 453 struct napi_struct *napi = &channel->napi_str; 461 454 gro_result_t gro_result; 462 455 463 456 /* Pass the skb/page into the GRO engine */ 464 - if (rx_buf->page) { 457 + if (rx_buf->is_page) { 465 458 struct efx_nic *efx = channel->efx; 466 - struct page *page = rx_buf->page; 459 + struct page *page = rx_buf->u.page; 467 460 struct sk_buff *skb; 468 461 469 - EFX_BUG_ON_PARANOID(rx_buf->skb); 470 - rx_buf->page = NULL; 462 + rx_buf->u.page = NULL; 471 463 472 464 skb = napi_get_frags(napi); 473 465 if (!skb) { ··· 475 469 } 476 470 477 471 if (efx->net_dev->features & NETIF_F_RXHASH) 478 - skb->rxhash = efx_rx_buf_hash(rx_buf); 472 + skb->rxhash = efx_rx_buf_hash(eh); 479 473 480 474 skb_shinfo(skb)->frags[0].page = page; 481 475 skb_shinfo(skb)->frags[0].page_offset = 482 - efx_rx_buf_offset(rx_buf); 476 + efx_rx_buf_offset(efx, rx_buf); 483 477 skb_shinfo(skb)->frags[0].size = rx_buf->len; 484 478 skb_shinfo(skb)->nr_frags = 1; 485 479 ··· 493 487 494 488 gro_result = napi_gro_frags(napi); 495 489 } else { 496 - struct sk_buff *skb = rx_buf->skb; 490 + struct sk_buff *skb = rx_buf->u.skb; 497 491 498 - EFX_BUG_ON_PARANOID(!skb); 499 492 EFX_BUG_ON_PARANOID(!checksummed); 500 - rx_buf->skb = NULL; 493 + rx_buf->u.skb = NULL; 501 494 502 495 gro_result = napi_gro_receive(napi, skb); 503 496 } ··· 518 513 bool leak_packet = false; 519 514 520 515 rx_buf = efx_rx_buffer(rx_queue, index); 521 - EFX_BUG_ON_PARANOID(!rx_buf->data); 522 - EFX_BUG_ON_PARANOID(rx_buf->skb && rx_buf->page); 523 - EFX_BUG_ON_PARANOID(!(rx_buf->skb || rx_buf->page)); 524 516 525 517 /* This allows the refill path to post another buffer. 526 518 * EFX_RXD_HEAD_ROOM ensures that the slot we are using ··· 556 554 /* Prefetch nice and early so data will (hopefully) be in cache by 557 555 * the time we look at it. 558 556 */ 559 - prefetch(rx_buf->data); 557 + prefetch(efx_rx_buf_eh(efx, rx_buf)); 560 558 561 559 /* Pipeline receives so that we give time for packet headers to be 562 560 * prefetched into cache. 563 561 */ 564 - rx_buf->len = len; 562 + rx_buf->len = len - efx->type->rx_buffer_hash_size; 565 563 out: 566 564 if (channel->rx_pkt) 567 565 __efx_rx_packet(channel, ··· 576 574 { 577 575 struct efx_nic *efx = channel->efx; 578 576 struct sk_buff *skb; 579 - 580 - rx_buf->data += efx->type->rx_buffer_hash_size; 581 - rx_buf->len -= efx->type->rx_buffer_hash_size; 577 + u8 *eh = efx_rx_buf_eh(efx, rx_buf); 582 578 583 579 /* If we're in loopback test, then pass the packet directly to the 584 580 * loopback layer, and free the rx_buf here 585 581 */ 586 582 if (unlikely(efx->loopback_selftest)) { 587 - efx_loopback_rx_packet(efx, rx_buf->data, rx_buf->len); 583 + efx_loopback_rx_packet(efx, eh, rx_buf->len); 588 584 efx_free_rx_buffer(efx, rx_buf); 589 585 return; 590 586 } 591 587 592 - if (rx_buf->skb) { 593 - prefetch(skb_shinfo(rx_buf->skb)); 588 + if (!rx_buf->is_page) { 589 + skb = rx_buf->u.skb; 594 590 595 - skb_reserve(rx_buf->skb, efx->type->rx_buffer_hash_size); 596 - skb_put(rx_buf->skb, rx_buf->len); 591 + prefetch(skb_shinfo(skb)); 592 + 593 + skb_reserve(skb, efx->type->rx_buffer_hash_size); 594 + skb_put(skb, rx_buf->len); 597 595 598 596 if (efx->net_dev->features & NETIF_F_RXHASH) 599 - rx_buf->skb->rxhash = efx_rx_buf_hash(rx_buf); 597 + skb->rxhash = efx_rx_buf_hash(eh); 600 598 601 599 /* Move past the ethernet header. rx_buf->data still points 602 600 * at the ethernet header */ 603 - rx_buf->skb->protocol = eth_type_trans(rx_buf->skb, 604 - efx->net_dev); 601 + skb->protocol = eth_type_trans(skb, efx->net_dev); 605 602 606 - skb_record_rx_queue(rx_buf->skb, channel->channel); 603 + skb_record_rx_queue(skb, channel->channel); 607 604 } 608 605 609 - if (likely(checksummed || rx_buf->page)) { 610 - efx_rx_packet_gro(channel, rx_buf, checksummed); 606 + if (likely(checksummed || rx_buf->is_page)) { 607 + efx_rx_packet_gro(channel, rx_buf, eh, checksummed); 611 608 return; 612 609 } 613 610 614 611 /* We now own the SKB */ 615 - skb = rx_buf->skb; 616 - rx_buf->skb = NULL; 617 - EFX_BUG_ON_PARANOID(!skb); 612 + skb = rx_buf->u.skb; 613 + rx_buf->u.skb = NULL; 618 614 619 615 /* Set the SKB flags */ 620 616 skb_checksum_none_assert(skb);
+1 -1
drivers/net/sfc/selftest.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2006-2009 Solarflare Communications Inc. 4 + * Copyright 2006-2010 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published
+1 -1
drivers/net/sfc/selftest.h
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2006-2008 Solarflare Communications Inc. 4 + * Copyright 2006-2010 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published
+1 -23
drivers/net/sfc/siena.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2006-2009 Solarflare Communications Inc. 4 + * Copyright 2006-2010 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published ··· 227 227 if (rc) 228 228 goto fail1; 229 229 230 - rc = efx_mcdi_fwver(efx, &nic_data->fw_version, &nic_data->fw_build); 231 - if (rc) { 232 - netif_err(efx, probe, efx->net_dev, 233 - "Failed to read MCPU firmware version - rc %d\n", rc); 234 - goto fail1; /* MCPU absent? */ 235 - } 236 - 237 230 /* Let the BMC know that the driver is now in charge of link and 238 231 * filter settings. We must do this before we reset the NIC */ 239 232 rc = efx_mcdi_drv_attach(efx, true, &already_attached); ··· 340 347 memcpy(&temp, efx->rx_hash_key + 2 * sizeof(temp), 341 348 FRF_CZ_RX_RSS_IPV6_TKEY_HI_WIDTH / 8); 342 349 efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG3); 343 - 344 - if (efx_nic_rx_xoff_thresh >= 0 || efx_nic_rx_xon_thresh >= 0) 345 - /* No MCDI operation has been defined to set thresholds */ 346 - netif_err(efx, hw, efx->net_dev, 347 - "ignoring RX flow control thresholds\n"); 348 350 349 351 /* Enable event logging */ 350 352 rc = efx_mcdi_log_ctrl(efx, true, false, 0); ··· 500 512 static void siena_stop_nic_stats(struct efx_nic *efx) 501 513 { 502 514 efx_mcdi_mac_stats(efx, efx->stats_buffer.dma_addr, 0, 0, 0); 503 - } 504 - 505 - void siena_print_fwver(struct efx_nic *efx, char *buf, size_t len) 506 - { 507 - struct siena_nic_data *nic_data = efx->nic_data; 508 - snprintf(buf, len, "%u.%u.%u.%u", 509 - (unsigned int)(nic_data->fw_version >> 48), 510 - (unsigned int)(nic_data->fw_version >> 32 & 0xffff), 511 - (unsigned int)(nic_data->fw_version >> 16 & 0xffff), 512 - (unsigned int)(nic_data->fw_version & 0xffff)); 513 515 } 514 516 515 517 /**************************************************************************
+1 -1
drivers/net/sfc/spi.h
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005 Fen Systems Ltd. 4 - * Copyright 2006 Solarflare Communications Inc. 4 + * Copyright 2006-2010 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published
+2 -2
drivers/net/sfc/tenxpress.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 - * Copyright 2007-2009 Solarflare Communications Inc. 3 + * Copyright 2007-2011 Solarflare Communications Inc. 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 6 * under the terms of the GNU General Public License version 2 as published ··· 196 196 if (rc < 0) 197 197 return rc; 198 198 199 - rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS, 0); 199 + rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS); 200 200 if (rc < 0) 201 201 return rc; 202 202 }
+1 -1
drivers/net/sfc/tx.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 3 * Copyright 2005-2006 Fen Systems Ltd. 4 - * Copyright 2005-2009 Solarflare Communications Inc. 4 + * Copyright 2005-2010 Solarflare Communications Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License version 2 as published
+2 -2
drivers/net/sfc/txc43128_phy.c
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 - * Copyright 2006-2010 Solarflare Communications Inc. 3 + * Copyright 2006-2011 Solarflare Communications Inc. 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 6 * under the terms of the GNU General Public License version 2 as published ··· 193 193 goto fail; 194 194 195 195 /* Check that all the MMDs we expect are present and responding. */ 196 - rc = efx_mdio_check_mmds(efx, TXC_REQUIRED_DEVS, 0); 196 + rc = efx_mdio_check_mmds(efx, TXC_REQUIRED_DEVS); 197 197 if (rc < 0) 198 198 goto fail; 199 199
+1 -1
drivers/net/sfc/workarounds.h
··· 1 1 /**************************************************************************** 2 2 * Driver for Solarflare Solarstorm network controllers and boards 3 - * Copyright 2006-2009 Solarflare Communications Inc. 3 + * Copyright 2006-2010 Solarflare Communications Inc. 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 6 * under the terms of the GNU General Public License version 2 as published