* Re: [PATCH net-next-2.6] inetpeer: seqlock optimization
From: David Miller @ 2011-03-04 19:17 UTC (permalink / raw)
To: eric.dumazet; +Cc: xiaosuo, netdev
In-Reply-To: <1299251348.2676.16.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 04 Mar 2011 16:09:08 +0100
> Here is a patch to implement this idea.
Applied, thanks Eric!
^ permalink raw reply
* Re: [net-next-2.6 PATCH 02/10] ethtool: add ntuple flow specifier to network flow classifier
From: Alexander Duyck @ 2011-03-04 19:30 UTC (permalink / raw)
To: Dimitrios Michailidis
Cc: Ben Hutchings, Alexander Duyck, davem@davemloft.net,
Kirsher, Jeffrey T, netdev@vger.kernel.org
In-Reply-To: <8A71B368A89016469F72CD08050AD334091C1FCF@maui.asicdesigners.com>
On 3/2/2011 12:03 PM, Dimitrios Michailidis wrote:
> Ben Hutchings wrote:
>> On Wed, 2011-03-02 at 11:11 -0800, Dimitrios Michailidis wrote:
>>> Ben Hutchings wrote:
>>>> /**
>>>> * struct ethtool_flow_ext - flow spec common extension fields
>>>> * @vlan_etype: EtherType for vlan tagged packet to match
>>>> * @vlan_tci: VLAN tag to match
>>>> * @data: Driver-dependent data to match
>>>> *
>>>> * Note: Additional fields may be inserted before @vlan_etype in future,
>>>> * but the offset of the existing fields within the containing structure
>>>> * (&struct ethtool_rx_flow_spec) will be stable.
>>>> */
>>>> struct ethtool_flow_ext {
>>>> __be16 vlan_etype;
>>>> __be16 vlan_tci;
>>>> __be32 data[2];
>>>> };
>>>
>>> I am wondering about the semantics of these vlan_* fields. Is vlan_etype the
>>> Ethertype in the VLAN header or the type after it?
>>
>> It would be the the type in the VLAN tag. The nested ethertype is
>> normally implied by flow_type to be ETH_P_IP.
>>
>> This does leave the question of what this would mean:
>>
>> struct ethtool_rx_flow_spec fs = {
>> .flow_type = ... | FLOW_EXT,
>> ...
>> .h_ext.vlan_tci = htons(0x1234),
>> .m_ext.vlan_etype = 0xffff,
>> };
>>
>> This says the TCI must be == 0x1234 but the type can be anything. But
>> the type surely has to be be one assigned for use in VLAN tags. Should
>> we leave it to the driver/hardware to determine what those valid types
>> are, or should we reject this as valid?
>
> Right. Devices have some internal rules for what qualifies as a VLAN frame.
> If users are given the option to specify vlan_etype what do they get?
> At least we need to specify what is expected so drivers can decide if they can support it.
The basic idea I had is similar to what Ben described. Basically the
vlan_etype can be used to determine the Ethertype for the VLAN to be
compared. The reason for this is specifically the VLAN 0 case since
without the VLAN Ethertype check VLAN 0 on ixgbe hardware will match an
untagged frame and that may not be a desired result. As such we can
specify the VLAN Ethertype and then we will only match VLAN tagged
frames without any false hits.
Thanks,
Alex
^ permalink raw reply
* Re: 2.6.37 regression: adding main interface to a bridge breaks vlan interface RX
From: chriss @ 2011-03-04 19:32 UTC (permalink / raw)
To: netdev
In-Reply-To: <20110301215252.GA13336@electric-eye.fr.zoreil.com>
Francois Romieu <romieu <at> fr.zoreil.com> writes:
>
> Chriss, can you give it a try against current -rc / -git and see if it makes
> a difference ?
>
I hope i'm doing it right. i checked out the
'git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git'
and will try to apply the patch you provided. please correct me if i'm wrong.
I will report back.
regards//chriss
^ permalink raw reply
* pull request: wireless-next-2.6 2011-03-04
From: John W. Linville @ 2011-03-04 19:40 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
Dave,
Yet another batch of new wireless bits intended for 2.6.39... :-)
Highlights in this round include AP-mode support for wl12xx, some
rtlwifi fixes (many build-related), some more b43 N-phy support
advancement, a big batch of ath9k_htc updates, and the refactoring of
iwlwifi to separate iwl3945 and iwl4965 support out into a new iwlegacy
driver. Mixed-in, of course, is the usual batch of various driver and
mac80211 updates and fixes.
Please let me know if there are problems!
John
---
The following changes since commit 29546a6404e3a4b5d13f0a9586eb5cf1c3b25167:
ipv6: Use ERR_CAST in addrconf_dst_alloc. (2011-03-03 12:10:37 -0800)
are available in the git repository at:
ssh://master.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6.git for-davem
Alessio Igor Bogani (2):
rtlwifi: Add the missing rcu_read_lock/unlock
rtlwifi: fix places where uninitialized data is used
Arik Nemtsov (9):
wl12xx: avoid blocking while holding rcu lock on bss info change
wl12xx: fix potential race condition with TX queue watermark
wl12xx: AP-mode - fix race condition on sta connection
wl12xx: AP-mode - TX queue per link in AC
wl12xx: report invalid TX rate when returning non-TX-ed skbs
wl12xx: AP-mode - support HW based link PS monitoring
wl12xx: AP mode - fix bug in cleanup of wl1271_op_sta_add()
wl12xx: AP-mode - count free FW TX blocks per link
wl12xx: AP-mode - management of links in PS-mode
Chaoming Li (1):
rtlwifi: Fix error registering rate-control
Christian Lamparter (1):
p54: implement set_coverage_class
Dan Carpenter (2):
wl12xx: change type from u8 to int
iwlwifi: remove duplicate initialization
Eliad Peller (4):
wl12xx: fix identification of beacon packets (debug)
wl12xx: declare support for IEEE80211_HW_REPORTS_TX_ACK_STATUS
wl12xx: use standard ALIGN() macro
wl12xx: always set mac_address when configuring ht caps
Felix Fietkau (4):
p54: fix a NULL pointer dereference bug
ath9k: use generic mac80211 LED blinking code
cfg80211: add a field for the bitrate of the last rx data packet from a station
mac80211: add support for showing the last rx bitrate
Gery Kahn (1):
wl12xx: update PLT initialization for new firmware
Gustavo F. Padovan (1):
Bluetooth: Fix BT_L2CAP and BT_SCO in Kconfig
Joe Gunn (1):
orinoco: Drop scan results with unknown channels
Johannes Berg (8):
mac80211: rename RX_FLAG_TSFT
rtl8192c: fix compilation errors
mac80211: make tx() operation return void
mac80211: remove IBSS merge delay
mac80211: copy peer MCS TX parameters
iwlagn: fix iwlagn_check_needed_chains
mac80211: support direct offchannel TX offload
mac80211: make rate control Kconfig warning depend on mac80211
John W. Linville (6):
Merge branch 'wireless-next-2.6' of git://git.kernel.org/.../iwlwifi/iwlwifi-2.6
Merge branch 'for-linville' of git://git.kernel.org/.../luca/wl12xx
iwlegacy: change some symbols duplicated from iwlwifi directory
at76c50x-usb: fix warning caused by at76_mac80211_tx now returning void
Merge branch 'wireless-next-2.6' of git://git.kernel.org/.../iwlwifi/iwlwifi-2.6
Merge branch 'master' of git://git.kernel.org/.../linville/wireless-next-2.6 into for-davem
Larry Finger (1):
rtlwifi: rtl8192ce: rtl8192cu: Fix multiple def errors for allyesconfig build
Luciano Coelho (1):
wl12xx: fix MODULE_AUTHOR email address
Nishant Sarmukadam (3):
mwl8k: fix rf_antenna rx argument for AP
mwl8k: Tell mac80211 we have rate adaptation in FW
mwl8k: Invert tx queues for set_hw_spec and set_edca_params
Rafał Miłecki (5):
b43: N-PHY: fix 0x2055 radio workaround condition
b43: N-PHY: rev1: enable some gain ctl workarounds
b43: N-PHY: rev1: restore PHY state after RSSI operations
b43: fill PHY ctl word1 in TX header for N-PHY
b43: N-PHY: rev3+: add static tables
Senthil Balasubramanian (1):
ath9k: Fix incorrect GPIO LED pin for AR9485
Stanislaw Gruszka (7):
iwlegacy: do not set tx power when channel is changing
mac80211: better fix for conn_mon_timer running after disassociate
iwlwifi: fix dma mappings and skbs leak
iwlegacy: fix dma mappings and skbs leak
iwlwifi: add {ack,plpc}_check module parameters
iwlwifi: move check health code into iwl-rx.c
iwlwifi: move remaining iwl-agn-rx.c code into iwl-rx.c
Sujith Manoharan (22):
ath9k_htc: Handle storage devices
ath9k_htc: Allow upto two simultaneous interfaces
ath9k_htc: Unify target capability updating
ath9k_htc: Fix error handling in add_interface
ath9k_htc: Remove OP_PREAMBLE_SHORT
ath9k_htc: Remove OP_PROTECT_ENABLE
ath9k_htc: Remove OP_ASSOCIATED variable
ath9k_htc: Set the BSSID mask for multiple interfaces
ath9k_htc: Make sequence number calculation per-VIF
ath9k_htc: Use VIF from the packet's control data
ath9k_htc: Protect ampdu_action with a mutex
ath9k_htc: Maintain individual counters for interfaces
ath9k_htc: Allow AP interface to be created
ath9k_htc: Calculate and set the HW opmode
ath9k_htc: Add ANI for AP mode
ath9k_htc: Configure beacon timers in AP mode
ath9k_htc: Fix TBTT calculation for IBSS mode
ath9k_htc: Fix host RX initialization
ath9k_htc: Fix RX filters
ath9k_htc: Add debug code to print endpoint mapping
ath9k_htc: Fix error path in URB allocation
ath9k_htc: Handle BSSID/AID for multiple interfaces
Vivek Natarajan (4):
mac80211: Fix a race on enabling power save.
ath9k_hw: Fix pcie_serdes setting for AR9485 1.1 version.
ath9k: Cancel pll_work while disabling radio.
ath9k: Fix compilation warning.
Wey-Yi Guy (11):
iwlwifi: Limit number of firmware reload
iwlwifi: Loading correct uCode again when fail to load
iwlwifi: enable 2-wire bt coex support for non-combo device
iwlwifi: split the drivers for agn and legacy devices 3945/4965
Revert "iwlwifi: split the drivers for agn and legacy devices 3945/4965"
iwlwifi: split the drivers for agn and legacy devices 3945/4965
iwlagn: name change for BT config command
iwlagn: add bt config structure support for 2000 series
iwlagn: add BT Session Activity 2 UART message (BT -> WiFi)
iwlagn: split BT page and inquiry UART msg
iwlagn: enable BT session 2 type UART for 2000 series
Willy Tarreau (4):
rtlwifi: Fix build when RTL8192CU is selected, but RTL8192CE is not
rtl8192cu: fix build error (vmalloc/vfree undefined)
rtlwifi: Let rtlwifi build when PCI is not enabled
rtlwifi: Eliminate udelay calls with too large values
drivers/net/wireless/Kconfig | 1 +
drivers/net/wireless/Makefile | 5 +-
drivers/net/wireless/adm8211.c | 4 +-
drivers/net/wireless/at76c50x-usb.c | 10 +-
drivers/net/wireless/ath/ar9170/ar9170.h | 2 +-
drivers/net/wireless/ath/ar9170/main.c | 5 +-
drivers/net/wireless/ath/ath5k/ath5k.h | 4 +-
drivers/net/wireless/ath/ath5k/base.c | 7 +-
drivers/net/wireless/ath/ath5k/mac80211-ops.c | 6 +-
drivers/net/wireless/ath/ath9k/ar9003_hw.c | 8 +-
drivers/net/wireless/ath/ath9k/ath9k.h | 43 +-
drivers/net/wireless/ath/ath9k/gpio.c | 166 +-
drivers/net/wireless/ath/ath9k/hif_usb.c | 78 +-
drivers/net/wireless/ath/ath9k/htc.h | 77 +-
drivers/net/wireless/ath/ath9k/htc_drv_beacon.c | 170 +-
drivers/net/wireless/ath/ath9k/htc_drv_init.c | 19 +-
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 452 ++-
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 84 +-
drivers/net/wireless/ath/ath9k/init.c | 22 +
drivers/net/wireless/ath/ath9k/main.c | 15 +-
drivers/net/wireless/ath/ath9k/recv.c | 2 +-
drivers/net/wireless/ath/ath9k/reg.h | 1 +
drivers/net/wireless/ath/ath9k/wmi.c | 4 -
drivers/net/wireless/ath/carl9170/carl9170.h | 2 +-
drivers/net/wireless/ath/carl9170/tx.c | 5 +-
drivers/net/wireless/b43/main.c | 6 +-
drivers/net/wireless/b43/phy_n.c | 28 +-
drivers/net/wireless/b43/tables_nphy.c | 1106 ++++++-
drivers/net/wireless/b43/tables_nphy.h | 27 +
drivers/net/wireless/b43/xmit.c | 75 +-
drivers/net/wireless/b43/xmit.h | 6 +
drivers/net/wireless/b43legacy/main.c | 5 +-
drivers/net/wireless/b43legacy/xmit.c | 2 +-
drivers/net/wireless/iwlegacy/Kconfig | 116 +
drivers/net/wireless/iwlegacy/Makefile | 25 +
.../{iwlwifi => iwlegacy}/iwl-3945-debugfs.c | 11 +-
.../{iwlwifi => iwlegacy}/iwl-3945-debugfs.h | 4 +-
.../wireless/{iwlwifi => iwlegacy}/iwl-3945-fh.h | 5 +-
.../wireless/{iwlwifi => iwlegacy}/iwl-3945-hw.h | 9 +-
.../wireless/{iwlwifi => iwlegacy}/iwl-3945-led.c | 4 +-
.../wireless/{iwlwifi => iwlegacy}/iwl-3945-led.h | 2 +-
.../wireless/{iwlwifi => iwlegacy}/iwl-3945-rs.c | 41 +-
.../net/wireless/{iwlwifi => iwlegacy}/iwl-3945.c | 253 +-
.../net/wireless/{iwlwifi => iwlegacy}/iwl-3945.h | 12 +-
drivers/net/wireless/iwlegacy/iwl-4965-calib.c | 967 ++++++
.../iwl-legacy.h => iwlegacy/iwl-4965-calib.h} | 30 +-
drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c | 774 +++++
.../iwl-4965-debugfs.h} | 35 +-
.../iwl-legacy.h => iwlegacy/iwl-4965-eeprom.c} | 107 +-
.../wireless/{iwlwifi => iwlegacy}/iwl-4965-hw.h | 26 +-
.../iwl-3945-led.c => iwlegacy/iwl-4965-led.c} | 30 +-
.../rtl8192cu/fw.c => iwlegacy/iwl-4965-led.h} | 17 +-
drivers/net/wireless/iwlegacy/iwl-4965-lib.c | 1260 +++++++
drivers/net/wireless/iwlegacy/iwl-4965-rs.c | 2870 ++++++++++++++++
.../iwl-agn-rx.c => iwlegacy/iwl-4965-rx.c} | 172 +-
drivers/net/wireless/iwlegacy/iwl-4965-sta.c | 721 ++++
drivers/net/wireless/iwlegacy/iwl-4965-tx.c | 1369 ++++++++
drivers/net/wireless/iwlegacy/iwl-4965-ucode.c | 166 +
.../net/wireless/{iwlwifi => iwlegacy}/iwl-4965.c | 806 +----
drivers/net/wireless/iwlegacy/iwl-4965.h | 282 ++
drivers/net/wireless/iwlegacy/iwl-commands.h | 3405 ++++++++++++++++++
drivers/net/wireless/iwlegacy/iwl-core.c | 2674 ++++++++++++++
drivers/net/wireless/iwlegacy/iwl-core.h | 646 ++++
drivers/net/wireless/iwlegacy/iwl-csr.h | 422 +++
drivers/net/wireless/iwlegacy/iwl-debug.h | 198 ++
drivers/net/wireless/iwlegacy/iwl-debugfs.c | 1467 ++++++++
drivers/net/wireless/iwlegacy/iwl-dev.h | 1426 ++++++++
.../iwl-3945-led.h => iwlegacy/iwl-devtrace.c} | 23 +-
drivers/net/wireless/iwlegacy/iwl-devtrace.h | 270 ++
drivers/net/wireless/iwlegacy/iwl-eeprom.c | 561 +++
drivers/net/wireless/iwlegacy/iwl-eeprom.h | 344 ++
drivers/net/wireless/iwlegacy/iwl-fh.h | 513 +++
drivers/net/wireless/iwlegacy/iwl-hcmd.c | 271 ++
drivers/net/wireless/iwlegacy/iwl-helpers.h | 181 +
drivers/net/wireless/iwlegacy/iwl-io.h | 545 +++
drivers/net/wireless/iwlegacy/iwl-led.c | 188 +
.../{iwlwifi/iwl-3945-led.h => iwlegacy/iwl-led.h} | 34 +-
drivers/net/wireless/iwlegacy/iwl-legacy-rs.h | 456 +++
drivers/net/wireless/iwlegacy/iwl-power.c | 165 +
.../iwl-3945-led.c => iwlegacy/iwl-power.h} | 61 +-
drivers/net/wireless/iwlegacy/iwl-prph.h | 523 +++
drivers/net/wireless/iwlegacy/iwl-rx.c | 302 ++
drivers/net/wireless/iwlegacy/iwl-scan.c | 625 ++++
drivers/net/wireless/iwlegacy/iwl-spectrum.h | 92 +
drivers/net/wireless/iwlegacy/iwl-sta.c | 816 +++++
drivers/net/wireless/iwlegacy/iwl-sta.h | 148 +
drivers/net/wireless/iwlegacy/iwl-tx.c | 660 ++++
.../wireless/{iwlwifi => iwlegacy}/iwl3945-base.c | 543 ++--
drivers/net/wireless/iwlegacy/iwl4965-base.c | 3632 ++++++++++++++++++++
drivers/net/wireless/iwlwifi/Kconfig | 124 +-
drivers/net/wireless/iwlwifi/Makefile | 41 +-
drivers/net/wireless/iwlwifi/iwl-1000.c | 2 -
drivers/net/wireless/iwlwifi/iwl-2000.c | 3 +-
drivers/net/wireless/iwlwifi/iwl-5000.c | 4 -
drivers/net/wireless/iwlwifi/iwl-6000.c | 4 -
drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 81 +-
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c | 58 +-
drivers/net/wireless/iwlwifi/iwl-agn-tx.c | 12 +-
drivers/net/wireless/iwlwifi/iwl-agn.c | 110 +-
drivers/net/wireless/iwlwifi/iwl-agn.h | 6 +-
drivers/net/wireless/iwlwifi/iwl-commands.h | 108 +-
drivers/net/wireless/iwlwifi/iwl-core.c | 76 +-
drivers/net/wireless/iwlwifi/iwl-core.h | 14 +-
drivers/net/wireless/iwlwifi/iwl-debugfs.c | 2 -
drivers/net/wireless/iwlwifi/iwl-dev.h | 13 +-
drivers/net/wireless/iwlwifi/iwl-eeprom.c | 8 -
drivers/net/wireless/iwlwifi/iwl-hcmd.c | 5 -
drivers/net/wireless/iwlwifi/iwl-led.c | 2 -
drivers/net/wireless/iwlwifi/iwl-legacy.c | 657 ----
drivers/net/wireless/iwlwifi/iwl-power.c | 3 -
drivers/net/wireless/iwlwifi/iwl-rx.c | 392 ++-
drivers/net/wireless/iwlwifi/iwl-scan.c | 10 -
drivers/net/wireless/iwlwifi/iwl-sta.c | 11 -
drivers/net/wireless/iwlwifi/iwl-tx.c | 78 +-
drivers/net/wireless/libertas_tf/main.c | 3 +-
drivers/net/wireless/mac80211_hwsim.c | 5 +-
drivers/net/wireless/mwl8k.c | 54 +-
drivers/net/wireless/orinoco/scan.c | 5 +
drivers/net/wireless/p54/eeprom.c | 7 +-
drivers/net/wireless/p54/fwio.c | 9 +-
drivers/net/wireless/p54/lmac.h | 2 +-
drivers/net/wireless/p54/main.c | 14 +-
drivers/net/wireless/p54/p54.h | 1 +
drivers/net/wireless/p54/txrx.c | 13 +-
drivers/net/wireless/rt2x00/rt2x00.h | 2 +-
drivers/net/wireless/rt2x00/rt2x00mac.c | 5 +-
drivers/net/wireless/rtl818x/rtl8180/dev.c | 10 +-
drivers/net/wireless/rtl818x/rtl8187/dev.c | 8 +-
drivers/net/wireless/rtlwifi/Kconfig | 7 +
drivers/net/wireless/rtlwifi/Makefile | 8 +-
drivers/net/wireless/rtlwifi/base.c | 15 +-
drivers/net/wireless/rtlwifi/core.c | 9 +-
drivers/net/wireless/rtlwifi/efuse.c | 18 -
drivers/net/wireless/rtlwifi/efuse.h | 3 -
drivers/net/wireless/rtlwifi/rtl8192c/Makefile | 9 +
drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c | 12 +-
drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h | 204 ++
.../{rtl8192ce/fw.c => rtl8192c/fw_common.c} | 13 +-
.../{rtl8192ce/fw.h => rtl8192c/fw_common.h} | 0
.../rtlwifi/{rtl8192cu/fw.h => rtl8192c/main.c} | 11 +-
drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c | 137 +-
drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h | 246 ++
drivers/net/wireless/rtlwifi/rtl8192ce/Makefile | 1 -
drivers/net/wireless/rtlwifi/rtl8192ce/dm.c | 7 +-
drivers/net/wireless/rtlwifi/rtl8192ce/dm.h | 2 +-
drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | 5 +-
drivers/net/wireless/rtlwifi/rtl8192ce/hw.h | 11 +
drivers/net/wireless/rtlwifi/rtl8192ce/phy.c | 31 +-
drivers/net/wireless/rtlwifi/rtl8192ce/phy.h | 28 +-
drivers/net/wireless/rtlwifi/rtl8192ce/rf.c | 10 +-
drivers/net/wireless/rtlwifi/rtl8192ce/rf.h | 5 +-
drivers/net/wireless/rtlwifi/rtl8192ce/sw.c | 15 +-
drivers/net/wireless/rtlwifi/rtl8192ce/sw.h | 12 +
drivers/net/wireless/rtlwifi/rtl8192ce/trx.c | 13 +-
drivers/net/wireless/rtlwifi/rtl8192cu/Makefile | 1 -
drivers/net/wireless/rtlwifi/rtl8192cu/dm.c | 5 +-
drivers/net/wireless/rtlwifi/rtl8192cu/dm.h | 2 +-
drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 7 +-
drivers/net/wireless/rtlwifi/rtl8192cu/hw.h | 9 +
drivers/net/wireless/rtlwifi/rtl8192cu/phy.c | 38 +-
drivers/net/wireless/rtlwifi/rtl8192cu/phy.h | 4 +-
drivers/net/wireless/rtlwifi/rtl8192cu/rf.c | 12 +-
drivers/net/wireless/rtlwifi/rtl8192cu/rf.h | 19 +-
drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 17 +-
drivers/net/wireless/rtlwifi/rtl8192cu/sw.h | 18 +
drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 7 +-
drivers/net/wireless/rtlwifi/wifi.h | 12 +
drivers/net/wireless/wl1251/main.c | 4 +-
drivers/net/wireless/wl1251/rx.c | 2 +-
drivers/net/wireless/wl12xx/acx.c | 28 +-
drivers/net/wireless/wl12xx/acx.h | 9 +
drivers/net/wireless/wl12xx/init.c | 2 +-
drivers/net/wireless/wl12xx/main.c | 151 +-
drivers/net/wireless/wl12xx/ps.c | 78 +
drivers/net/wireless/wl12xx/ps.h | 2 +
drivers/net/wireless/wl12xx/rx.c | 6 +-
drivers/net/wireless/wl12xx/rx.h | 4 -
drivers/net/wireless/wl12xx/tx.c | 237 ++-
drivers/net/wireless/wl12xx/tx.h | 5 +-
drivers/net/wireless/wl12xx/wl12xx.h | 37 +
drivers/net/wireless/zd1211rw/zd_mac.c | 5 +-
drivers/staging/brcm80211/sys/wl_mac80211.c | 28 +-
drivers/staging/brcm80211/sys/wlc_mac80211.c | 5 +-
drivers/staging/winbond/wbusb.c | 7 +-
include/linux/nl80211.h | 3 +
include/net/cfg80211.h | 5 +-
include/net/mac80211.h | 21 +-
net/bluetooth/Kconfig | 6 +-
net/mac80211/Kconfig | 2 +-
net/mac80211/cfg.c | 68 +-
net/mac80211/driver-ops.h | 35 +-
net/mac80211/driver-trace.h | 33 +
net/mac80211/ht.c | 5 +-
net/mac80211/ibss.c | 7 +-
net/mac80211/ieee80211_i.h | 1 +
net/mac80211/mlme.c | 23 +-
net/mac80211/rx.c | 15 +-
net/mac80211/sta_info.h | 4 +
net/mac80211/status.c | 6 +-
net/mac80211/tx.c | 164 +-
net/wireless/nl80211.c | 56 +-
201 files changed, 34374 insertions(+), 3387 deletions(-)
create mode 100644 drivers/net/wireless/iwlegacy/Kconfig
create mode 100644 drivers/net/wireless/iwlegacy/Makefile
rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-debugfs.c (99%)
copy drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-debugfs.h (95%)
rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-fh.h (98%)
rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-hw.h (96%)
copy drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-led.c (94%)
copy drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-led.h (95%)
rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945-rs.c (96%)
rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945.c (92%)
rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-3945.h (97%)
create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-calib.c
copy drivers/net/wireless/{iwlwifi/iwl-legacy.h => iwlegacy/iwl-4965-calib.h} (80%)
create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c
rename drivers/net/wireless/{iwlwifi/iwl-3945-debugfs.h => iwlegacy/iwl-4965-debugfs.h} (61%)
rename drivers/net/wireless/{iwlwifi/iwl-legacy.h => iwlegacy/iwl-4965-eeprom.c} (53%)
rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-4965-hw.h (97%)
copy drivers/net/wireless/{iwlwifi/iwl-3945-led.c => iwlegacy/iwl-4965-led.c} (73%)
rename drivers/net/wireless/{rtlwifi/rtl8192cu/fw.c => iwlegacy/iwl-4965-led.h} (71%)
create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-lib.c
create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-rs.c
rename drivers/net/wireless/{iwlwifi/iwl-agn-rx.c => iwlegacy/iwl-4965-rx.c} (60%)
create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-sta.c
create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-tx.c
create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965-ucode.c
rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl-4965.c (71%)
create mode 100644 drivers/net/wireless/iwlegacy/iwl-4965.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-commands.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-core.c
create mode 100644 drivers/net/wireless/iwlegacy/iwl-core.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-csr.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-debug.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-debugfs.c
create mode 100644 drivers/net/wireless/iwlegacy/iwl-dev.h
copy drivers/net/wireless/{iwlwifi/iwl-3945-led.h => iwlegacy/iwl-devtrace.c} (59%)
create mode 100644 drivers/net/wireless/iwlegacy/iwl-devtrace.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-eeprom.c
create mode 100644 drivers/net/wireless/iwlegacy/iwl-eeprom.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-fh.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-hcmd.c
create mode 100644 drivers/net/wireless/iwlegacy/iwl-helpers.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-io.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-led.c
rename drivers/net/wireless/{iwlwifi/iwl-3945-led.h => iwlegacy/iwl-led.h} (59%)
create mode 100644 drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-power.c
rename drivers/net/wireless/{iwlwifi/iwl-3945-led.c => iwlegacy/iwl-power.h} (56%)
create mode 100644 drivers/net/wireless/iwlegacy/iwl-prph.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-rx.c
create mode 100644 drivers/net/wireless/iwlegacy/iwl-scan.c
create mode 100644 drivers/net/wireless/iwlegacy/iwl-spectrum.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-sta.c
create mode 100644 drivers/net/wireless/iwlegacy/iwl-sta.h
create mode 100644 drivers/net/wireless/iwlegacy/iwl-tx.c
rename drivers/net/wireless/{iwlwifi => iwlegacy}/iwl3945-base.c (90%)
create mode 100644 drivers/net/wireless/iwlegacy/iwl4965-base.c
delete mode 100644 drivers/net/wireless/iwlwifi/iwl-legacy.c
create mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/Makefile
create mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h
rename drivers/net/wireless/rtlwifi/{rtl8192ce/fw.c => rtl8192c/fw_common.c} (98%)
rename drivers/net/wireless/rtlwifi/{rtl8192ce/fw.h => rtl8192c/fw_common.h} (100%)
rename drivers/net/wireless/rtlwifi/{rtl8192cu/fw.h => rtl8192c/main.c} (75%)
create mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h
Omnibus patch available here:
http://www.kernel.org/pub/linux/kernel/people/linville/wireless-next-2.6-2011-03-04.patch.bz2
--
John W. Linville Someday the world will need a hero, and you
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org might be all we have. Be ready.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [RFC PATCH v2 10/12] netdev: mdio-octeon.c: Convert to use device tree.
From: David Daney @ 2011-03-04 19:42 UTC (permalink / raw)
To: linux-mips-6z/3iImG2C8G8FEW9MqTrA, ralf-6z/3iImG2C8G8FEW9MqTrA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, David Daney, David S. Miller
In-Reply-To: <1299267744-17278-1-git-send-email-ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
Get the MDIO bus controller addresses from the device tree.
Signed-off-by: David Daney <ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
arch/mips/cavium-octeon/octeon-platform.c | 30 ---------
drivers/net/phy/mdio-octeon.c | 92 +++++++++++++++++++---------
2 files changed, 62 insertions(+), 60 deletions(-)
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index 0533351..ce471bd 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -168,36 +168,6 @@ out:
}
device_initcall(octeon_rng_device_init);
-/* Octeon SMI/MDIO interface. */
-static int __init octeon_mdiobus_device_init(void)
-{
- struct platform_device *pd;
- int ret = 0;
-
- if (octeon_is_simulation())
- return 0; /* No mdio in the simulator. */
-
- /* The bus number is the platform_device id. */
- pd = platform_device_alloc("mdio-octeon", 0);
- if (!pd) {
- ret = -ENOMEM;
- goto out;
- }
-
- ret = platform_device_add(pd);
- if (ret)
- goto fail;
-
- return ret;
-fail:
- platform_device_put(pd);
-
-out:
- return ret;
-
-}
-device_initcall(octeon_mdiobus_device_init);
-
/* Octeon mgmt port Ethernet interface. */
static int __init octeon_mgmt_device_init(void)
{
diff --git a/drivers/net/phy/mdio-octeon.c b/drivers/net/phy/mdio-octeon.c
index bd12ba9..dd33023 100644
--- a/drivers/net/phy/mdio-octeon.c
+++ b/drivers/net/phy/mdio-octeon.c
@@ -3,13 +3,15 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
- * Copyright (C) 2009 Cavium Networks
+ * Copyright (C) 2009, 2010, 2011 Cavium Networks
*/
-#include <linux/gfp.h>
-#include <linux/init.h>
-#include <linux/module.h>
#include <linux/platform_device.h>
+#include <linux/of_mdio.h>
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/gfp.h>
#include <linux/phy.h>
#include <asm/octeon/octeon.h>
@@ -18,9 +20,17 @@
#define DRV_VERSION "1.0"
#define DRV_DESCRIPTION "Cavium Networks Octeon SMI/MDIO driver"
+#define SMI_CMD 0x0
+#define SMI_WR_DAT 0x8
+#define SMI_RD_DAT 0x10
+#define SMI_CLK 0x18
+#define SMI_EN 0x20
+
struct octeon_mdiobus {
struct mii_bus *mii_bus;
- int unit;
+ u64 register_base;
+ resource_size_t mdio_phys;
+ resource_size_t regsize;
int phy_irq[PHY_MAX_ADDR];
};
@@ -35,15 +45,15 @@ static int octeon_mdiobus_read(struct mii_bus *bus, int phy_id, int regnum)
smi_cmd.s.phy_op = 1; /* MDIO_CLAUSE_22_READ */
smi_cmd.s.phy_adr = phy_id;
smi_cmd.s.reg_adr = regnum;
- cvmx_write_csr(CVMX_SMIX_CMD(p->unit), smi_cmd.u64);
+ cvmx_write_csr(p->register_base + SMI_CMD, smi_cmd.u64);
do {
/*
* Wait 1000 clocks so we don't saturate the RSL bus
* doing reads.
*/
- cvmx_wait(1000);
- smi_rd.u64 = cvmx_read_csr(CVMX_SMIX_RD_DAT(p->unit));
+ __delay(1000);
+ smi_rd.u64 = cvmx_read_csr(p->register_base + SMI_RD_DAT);
} while (smi_rd.s.pending && --timeout);
if (smi_rd.s.val)
@@ -62,21 +72,21 @@ static int octeon_mdiobus_write(struct mii_bus *bus, int phy_id,
smi_wr.u64 = 0;
smi_wr.s.dat = val;
- cvmx_write_csr(CVMX_SMIX_WR_DAT(p->unit), smi_wr.u64);
+ cvmx_write_csr(p->register_base + SMI_WR_DAT, smi_wr.u64);
smi_cmd.u64 = 0;
smi_cmd.s.phy_op = 0; /* MDIO_CLAUSE_22_WRITE */
smi_cmd.s.phy_adr = phy_id;
smi_cmd.s.reg_adr = regnum;
- cvmx_write_csr(CVMX_SMIX_CMD(p->unit), smi_cmd.u64);
+ cvmx_write_csr(p->register_base + SMI_CMD, smi_cmd.u64);
do {
/*
* Wait 1000 clocks so we don't saturate the RSL bus
* doing reads.
*/
- cvmx_wait(1000);
- smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(p->unit));
+ __delay(1000);
+ smi_wr.u64 = cvmx_read_csr(p->register_base + SMI_WR_DAT);
} while (smi_wr.s.pending && --timeout);
if (timeout <= 0)
@@ -88,8 +98,8 @@ static int octeon_mdiobus_write(struct mii_bus *bus, int phy_id,
static int __devinit octeon_mdiobus_probe(struct platform_device *pdev)
{
struct octeon_mdiobus *bus;
+ struct resource *res_mem;
union cvmx_smix_en smi_en;
- int i;
int err = -ENOENT;
bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL);
@@ -97,28 +107,36 @@ static int __devinit octeon_mdiobus_probe(struct platform_device *pdev)
return -ENOMEM;
/* The platform_device id is our unit number. */
- bus->unit = pdev->id;
+ res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
+ if (res_mem == NULL) {
+ dev_err(&pdev->dev, "found no memory resource\n");
+ err = -ENXIO;
+ goto fail_region;
+ }
+ bus->mdio_phys = res_mem->start;
+ bus->regsize = resource_size(res_mem);
+ if (!devm_request_mem_region(&pdev->dev, bus->mdio_phys, bus->regsize,
+ res_mem->name)) {
+ dev_err(&pdev->dev, "request_mem_region failed\n");
+ goto fail_region;
+ }
+ bus->register_base = (u64)ioremap(bus->mdio_phys, bus->regsize);
bus->mii_bus = mdiobus_alloc();
if (!bus->mii_bus)
- goto err;
+ goto fail_mdio_alloc;
smi_en.u64 = 0;
smi_en.s.en = 1;
- cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64);
+ cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64);
- /*
- * Standard Octeon evaluation boards don't support phy
- * interrupts, we need to poll.
- */
- for (i = 0; i < PHY_MAX_ADDR; i++)
- bus->phy_irq[i] = PHY_POLL;
bus->mii_bus->priv = bus;
bus->mii_bus->irq = bus->phy_irq;
bus->mii_bus->name = "mdio-octeon";
- snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%x", bus->unit);
+ snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%llx", bus->register_base);
bus->mii_bus->parent = &pdev->dev;
bus->mii_bus->read = octeon_mdiobus_read;
@@ -126,20 +144,23 @@ static int __devinit octeon_mdiobus_probe(struct platform_device *pdev)
dev_set_drvdata(&pdev->dev, bus);
- err = mdiobus_register(bus->mii_bus);
+ err = of_mdiobus_register(bus->mii_bus, pdev->dev.of_node);
if (err)
- goto err_register;
+ goto fail_register;
dev_info(&pdev->dev, "Version " DRV_VERSION "\n");
return 0;
-err_register:
+fail_register:
mdiobus_free(bus->mii_bus);
-err:
- devm_kfree(&pdev->dev, bus);
+fail_mdio_alloc:
+ devm_release_mem_region(&pdev->dev, bus->mdio_phys, bus->regsize);
+
+fail_region:
smi_en.u64 = 0;
- cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64);
+ cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64);
+ devm_kfree(&pdev->dev, bus);
return err;
}
@@ -152,15 +173,26 @@ static int __devexit octeon_mdiobus_remove(struct platform_device *pdev)
mdiobus_unregister(bus->mii_bus);
mdiobus_free(bus->mii_bus);
+ devm_release_mem_region(&pdev->dev, bus->mdio_phys, bus->regsize);
smi_en.u64 = 0;
- cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64);
+ cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64);
+ devm_kfree(&pdev->dev, bus);
return 0;
}
+static struct of_device_id octeon_mdiobus_match[] = {
+ {
+ .compatible = "cavium,octeon-3860-mdio",
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(of, octeon_mdiobus_match);
+
static struct platform_driver octeon_mdiobus_driver = {
.driver = {
.name = "mdio-octeon",
.owner = THIS_MODULE,
+ .of_match_table = octeon_mdiobus_match,
},
.probe = octeon_mdiobus_probe,
.remove = __devexit_p(octeon_mdiobus_remove),
--
1.7.2.3
^ permalink raw reply related
* [RFC PATCH v2 11/12] netdev: octeon_mgmt: Convert to use device tree.
From: David Daney @ 2011-03-04 19:42 UTC (permalink / raw)
To: linux-mips-6z/3iImG2C8G8FEW9MqTrA, ralf-6z/3iImG2C8G8FEW9MqTrA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, David Daney, David S. Miller
In-Reply-To: <1299267744-17278-1-git-send-email-ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
The device tree will supply the register bank base addresses, make
register addressing relative to those. PHY connection is now
described by the device tree.
Signed-off-by: David Daney <ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
arch/mips/cavium-octeon/octeon-platform.c | 62 ------
drivers/net/octeon/octeon_mgmt.c | 321 +++++++++++++++++++----------
2 files changed, 217 insertions(+), 166 deletions(-)
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index ce471bd..104713c 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -168,68 +168,6 @@ out:
}
device_initcall(octeon_rng_device_init);
-/* Octeon mgmt port Ethernet interface. */
-static int __init octeon_mgmt_device_init(void)
-{
- struct platform_device *pd;
- int ret = 0;
- int port, num_ports;
-
- struct resource mgmt_port_resource = {
- .flags = IORESOURCE_IRQ,
- .start = -1,
- .end = -1
- };
-
- if (!OCTEON_IS_MODEL(OCTEON_CN56XX) && !OCTEON_IS_MODEL(OCTEON_CN52XX))
- return 0;
-
- if (OCTEON_IS_MODEL(OCTEON_CN56XX))
- num_ports = 1;
- else
- num_ports = 2;
-
- for (port = 0; port < num_ports; port++) {
- pd = platform_device_alloc("octeon_mgmt", port);
- if (!pd) {
- ret = -ENOMEM;
- goto out;
- }
- /* No DMA restrictions */
- pd->dev.coherent_dma_mask = DMA_BIT_MASK(64);
- pd->dev.dma_mask = &pd->dev.coherent_dma_mask;
-
- switch (port) {
- case 0:
- mgmt_port_resource.start = OCTEON_IRQ_MII0;
- break;
- case 1:
- mgmt_port_resource.start = OCTEON_IRQ_MII1;
- break;
- default:
- BUG();
- }
- mgmt_port_resource.end = mgmt_port_resource.start;
-
- ret = platform_device_add_resources(pd, &mgmt_port_resource, 1);
-
- if (ret)
- goto fail;
-
- ret = platform_device_add(pd);
- if (ret)
- goto fail;
- }
- return ret;
-fail:
- platform_device_put(pd);
-
-out:
- return ret;
-
-}
-device_initcall(octeon_mgmt_device_init);
-
#ifdef CONFIG_USB
static int __init octeon_ehci_device_init(void)
diff --git a/drivers/net/octeon/octeon_mgmt.c b/drivers/net/octeon/octeon_mgmt.c
index b264f0f..17be326 100644
--- a/drivers/net/octeon/octeon_mgmt.c
+++ b/drivers/net/octeon/octeon_mgmt.c
@@ -6,16 +6,18 @@
* Copyright (C) 2009 Cavium Networks
*/
-#include <linux/capability.h>
-#include <linux/dma-mapping.h>
-#include <linux/init.h>
#include <linux/platform_device.h>
-#include <linux/netdevice.h>
+#include <linux/dma-mapping.h>
#include <linux/etherdevice.h>
+#include <linux/capability.h>
+#include <linux/netdevice.h>
+#include <linux/spinlock.h>
#include <linux/if_vlan.h>
+#include <linux/of_mdio.h>
+#include <linux/of_net.h>
+#include <linux/init.h>
#include <linux/slab.h>
#include <linux/phy.h>
-#include <linux/spinlock.h>
#include <asm/octeon/octeon.h>
#include <asm/octeon/cvmx-mixx-defs.h>
@@ -55,8 +57,56 @@ union mgmt_port_ring_entry {
} s;
};
+#define MIX_ORING1 0x0
+#define MIX_ORING2 0x8
+#define MIX_IRING1 0x10
+#define MIX_IRING2 0x18
+#define MIX_CTL 0x20
+#define MIX_IRHWM 0x28
+#define MIX_IRCNT 0x30
+#define MIX_ORHWM 0x38
+#define MIX_ORCNT 0x40
+#define MIX_ISR 0x48
+#define MIX_INTENA 0x50
+#define MIX_REMCNT 0x58
+#define MIX_BIST 0x78
+
+#define AGL_GMX_PRT_CFG 0x10
+#define AGL_GMX_RX_FRM_CTL 0x18
+#define AGL_GMX_RX_FRM_MAX 0x30
+#define AGL_GMX_RX_JABBER 0x38
+#define AGL_GMX_RX_STATS_CTL 0x50
+
+#define AGL_GMX_RX_STATS_PKTS_DRP 0xb0
+#define AGL_GMX_RX_STATS_OCTS_DRP 0xb8
+#define AGL_GMX_RX_STATS_PKTS_BAD 0xc0
+
+#define AGL_GMX_RX_ADR_CTL 0x100
+#define AGL_GMX_RX_ADR_CAM_EN 0x108
+#define AGL_GMX_RX_ADR_CAM0 0x180
+#define AGL_GMX_RX_ADR_CAM1 0x188
+#define AGL_GMX_RX_ADR_CAM2 0x190
+#define AGL_GMX_RX_ADR_CAM3 0x198
+#define AGL_GMX_RX_ADR_CAM4 0x1a0
+#define AGL_GMX_RX_ADR_CAM5 0x1a8
+
+#define AGL_GMX_TX_STATS_CTL 0x268
+#define AGL_GMX_TX_CTL 0x270
+#define AGL_GMX_TX_STAT0 0x280
+#define AGL_GMX_TX_STAT1 0x288
+#define AGL_GMX_TX_STAT2 0x290
+#define AGL_GMX_TX_STAT3 0x298
+#define AGL_GMX_TX_STAT4 0x2a0
+#define AGL_GMX_TX_STAT5 0x2a8
+#define AGL_GMX_TX_STAT6 0x2b0
+#define AGL_GMX_TX_STAT7 0x2b8
+#define AGL_GMX_TX_STAT8 0x2c0
+#define AGL_GMX_TX_STAT9 0x2c8
+
struct octeon_mgmt {
struct net_device *netdev;
+ u64 mix;
+ u64 agl;
int port;
int irq;
u64 *tx_ring;
@@ -82,31 +132,34 @@ struct octeon_mgmt {
struct napi_struct napi;
struct tasklet_struct tx_clean_tasklet;
struct phy_device *phydev;
+ struct device_node *phy_np;
+ resource_size_t mix_phys;
+ resource_size_t mix_size;
+ resource_size_t agl_phys;
+ resource_size_t agl_size;
};
static void octeon_mgmt_set_rx_irq(struct octeon_mgmt *p, int enable)
{
- int port = p->port;
union cvmx_mixx_intena mix_intena;
unsigned long flags;
spin_lock_irqsave(&p->lock, flags);
- mix_intena.u64 = cvmx_read_csr(CVMX_MIXX_INTENA(port));
+ mix_intena.u64 = cvmx_read_csr(p->mix + MIX_INTENA);
mix_intena.s.ithena = enable ? 1 : 0;
- cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64);
+ cvmx_write_csr(p->mix + MIX_INTENA, mix_intena.u64);
spin_unlock_irqrestore(&p->lock, flags);
}
static void octeon_mgmt_set_tx_irq(struct octeon_mgmt *p, int enable)
{
- int port = p->port;
union cvmx_mixx_intena mix_intena;
unsigned long flags;
spin_lock_irqsave(&p->lock, flags);
- mix_intena.u64 = cvmx_read_csr(CVMX_MIXX_INTENA(port));
+ mix_intena.u64 = cvmx_read_csr(p->mix + MIX_INTENA);
mix_intena.s.othena = enable ? 1 : 0;
- cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64);
+ cvmx_write_csr(p->mix + MIX_INTENA, mix_intena.u64);
spin_unlock_irqrestore(&p->lock, flags);
}
@@ -143,7 +196,6 @@ static unsigned int ring_size_to_bytes(unsigned int ring_size)
static void octeon_mgmt_rx_fill_ring(struct net_device *netdev)
{
struct octeon_mgmt *p = netdev_priv(netdev);
- int port = p->port;
while (p->rx_current_fill < ring_max_fill(OCTEON_MGMT_RX_RING_SIZE)) {
unsigned int size;
@@ -174,24 +226,23 @@ static void octeon_mgmt_rx_fill_ring(struct net_device *netdev)
(p->rx_next_fill + 1) % OCTEON_MGMT_RX_RING_SIZE;
p->rx_current_fill++;
/* Ring the bell. */
- cvmx_write_csr(CVMX_MIXX_IRING2(port), 1);
+ cvmx_write_csr(p->mix + MIX_IRING2, 1);
}
}
static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
{
- int port = p->port;
union cvmx_mixx_orcnt mix_orcnt;
union mgmt_port_ring_entry re;
struct sk_buff *skb;
int cleaned = 0;
unsigned long flags;
- mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port));
+ mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT);
while (mix_orcnt.s.orcnt) {
spin_lock_irqsave(&p->tx_list.lock, flags);
- mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port));
+ mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT);
if (mix_orcnt.s.orcnt == 0) {
spin_unlock_irqrestore(&p->tx_list.lock, flags);
@@ -211,7 +262,7 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
mix_orcnt.s.orcnt = 1;
/* Acknowledge to hardware that we have the buffer. */
- cvmx_write_csr(CVMX_MIXX_ORCNT(port), mix_orcnt.u64);
+ cvmx_write_csr(p->mix + MIX_ORCNT, mix_orcnt.u64);
p->tx_current_fill--;
spin_unlock_irqrestore(&p->tx_list.lock, flags);
@@ -221,7 +272,7 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
dev_kfree_skb_any(skb);
cleaned++;
- mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port));
+ mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT);
}
if (cleaned && netif_queue_stopped(p->netdev))
@@ -238,13 +289,12 @@ static void octeon_mgmt_clean_tx_tasklet(unsigned long arg)
static void octeon_mgmt_update_rx_stats(struct net_device *netdev)
{
struct octeon_mgmt *p = netdev_priv(netdev);
- int port = p->port;
unsigned long flags;
u64 drop, bad;
/* These reads also clear the count registers. */
- drop = cvmx_read_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(port));
- bad = cvmx_read_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(port));
+ drop = cvmx_read_csr(p->agl + AGL_GMX_RX_STATS_PKTS_DRP);
+ bad = cvmx_read_csr(p->agl + AGL_GMX_RX_STATS_PKTS_BAD);
if (drop || bad) {
/* Do an atomic update. */
@@ -258,15 +308,14 @@ static void octeon_mgmt_update_rx_stats(struct net_device *netdev)
static void octeon_mgmt_update_tx_stats(struct net_device *netdev)
{
struct octeon_mgmt *p = netdev_priv(netdev);
- int port = p->port;
unsigned long flags;
union cvmx_agl_gmx_txx_stat0 s0;
union cvmx_agl_gmx_txx_stat1 s1;
/* These reads also clear the count registers. */
- s0.u64 = cvmx_read_csr(CVMX_AGL_GMX_TXX_STAT0(port));
- s1.u64 = cvmx_read_csr(CVMX_AGL_GMX_TXX_STAT1(port));
+ s0.u64 = cvmx_read_csr(p->agl + AGL_GMX_TX_STAT0);
+ s1.u64 = cvmx_read_csr(p->agl + AGL_GMX_TX_STAT1);
if (s0.s.xsdef || s0.s.xscol || s1.s.scol || s1.s.mcol) {
/* Do an atomic update. */
@@ -305,7 +354,6 @@ static u64 octeon_mgmt_dequeue_rx_buffer(struct octeon_mgmt *p,
static int octeon_mgmt_receive_one(struct octeon_mgmt *p)
{
- int port = p->port;
struct net_device *netdev = p->netdev;
union cvmx_mixx_ircnt mix_ircnt;
union mgmt_port_ring_entry re;
@@ -378,18 +426,17 @@ done:
/* Tell the hardware we processed a packet. */
mix_ircnt.u64 = 0;
mix_ircnt.s.ircnt = 1;
- cvmx_write_csr(CVMX_MIXX_IRCNT(port), mix_ircnt.u64);
+ cvmx_write_csr(p->mix + MIX_IRCNT, mix_ircnt.u64);
return rc;
}
static int octeon_mgmt_receive_packets(struct octeon_mgmt *p, int budget)
{
- int port = p->port;
unsigned int work_done = 0;
union cvmx_mixx_ircnt mix_ircnt;
int rc;
- mix_ircnt.u64 = cvmx_read_csr(CVMX_MIXX_IRCNT(port));
+ mix_ircnt.u64 = cvmx_read_csr(p->mix + MIX_IRCNT);
while (work_done < budget && mix_ircnt.s.ircnt) {
rc = octeon_mgmt_receive_one(p);
@@ -397,7 +444,7 @@ static int octeon_mgmt_receive_packets(struct octeon_mgmt *p, int budget)
work_done++;
/* Check for more packets. */
- mix_ircnt.u64 = cvmx_read_csr(CVMX_MIXX_IRCNT(port));
+ mix_ircnt.u64 = cvmx_read_csr(p->mix + MIX_IRCNT);
}
octeon_mgmt_rx_fill_ring(p->netdev);
@@ -431,16 +478,16 @@ static void octeon_mgmt_reset_hw(struct octeon_mgmt *p)
union cvmx_agl_gmx_bist agl_gmx_bist;
mix_ctl.u64 = 0;
- cvmx_write_csr(CVMX_MIXX_CTL(p->port), mix_ctl.u64);
+ cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64);
do {
- mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(p->port));
+ mix_ctl.u64 = cvmx_read_csr(p->mix + MIX_CTL);
} while (mix_ctl.s.busy);
mix_ctl.s.reset = 1;
- cvmx_write_csr(CVMX_MIXX_CTL(p->port), mix_ctl.u64);
- cvmx_read_csr(CVMX_MIXX_CTL(p->port));
+ cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64);
+ cvmx_read_csr(p->mix + MIX_CTL);
cvmx_wait(64);
- mix_bist.u64 = cvmx_read_csr(CVMX_MIXX_BIST(p->port));
+ mix_bist.u64 = cvmx_read_csr(p->mix + MIX_BIST);
if (mix_bist.u64)
dev_warn(p->dev, "MIX failed BIST (0x%016llx)\n",
(unsigned long long)mix_bist.u64);
@@ -471,7 +518,6 @@ static void octeon_mgmt_cam_state_add(struct octeon_mgmt_cam_state *cs,
static void octeon_mgmt_set_rx_filtering(struct net_device *netdev)
{
struct octeon_mgmt *p = netdev_priv(netdev);
- int port = p->port;
union cvmx_agl_gmx_rxx_adr_ctl adr_ctl;
union cvmx_agl_gmx_prtx_cfg agl_gmx_prtx;
unsigned long flags;
@@ -517,29 +563,29 @@ static void octeon_mgmt_set_rx_filtering(struct net_device *netdev)
spin_lock_irqsave(&p->lock, flags);
/* Disable packet I/O. */
- agl_gmx_prtx.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port));
+ agl_gmx_prtx.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG);
prev_packet_enable = agl_gmx_prtx.s.en;
agl_gmx_prtx.s.en = 0;
- cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), agl_gmx_prtx.u64);
+ cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, agl_gmx_prtx.u64);
adr_ctl.u64 = 0;
adr_ctl.s.cam_mode = cam_mode;
adr_ctl.s.mcst = multicast_mode;
adr_ctl.s.bcst = 1; /* Allow broadcast */
- cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CTL(port), adr_ctl.u64);
+ cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CTL, adr_ctl.u64);
- cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM0(port), cam_state.cam[0]);
- cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM1(port), cam_state.cam[1]);
- cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM2(port), cam_state.cam[2]);
- cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM3(port), cam_state.cam[3]);
- cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM4(port), cam_state.cam[4]);
- cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM5(port), cam_state.cam[5]);
- cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM_EN(port), cam_state.cam_mask);
+ cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM0, cam_state.cam[0]);
+ cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM1, cam_state.cam[1]);
+ cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM2, cam_state.cam[2]);
+ cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM3, cam_state.cam[3]);
+ cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM4, cam_state.cam[4]);
+ cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM5, cam_state.cam[5]);
+ cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM_EN, cam_state.cam_mask);
/* Restore packet I/O. */
agl_gmx_prtx.s.en = prev_packet_enable;
- cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), agl_gmx_prtx.u64);
+ cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, agl_gmx_prtx.u64);
spin_unlock_irqrestore(&p->lock, flags);
}
@@ -561,7 +607,6 @@ static int octeon_mgmt_set_mac_address(struct net_device *netdev, void *addr)
static int octeon_mgmt_change_mtu(struct net_device *netdev, int new_mtu)
{
struct octeon_mgmt *p = netdev_priv(netdev);
- int port = p->port;
int size_without_fcs = new_mtu + OCTEON_MGMT_RX_HEADROOM;
/*
@@ -577,8 +622,8 @@ static int octeon_mgmt_change_mtu(struct net_device *netdev, int new_mtu)
netdev->mtu = new_mtu;
- cvmx_write_csr(CVMX_AGL_GMX_RXX_FRM_MAX(port), size_without_fcs);
- cvmx_write_csr(CVMX_AGL_GMX_RXX_JABBER(port),
+ cvmx_write_csr(p->agl + AGL_GMX_RX_FRM_MAX, size_without_fcs);
+ cvmx_write_csr(p->agl + AGL_GMX_RX_JABBER,
(size_without_fcs + 7) & 0xfff8);
return 0;
@@ -588,14 +633,13 @@ static irqreturn_t octeon_mgmt_interrupt(int cpl, void *dev_id)
{
struct net_device *netdev = dev_id;
struct octeon_mgmt *p = netdev_priv(netdev);
- int port = p->port;
union cvmx_mixx_isr mixx_isr;
- mixx_isr.u64 = cvmx_read_csr(CVMX_MIXX_ISR(port));
+ mixx_isr.u64 = cvmx_read_csr(p->mix + MIX_ISR);
/* Clear any pending interrupts */
- cvmx_write_csr(CVMX_MIXX_ISR(port), mixx_isr.u64);
- cvmx_read_csr(CVMX_MIXX_ISR(port));
+ cvmx_write_csr(p->mix + MIX_ISR, mixx_isr.u64);
+ cvmx_read_csr(p->mix + MIX_ISR);
if (mixx_isr.s.irthresh) {
octeon_mgmt_disable_rx_irq(p);
@@ -626,7 +670,6 @@ static int octeon_mgmt_ioctl(struct net_device *netdev,
static void octeon_mgmt_adjust_link(struct net_device *netdev)
{
struct octeon_mgmt *p = netdev_priv(netdev);
- int port = p->port;
union cvmx_agl_gmx_prtx_cfg prtx_cfg;
unsigned long flags;
int link_changed = 0;
@@ -637,11 +680,9 @@ static void octeon_mgmt_adjust_link(struct net_device *netdev)
link_changed = 1;
if (p->last_duplex != p->phydev->duplex) {
p->last_duplex = p->phydev->duplex;
- prtx_cfg.u64 =
- cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port));
+ prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG);
prtx_cfg.s.duplex = p->phydev->duplex;
- cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port),
- prtx_cfg.u64);
+ cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, prtx_cfg.u64);
}
} else {
if (p->last_link)
@@ -667,18 +708,16 @@ static void octeon_mgmt_adjust_link(struct net_device *netdev)
static int octeon_mgmt_init_phy(struct net_device *netdev)
{
struct octeon_mgmt *p = netdev_priv(netdev);
- char phy_id[20];
- if (octeon_is_simulation()) {
+ if (octeon_is_simulation() || p->phy_np == NULL) {
/* No PHYs in the simulator. */
netif_carrier_on(netdev);
return 0;
}
- snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "0", p->port);
-
- p->phydev = phy_connect(netdev, phy_id, octeon_mgmt_adjust_link, 0,
- PHY_INTERFACE_MODE_MII);
+ p->phydev = of_phy_connect(netdev, p->phy_np,
+ octeon_mgmt_adjust_link, 0,
+ PHY_INTERFACE_MODE_MII);
if (IS_ERR(p->phydev)) {
p->phydev = NULL;
@@ -734,14 +773,14 @@ static int octeon_mgmt_open(struct net_device *netdev)
octeon_mgmt_reset_hw(p);
- mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(port));
+ mix_ctl.u64 = cvmx_read_csr(p->mix + MIX_CTL);
/* Bring it out of reset if needed. */
if (mix_ctl.s.reset) {
mix_ctl.s.reset = 0;
- cvmx_write_csr(CVMX_MIXX_CTL(port), mix_ctl.u64);
+ cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64);
do {
- mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(port));
+ mix_ctl.u64 = cvmx_read_csr(p->mix + MIX_CTL);
} while (mix_ctl.s.reset);
}
@@ -752,17 +791,17 @@ static int octeon_mgmt_open(struct net_device *netdev)
oring1.u64 = 0;
oring1.s.obase = p->tx_ring_handle >> 3;
oring1.s.osize = OCTEON_MGMT_TX_RING_SIZE;
- cvmx_write_csr(CVMX_MIXX_ORING1(port), oring1.u64);
+ cvmx_write_csr(p->mix + MIX_ORING1, oring1.u64);
iring1.u64 = 0;
iring1.s.ibase = p->rx_ring_handle >> 3;
iring1.s.isize = OCTEON_MGMT_RX_RING_SIZE;
- cvmx_write_csr(CVMX_MIXX_IRING1(port), iring1.u64);
+ cvmx_write_csr(p->mix + MIX_IRING1, iring1.u64);
/* Disable packet I/O. */
- prtx_cfg.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port));
+ prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG);
prtx_cfg.s.en = 0;
- cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), prtx_cfg.u64);
+ cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, prtx_cfg.u64);
memcpy(sa.sa_data, netdev->dev_addr, ETH_ALEN);
octeon_mgmt_set_mac_address(netdev, &sa);
@@ -779,7 +818,7 @@ static int octeon_mgmt_open(struct net_device *netdev)
mix_ctl.s.nbtarb = 0; /* Arbitration mode */
/* MII CB-request FIFO programmable high watermark */
mix_ctl.s.mrq_hwm = 1;
- cvmx_write_csr(CVMX_MIXX_CTL(port), mix_ctl.u64);
+ cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64);
if (OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X)
|| OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X)) {
@@ -806,16 +845,16 @@ static int octeon_mgmt_open(struct net_device *netdev)
/* Clear statistics. */
/* Clear on read. */
- cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_CTL(port), 1);
- cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(port), 0);
- cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(port), 0);
+ cvmx_write_csr(p->agl + AGL_GMX_RX_STATS_CTL, 1);
+ cvmx_write_csr(p->agl + AGL_GMX_RX_STATS_PKTS_DRP, 0);
+ cvmx_write_csr(p->agl + AGL_GMX_RX_STATS_PKTS_BAD, 0);
- cvmx_write_csr(CVMX_AGL_GMX_TXX_STATS_CTL(port), 1);
- cvmx_write_csr(CVMX_AGL_GMX_TXX_STAT0(port), 0);
- cvmx_write_csr(CVMX_AGL_GMX_TXX_STAT1(port), 0);
+ cvmx_write_csr(p->agl + AGL_GMX_TX_STATS_CTL, 1);
+ cvmx_write_csr(p->agl + AGL_GMX_TX_STAT0, 0);
+ cvmx_write_csr(p->agl + AGL_GMX_TX_STAT1, 0);
/* Clear any pending interrupts */
- cvmx_write_csr(CVMX_MIXX_ISR(port), cvmx_read_csr(CVMX_MIXX_ISR(port)));
+ cvmx_write_csr(p->mix + MIX_ISR, cvmx_read_csr(p->mix + MIX_ISR));
if (request_irq(p->irq, octeon_mgmt_interrupt, 0, netdev->name,
netdev)) {
@@ -826,18 +865,18 @@ static int octeon_mgmt_open(struct net_device *netdev)
/* Interrupt every single RX packet */
mix_irhwm.u64 = 0;
mix_irhwm.s.irhwm = 0;
- cvmx_write_csr(CVMX_MIXX_IRHWM(port), mix_irhwm.u64);
+ cvmx_write_csr(p->mix + MIX_IRHWM, mix_irhwm.u64);
/* Interrupt when we have 1 or more packets to clean. */
mix_orhwm.u64 = 0;
mix_orhwm.s.orhwm = 1;
- cvmx_write_csr(CVMX_MIXX_ORHWM(port), mix_orhwm.u64);
+ cvmx_write_csr(p->mix + MIX_ORHWM, mix_orhwm.u64);
/* Enable receive and transmit interrupts */
mix_intena.u64 = 0;
mix_intena.s.ithena = 1;
mix_intena.s.othena = 1;
- cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64);
+ cvmx_write_csr(p->mix + MIX_INTENA, mix_intena.u64);
/* Enable packet I/O. */
@@ -868,7 +907,7 @@ static int octeon_mgmt_open(struct net_device *netdev)
* frame. GMX checks that the PREAMBLE is sent correctly.
*/
rxx_frm_ctl.s.pre_chk = 1;
- cvmx_write_csr(CVMX_AGL_GMX_RXX_FRM_CTL(port), rxx_frm_ctl.u64);
+ cvmx_write_csr(p->agl + AGL_GMX_RX_FRM_CTL, rxx_frm_ctl.u64);
/* Enable the AGL block */
agl_gmx_inf_mode.u64 = 0;
@@ -876,13 +915,13 @@ static int octeon_mgmt_open(struct net_device *netdev)
cvmx_write_csr(CVMX_AGL_GMX_INF_MODE, agl_gmx_inf_mode.u64);
/* Configure the port duplex and enables */
- prtx_cfg.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port));
+ prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG);
prtx_cfg.s.tx_en = 1;
prtx_cfg.s.rx_en = 1;
prtx_cfg.s.en = 1;
p->last_duplex = 1;
prtx_cfg.s.duplex = p->last_duplex;
- cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), prtx_cfg.u64);
+ cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, prtx_cfg.u64);
p->last_link = 0;
netif_carrier_off(netdev);
@@ -946,7 +985,6 @@ static int octeon_mgmt_stop(struct net_device *netdev)
static int octeon_mgmt_xmit(struct sk_buff *skb, struct net_device *netdev)
{
struct octeon_mgmt *p = netdev_priv(netdev);
- int port = p->port;
union mgmt_port_ring_entry re;
unsigned long flags;
int rv = NETDEV_TX_BUSY;
@@ -990,7 +1028,7 @@ static int octeon_mgmt_xmit(struct sk_buff *skb, struct net_device *netdev)
netdev->stats.tx_bytes += skb->len;
/* Ring the bell. */
- cvmx_write_csr(CVMX_MIXX_ORING2(port), 1);
+ cvmx_write_csr(p->mix + MIX_ORING2, 1);
rv = NETDEV_TX_OK;
out:
@@ -1069,10 +1107,14 @@ static const struct net_device_ops octeon_mgmt_ops = {
static int __devinit octeon_mgmt_probe(struct platform_device *pdev)
{
- struct resource *res_irq;
struct net_device *netdev;
struct octeon_mgmt *p;
- int i;
+ const __be32 *data;
+ const u8 *mac;
+ struct resource *res_mix;
+ struct resource *res_agl;
+ int len;
+ int result;
netdev = alloc_etherdev(sizeof(struct octeon_mgmt));
if (netdev == NULL)
@@ -1086,14 +1128,63 @@ static int __devinit octeon_mgmt_probe(struct platform_device *pdev)
p->netdev = netdev;
p->dev = &pdev->dev;
- p->port = pdev->id;
+ data = of_get_property(pdev->dev.of_node, "cell-index", &len);
+ if (data && len == sizeof(*data)) {
+ p->port = be32_to_cpup(data);
+ } else {
+ dev_err(&pdev->dev, "no 'cell-index' property\n");
+ result = -ENXIO;
+ goto err;
+ }
+
snprintf(netdev->name, IFNAMSIZ, "mgmt%d", p->port);
- res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
- if (!res_irq)
+ result = platform_get_irq(pdev, 0);
+ if (result < 0)
+ goto err;
+
+ p->irq = result;
+
+ res_mix = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (res_mix == NULL) {
+ dev_err(&pdev->dev, "no 'reg' resource\n");
+ result = -ENXIO;
+ goto err;
+ }
+
+ res_agl = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ if (res_agl == NULL) {
+ dev_err(&pdev->dev, "no 'reg' resource\n");
+ result = -ENXIO;
goto err;
+ }
+
+ p->mix_phys = res_mix->start;
+ p->mix_size = resource_size(res_mix);
+ p->agl_phys = res_agl->start;
+ p->agl_size = resource_size(res_agl);
+
+
+ if (!devm_request_mem_region(&pdev->dev, p->mix_phys, p->mix_size,
+ res_mix->name)) {
+ dev_err(&pdev->dev, "request_mem_region (%s) failed\n",
+ res_mix->name);
+ result = -ENXIO;
+ goto err;
+ }
+
+ if (!devm_request_mem_region(&pdev->dev, p->agl_phys, p->agl_size,
+ res_agl->name)) {
+ result = -ENXIO;
+ dev_err(&pdev->dev, "request_mem_region (%s) failed\n",
+ res_agl->name);
+ goto fail_region1;
+ }
+
+
+ p->mix = (u64)ioremap(p->mix_phys, p->mix_size);
+ p->agl = (u64)ioremap(p->agl_phys, p->agl_size);
- p->irq = res_irq->start;
spin_lock_init(&p->lock);
skb_queue_head_init(&p->tx_list);
@@ -1104,39 +1195,61 @@ static int __devinit octeon_mgmt_probe(struct platform_device *pdev)
netdev->netdev_ops = &octeon_mgmt_ops;
netdev->ethtool_ops = &octeon_mgmt_ethtool_ops;
- /* The mgmt ports get the first N MACs. */
- for (i = 0; i < 6; i++)
- netdev->dev_addr[i] = octeon_bootinfo->mac_addr_base[i];
- netdev->dev_addr[5] += p->port;
+ mac = of_get_mac_address(pdev->dev.of_node);
- if (p->port >= octeon_bootinfo->mac_addr_count)
- dev_err(&pdev->dev,
- "Error %s: Using MAC outside of the assigned range: %pM\n",
- netdev->name, netdev->dev_addr);
+ if (mac)
+ memcpy(netdev->dev_addr, mac, 6);
- if (register_netdev(netdev))
- goto err;
+ p->phy_np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
+
+ pdev->dev.coherent_dma_mask = DMA_BIT_MASK(64);
+ pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
+
+ result = register_netdev(netdev);
+ if (result)
+ goto fail_region2;
dev_info(&pdev->dev, "Version " DRV_VERSION "\n");
return 0;
+
+fail_region2:
+ iounmap((void *)p->agl);
+ iounmap((void *)p->mix);
+ devm_release_mem_region(&pdev->dev, p->agl_phys, p->agl_size);
+fail_region1:
+ devm_release_mem_region(&pdev->dev, p->mix_phys, p->mix_size);
err:
free_netdev(netdev);
- return -ENOENT;
+ return result;
}
static int __devexit octeon_mgmt_remove(struct platform_device *pdev)
{
struct net_device *netdev = dev_get_drvdata(&pdev->dev);
+ struct octeon_mgmt *p = netdev_priv(netdev);
unregister_netdev(netdev);
+ iounmap((void *)p->agl);
+ iounmap((void *)p->mix);
+ devm_release_mem_region(&pdev->dev, p->agl_phys, p->agl_size);
+ devm_release_mem_region(&pdev->dev, p->mix_phys, p->mix_size);
free_netdev(netdev);
return 0;
}
+static struct of_device_id octeon_mgmt_match[] = {
+ {
+ .compatible = "cavium,octeon-5750-mix",
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(of, octeon_mgmt_match);
+
static struct platform_driver octeon_mgmt_driver = {
.driver = {
.name = "octeon_mgmt",
.owner = THIS_MODULE,
+ .of_match_table = octeon_mgmt_match,
},
.probe = octeon_mgmt_probe,
.remove = __devexit_p(octeon_mgmt_remove),
--
1.7.2.3
^ permalink raw reply related
* [RFC PATCH v2 12/12] staging: octeon_ethernet: Convert to use device tree.
From: David Daney @ 2011-03-04 19:42 UTC (permalink / raw)
To: linux-mips-6z/3iImG2C8G8FEW9MqTrA, ralf-6z/3iImG2C8G8FEW9MqTrA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, David Daney, David S. Miller
In-Reply-To: <1299267744-17278-1-git-send-email-ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
Get MAC address and PHY connection from the device tree.
Signed-off-by: David Daney <ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
drivers/staging/octeon/ethernet-mdio.c | 27 +++++----
drivers/staging/octeon/ethernet.c | 88 +++++++++++++++++-------------
drivers/staging/octeon/octeon-ethernet.h | 3 +
3 files changed, 69 insertions(+), 49 deletions(-)
diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
index 0e5dab7..38a0153 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -27,6 +27,7 @@
#include <linux/kernel.h>
#include <linux/ethtool.h>
#include <linux/phy.h>
+#include <linux/of_mdio.h>
#include <net/dst.h>
@@ -162,22 +163,24 @@ static void cvm_oct_adjust_link(struct net_device *dev)
int cvm_oct_phy_setup_device(struct net_device *dev)
{
struct octeon_ethernet *priv = netdev_priv(dev);
+ struct device_node *phy_node;
- int phy_addr = cvmx_helper_board_get_mii_address(priv->port);
- if (phy_addr != -1) {
- char phy_id[20];
+ if (!priv->of_node)
+ return 0;
- snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "0", phy_addr);
+ phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0);
+ if (!phy_node)
+ return 0;
- priv->phydev = phy_connect(dev, phy_id, cvm_oct_adjust_link, 0,
- PHY_INTERFACE_MODE_GMII);
+ priv->phydev = of_phy_connect(dev, phy_node, cvm_oct_adjust_link, 0,
+ PHY_INTERFACE_MODE_GMII);
- if (IS_ERR(priv->phydev)) {
- priv->phydev = NULL;
- return -1;
- }
- priv->last_link = 0;
- phy_start_aneg(priv->phydev);
+ if (IS_ERR(priv->phydev)) {
+ priv->phydev = NULL;
+ return -1;
}
+ priv->last_link = 0;
+ phy_start_aneg(priv->phydev);
+
return 0;
}
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index 042adf7..16c93e4 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -31,6 +31,7 @@
#include <linux/etherdevice.h>
#include <linux/phy.h>
#include <linux/slab.h>
+#include <linux/of_net.h>
#include <net/dst.h>
@@ -112,15 +113,6 @@ int rx_napi_weight = 32;
module_param(rx_napi_weight, int, 0444);
MODULE_PARM_DESC(rx_napi_weight, "The NAPI WEIGHT parameter.");
-/*
- * The offset from mac_addr_base that should be used for the next port
- * that is configured. By convention, if any mgmt ports exist on the
- * chip, they get the first mac addresses, The ports controlled by
- * this driver are numbered sequencially following any mgmt addresses
- * that may exist.
- */
-static unsigned int cvm_oct_mac_addr_offset;
-
/**
* cvm_oct_poll_queue - Workqueue for polling operations.
*/
@@ -447,26 +439,13 @@ static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr)
int cvm_oct_common_init(struct net_device *dev)
{
struct octeon_ethernet *priv = netdev_priv(dev);
- struct sockaddr sa;
- u64 mac = ((u64)(octeon_bootinfo->mac_addr_base[0] & 0xff) << 40) |
- ((u64)(octeon_bootinfo->mac_addr_base[1] & 0xff) << 32) |
- ((u64)(octeon_bootinfo->mac_addr_base[2] & 0xff) << 24) |
- ((u64)(octeon_bootinfo->mac_addr_base[3] & 0xff) << 16) |
- ((u64)(octeon_bootinfo->mac_addr_base[4] & 0xff) << 8) |
- (u64)(octeon_bootinfo->mac_addr_base[5] & 0xff);
-
- mac += cvm_oct_mac_addr_offset;
- sa.sa_data[0] = (mac >> 40) & 0xff;
- sa.sa_data[1] = (mac >> 32) & 0xff;
- sa.sa_data[2] = (mac >> 24) & 0xff;
- sa.sa_data[3] = (mac >> 16) & 0xff;
- sa.sa_data[4] = (mac >> 8) & 0xff;
- sa.sa_data[5] = mac & 0xff;
-
- if (cvm_oct_mac_addr_offset >= octeon_bootinfo->mac_addr_count)
- printk(KERN_DEBUG "%s: Using MAC outside of the assigned range:"
- " %pM\n", dev->name, sa.sa_data);
- cvm_oct_mac_addr_offset++;
+ struct sockaddr sa = {0};
+
+ if (priv->of_node) {
+ const u8 *mac = of_get_mac_address(priv->of_node);
+ if (mac)
+ memcpy(sa.sa_data, mac, 6);
+ }
/*
* Force the interface to use the POW send if always_use_pow
@@ -594,22 +573,55 @@ static const struct net_device_ops cvm_oct_pow_netdev_ops = {
extern void octeon_mdiobus_force_mod_depencency(void);
+static struct device_node * __init cvm_oct_of_get_child(const struct device_node *parent,
+ int reg_val)
+{
+ struct device_node *node = NULL;
+ int size;
+ const __be32 *addr;
+
+ for (;;) {
+ node = of_get_next_child(parent, node);
+ if (!node)
+ break;
+ addr = of_get_property(node, "reg", &size);
+ if (addr && (be32_to_cpu(*addr) == reg_val))
+ break;
+ }
+ return node;
+}
+
+static struct device_node * __init cvm_oct_node_for_port(struct device_node *pip,
+ int interface, int port)
+{
+ struct device_node *ni, *np;
+
+ ni = cvm_oct_of_get_child(pip, interface);
+ if (!ni)
+ return NULL;
+
+ np = cvm_oct_of_get_child(ni, port);
+ of_node_put(ni);
+
+ return np;
+}
+
static int __init cvm_oct_init_module(void)
{
int num_interfaces;
int interface;
int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE;
int qos;
+ struct device_node *pip;
octeon_mdiobus_force_mod_depencency();
pr_notice("cavium-ethernet %s\n", OCTEON_ETHERNET_VERSION);
- if (OCTEON_IS_MODEL(OCTEON_CN52XX))
- cvm_oct_mac_addr_offset = 2; /* First two are the mgmt ports. */
- else if (OCTEON_IS_MODEL(OCTEON_CN56XX))
- cvm_oct_mac_addr_offset = 1; /* First one is the mgmt port. */
- else
- cvm_oct_mac_addr_offset = 0;
+ pip = of_find_node_by_path("pip");
+ if (!pip) {
+ pr_err("Error: No 'pip' in /aliases\n");
+ return -EINVAL;
+ }
cvm_oct_poll_queue = create_singlethread_workqueue("octeon-ethernet");
if (cvm_oct_poll_queue == NULL) {
@@ -688,10 +700,11 @@ static int __init cvm_oct_init_module(void)
cvmx_helper_interface_get_mode(interface);
int num_ports = cvmx_helper_ports_on_interface(interface);
int port;
+ int port_index;
- for (port = cvmx_helper_get_ipd_port(interface, 0);
+ for (port_index = 0, port = cvmx_helper_get_ipd_port(interface, 0);
port < cvmx_helper_get_ipd_port(interface, num_ports);
- port++) {
+ port_index++, port++) {
struct octeon_ethernet *priv;
struct net_device *dev =
alloc_etherdev(sizeof(struct octeon_ethernet));
@@ -702,6 +715,7 @@ static int __init cvm_oct_init_module(void)
/* Initialize the device private structure. */
priv = netdev_priv(dev);
+ priv->of_node = cvm_oct_node_for_port(pip, interface, port_index);
INIT_DELAYED_WORK(&priv->port_periodic_work,
cvm_oct_periodic_worker);
diff --git a/drivers/staging/octeon/octeon-ethernet.h b/drivers/staging/octeon/octeon-ethernet.h
index d581925..9360e22 100644
--- a/drivers/staging/octeon/octeon-ethernet.h
+++ b/drivers/staging/octeon/octeon-ethernet.h
@@ -31,6 +31,8 @@
#ifndef OCTEON_ETHERNET_H
#define OCTEON_ETHERNET_H
+#include <linux/of.h>
+
/**
* This is the definition of the Ethernet driver's private
* driver state stored in netdev_priv(dev).
@@ -59,6 +61,7 @@ struct octeon_ethernet {
void (*poll) (struct net_device *dev);
struct delayed_work port_periodic_work;
struct work_struct port_work; /* may be unused. */
+ struct device_node *of_node;
};
int cvm_oct_free_work(void *work_queue_entry);
--
1.7.2.3
^ permalink raw reply related
* Re: pull request: wireless-next-2.6 2011-03-04
From: David Miller @ 2011-03-04 20:25 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, netdev
In-Reply-To: <20110304194018.GD9866@tuxdriver.com>
From: "John W. Linville" <linville@tuxdriver.com>
Date: Fri, 4 Mar 2011 14:40:18 -0500
> Yet another batch of new wireless bits intended for 2.6.39... :-)
>
> Highlights in this round include AP-mode support for wl12xx, some
> rtlwifi fixes (many build-related), some more b43 N-phy support
> advancement, a big batch of ath9k_htc updates, and the refactoring of
> iwlwifi to separate iwl3945 and iwl4965 support out into a new iwlegacy
> driver. Mixed-in, of course, is the usual batch of various driver and
> mac80211 updates and fixes.
>
> Please let me know if there are problems!
Pulled, thanks John.
^ permalink raw reply
* Re: [PATCH net-next-2.6] inetpeer: seqlock optimization
From: David Miller @ 2011-03-04 20:45 UTC (permalink / raw)
To: eric.dumazet; +Cc: xiaosuo, netdev
In-Reply-To: <20110304.111705.193726268.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Fri, 04 Mar 2011 11:17:05 -0800 (PST)
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Fri, 04 Mar 2011 16:09:08 +0100
>
>> Here is a patch to implement this idea.
>
> Applied, thanks Eric!
Unfortunately, I have to revert, the lockdep annotations needs to
be updated:
net/ipv4/inetpeer.c: In function ‘peer_avl_rebalance’:
net/ipv4/inetpeer.c:274:10: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:276:7: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:278:7: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:285:9: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:287:9: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:299:11: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:301:11: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:317:9: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:319:9: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:331:11: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:333:11: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c: In function ‘unlink_from_pool’:
net/ipv4/inetpeer.c:385:7: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:385:7: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:394:8: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:394:8: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:395:4: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c: In function ‘inet_getpeer’:
net/ipv4/inetpeer.c:508:6: error: ‘seqlock_t’ has no member named ‘dep_map’
net/ipv4/inetpeer.c:508:6: error: ‘seqlock_t’ has no member named ‘dep_map’
^ permalink raw reply
* Re: [net-next-2.6 PATCH 02/10] ethtool: add ntuple flow specifier to network flow classifier
From: Alexander Duyck @ 2011-03-04 21:00 UTC (permalink / raw)
To: Ben Hutchings
Cc: Alexander Duyck, davem@davemloft.net, Kirsher, Jeffrey T,
netdev@vger.kernel.org
In-Reply-To: <1299091805.2664.16.camel@bwh-desktop>
On 3/2/2011 10:50 AM, Ben Hutchings wrote:
> On Fri, 2011-02-25 at 21:30 -0800, Alexander Duyck wrote:
>> On Fri, Feb 25, 2011 at 5:00 PM, Ben Hutchings
>> <bhutchings@solarflare.com> wrote:
>>> On Fri, 2011-02-25 at 15:32 -0800, Alexander Duyck wrote:
> [...]
>>>> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
>>>> index aac3e2e..3d1f8e0 100644
>>>> --- a/include/linux/ethtool.h
>>>> +++ b/include/linux/ethtool.h
>>>> @@ -378,10 +378,25 @@ struct ethtool_usrip4_spec {
>>>> };
>>>>
>>>> /**
>>>> + * struct ethtool_ntuple_spec_ext - flow spec extension for ntuple in nfc
>>>> + * @unused: space unused by extension
>>>> + * @vlan_etype: EtherType for vlan tagged packet to match
>>>> + * @vlan_tci: VLAN tag to match
>>>> + * @data: Driver-dependent data to match
>>>> + */
>>>> +struct ethtool_ntuple_spec_ext {
>>>> + __be32 unused[15];
>>>> + __be16 vlan_etype;
>>>> + __be16 vlan_tci;
>>>> + __be32 data[2];
>>>> +};
>>> [...]
>>>
>>> This is a really nasty way to reclaim space in the union.
>>>
>>> Let's name the union, shrink it and insert the extra fields that way:
>>>
>>> --- a/include/linux/ethtool.h
>>> +++ b/include/linux/ethtool.h
>>> @@ -377,27 +377,43 @@ struct ethtool_usrip4_spec {
>>> __u8 proto;
>>> };
>>>
>>> +union ethtool_flow_union {
>>> + struct ethtool_tcpip4_spec tcp_ip4_spec;
>>> + struct ethtool_tcpip4_spec udp_ip4_spec;
>>> + struct ethtool_tcpip4_spec sctp_ip4_spec;
>>> + struct ethtool_ah_espip4_spec ah_ip4_spec;
>>> + struct ethtool_ah_espip4_spec esp_ip4_spec;
>>> + struct ethtool_usrip4_spec usr_ip4_spec;
>>> + struct ethhdr ether_spec;
>>> + __u8 hdata[52];
>>> +};
>>> +
>>> +struct ethtool_flow_ext {
>>> + __be16 vlan_etype;
>>> + __be16 vlan_tci;
>>> + __be32 data[2];
>>> + __u32 reserved[2];
>>> +};
>>> +
>>
>> Any chance of getting the reserved fields moved to the top of the
>> structure? My only concern is that we might end up with a flow spec
>> larger than 52 bytes at some point and moving the reserved fields to
>> the front might give us a little more wiggle room future
>> compatibility.
> [...]
>
> OK, so how about this:
>
> /**
> * union ethtool_flow_union - flow spec type-specific fields
> * @tcp_ip4_spec: TCP/IPv4 fields to match
> * @udp_ip4_spec: UDP/IPv4 fields to match
> * @sctp_ip4_spec: SCTP/IPv4 fields to match
> * @ah_ip4_spec: AH/IPv4 fields to match
> * @esp_ip4_spec: ESP/IPv4 fields to match
> * @usr_ip4_spec: User-defined IPv4 fields to match
> * @ether_spec: Ethernet fields to match
> *
> * Note: The size of this union may shrink in future to allow for
> * expansion in&struct ethtool_flow_ext.
> */
> union ethtool_flow_union {
> struct ethtool_tcpip4_spec tcp_ip4_spec;
> struct ethtool_tcpip4_spec udp_ip4_spec;
> struct ethtool_tcpip4_spec sctp_ip4_spec;
> struct ethtool_ah_espip4_spec ah_ip4_spec;
> struct ethtool_ah_espip4_spec esp_ip4_spec;
> struct ethtool_usrip4_spec usr_ip4_spec;
> struct ethhdr ether_spec;
> __u8 hdata[60];
> };
>
> /**
> * struct ethtool_flow_ext - flow spec common extension fields
> * @vlan_etype: EtherType for vlan tagged packet to match
> * @vlan_tci: VLAN tag to match
> * @data: Driver-dependent data to match
> *
> * Note: Additional fields may be inserted before @vlan_etype in future,
> * but the offset of the existing fields within the containing structure
> * (&struct ethtool_rx_flow_spec) will be stable.
> */
> struct ethtool_flow_ext {
> __be16 vlan_etype;
> __be16 vlan_tci;
> __be32 data[2];
> };
>
> Please can you check that these definitions won't affect the size of
> struct ethtool_rx_flow_spec on i386 or x86-64?
>
> Ben.
>
I'll try to look into it next week since I am just getting caught up
from being out on vacation.
As I recall when I had made my original changes they didn't have an
effect on the size so this should be fine since all of the fields have a
maximum alignment of 32 bits.
Thanks,
Alex
^ permalink raw reply
* Re: [RFC PATCH v2 10/12] netdev: mdio-octeon.c: Convert to use device tree.
From: David Miller @ 2011-03-04 21:10 UTC (permalink / raw)
To: ddaney
Cc: linux-mips, ralf, devicetree-discuss, grant.likely, linux-kernel,
netdev
In-Reply-To: <1299267744-17278-11-git-send-email-ddaney@caviumnetworks.com>
From: David Daney <ddaney@caviumnetworks.com>
Date: Fri, 4 Mar 2011 11:42:22 -0800
> Get the MDIO bus controller addresses from the device tree.
>
> Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* Re: [RFC PATCH v2 11/12] netdev: octeon_mgmt: Convert to use device tree.
From: David Miller @ 2011-03-04 21:10 UTC (permalink / raw)
To: ddaney
Cc: linux-mips, ralf, devicetree-discuss, grant.likely, linux-kernel,
netdev
In-Reply-To: <1299267744-17278-12-git-send-email-ddaney@caviumnetworks.com>
From: David Daney <ddaney@caviumnetworks.com>
Date: Fri, 4 Mar 2011 11:42:23 -0800
> The device tree will supply the register bank base addresses, make
> register addressing relative to those. PHY connection is now
> described by the device tree.
>
> Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* Re: [RFC PATCH v2 12/12] staging: octeon_ethernet: Convert to use device tree.
From: David Miller @ 2011-03-04 21:10 UTC (permalink / raw)
To: ddaney
Cc: linux-mips, ralf, devicetree-discuss, grant.likely, linux-kernel,
netdev
In-Reply-To: <1299267744-17278-13-git-send-email-ddaney@caviumnetworks.com>
From: David Daney <ddaney@caviumnetworks.com>
Date: Fri, 4 Mar 2011 11:42:24 -0800
> Get MAC address and PHY connection from the device tree.
>
> Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* E-mail
From: Esther Leonia Marvis @ 2011-03-04 21:28 UTC (permalink / raw)
To: info
I was told by Mrs Helen Cole to send this mail to you as at last two (2) Months
ago, regarding you to contact her Lawyer.
Below are the details she gave me for you to contact her,
lawyer.
Name - Barrister Morgan Owen.
Email - barrmorgan6@myway.com
Please don't be angry for my late mail to you.
Thank you.
Esther Leonia Marvis.
^ permalink raw reply
* [PATCH 1/4] mcast: net_device dev not used
From: Hagen Paul Pfeifer @ 2011-03-04 21:45 UTC (permalink / raw)
To: netdev; +Cc: Hagen Paul Pfeifer
ip6_mc_source(), ip6_mc_msfilter() as well as ip6_mc_msfget() declare
and assign dev but do not use the variable afterwards.
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
---
net/ipv6/mcast.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 7b27d08..f2c9b69 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -319,7 +319,6 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
{
struct in6_addr *source, *group;
struct ipv6_mc_socklist *pmc;
- struct net_device *dev;
struct inet6_dev *idev;
struct ipv6_pinfo *inet6 = inet6_sk(sk);
struct ip6_sf_socklist *psl;
@@ -341,7 +340,6 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
rcu_read_unlock();
return -ENODEV;
}
- dev = idev->dev;
err = -EADDRNOTAVAIL;
@@ -455,7 +453,6 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf)
{
struct in6_addr *group;
struct ipv6_mc_socklist *pmc;
- struct net_device *dev;
struct inet6_dev *idev;
struct ipv6_pinfo *inet6 = inet6_sk(sk);
struct ip6_sf_socklist *newpsl, *psl;
@@ -478,7 +475,6 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf)
rcu_read_unlock();
return -ENODEV;
}
- dev = idev->dev;
err = 0;
@@ -549,7 +545,6 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
struct in6_addr *group;
struct ipv6_mc_socklist *pmc;
struct inet6_dev *idev;
- struct net_device *dev;
struct ipv6_pinfo *inet6 = inet6_sk(sk);
struct ip6_sf_socklist *psl;
struct net *net = sock_net(sk);
@@ -566,7 +561,6 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
rcu_read_unlock();
return -ENODEV;
}
- dev = idev->dev;
err = -EADDRNOTAVAIL;
/*
--
1.7.4.1.57.g0466.dirty
^ permalink raw reply related
* [PATCH 2/4] af_packet: struct socket declared/assigned but unused
From: Hagen Paul Pfeifer @ 2011-03-04 21:45 UTC (permalink / raw)
To: netdev; +Cc: Hagen Paul Pfeifer
In-Reply-To: <1299275106-11513-1-git-send-email-hagen@jauu.net>
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
---
net/packet/af_packet.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 5efef5b..b5362e9 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -966,7 +966,6 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
{
- struct socket *sock;
struct sk_buff *skb;
struct net_device *dev;
__be16 proto;
@@ -978,8 +977,6 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
int len_sum = 0;
int status = 0;
- sock = po->sk.sk_socket;
-
mutex_lock(&po->pg_vec_lock);
err = -EBUSY;
--
1.7.4.1.57.g0466.dirty
^ permalink raw reply related
* [PATCH 4/4] af_unix: remove unused struct sockaddr_un cruft
From: Hagen Paul Pfeifer @ 2011-03-04 21:45 UTC (permalink / raw)
To: netdev; +Cc: Hagen Paul Pfeifer
In-Reply-To: <1299275106-11513-1-git-send-email-hagen@jauu.net>
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
---
net/unix/af_unix.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 217fb7f..df5997d 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1567,7 +1567,6 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
struct sock_iocb *siocb = kiocb_to_siocb(kiocb);
struct sock *sk = sock->sk;
struct sock *other = NULL;
- struct sockaddr_un *sunaddr = msg->msg_name;
int err, size;
struct sk_buff *skb;
int sent = 0;
@@ -1590,7 +1589,6 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
err = sk->sk_state == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP;
goto out_err;
} else {
- sunaddr = NULL;
err = -ENOTCONN;
other = unix_peer(sk);
if (!other)
--
1.7.4.1.57.g0466.dirty
^ permalink raw reply related
* [PATCH 3/4] sctp: several declared/set but unused fixes
From: Hagen Paul Pfeifer @ 2011-03-04 21:45 UTC (permalink / raw)
To: netdev; +Cc: Hagen Paul Pfeifer
In-Reply-To: <1299275106-11513-1-git-send-email-hagen@jauu.net>
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
---
net/sctp/associola.c | 2 --
net/sctp/input.c | 3 ---
net/sctp/outqueue.c | 2 --
net/sctp/sm_make_chunk.c | 3 ---
net/sctp/socket.c | 2 --
net/sctp/ulpqueue.c | 7 +------
6 files changed, 1 insertions(+), 18 deletions(-)
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 5f1fb8b..6b04287 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -1089,7 +1089,6 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
base.inqueue.immediate);
struct sctp_endpoint *ep;
struct sctp_chunk *chunk;
- struct sock *sk;
struct sctp_inq *inqueue;
int state;
sctp_subtype_t subtype;
@@ -1097,7 +1096,6 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
/* The association should be held so we should be safe. */
ep = asoc->ep;
- sk = asoc->base.sk;
inqueue = &asoc->base.inqueue;
sctp_association_hold(asoc);
diff --git a/net/sctp/input.c b/net/sctp/input.c
index ea21924..826661b 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -948,14 +948,11 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct sk_buff *skb,
union sctp_addr addr;
union sctp_addr *paddr = &addr;
struct sctphdr *sh = sctp_hdr(skb);
- sctp_chunkhdr_t *ch;
union sctp_params params;
sctp_init_chunk_t *init;
struct sctp_transport *transport;
struct sctp_af *af;
- ch = (sctp_chunkhdr_t *) skb->data;
-
/*
* This code will NOT touch anything inside the chunk--it is
* strictly READ-ONLY.
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 8c6d379..26dc005 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -545,13 +545,11 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
struct sctp_transport *transport = pkt->transport;
sctp_xmit_t status;
struct sctp_chunk *chunk, *chunk1;
- struct sctp_association *asoc;
int fast_rtx;
int error = 0;
int timer = 0;
int done = 0;
- asoc = q->asoc;
lqueue = &q->retransmit;
fast_rtx = q->fast_rtx;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index b23428f..de98665 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -3375,7 +3375,6 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc,
struct sctp_fwdtsn_skip *skiplist)
{
struct sctp_chunk *retval = NULL;
- struct sctp_fwdtsn_chunk *ftsn_chunk;
struct sctp_fwdtsn_hdr ftsn_hdr;
struct sctp_fwdtsn_skip skip;
size_t hint;
@@ -3388,8 +3387,6 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc,
if (!retval)
return NULL;
- ftsn_chunk = (struct sctp_fwdtsn_chunk *)retval->subh.fwdtsn_hdr;
-
ftsn_hdr.new_cum_tsn = htonl(new_cum_tsn);
retval->subh.fwdtsn_hdr =
sctp_addto_chunk(retval, sizeof(ftsn_hdr), &ftsn_hdr);
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index b53b2eb..3951a10 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2928,7 +2928,6 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
unsigned int optlen)
{
struct sctp_sock *sp;
- struct sctp_endpoint *ep;
struct sctp_association *asoc = NULL;
struct sctp_setpeerprim prim;
struct sctp_chunk *chunk;
@@ -2936,7 +2935,6 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
int err;
sp = sctp_sk(sk);
- ep = sp->ep;
if (!sctp_addip_enable)
return -EPERM;
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index c7f7e49..1767818 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -105,11 +105,8 @@ int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
gfp_t gfp)
{
struct sk_buff_head temp;
- sctp_data_chunk_t *hdr;
struct sctp_ulpevent *event;
- hdr = (sctp_data_chunk_t *) chunk->chunk_hdr;
-
/* Create an event from the incoming chunk. */
event = sctp_ulpevent_make_rcvmsg(chunk->asoc, chunk, gfp);
if (!event)
@@ -743,11 +740,9 @@ static void sctp_ulpq_retrieve_ordered(struct sctp_ulpq *ulpq,
struct sk_buff *pos, *tmp;
struct sctp_ulpevent *cevent;
struct sctp_stream *in;
- __u16 sid, csid;
- __u16 ssn, cssn;
+ __u16 sid, csid, cssn;
sid = event->stream;
- ssn = event->ssn;
in = &ulpq->asoc->ssnmap->in;
event_list = (struct sk_buff_head *) sctp_event2skb(event)->prev;
--
1.7.4.1.57.g0466.dirty
^ permalink raw reply related
* Re: [PATCH net-next-2.6] inetpeer: seqlock optimization
From: Eric Dumazet @ 2011-03-04 22:13 UTC (permalink / raw)
To: David Miller; +Cc: xiaosuo, netdev
In-Reply-To: <20110304.124534.71142427.davem@davemloft.net>
Le vendredi 04 mars 2011 à 12:45 -0800, David Miller a écrit :
> From: David Miller <davem@davemloft.net>
> Date: Fri, 04 Mar 2011 11:17:05 -0800 (PST)
>
> > From: Eric Dumazet <eric.dumazet@gmail.com>
> > Date: Fri, 04 Mar 2011 16:09:08 +0100
> >
> >> Here is a patch to implement this idea.
> >
> > Applied, thanks Eric!
>
> Unfortunately, I have to revert, the lockdep annotations needs to
> be updated:
>
> net/ipv4/inetpeer.c: In function ‘peer_avl_rebalance’:
> net/ipv4/inetpeer.c:274:10: error: ‘seqlock_t’ has no member named ‘dep_map’
Oops thats right, here is an updated version.
Thanks
[PATCH net-next-2.6] inetpeer: seqlock optimization
David noticed :
------------------
Eric, I was profiling the non-routing-cache case and something that
stuck out is the case of calling inet_getpeer() with create==0.
If an entry is not found, we have to redo the lookup under a spinlock
to make certain that a concurrent writer rebalancing the tree does
not "hide" an existing entry from us.
This makes the case of a create==0 lookup for a not-present entry
really expensive. It is on the order of 600 cpu cycles on my
Niagara2.
I added a hack to not do the relookup under the lock when create==0
and it now costs less than 300 cycles.
This is now a pretty common operation with the way we handle COW'd
metrics, so I think it's definitely worth optimizing.
-----------------
One solution is to use a seqlock instead of a spinlock to protect struct
inet_peer_base.
After a failed avl tree lookup, we can easily detect if a writer did
some changes during our lookup. Taking the lock and redo the lookup is
only necessary in this case.
Note: Add one private rcu_deref_locked() macro to place in one spot the
access to spinlock included in seqlock.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
V2: updated lockdep annotations
net/ipv4/inetpeer.c | 75 +++++++++++++++++++-----------------------
1 files changed, 35 insertions(+), 40 deletions(-)
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 48f8d45..f604ffd 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -81,19 +81,19 @@ static const struct inet_peer peer_fake_node = {
struct inet_peer_base {
struct inet_peer __rcu *root;
- spinlock_t lock;
+ seqlock_t lock;
int total;
};
static struct inet_peer_base v4_peers = {
.root = peer_avl_empty_rcu,
- .lock = __SPIN_LOCK_UNLOCKED(v4_peers.lock),
+ .lock = __SEQLOCK_UNLOCKED(v4_peers.lock),
.total = 0,
};
static struct inet_peer_base v6_peers = {
.root = peer_avl_empty_rcu,
- .lock = __SPIN_LOCK_UNLOCKED(v6_peers.lock),
+ .lock = __SEQLOCK_UNLOCKED(v6_peers.lock),
.total = 0,
};
@@ -177,6 +177,9 @@ static int addr_compare(const struct inetpeer_addr *a,
return 0;
}
+#define rcu_deref_locked(X, BASE) \
+ rcu_dereference_protected(X, lockdep_is_held(&(BASE)->lock.lock))
+
/*
* Called with local BH disabled and the pool lock held.
*/
@@ -187,8 +190,7 @@ static int addr_compare(const struct inetpeer_addr *a,
\
stackptr = _stack; \
*stackptr++ = &_base->root; \
- for (u = rcu_dereference_protected(_base->root, \
- lockdep_is_held(&_base->lock)); \
+ for (u = rcu_deref_locked(_base->root, _base); \
u != peer_avl_empty; ) { \
int cmp = addr_compare(_daddr, &u->daddr); \
if (cmp == 0) \
@@ -198,8 +200,7 @@ static int addr_compare(const struct inetpeer_addr *a,
else \
v = &u->avl_right; \
*stackptr++ = v; \
- u = rcu_dereference_protected(*v, \
- lockdep_is_held(&_base->lock)); \
+ u = rcu_deref_locked(*v, _base); \
} \
u; \
})
@@ -246,13 +247,11 @@ static struct inet_peer *lookup_rcu_bh(const struct inetpeer_addr *daddr,
struct inet_peer __rcu **v; \
*stackptr++ = &start->avl_left; \
v = &start->avl_left; \
- for (u = rcu_dereference_protected(*v, \
- lockdep_is_held(&base->lock)); \
+ for (u = rcu_deref_locked(*v, base); \
u->avl_right != peer_avl_empty_rcu; ) { \
v = &u->avl_right; \
*stackptr++ = v; \
- u = rcu_dereference_protected(*v, \
- lockdep_is_held(&base->lock)); \
+ u = rcu_deref_locked(*v, base); \
} \
u; \
})
@@ -271,21 +270,16 @@ static void peer_avl_rebalance(struct inet_peer __rcu **stack[],
while (stackend > stack) {
nodep = *--stackend;
- node = rcu_dereference_protected(*nodep,
- lockdep_is_held(&base->lock));
- l = rcu_dereference_protected(node->avl_left,
- lockdep_is_held(&base->lock));
- r = rcu_dereference_protected(node->avl_right,
- lockdep_is_held(&base->lock));
+ node = rcu_deref_locked(*nodep, base);
+ l = rcu_deref_locked(node->avl_left, base);
+ r = rcu_deref_locked(node->avl_right, base);
lh = node_height(l);
rh = node_height(r);
if (lh > rh + 1) { /* l: RH+2 */
struct inet_peer *ll, *lr, *lrl, *lrr;
int lrh;
- ll = rcu_dereference_protected(l->avl_left,
- lockdep_is_held(&base->lock));
- lr = rcu_dereference_protected(l->avl_right,
- lockdep_is_held(&base->lock));
+ ll = rcu_deref_locked(l->avl_left, base);
+ lr = rcu_deref_locked(l->avl_right, base);
lrh = node_height(lr);
if (lrh <= node_height(ll)) { /* ll: RH+1 */
RCU_INIT_POINTER(node->avl_left, lr); /* lr: RH or RH+1 */
@@ -296,10 +290,8 @@ static void peer_avl_rebalance(struct inet_peer __rcu **stack[],
l->avl_height = node->avl_height + 1;
RCU_INIT_POINTER(*nodep, l);
} else { /* ll: RH, lr: RH+1 */
- lrl = rcu_dereference_protected(lr->avl_left,
- lockdep_is_held(&base->lock)); /* lrl: RH or RH-1 */
- lrr = rcu_dereference_protected(lr->avl_right,
- lockdep_is_held(&base->lock)); /* lrr: RH or RH-1 */
+ lrl = rcu_deref_locked(lr->avl_left, base);/* lrl: RH or RH-1 */
+ lrr = rcu_deref_locked(lr->avl_right, base);/* lrr: RH or RH-1 */
RCU_INIT_POINTER(node->avl_left, lrr); /* lrr: RH or RH-1 */
RCU_INIT_POINTER(node->avl_right, r); /* r: RH */
node->avl_height = rh + 1; /* node: RH+1 */
@@ -314,10 +306,8 @@ static void peer_avl_rebalance(struct inet_peer __rcu **stack[],
} else if (rh > lh + 1) { /* r: LH+2 */
struct inet_peer *rr, *rl, *rlr, *rll;
int rlh;
- rr = rcu_dereference_protected(r->avl_right,
- lockdep_is_held(&base->lock));
- rl = rcu_dereference_protected(r->avl_left,
- lockdep_is_held(&base->lock));
+ rr = rcu_deref_locked(r->avl_right, base);
+ rl = rcu_deref_locked(r->avl_left, base);
rlh = node_height(rl);
if (rlh <= node_height(rr)) { /* rr: LH+1 */
RCU_INIT_POINTER(node->avl_right, rl); /* rl: LH or LH+1 */
@@ -328,10 +318,8 @@ static void peer_avl_rebalance(struct inet_peer __rcu **stack[],
r->avl_height = node->avl_height + 1;
RCU_INIT_POINTER(*nodep, r);
} else { /* rr: RH, rl: RH+1 */
- rlr = rcu_dereference_protected(rl->avl_right,
- lockdep_is_held(&base->lock)); /* rlr: LH or LH-1 */
- rll = rcu_dereference_protected(rl->avl_left,
- lockdep_is_held(&base->lock)); /* rll: LH or LH-1 */
+ rlr = rcu_deref_locked(rl->avl_right, base);/* rlr: LH or LH-1 */
+ rll = rcu_deref_locked(rl->avl_left, base);/* rll: LH or LH-1 */
RCU_INIT_POINTER(node->avl_right, rll); /* rll: LH or LH-1 */
RCU_INIT_POINTER(node->avl_left, l); /* l: LH */
node->avl_height = lh + 1; /* node: LH+1 */
@@ -372,7 +360,7 @@ static void unlink_from_pool(struct inet_peer *p, struct inet_peer_base *base)
do_free = 0;
- spin_lock_bh(&base->lock);
+ write_seqlock_bh(&base->lock);
/* Check the reference counter. It was artificially incremented by 1
* in cleanup() function to prevent sudden disappearing. If we can
* atomically (because of lockless readers) take this last reference,
@@ -392,8 +380,7 @@ static void unlink_from_pool(struct inet_peer *p, struct inet_peer_base *base)
/* look for a node to insert instead of p */
struct inet_peer *t;
t = lookup_rightempty(p, base);
- BUG_ON(rcu_dereference_protected(*stackptr[-1],
- lockdep_is_held(&base->lock)) != t);
+ BUG_ON(rcu_deref_locked(*stackptr[-1], base) != t);
**--stackptr = t->avl_left;
/* t is removed, t->daddr > x->daddr for any
* x in p->avl_left subtree.
@@ -409,7 +396,7 @@ static void unlink_from_pool(struct inet_peer *p, struct inet_peer_base *base)
base->total--;
do_free = 1;
}
- spin_unlock_bh(&base->lock);
+ write_sequnlock_bh(&base->lock);
if (do_free)
call_rcu_bh(&p->rcu, inetpeer_free_rcu);
@@ -477,12 +464,16 @@ struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
struct inet_peer __rcu **stack[PEER_MAXDEPTH], ***stackptr;
struct inet_peer_base *base = family_to_base(daddr->family);
struct inet_peer *p;
+ unsigned int sequence;
+ int invalidated;
/* Look up for the address quickly, lockless.
* Because of a concurrent writer, we might not find an existing entry.
*/
rcu_read_lock_bh();
+ sequence = read_seqbegin(&base->lock);
p = lookup_rcu_bh(daddr, base);
+ invalidated = read_seqretry(&base->lock, sequence);
rcu_read_unlock_bh();
if (p) {
@@ -493,14 +484,18 @@ struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
return p;
}
+ /* If no writer did a change during our lookup, we can return early. */
+ if (!create && !invalidated)
+ return NULL;
+
/* retry an exact lookup, taking the lock before.
* At least, nodes should be hot in our cache.
*/
- spin_lock_bh(&base->lock);
+ write_seqlock_bh(&base->lock);
p = lookup(daddr, stack, base);
if (p != peer_avl_empty) {
atomic_inc(&p->refcnt);
- spin_unlock_bh(&base->lock);
+ write_sequnlock_bh(&base->lock);
/* Remove the entry from unused list if it was there. */
unlink_from_unused(p);
return p;
@@ -524,7 +519,7 @@ struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
link_to_pool(p, base);
base->total++;
}
- spin_unlock_bh(&base->lock);
+ write_sequnlock_bh(&base->lock);
if (base->total >= inet_peer_threshold)
/* Remove one less-recently-used entry. */
^ permalink raw reply related
* Re: Jetway JAD3RTLANG, Daughter Board, 3x GigaBit LAN does not work correctly
From: Francois Romieu @ 2011-03-04 22:25 UTC (permalink / raw)
To: Markus Feldmann; +Cc: netdev
In-Reply-To: <ikovkn$bn8$1@dough.gmane.org>
Markus Feldmann <feldmann_markus@gmx.de> :
> Hi All,
>
> i have a mini-ITX server with the mainboard "Jetway JNF92-270-LF"
> with the daughterboard "Jetway JAD3RTLANG, 3x GigaBit LAN".
>
> My current kernel is 2.6.36.4 and i can only connect over one of the
> network interfaces of my daughterboard at the time.
?
Are you worried that eth1 keeps going up/down or do you mean
something else ?
--
Ueimor
^ permalink raw reply
* Re: [PATCH] e1000: power off PHY after reset when interface is down
From: Prasanna Panchamukhi @ 2011-03-04 22:41 UTC (permalink / raw)
To: Jeff Kirsher
Cc: Allan, Bruce W, Pieper, Jeffrey E,
e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org
In-Reply-To: <4D71298F.6090009@riverbed.com>
On 03/04/2011 10:03 AM, Prasanna Panchamukhi wrote:
> On 03/04/2011 12:19 AM, Jeff Kirsher wrote:
>> On Wed, Feb 23, 2011 at 16:02, Jeff Kirsher<jeffrey.t.kirsher@intel.com> wrote:
>>> On Tue, 2011-02-22 at 17:25 -0800, prasanna.panchamukhi@riverbed.com
>>> wrote:
>>>> From: Prasanna S. Panchamukhi<prasanna.panchamukhi@riverbed.com>
>>>>
>>>> Some Phys supported by the e1000 driver do not remain powered off
>>>> across
>>>> a reset of the device when the interface is down, e.g. on 82546.
>>>> This patch powers down (only when WoL is disabled) the PHY after reset
>>>> if
>>>> the interface is down and ethtool diagnostics are not currently
>>>> running.
>>>>
>>>> Similar problem was see on 82571 controller and was fixed in e1000e
>>>> driver
>>>> by Bruce Allan.
>>>> Please refer commit 31dbe5b4ac6fca72dec946e4d0fa7f0913f1d9b1 for
>>>> details.
>>>>
>>>> Signed-off-by: Prasanna S. Panchamukhi
>>>> <prasanna.panchamukhi@riverbed.com>
>>>> ---
>>>> drivers/net/e1000/e1000_ethtool.c | 27 +++++++++++++++++++--------
>>>> drivers/net/e1000/e1000_main.c | 7 +++++++
>>>> 2 files changed, 26 insertions(+), 8 deletions(-)
>>> Thanks Prasanna! I have added the patch to my queue of e1000 patches.
>>>
>> Prasanna-
>> Here is what we found during validating your patch:
>>
>> The behavior of 82546 device(s) seems to be identical with/without this patch
>> applied. 82546GB (LOM), dev_id 1079 powers down (with wol disabled) after
>> ifdown, but powers back up after approx. 10 seconds. 82546EB (NIC), dev_id
>> 1010 powers down (with wol disabled) after ifdown. Both of the above
>> behaviors are the same with and without the patch applied. Also, if this patch
>> DID work as expected, it should print a message after a reset, such as "Cannot
>> restart autonegotiation: Resource temporarily unavailable", which would mirror
>> the behavior of e1000e.
>>
> Hi Jeff,
>
> Below is the test case we run verify this fix:
>
> $ ethtool -s eth0 wol d
> $ ifconfig eth0 up
> $ mii-tool eth0
> eth0: negotiated 100baseTx-FD, link ok
> $ ifconfig eth0 down
> $ mii-tool eth0
> eth0: no link
> $ ethtool -s eth0 autoneg on (doesn't really matter what we do here)
> $ mii-tool eth0
> eth0: negotiated 100baseTx-FD, link ok (this should be: eth0: no link)
>
> I will re-run the test& check if does not fix this.
Hi Jeff,
I re-verified it & confirm that, this patch fixes the problem.
Please let me know if you have any issues.
Thanks
Prasanna
> Thanks
> Prasanna
>
>
>
^ permalink raw reply
* Re: [PATCH net-next-2.6] inetpeer: seqlock optimization
From: David Miller @ 2011-03-04 22:44 UTC (permalink / raw)
To: eric.dumazet; +Cc: xiaosuo, netdev
In-Reply-To: <1299276839.2758.50.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 04 Mar 2011 23:13:59 +0100
> Le vendredi 04 mars 2011 à 12:45 -0800, David Miller a écrit :
>> From: David Miller <davem@davemloft.net>
>> Date: Fri, 04 Mar 2011 11:17:05 -0800 (PST)
>>
>> > From: Eric Dumazet <eric.dumazet@gmail.com>
>> > Date: Fri, 04 Mar 2011 16:09:08 +0100
>> >
>> >> Here is a patch to implement this idea.
>> >
>> > Applied, thanks Eric!
>>
>> Unfortunately, I have to revert, the lockdep annotations needs to
>> be updated:
>>
>> net/ipv4/inetpeer.c: In function ‘peer_avl_rebalance’:
>> net/ipv4/inetpeer.c:274:10: error: ‘seqlock_t’ has no member named ‘dep_map’
>
> Oops thats right, here is an updated version.
Applied, thanks Eric!
With this and the following patch applied to my no-routing-cache tree,
output route lookup on my Niagara2 is down to 2966 cycles! For reference
with just the plain routing cache removal, it was as much as 3832 cycles.
udpflood is a lot faster too, with plain routing cache removal it ran as:
bash$ time ./bin/udpflood -l 10000000 10.2.2.11
real 3m9.921s
user 0m9.520s
sys 3m0.440s
But now it's:
bash$ time ./bin/udpflood -l 10000000 10.2.2.11
real 2m45.903s
user 0m8.640s
sys 2m37.280s
:-)
--------------------
ipv4: Optimize flow initialization in output route lookup.
We burn a lot of useless cycles, cpu store buffer traffic, and
memory operations memset()'ing the on-stack flow used to perform
output route lookups in __ip_route_output_key().
Only the first half of the flow object members even matter for
output route lookups in this context, specifically:
FIB rules matching cares about:
dst, src, tos, iif, oif, mark
FIB trie lookup cares about:
dst
FIB semantic match cares about:
tos, scope, oif
Therefore only initialize these specific members and elide the
memset entirely.
On Niagara2 this kills about ~300 cycles from the output route
lookup path.
Likely, we can take things further, since all callers of output
route lookups essentially throw away the on-stack flow they use.
So they don't care if we use it as a scratch-pad to compute the
final flow key.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/ipv4/route.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 04b8954..e3a5a89 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1670,14 +1670,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
struct rtable *__ip_route_output_key(struct net *net, const struct flowi *oldflp)
{
u32 tos = RT_FL_TOS(oldflp);
- struct flowi fl = { .fl4_dst = oldflp->fl4_dst,
- .fl4_src = oldflp->fl4_src,
- .fl4_tos = tos & IPTOS_RT_MASK,
- .fl4_scope = ((tos & RTO_ONLINK) ?
- RT_SCOPE_LINK : RT_SCOPE_UNIVERSE),
- .mark = oldflp->mark,
- .iif = net->loopback_dev->ifindex,
- .oif = oldflp->oif };
+ struct flowi fl;
struct fib_result res;
unsigned int flags = 0;
struct net_device *dev_out = NULL;
@@ -1688,6 +1681,15 @@ struct rtable *__ip_route_output_key(struct net *net, const struct flowi *oldflp
res.r = NULL;
#endif
+ fl.oif = oldflp->oif;
+ fl.iif = net->loopback_dev->ifindex;
+ fl.mark = oldflp->mark;
+ fl.fl4_dst = oldflp->fl4_dst;
+ fl.fl4_src = oldflp->fl4_src;
+ fl.fl4_tos = tos & IPTOS_RT_MASK;
+ fl.fl4_scope = ((tos & RTO_ONLINK) ?
+ RT_SCOPE_LINK : RT_SCOPE_UNIVERSE);
+
rcu_read_lock();
if (oldflp->fl4_src) {
rth = ERR_PTR(-EINVAL);
--
1.7.4.1
^ permalink raw reply related
* Re: 2.6.37 regression: adding main interface to a bridge breaks vlan interface RX
From: Francois Romieu @ 2011-03-04 22:41 UTC (permalink / raw)
To: chriss; +Cc: netdev
In-Reply-To: <loom.20110304T202925-568@post.gmane.org>
chriss <mail_to_chriss@gmx.net> :
[...]
> I hope i'm doing it right. i checked out the
> 'git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git'
>
> and will try to apply the patch you provided. please correct me if i'm wrong.
> I will report back.
I have tested it against davem's -next somewhere along -rc5 but it should be
fine as well.
--
Ueimor
^ permalink raw reply
* Re: [PATCH net-next-2.6] inetpeer: seqlock optimization
From: Eric Dumazet @ 2011-03-04 23:02 UTC (permalink / raw)
To: David Miller; +Cc: xiaosuo, netdev
In-Reply-To: <20110304.144448.115945732.davem@davemloft.net>
Le vendredi 04 mars 2011 à 14:44 -0800, David Miller a écrit :
> Applied, thanks Eric!
>
> With this and the following patch applied to my no-routing-cache tree,
> output route lookup on my Niagara2 is down to 2966 cycles! For reference
> with just the plain routing cache removal, it was as much as 3832 cycles.
>
> udpflood is a lot faster too, with plain routing cache removal it ran as:
>
> bash$ time ./bin/udpflood -l 10000000 10.2.2.11
> real 3m9.921s
> user 0m9.520s
> sys 3m0.440s
>
> But now it's:
>
> bash$ time ./bin/udpflood -l 10000000 10.2.2.11
> real 2m45.903s
> user 0m8.640s
> sys 2m37.280s
>
> :-)
>
Nice indeed :)
> --------------------
> ipv4: Optimize flow initialization in output route lookup.
>
> We burn a lot of useless cycles, cpu store buffer traffic, and
> memory operations memset()'ing the on-stack flow used to perform
> output route lookups in __ip_route_output_key().
>
> Only the first half of the flow object members even matter for
> output route lookups in this context, specifically:
>
> FIB rules matching cares about:
>
> dst, src, tos, iif, oif, mark
>
> FIB trie lookup cares about:
>
> dst
>
> FIB semantic match cares about:
>
> tos, scope, oif
>
> Therefore only initialize these specific members and elide the
> memset entirely.
>
> On Niagara2 this kills about ~300 cycles from the output route
> lookup path.
>
> Likely, we can take things further, since all callers of output
> route lookups essentially throw away the on-stack flow they use.
> So they don't care if we use it as a scratch-pad to compute the
> final flow key.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
> net/ipv4/route.c | 18 ++++++++++--------
> 1 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 04b8954..e3a5a89 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -1670,14 +1670,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
> struct rtable *__ip_route_output_key(struct net *net, const struct flowi *oldflp)
> {
> u32 tos = RT_FL_TOS(oldflp);
> - struct flowi fl = { .fl4_dst = oldflp->fl4_dst,
> - .fl4_src = oldflp->fl4_src,
> - .fl4_tos = tos & IPTOS_RT_MASK,
> - .fl4_scope = ((tos & RTO_ONLINK) ?
> - RT_SCOPE_LINK : RT_SCOPE_UNIVERSE),
> - .mark = oldflp->mark,
> - .iif = net->loopback_dev->ifindex,
> - .oif = oldflp->oif };
> + struct flowi fl;
> struct fib_result res;
> unsigned int flags = 0;
> struct net_device *dev_out = NULL;
> @@ -1688,6 +1681,15 @@ struct rtable *__ip_route_output_key(struct net *net, const struct flowi *oldflp
> res.r = NULL;
> #endif
>
> + fl.oif = oldflp->oif;
> + fl.iif = net->loopback_dev->ifindex;
> + fl.mark = oldflp->mark;
> + fl.fl4_dst = oldflp->fl4_dst;
> + fl.fl4_src = oldflp->fl4_src;
> + fl.fl4_tos = tos & IPTOS_RT_MASK;
> + fl.fl4_scope = ((tos & RTO_ONLINK) ?
> + RT_SCOPE_LINK : RT_SCOPE_UNIVERSE);
> +
> rcu_read_lock();
> if (oldflp->fl4_src) {
> rth = ERR_PTR(-EINVAL);
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
^ permalink raw reply
* Re: Jetway JAD3RTLANG, Daughter Board, 3x GigaBit LAN does not work correctly
From: Markus Feldmann @ 2011-03-04 23:41 UTC (permalink / raw)
To: netdev
In-Reply-To: <20110304222534.GA13681@electric-eye.fr.zoreil.com>
Am 04.03.2011 23:25, schrieb Francois Romieu:
> Are you worried that eth1 keeps going up/down or do you mean
> something else ?
I mean when two computers try to connect to my router, then not both can
establish a connection. Sometimes only one computer can connect.
regards markus
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox