···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2005-2009 Solarflare Communications Inc.44+ * Copyright 2005-2011 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published
+1-1
drivers/net/sfc/efx.h
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2006-2009 Solarflare Communications Inc.44+ * Copyright 2006-2010 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published
+23-4
drivers/net/sfc/ethtool.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2006-2009 Solarflare Communications Inc.44+ * Copyright 2006-2010 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published···2828 enum {2929 EFX_ETHTOOL_STAT_SOURCE_mac_stats,3030 EFX_ETHTOOL_STAT_SOURCE_nic,3131- EFX_ETHTOOL_STAT_SOURCE_channel3131+ EFX_ETHTOOL_STAT_SOURCE_channel,3232+ EFX_ETHTOOL_STAT_SOURCE_tx_queue3233 } source;3334 unsigned offset;3435 u64(*get_stat) (void *field); /* Reader function */···8786 EFX_ETHTOOL_STAT(field, channel, n_##field, \8887 unsigned int, efx_get_uint_stat)89888989+#define EFX_ETHTOOL_UINT_TXQ_STAT(field) \9090+ EFX_ETHTOOL_STAT(tx_##field, tx_queue, field, \9191+ unsigned int, efx_get_uint_stat)9292+9093static struct efx_ethtool_stat efx_ethtool_stats[] = {9194 EFX_ETHTOOL_U64_MAC_STAT(tx_bytes),9295 EFX_ETHTOOL_U64_MAC_STAT(tx_good_bytes),···121116 EFX_ETHTOOL_ULONG_MAC_STAT(tx_non_tcpudp),122117 EFX_ETHTOOL_ULONG_MAC_STAT(tx_mac_src_error),123118 EFX_ETHTOOL_ULONG_MAC_STAT(tx_ip_src_error),119119+ EFX_ETHTOOL_UINT_TXQ_STAT(tso_bursts),120120+ EFX_ETHTOOL_UINT_TXQ_STAT(tso_long_headers),121121+ EFX_ETHTOOL_UINT_TXQ_STAT(tso_packets),122122+ EFX_ETHTOOL_UINT_TXQ_STAT(pushes),124123 EFX_ETHTOOL_U64_MAC_STAT(rx_bytes),125124 EFX_ETHTOOL_U64_MAC_STAT(rx_good_bytes),126125 EFX_ETHTOOL_U64_MAC_STAT(rx_bad_bytes),···246237 strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));247238 strlcpy(info->version, EFX_DRIVER_VERSION, sizeof(info->version));248239 if (efx_nic_rev(efx) >= EFX_REV_SIENA_A0)249249- siena_print_fwver(efx, info->fw_version,250250- sizeof(info->fw_version));240240+ efx_mcdi_print_fwver(efx, info->fw_version,241241+ sizeof(info->fw_version));251242 strlcpy(info->bus_info, pci_name(efx->pci_dev), sizeof(info->bus_info));252243}253244···479470 struct efx_mac_stats *mac_stats = &efx->mac_stats;480471 struct efx_ethtool_stat *stat;481472 struct efx_channel *channel;473473+ struct efx_tx_queue *tx_queue;482474 struct rtnl_link_stats64 temp;483475 int i;484476···504494 efx_for_each_channel(channel, efx)505495 data[i] += stat->get_stat((void *)channel +506496 stat->offset);497497+ break;498498+ case EFX_ETHTOOL_STAT_SOURCE_tx_queue:499499+ data[i] = 0;500500+ efx_for_each_channel(channel, efx) {501501+ efx_for_each_channel_tx_queue(tx_queue, channel)502502+ data[i] +=503503+ stat->get_stat((void *)tx_queue504504+ + stat->offset);505505+ }507506 break;508507 }509508 }
+6-16
drivers/net/sfc/falcon.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2006-2009 Solarflare Communications Inc.44+ * Copyright 2006-2010 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published···14781478 /* RX control FIFO thresholds (32 entries) */14791479 const unsigned ctrl_xon_thr = 20;14801480 const unsigned ctrl_xoff_thr = 25;14811481- /* RX data FIFO thresholds (256-byte units; size varies) */14821482- int data_xon_thr = efx_nic_rx_xon_thresh >> 8;14831483- int data_xoff_thr = efx_nic_rx_xoff_thresh >> 8;14841481 efx_oword_t reg;1485148214861483 efx_reado(efx, ®, FR_AZ_RX_CFG);14871484 if (efx_nic_rev(efx) <= EFX_REV_FALCON_A1) {14881485 /* Data FIFO size is 5.5K */14891489- if (data_xon_thr < 0)14901490- data_xon_thr = 512 >> 8;14911491- if (data_xoff_thr < 0)14921492- data_xoff_thr = 2048 >> 8;14931486 EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_DESC_PUSH_EN, 0);14941487 EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_USR_BUF_SIZE,14951488 huge_buf_size);14961496- EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_XON_MAC_TH, data_xon_thr);14971497- EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_XOFF_MAC_TH, data_xoff_thr);14891489+ EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_XON_MAC_TH, 512 >> 8);14901490+ EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_XOFF_MAC_TH, 2048 >> 8);14981491 EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_XON_TX_TH, ctrl_xon_thr);14991492 EFX_SET_OWORD_FIELD(reg, FRF_AA_RX_XOFF_TX_TH, ctrl_xoff_thr);15001493 } else {15011494 /* Data FIFO size is 80K; register fields moved */15021502- if (data_xon_thr < 0)15031503- data_xon_thr = 27648 >> 8; /* ~3*max MTU */15041504- if (data_xoff_thr < 0)15051505- data_xoff_thr = 54272 >> 8; /* ~80Kb - 3*max MTU */15061495 EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_DESC_PUSH_EN, 0);15071496 EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_USR_BUF_SIZE,15081497 huge_buf_size);15091509- EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XON_MAC_TH, data_xon_thr);15101510- EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XOFF_MAC_TH, data_xoff_thr);14981498+ /* Send XON and XOFF at ~3 * max MTU away from empty/full */14991499+ EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XON_MAC_TH, 27648 >> 8);15001500+ EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XOFF_MAC_TH, 54272 >> 8);15111501 EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XON_TX_TH, ctrl_xon_thr);15121502 EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XOFF_TX_TH, ctrl_xoff_thr);15131503 EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_INGR_EN, 1);
+1-1
drivers/net/sfc/falcon_boards.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33- * Copyright 2007-2009 Solarflare Communications Inc.33+ * Copyright 2007-2010 Solarflare Communications Inc.44 *55 * This program is free software; you can redistribute it and/or modify it66 * under the terms of the GNU General Public License version 2 as published
+1-1
drivers/net/sfc/falcon_xmac.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2006-2009 Solarflare Communications Inc.44+ * Copyright 2006-2010 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published
+1-1
drivers/net/sfc/io.h
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2006-2009 Solarflare Communications Inc.44+ * Copyright 2006-2010 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published
+7-16
drivers/net/sfc/mcdi.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33- * Copyright 2008-2009 Solarflare Communications Inc.33+ * Copyright 2008-2011 Solarflare Communications Inc.44 *55 * This program is free software; you can redistribute it and/or modify it66 * under the terms of the GNU General Public License version 2 as published···602602 **************************************************************************603603 */604604605605-int efx_mcdi_fwver(struct efx_nic *efx, u64 *version, u32 *build)605605+void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len)606606{607607 u8 outbuf[ALIGN(MC_CMD_GET_VERSION_V1_OUT_LEN, 4)];608608 size_t outlength;···616616 if (rc)617617 goto fail;618618619619- if (outlength == MC_CMD_GET_VERSION_V0_OUT_LEN) {620620- *version = 0;621621- *build = MCDI_DWORD(outbuf, GET_VERSION_OUT_FIRMWARE);622622- return 0;623623- }624624-625619 if (outlength < MC_CMD_GET_VERSION_V1_OUT_LEN) {626620 rc = -EIO;627621 goto fail;628622 }629623630624 ver_words = (__le16 *)MCDI_PTR(outbuf, GET_VERSION_OUT_VERSION);631631- *version = (((u64)le16_to_cpu(ver_words[0]) << 48) |632632- ((u64)le16_to_cpu(ver_words[1]) << 32) |633633- ((u64)le16_to_cpu(ver_words[2]) << 16) |634634- le16_to_cpu(ver_words[3]));635635- *build = MCDI_DWORD(outbuf, GET_VERSION_OUT_FIRMWARE);636636-637637- return 0;625625+ snprintf(buf, len, "%u.%u.%u.%u",626626+ le16_to_cpu(ver_words[0]), le16_to_cpu(ver_words[1]),627627+ le16_to_cpu(ver_words[2]), le16_to_cpu(ver_words[3]));628628+ return;638629639630fail:640631 netif_err(efx, probe, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);641641- return rc;632632+ buf[0] = 0;642633}643634644635int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,
+2-2
drivers/net/sfc/mcdi.h
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33- * Copyright 2008-2009 Solarflare Communications Inc.33+ * Copyright 2008-2010 Solarflare Communications Inc.44 *55 * This program is free software; you can redistribute it and/or modify it66 * under the terms of the GNU General Public License version 2 as published···9393#define MCDI_EVENT_FIELD(_ev, _field) \9494 EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field)95959696-extern int efx_mcdi_fwver(struct efx_nic *efx, u64 *version, u32 *build);9696+extern void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len);9797extern int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,9898 bool *was_attached_out);9999extern int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
+1-1
drivers/net/sfc/mcdi_mac.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33- * Copyright 2009 Solarflare Communications Inc.33+ * Copyright 2009-2010 Solarflare Communications Inc.44 *55 * This program is free software; you can redistribute it and/or modify it66 * under the terms of the GNU General Public License version 2 as published
+1-1
drivers/net/sfc/mcdi_pcol.h
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33- * Copyright 2009 Solarflare Communications Inc.33+ * Copyright 2009-2011 Solarflare Communications Inc.44 *55 * This program is free software; you can redistribute it and/or modify it66 * under the terms of the GNU General Public License version 2 as published
+1-1
drivers/net/sfc/mcdi_phy.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33- * Copyright 2009 Solarflare Communications Inc.33+ * Copyright 2009-2010 Solarflare Communications Inc.44 *55 * This program is free software; you can redistribute it and/or modify it66 * under the terms of the GNU General Public License version 2 as published
+6-28
drivers/net/sfc/mdio_10g.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33- * Copyright 2006-2009 Solarflare Communications Inc.33+ * Copyright 2006-2011 Solarflare Communications Inc.44 *55 * This program is free software; you can redistribute it and/or modify it66 * under the terms of the GNU General Public License version 2 as published···5151 return spins ? spins : -ETIMEDOUT;5252}53535454-static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd, int fault_fatal)5454+static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd)5555{5656 int status;5757-5858- if (LOOPBACK_INTERNAL(efx))5959- return 0;60576158 if (mmd != MDIO_MMD_AN) {6259 /* Read MMD STATUS2 to check it is responding. */···6568 }6669 }67706868- /* Read MMD STATUS 1 to check for fault. */6969- status = efx_mdio_read(efx, mmd, MDIO_STAT1);7070- if (status & MDIO_STAT1_FAULT) {7171- if (fault_fatal) {7272- netif_err(efx, hw, efx->net_dev,7373- "PHY MMD %d reporting fatal"7474- " fault: status %x\n", mmd, status);7575- return -EIO;7676- } else {7777- netif_dbg(efx, hw, efx->net_dev,7878- "PHY MMD %d reporting status"7979- " %x (expected)\n", mmd, status);8080- }8181- }8271 return 0;8372}8473···113130 return rc;114131}115132116116-int efx_mdio_check_mmds(struct efx_nic *efx,117117- unsigned int mmd_mask, unsigned int fatal_mask)133133+int efx_mdio_check_mmds(struct efx_nic *efx, unsigned int mmd_mask)118134{119135 int mmd = 0, probe_mmd, devs1, devs2;120136 u32 devices;···143161144162 /* Check all required MMDs are responding and happy. */145163 while (mmd_mask) {146146- if (mmd_mask & 1) {147147- int fault_fatal = fatal_mask & 1;148148- if (efx_mdio_check_mmd(efx, mmd, fault_fatal))149149- return -EIO;150150- }164164+ if ((mmd_mask & 1) && efx_mdio_check_mmd(efx, mmd))165165+ return -EIO;151166 mmd_mask = mmd_mask >> 1;152152- fatal_mask = fatal_mask >> 1;153167 mmd++;154168 }155169···315337 "no MDIO PHY present with ID %d\n", efx->mdio.prtad);316338 rc = -EINVAL;317339 } else {318318- rc = efx_mdio_check_mmds(efx, efx->mdio.mmds, 0);340340+ rc = efx_mdio_check_mmds(efx, efx->mdio.mmds);319341 }320342321343 mutex_unlock(&efx->mac_lock);
+2-3
drivers/net/sfc/mdio_10g.h
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33- * Copyright 2006-2009 Solarflare Communications Inc.33+ * Copyright 2006-2011 Solarflare Communications Inc.44 *55 * This program is free software; you can redistribute it and/or modify it66 * under the terms of the GNU General Public License version 2 as published···6868 int spins, int spintime);69697070/* As efx_mdio_check_mmd but for multiple MMDs */7171-int efx_mdio_check_mmds(struct efx_nic *efx,7272- unsigned int mmd_mask, unsigned int fatal_mask);7171+int efx_mdio_check_mmds(struct efx_nic *efx, unsigned int mmd_mask);73727473/* Check the link status of specified mmds in bit mask */7574extern bool efx_mdio_links_ok(struct efx_nic *efx, unsigned int mmd_mask);
+1-1
drivers/net/sfc/mtd.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2006-2009 Solarflare Communications Inc.44+ * Copyright 2006-2010 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published
+8-6
drivers/net/sfc/net_driver.h
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2005-2009 Solarflare Communications Inc.44+ * Copyright 2005-2011 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published···4141 *4242 **************************************************************************/43434444-#define EFX_DRIVER_VERSION "3.0"4444+#define EFX_DRIVER_VERSION "3.1"45454646#ifdef EFX_ENABLE_DEBUG4747#define EFX_BUG_ON_PARANOID(x) BUG_ON(x)···214214 * If both this and page are %NULL, the buffer slot is currently free.215215 * @page: The associated page buffer, if any.216216 * If both this and skb are %NULL, the buffer slot is currently free.217217- * @data: Pointer to ethernet header218217 * @len: Buffer length, in bytes.218218+ * @is_page: Indicates if @page is valid. If false, @skb is valid.219219 */220220struct efx_rx_buffer {221221 dma_addr_t dma_addr;222222- struct sk_buff *skb;223223- struct page *page;224224- char *data;222222+ union {223223+ struct sk_buff *skb;224224+ struct page *page;225225+ } u;225226 unsigned int len;227227+ bool is_page;226228};227229228230/**
+1-21
drivers/net/sfc/nic.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2006-2009 Solarflare Communications Inc.44+ * Copyright 2006-2011 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published···40404141#define RX_DC_ENTRIES 644242#define RX_DC_ENTRIES_ORDER 34343-4444-/* RX FIFO XOFF watermark4545- *4646- * When the amount of the RX FIFO increases used increases past this4747- * watermark send XOFF. Only used if RX flow control is enabled (ethtool -A)4848- * This also has an effect on RX/TX arbitration4949- */5050-int efx_nic_rx_xoff_thresh = -1;5151-module_param_named(rx_xoff_thresh_bytes, efx_nic_rx_xoff_thresh, int, 0644);5252-MODULE_PARM_DESC(rx_xoff_thresh_bytes, "RX fifo XOFF threshold");5353-5454-/* RX FIFO XON watermark5555- *5656- * When the amount of the RX FIFO used decreases below this5757- * watermark send XON. Only used if TX flow control is enabled (ethtool -A)5858- * This also has an effect on RX/TX arbitration5959- */6060-int efx_nic_rx_xon_thresh = -1;6161-module_param_named(rx_xon_thresh_bytes, efx_nic_rx_xon_thresh, int, 0644);6262-MODULE_PARM_DESC(rx_xon_thresh_bytes, "RX fifo XON threshold");63436444/* If EFX_MAX_INT_ERRORS internal errors occur within6545 * EFX_INT_ERROR_EXPIRE seconds, we consider the NIC broken and
+1-8
drivers/net/sfc/nic.h
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2006-2009 Solarflare Communications Inc.44+ * Copyright 2006-2011 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published···142142143143/**144144 * struct siena_nic_data - Siena NIC state145145- * @fw_version: Management controller firmware version146146- * @fw_build: Firmware build number147145 * @mcdi: Management-Controller-to-Driver Interface148146 * @wol_filter_id: Wake-on-LAN packet filter id149147 */150148struct siena_nic_data {151151- u64 fw_version;152152- u32 fw_build;153149 struct efx_mcdi_iface mcdi;154150 int wol_filter_id;155151};156156-157157-extern void siena_print_fwver(struct efx_nic *efx, char *buf, size_t len);158152159153extern struct efx_nic_type falcon_a1_nic_type;160154extern struct efx_nic_type falcon_b0_nic_type;···188194/* MAC/PHY */189195extern void falcon_drain_tx_fifo(struct efx_nic *efx);190196extern void falcon_reconfigure_mac_wrapper(struct efx_nic *efx);191191-extern int efx_nic_rx_xoff_thresh, efx_nic_rx_xon_thresh;192197193198/* Interrupts and test events */194199extern int efx_nic_init_interrupt(struct efx_nic *efx);
+1-1
drivers/net/sfc/phy.h
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33- * Copyright 2007-2009 Solarflare Communications Inc.33+ * Copyright 2007-2010 Solarflare Communications Inc.44 *55 * This program is free software; you can redistribute it and/or modify it66 * under the terms of the GNU General Public License version 2 as published
+1-1
drivers/net/sfc/qt202x_phy.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33- * Copyright 2006-2009 Solarflare Communications Inc.33+ * Copyright 2006-2010 Solarflare Communications Inc.44 *55 * This program is free software; you can redistribute it and/or modify it66 * under the terms of the GNU General Public License version 2 as published
+1-1
drivers/net/sfc/regs.h
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2006-2009 Solarflare Communications Inc.44+ * Copyright 2006-2010 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published
+72-72
drivers/net/sfc/rx.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2005-2009 Solarflare Communications Inc.44+ * Copyright 2005-2011 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published···8989 */9090#define EFX_RXD_HEAD_ROOM 291919292-static inline unsigned int efx_rx_buf_offset(struct efx_rx_buffer *buf)9292+/* Offset of ethernet header within page */9393+static inline unsigned int efx_rx_buf_offset(struct efx_nic *efx,9494+ struct efx_rx_buffer *buf)9395{9496 /* Offset is always within one page, so we don't need to consider9597 * the page order.9698 */9797- return (__force unsigned long) buf->data & (PAGE_SIZE - 1);9999+ return (((__force unsigned long) buf->dma_addr & (PAGE_SIZE - 1)) +100100+ efx->type->rx_buffer_hash_size);98101}99102static inline unsigned int efx_rx_buf_size(struct efx_nic *efx)100103{101104 return PAGE_SIZE << efx->rx_buffer_order;102105}103106104104-static inline u32 efx_rx_buf_hash(struct efx_rx_buffer *buf)107107+static u8 *efx_rx_buf_eh(struct efx_nic *efx, struct efx_rx_buffer *buf)105108{109109+ if (buf->is_page)110110+ return page_address(buf->u.page) + efx_rx_buf_offset(efx, buf);111111+ else112112+ return ((u8 *)buf->u.skb->data +113113+ efx->type->rx_buffer_hash_size);114114+}115115+116116+static inline u32 efx_rx_buf_hash(const u8 *eh)117117+{118118+ /* The ethernet header is always directly after any hash. */106119#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) || NET_IP_ALIGN % 4 == 0107107- return __le32_to_cpup((const __le32 *)(buf->data - 4));120120+ return __le32_to_cpup((const __le32 *)(eh - 4));108121#else109109- const u8 *data = (const u8 *)(buf->data - 4);122122+ const u8 *data = eh - 4;110123 return ((u32)data[0] |111124 (u32)data[1] << 8 |112125 (u32)data[2] << 16 |···142129 struct efx_nic *efx = rx_queue->efx;143130 struct net_device *net_dev = efx->net_dev;144131 struct efx_rx_buffer *rx_buf;132132+ struct sk_buff *skb;145133 int skb_len = efx->rx_buffer_len;146134 unsigned index, count;147135···150136 index = rx_queue->added_count & rx_queue->ptr_mask;151137 rx_buf = efx_rx_buffer(rx_queue, index);152138153153- rx_buf->skb = netdev_alloc_skb(net_dev, skb_len);154154- if (unlikely(!rx_buf->skb))139139+ rx_buf->u.skb = skb = netdev_alloc_skb(net_dev, skb_len);140140+ if (unlikely(!skb))155141 return -ENOMEM;156156- rx_buf->page = NULL;157142158143 /* Adjust the SKB for padding and checksum */159159- skb_reserve(rx_buf->skb, NET_IP_ALIGN);144144+ skb_reserve(skb, NET_IP_ALIGN);160145 rx_buf->len = skb_len - NET_IP_ALIGN;161161- rx_buf->data = (char *)rx_buf->skb->data;162162- rx_buf->skb->ip_summed = CHECKSUM_UNNECESSARY;146146+ rx_buf->is_page = false;147147+ skb->ip_summed = CHECKSUM_UNNECESSARY;163148164149 rx_buf->dma_addr = pci_map_single(efx->pci_dev,165165- rx_buf->data, rx_buf->len,150150+ skb->data, rx_buf->len,166151 PCI_DMA_FROMDEVICE);167152 if (unlikely(pci_dma_mapping_error(efx->pci_dev,168153 rx_buf->dma_addr))) {169169- dev_kfree_skb_any(rx_buf->skb);170170- rx_buf->skb = NULL;154154+ dev_kfree_skb_any(skb);155155+ rx_buf->u.skb = NULL;171156 return -EIO;172157 }173158···224211 index = rx_queue->added_count & rx_queue->ptr_mask;225212 rx_buf = efx_rx_buffer(rx_queue, index);226213 rx_buf->dma_addr = dma_addr + EFX_PAGE_IP_ALIGN;227227- rx_buf->skb = NULL;228228- rx_buf->page = page;229229- rx_buf->data = page_addr + EFX_PAGE_IP_ALIGN;214214+ rx_buf->u.page = page;230215 rx_buf->len = efx->rx_buffer_len - EFX_PAGE_IP_ALIGN;216216+ rx_buf->is_page = true;231217 ++rx_queue->added_count;232218 ++rx_queue->alloc_page_count;233219 ++state->refcnt;···247235static void efx_unmap_rx_buffer(struct efx_nic *efx,248236 struct efx_rx_buffer *rx_buf)249237{250250- if (rx_buf->page) {238238+ if (rx_buf->is_page && rx_buf->u.page) {251239 struct efx_rx_page_state *state;252240253253- EFX_BUG_ON_PARANOID(rx_buf->skb);254254-255255- state = page_address(rx_buf->page);241241+ state = page_address(rx_buf->u.page);256242 if (--state->refcnt == 0) {257243 pci_unmap_page(efx->pci_dev,258244 state->dma_addr,259245 efx_rx_buf_size(efx),260246 PCI_DMA_FROMDEVICE);261247 }262262- } else if (likely(rx_buf->skb)) {248248+ } else if (!rx_buf->is_page && rx_buf->u.skb) {263249 pci_unmap_single(efx->pci_dev, rx_buf->dma_addr,264250 rx_buf->len, PCI_DMA_FROMDEVICE);265251 }···266256static void efx_free_rx_buffer(struct efx_nic *efx,267257 struct efx_rx_buffer *rx_buf)268258{269269- if (rx_buf->page) {270270- __free_pages(rx_buf->page, efx->rx_buffer_order);271271- rx_buf->page = NULL;272272- } else if (likely(rx_buf->skb)) {273273- dev_kfree_skb_any(rx_buf->skb);274274- rx_buf->skb = NULL;259259+ if (rx_buf->is_page && rx_buf->u.page) {260260+ __free_pages(rx_buf->u.page, efx->rx_buffer_order);261261+ rx_buf->u.page = NULL;262262+ } else if (!rx_buf->is_page && rx_buf->u.skb) {263263+ dev_kfree_skb_any(rx_buf->u.skb);264264+ rx_buf->u.skb = NULL;275265 }276266}277267···287277static void efx_resurrect_rx_buffer(struct efx_rx_queue *rx_queue,288278 struct efx_rx_buffer *rx_buf)289279{290290- struct efx_rx_page_state *state = page_address(rx_buf->page);280280+ struct efx_rx_page_state *state = page_address(rx_buf->u.page);291281 struct efx_rx_buffer *new_buf;292282 unsigned fill_level, index;293283···302292 }303293304294 ++state->refcnt;305305- get_page(rx_buf->page);295295+ get_page(rx_buf->u.page);306296307297 index = rx_queue->added_count & rx_queue->ptr_mask;308298 new_buf = efx_rx_buffer(rx_queue, index);309299 new_buf->dma_addr = rx_buf->dma_addr ^ (PAGE_SIZE >> 1);310310- new_buf->skb = NULL;311311- new_buf->page = rx_buf->page;312312- new_buf->data = (void *)313313- ((__force unsigned long)rx_buf->data ^ (PAGE_SIZE >> 1));300300+ new_buf->u.page = rx_buf->u.page;314301 new_buf->len = rx_buf->len;302302+ new_buf->is_page = true;315303 ++rx_queue->added_count;316304}317305···323315 struct efx_rx_buffer *new_buf;324316 unsigned index;325317326326- if (rx_buf->page != NULL && efx->rx_buffer_len <= EFX_RX_HALF_PAGE &&327327- page_count(rx_buf->page) == 1)318318+ if (rx_buf->is_page && efx->rx_buffer_len <= EFX_RX_HALF_PAGE &&319319+ page_count(rx_buf->u.page) == 1)328320 efx_resurrect_rx_buffer(rx_queue, rx_buf);329321330322 index = rx_queue->added_count & rx_queue->ptr_mask;331323 new_buf = efx_rx_buffer(rx_queue, index);332324333325 memcpy(new_buf, rx_buf, sizeof(*new_buf));334334- rx_buf->page = NULL;335335- rx_buf->skb = NULL;326326+ rx_buf->u.page = NULL;336327 ++rx_queue->added_count;337328}338329···435428 * data at the end of the skb will be trashed. So436429 * we have no choice but to leak the fragment.437430 */438438- *leak_packet = (rx_buf->skb != NULL);431431+ *leak_packet = !rx_buf->is_page;439432 efx_schedule_reset(efx, RESET_TYPE_RX_RECOVERY);440433 } else {441434 if (net_ratelimit())···455448 */456449static void efx_rx_packet_gro(struct efx_channel *channel,457450 struct efx_rx_buffer *rx_buf,458458- bool checksummed)451451+ const u8 *eh, bool checksummed)459452{460453 struct napi_struct *napi = &channel->napi_str;461454 gro_result_t gro_result;462455463456 /* Pass the skb/page into the GRO engine */464464- if (rx_buf->page) {457457+ if (rx_buf->is_page) {465458 struct efx_nic *efx = channel->efx;466466- struct page *page = rx_buf->page;459459+ struct page *page = rx_buf->u.page;467460 struct sk_buff *skb;468461469469- EFX_BUG_ON_PARANOID(rx_buf->skb);470470- rx_buf->page = NULL;462462+ rx_buf->u.page = NULL;471463472464 skb = napi_get_frags(napi);473465 if (!skb) {···475469 }476470477471 if (efx->net_dev->features & NETIF_F_RXHASH)478478- skb->rxhash = efx_rx_buf_hash(rx_buf);472472+ skb->rxhash = efx_rx_buf_hash(eh);479473480474 skb_shinfo(skb)->frags[0].page = page;481475 skb_shinfo(skb)->frags[0].page_offset =482482- efx_rx_buf_offset(rx_buf);476476+ efx_rx_buf_offset(efx, rx_buf);483477 skb_shinfo(skb)->frags[0].size = rx_buf->len;484478 skb_shinfo(skb)->nr_frags = 1;485479···493487494488 gro_result = napi_gro_frags(napi);495489 } else {496496- struct sk_buff *skb = rx_buf->skb;490490+ struct sk_buff *skb = rx_buf->u.skb;497491498498- EFX_BUG_ON_PARANOID(!skb);499492 EFX_BUG_ON_PARANOID(!checksummed);500500- rx_buf->skb = NULL;493493+ rx_buf->u.skb = NULL;501494502495 gro_result = napi_gro_receive(napi, skb);503496 }···518513 bool leak_packet = false;519514520515 rx_buf = efx_rx_buffer(rx_queue, index);521521- EFX_BUG_ON_PARANOID(!rx_buf->data);522522- EFX_BUG_ON_PARANOID(rx_buf->skb && rx_buf->page);523523- EFX_BUG_ON_PARANOID(!(rx_buf->skb || rx_buf->page));524516525517 /* This allows the refill path to post another buffer.526518 * EFX_RXD_HEAD_ROOM ensures that the slot we are using···556554 /* Prefetch nice and early so data will (hopefully) be in cache by557555 * the time we look at it.558556 */559559- prefetch(rx_buf->data);557557+ prefetch(efx_rx_buf_eh(efx, rx_buf));560558561559 /* Pipeline receives so that we give time for packet headers to be562560 * prefetched into cache.563561 */564564- rx_buf->len = len;562562+ rx_buf->len = len - efx->type->rx_buffer_hash_size;565563out:566564 if (channel->rx_pkt)567565 __efx_rx_packet(channel,···576574{577575 struct efx_nic *efx = channel->efx;578576 struct sk_buff *skb;579579-580580- rx_buf->data += efx->type->rx_buffer_hash_size;581581- rx_buf->len -= efx->type->rx_buffer_hash_size;577577+ u8 *eh = efx_rx_buf_eh(efx, rx_buf);582578583579 /* If we're in loopback test, then pass the packet directly to the584580 * loopback layer, and free the rx_buf here585581 */586582 if (unlikely(efx->loopback_selftest)) {587587- efx_loopback_rx_packet(efx, rx_buf->data, rx_buf->len);583583+ efx_loopback_rx_packet(efx, eh, rx_buf->len);588584 efx_free_rx_buffer(efx, rx_buf);589585 return;590586 }591587592592- if (rx_buf->skb) {593593- prefetch(skb_shinfo(rx_buf->skb));588588+ if (!rx_buf->is_page) {589589+ skb = rx_buf->u.skb;594590595595- skb_reserve(rx_buf->skb, efx->type->rx_buffer_hash_size);596596- skb_put(rx_buf->skb, rx_buf->len);591591+ prefetch(skb_shinfo(skb));592592+593593+ skb_reserve(skb, efx->type->rx_buffer_hash_size);594594+ skb_put(skb, rx_buf->len);597595598596 if (efx->net_dev->features & NETIF_F_RXHASH)599599- rx_buf->skb->rxhash = efx_rx_buf_hash(rx_buf);597597+ skb->rxhash = efx_rx_buf_hash(eh);600598601599 /* Move past the ethernet header. rx_buf->data still points602600 * at the ethernet header */603603- rx_buf->skb->protocol = eth_type_trans(rx_buf->skb,604604- efx->net_dev);601601+ skb->protocol = eth_type_trans(skb, efx->net_dev);605602606606- skb_record_rx_queue(rx_buf->skb, channel->channel);603603+ skb_record_rx_queue(skb, channel->channel);607604 }608605609609- if (likely(checksummed || rx_buf->page)) {610610- efx_rx_packet_gro(channel, rx_buf, checksummed);606606+ if (likely(checksummed || rx_buf->is_page)) {607607+ efx_rx_packet_gro(channel, rx_buf, eh, checksummed);611608 return;612609 }613610614611 /* We now own the SKB */615615- skb = rx_buf->skb;616616- rx_buf->skb = NULL;617617- EFX_BUG_ON_PARANOID(!skb);612612+ skb = rx_buf->u.skb;613613+ rx_buf->u.skb = NULL;618614619615 /* Set the SKB flags */620616 skb_checksum_none_assert(skb);
+1-1
drivers/net/sfc/selftest.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2006-2009 Solarflare Communications Inc.44+ * Copyright 2006-2010 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published
+1-1
drivers/net/sfc/selftest.h
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2006-2008 Solarflare Communications Inc.44+ * Copyright 2006-2010 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published
+1-23
drivers/net/sfc/siena.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2006-2009 Solarflare Communications Inc.44+ * Copyright 2006-2010 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published···227227 if (rc)228228 goto fail1;229229230230- rc = efx_mcdi_fwver(efx, &nic_data->fw_version, &nic_data->fw_build);231231- if (rc) {232232- netif_err(efx, probe, efx->net_dev,233233- "Failed to read MCPU firmware version - rc %d\n", rc);234234- goto fail1; /* MCPU absent? */235235- }236236-237230 /* Let the BMC know that the driver is now in charge of link and238231 * filter settings. We must do this before we reset the NIC */239232 rc = efx_mcdi_drv_attach(efx, true, &already_attached);···340347 memcpy(&temp, efx->rx_hash_key + 2 * sizeof(temp),341348 FRF_CZ_RX_RSS_IPV6_TKEY_HI_WIDTH / 8);342349 efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG3);343343-344344- if (efx_nic_rx_xoff_thresh >= 0 || efx_nic_rx_xon_thresh >= 0)345345- /* No MCDI operation has been defined to set thresholds */346346- netif_err(efx, hw, efx->net_dev,347347- "ignoring RX flow control thresholds\n");348350349351 /* Enable event logging */350352 rc = efx_mcdi_log_ctrl(efx, true, false, 0);···500512static void siena_stop_nic_stats(struct efx_nic *efx)501513{502514 efx_mcdi_mac_stats(efx, efx->stats_buffer.dma_addr, 0, 0, 0);503503-}504504-505505-void siena_print_fwver(struct efx_nic *efx, char *buf, size_t len)506506-{507507- struct siena_nic_data *nic_data = efx->nic_data;508508- snprintf(buf, len, "%u.%u.%u.%u",509509- (unsigned int)(nic_data->fw_version >> 48),510510- (unsigned int)(nic_data->fw_version >> 32 & 0xffff),511511- (unsigned int)(nic_data->fw_version >> 16 & 0xffff),512512- (unsigned int)(nic_data->fw_version & 0xffff));513515}514516515517/**************************************************************************
+1-1
drivers/net/sfc/spi.h
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005 Fen Systems Ltd.44- * Copyright 2006 Solarflare Communications Inc.44+ * Copyright 2006-2010 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published
+2-2
drivers/net/sfc/tenxpress.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33- * Copyright 2007-2009 Solarflare Communications Inc.33+ * Copyright 2007-2011 Solarflare Communications Inc.44 *55 * This program is free software; you can redistribute it and/or modify it66 * under the terms of the GNU General Public License version 2 as published···196196 if (rc < 0)197197 return rc;198198199199- rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS, 0);199199+ rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS);200200 if (rc < 0)201201 return rc;202202 }
+1-1
drivers/net/sfc/tx.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33 * Copyright 2005-2006 Fen Systems Ltd.44- * Copyright 2005-2009 Solarflare Communications Inc.44+ * Copyright 2005-2010 Solarflare Communications Inc.55 *66 * This program is free software; you can redistribute it and/or modify it77 * under the terms of the GNU General Public License version 2 as published
+2-2
drivers/net/sfc/txc43128_phy.c
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33- * Copyright 2006-2010 Solarflare Communications Inc.33+ * Copyright 2006-2011 Solarflare Communications Inc.44 *55 * This program is free software; you can redistribute it and/or modify it66 * under the terms of the GNU General Public License version 2 as published···193193 goto fail;194194195195 /* Check that all the MMDs we expect are present and responding. */196196- rc = efx_mdio_check_mmds(efx, TXC_REQUIRED_DEVS, 0);196196+ rc = efx_mdio_check_mmds(efx, TXC_REQUIRED_DEVS);197197 if (rc < 0)198198 goto fail;199199
+1-1
drivers/net/sfc/workarounds.h
···11/****************************************************************************22 * Driver for Solarflare Solarstorm network controllers and boards33- * Copyright 2006-2009 Solarflare Communications Inc.33+ * Copyright 2006-2010 Solarflare Communications Inc.44 *55 * This program is free software; you can redistribute it and/or modify it66 * under the terms of the GNU General Public License version 2 as published