Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 1/2] genetlink: trigger BUG_ON if a group name is too long
From: Yinghai Lu @ 2013-03-20 21:01 UTC (permalink / raw)
  To: David Miller, Zhang Rui; +Cc: yamato, netdev
In-Reply-To: <20130320.120705.58997943737455552.davem@davemloft.net>

On Wed, Mar 20, 2013 at 9:07 AM, David Miller <davem@davemloft.net> wrote:
> From: Masatake YAMATO <yamato@redhat.com>
> Date: Tue, 19 Mar 2013 20:47:27 +0900
>
>> Trigger BUG_ON if a group name is longer than GENL_NAMSIZ.
>>
>> Signed-off-by: Masatake YAMATO <yamato@redhat.com>
>
> Applied, thanks.

catch one in

drivers/thermal/thermal_sys.c::genetlink_init

        result = genl_register_mc_group(&thermal_event_genl_family,
                                        &thermal_event_mcgrp);

and

static struct genl_multicast_group thermal_event_mcgrp = {
        .name = THERMAL_GENL_MCAST_GROUP_NAME,
};

#define THERMAL_GENL_MCAST_GROUP_NAME           "thermal_mc_group"

that string len 16.

^ permalink raw reply

* pull request: wireless-next 2013-03-20
From: John W. Linville @ 2013-03-20 20:10 UTC (permalink / raw)
  To: davem; +Cc: linux-wireless, netdev

[-- Attachment #1: Type: text/plain, Size: 35527 bytes --]

Dave,

This is a big pull request for new features intended for the 3.10
stream...

Regarding mac80211, Johannes says:

"First, I merged mac80211/master to avoid some conflicts. This brings in
a bunch of fixes you're already familiar with. For real -next material,
I have a whole bunch of minstrel work, minstrel_ht from Felix and legacy
minstrel from Thomas (Huehn). The other Thomas (Pedersen) did a number
of changes in mesh to allow userspace peering management even when the
mesh isn't secured. Stanislaw changes suspend/resume to always
disconnect the networks. This is typically already done by
network-manager so won't make a huge difference for most users, but
fixes a number problems, particularly with USB drivers that can easily
disconnect while suspended. Ilan has a small change to allow mac80211
drivers to differentiate remain-on-channel reasons, and Jouni extends
nl80211 to allow fast roaming with full-MAC devices. I have a fairly
large number of patches as well, many of them fairly simple cleanups,
but also allowing split wiphy dumps and adding back the full wiphy
information in nl80211, station entry change checking and more VHT work
including VHT capability overrides (mostly for testing purposes)."

And for iwlwifi, Johannes says:

"Here, I also merged iwlwifi-fixes to avoid conflicts, and otherwise have
various cleanups and improvements on the MVM driver, along with a few
throughout the driver. Other than Bluetooth Coexistence from Emmanuel
there's no over-arching theme, so listing them would pretty much
reproduce the shortlog."

Regarding NFC, Samuel says:

"The 2 features we have with this one are:

- An LLCP Service Name Lookup (SNL) netlink interface for querying LLCP
  service availability from user space.
  Along the way, Thierry also improved the existing SNL interface for
  aggregating SNL responses.

- An initial LLCP socket options implementation, for setting the Receive
  Window (RW) and the Maximum Information Unit Extension (MIUX) per socket.
  This is need for the LLCP validation tests.

We also have a microread MEI build failure here: I am not sending this one to
3.9 because the MEI bus code is not there yet, so it won't break for anyone
else than me."

And for ath6kl, Kalle says:

"I added tracing support to ath6kl, along with a new Kconfig option. Now
there's also a workaround to reset USB devices when the firmware upload
fails, this happened when host was warm rebooted. There are also quite a
few small fixes or cleanup."

On top of all that, there is the usual bundle of driver updates
with new features, new hardware support and the like mixed-in.
The ath9k, b43, brcmfmac, mwifiex, rt2800, and wil6210 drivers
are all well-represented, and a few other drivers are hit as well.
I also pulled-in the wireless fixes tree in order to resolve some
pending merge conflicts.

Please let me know if there are problems!

Thanks,

John

---

The following changes since commit 4c1d8d0617a39c8325a7c2fd80ac14bf40fd8cc6:

  net: fix psock_fanout selftest bind error message (2013-03-20 13:42:41 -0400)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git for-davem

for you to fetch changes up to 5470b462c3f0c6fa980c320968a165bd0f34ca8d:

  Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem (2013-03-20 15:24:57 -0400)

----------------------------------------------------------------

Amitkumar Karwar (3):
      mwifiex: shorten the host sleep configuration macro names
      mwifiex: add "ethtool wol" command support
      mwifiex: add WOWLAN support

Amnon Paz (1):
      iwlwifi: fix indirect write bug

Andrei Epure (2):
      wireless:rtlwifi: replaced kmalloc+memcpy with kmemdup
      ath: changed kmalloc to kmemdup

Arend van Spriel (11):
      brcmfmac: introduce tracepoints for message logging
      brcmfmac: make debug module parameter more clear
      brcmfmac: cleanup module information macros
      brcmfmac: remove null-pointer check in .sched_scan_start() callback
      brcmfmac: increase required skbuff headroom for firmware signalling
      brcmutil: add macros for setting bitfields using mask/shift operations
      brcmfmac: add support for TLV based firmware signalling
      brcmfmac: release transmit packet in brcmf_txcomplete()
      brcmfmac: assure brcmf_txcomplete() is called in failure paths
      brcmutil: add dequeue function with filtering
      brcmfmac: add parameter to brcmf_proto_hdrpush() for data offset

Ashok Nagarajan (1):
      mwifiex: Trigger a card reset on reaching tx_timeout threshold

Avinash Patil (1):
      mwifiex: modify skb->truesize for PCIE Rx

Ben Greear (2):
      ath9k: Report txerr-filtered errors in debugfs.
      ath9k: Report rx-crc-errors in ethtool stats.

Beni Lev (2):
      iwlwifi: 7000: disable HT greenfield support
      iwlwifi: disable greenfield transmissions as a workaround

Bing Zhao (4):
      mwifiex: remove static forward declarations in pcie.c
      mwifiex: fix [-Wunused-function] warnings on pcie suspend/resume
      mwifiex: avoid [-Wmaybe-uninitialized] warnings in pcie.c
      mwifiex: fix potential null dereference 'mef_entry'

Bob Copeland (1):
      ath9k: simplify ATH_EP_RND

Chen Gang (1):
      drivers/net/wireless/ath/wil6210: Makefile, only -Werror when no -W* in EXTRA_CFLAGS

Christian Lamparter (1):
      carl9170: fix frame drop and WARN due to minstrel_ht change

Dan Carpenter (3):
      ray_cs: read past the end of the array
      ath6kl: small cleanup in ath6kl_htc_pipe_rx_complete()
      ath6kl: small cleanup in ath6kl_htc_pipe_rx_complete()

Dor Shaish (2):
      iwlwifi: mvm: don't use cts to self
      iwlwifi: mvm: Change NVM default section read size

Emmanuel Grumbach (15):
      iwlwifi: a few fixes in license
      iwlwifi: mvm: respect disable Tx AGG parameter
      iwlwifi: mvm: free AGG queue when we STA is removed
      iwlwifi: mvm: support IEEE80211_AMPDU_TX_STOP_FLUSH
      iwlwifi: dvm: pad iwl_compressed_ba_resp
      iwlwifi: make device configuration bus agnostic
      iwlwifi: mvm: add CARD_STATE_NOTIFICATION to the cmd strings
      iwlwifi: mvm: add BT Coex FW API
      iwlwifi: mvm: begin basic BT-Coex implementation
      iwlwifi: mvm: handle BT-coex notification
      iwlwifi: mvm: update SMPS when BT gets active
      iwlwifi: mvm: export last bt_notif through debugfs
      iwlwifi: mvm: update firmware API - MAC ID in RX
      iwlwifi: move firmware restart debugfs hook to op_mode
      iwlwifi: mvm: the SCD byte count is a TLV flag

Eytan Lifshitz (1):
      iwlwifi: mvm: advertise VHT capabilities

Felix Fietkau (7):
      ieee80211: mark 802.11 related structs as being 2-byte aligned
      mac80211/minstrel_ht: improve accuracy of throughput metric at high data rates
      mac80211/minstrel_ht: improve max_prob_rate selection
      minstrel_ht: increase sampling frequency
      mac80211/minstrel_ht: increase sampling frequency of some slower rates
      mac80211/minstrel_ht: fix spacing between sample attempts
      mac80211/minstrel_ht: disable multiple consecutive sample attempts

Hauke Mehrtens (2):
      ssb: fix unaligned access to mac address
      brcmsmac: export firmware version to ethtool

Helmut Schaa (2):
      rt2x00: Revert "rt2x00: remove unused argument"
      rt2x00: Fix tx status reporting for reordered frames in rt2800pci

Ilan Peer (3):
      mac80211: Allow drivers to differentiate between ROC types
      iwlwifi: mvm: Update MAC context filter flags
      iwlwifi: mvm: Add support for additional addresses

Jiri Slaby (1):
      ath5k: cleanup channel to eprom_mode function

Joe Perches (2):
      ssb: pci: Standardize a function to get mac address
      ssb: Convert ssb_printk to ssb_<level>

Johannes Berg (36):
      Merge remote-tracking branch 'mac80211/master' into HEAD
      cfg80211: clean up mesh plink station change API
      cfg80211: constify station parameter pointers
      cfg80211: clean up station WME attribute parsing
      cfg80211: unify station WME parsing
      cfg80211: comprehensively check station changes
      mac80211: clarify alignment comment
      nl80211: allow splitting wiphy information in dumps
      nl80211: conditionally add back radar information
      nl80211: conditionally add back TCP WoWLAN information
      wireless: move sequence number arithmetic to ieee80211.h
      nl80211: re-add channel width and extended capa advertising
      cfg80211: move exported event functions into nl80211
      wireless: remove unused VHT MCS defines
      cfg80211: add ability to override VHT capabilities
      mac80211: support VHT capability overrides
      cfg80211: refactor association parameters
      cfg80211: prohibit zero keepalive interval
      mac80211: remove IEEE80211_KEY_FLAG_WMM_STA
      mac80211: defer tailroom counter manipulation when roaming
      mac80211: flush keys when stopping AP
      mac80211: simplify AP interface stop
      mac80211: don't apply HT overrides to TDLS peers
      mac80211: fix HT capability overrides for AP station
      mac80211: restrict peer's VHT capabilities to own
      mac80211: add VHT capabilities station debugfs file
      cfg80211: enable TDLS on P2P client interfaces
      regulatory: allow VHT channels in world roaming
      Merge remote-tracking branch 'iwlwifi-fixes/master' into HEAD
      iwlwifi: support DSSS/CCK mode in 40 MHz
      iwlwifi: use __get_str in tracing
      iwlwifi: mvm: implement remote wake
      iwlwifi: mvm: set up initial SMPS/NSS station info
      iwlwifi: mvm: don't read system time when modifying AP/GO MAC
      iwlwifi: allow selecting only MVM driver
      iwlwifi: export symbols only conditionally

John W. Linville (6):
      Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211-next
      Merge branch 'for-john' of git://git.kernel.org/.../iwlwifi/iwlwifi-next
      Merge tag 'nfc-next-3.10-1' of git://git.kernel.org/.../sameo/nfc-next
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless
      Merge tag 'for-linville-20130318' of git://github.com/kvalo/ath6kl
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless-next into for-davem

Jonas Gorski (1):
      mwl8k: don't overwrite regulatory settings on fw reload

Jouni Malinen (1):
      cfg80211: Extend support for IEEE 802.11r Fast BSS Transition

Jussi Kivilinna (1):
      rndis_wlan: update email address

Kalle Valo (14):
      ath6kl: print firmware capabilities
      ath6kl: cleanup ath6kl_reset_device()
      ath6kl: fix usb related error handling and warnings
      ath6kl: cold reset target after host warm boot
      ath6kl: add tracing support and tracing points for wmi packets
      ath6kl: add tracing points for sdio transfers
      ath6kl: add tracing point for hif irqs
      ath6kl: adding tracing points for htc_mbox
      ath6kl: convert ath6kl_info/err/warn macros to real functions
      ath6kl: add tracing support to log functions
      ath6kl: add tracing support to debug message macros
      ath6kl: add an extra band check to ath6kl_wmi_beginscan_cmd()
      ath6kl: remove false check from ath6kl_rx()
      ath6kl: fix size_t printf warnings

Larry Finger (1):
      ssb: pci: Fix flipping of MAC address

Michal Pecio (1):
      orinoco_usb: don't release nonexistent firmware

Mohammed Shafi Shajakhan (5):
      ath6kl: Cosmetic change in checking for free vif slot
      ath6kl: Protect ath6kl_cfg80211_vif_cleanup using rtnl_locks
      ath6kl: Return error from ath6kl_bmi_done()
      ath6kl: Remove NETDEV_REGISTERED flag
      ath6kl: Fix a debugfs crash for USB devices

Myoungje Kim (1):
      ath6kl: Fix the byte alignment rule to avoid loss of bytes in a TCP segment

Nishant Sarmukadam (2):
      mwl8k: Adding support for 8764 4x4 AP
      mwl8k: Load 8764 firmware image

Piotr Haber (1):
      brcmsmac: radio on led support

Rafał Miłecki (17):
      bcma: ignore extra GMAC cores on BCM4706
      bcma: implement disabling PLLs
      b43: define BCMA wireless specific PLLs
      b43: HT-PHY: make it BCMA-only
      b43: HT-PHY: rename AFE defines
      b43: HT-PHY: add classifier control function
      b43: HT-PHY: move TX fix to the separated function
      b43: HT-PHY: implement spurious tone avoidance
      b43: HT-PHY: implement MAC reclocking
      b43: HT-PHY: implement CCA reset
      b43: HT-PHY: implement PA override
      b43: HT-PHY: implement controlling TX power control
      b43: HT-PHY: implement stopping sample tone playback
      b43: HT-PHY: implement playing sample tone
      b43: HT-PHY: implement RSSI polling
      b43: HT-PHY: setup TX power control
      b43: HT-PHY: enable basic TX power setup

Sachin Kamat (1):
      net: rfkill: Fix sparse warning in rfkill-regulator.c

Samuel Ortiz (5):
      NFC: microread: Fix MEI build failure
      NFC: llcp: Rename socket rw and miu fields
      NFC: llcp: Implement socket options
      NFC: llcp: Use socket specific link parameters before the local ones
      NFC: llcp: Remove redundant printk

Stanislaw Gruszka (32):
      mac80211: remove napi
      cfg80211/mac80211: disconnect on suspend
      mac80211: cleanup generic suspend/resume procedures
      mac80211: cleanup suspend/resume on managed mode
      mac80211: cleanup suspend/resume on ibss mode
      mac80211: cleanup suspend/resume on mesh mode
      mac80211: merge reconfig assign chanctx code
      rt2800: do not crash if spec->channels is NULL
      rt2800: 5592: early defines
      rt2800: 5592: add channels table
      rt2800: 5592: channel config stub
      rt2800: 5592: MAC registers initalization
      rt2800: 5592: BBP registers initialization
      rt2800: 5592: common BBP initialization
      rt2800: 5592: RF early registers initialization
      rt2800: 5592: initalize RF_R27 on older revisions
      rt2800: 5592: initalize BBP_R103 register on new revisions
      rt2800: 5592: initialize BBP_R138 register
      rt2800: 5592: initialize RF_38/39/30 registers
      rt2800: 5592: init frequency calibration
      rt2800: 5592: setup LDO_CFG0 when configuring channel
      rt2800: 5592: enable rf init
      rt2800: 5592: more channel switch registers settings (BBP & GLRT)
      rt2800: 5592: add iq calibration
      rt2800: rearrange bbp/rfcsr initialization
      rt2800: add write_with_rx_chain function
      rt2800: 5592: add AGC init
      rt2800: 5592: add chip specific vgc calculations
      rt2800: 5592: TXWI & RXWI descriptors size
      rt2800: 5592: add Kconfig
      rt2800: 5592: iq calibration for 5GHz
      rt2800: 5592: add more USB devices IDs

Stephen Hemminger (1):
      iwlegacy: fix sparse warnings

Sujith Manoharan (4):
      ath9k_hw: Remove CHANNEL_CW_INT
      ath9k_hw: Use helper functions to simplify HW reset
      ath9k_hw: Update initvals for AR9462
      ath9k_hw: Fix fixed antenna for AR9462

Syam Sidhardhan (1):
      rndis_wlan: Remove redundant NULL check before kfree

Thierry Escande (4):
      NFC: Add missing type policies for netlink attributes
      NFC: llcp: Service Name Lookup SDRES aggregation
      NFC: llcp: Service Name Lookup netlink interface
      NFC: llcp: Add cleanup support for unreplied SNL requests

Thomas Huehn (7):
      mac80211: merge EWMA calculation of minstrel_ht and minstrel
      mac80211: merge value scaling macros of minstrel_ht and minstrel
      mac80211: add documentation and verbose variable names in
      mac80211: extend minstrel's rate sampling to avoid unsampled rates
      mac80211: add lowest rate into minstrel's random rate sampling table
      mac80211: treat minstrel success probabilities below 10% as implausible
      mac80211: improve minstrels rate sorting by means of throughput & probability

Thomas Pedersen (6):
      nl80211: explicit userspace MPM
      cfg80211: rename mesh station types
      mac80211: support userspace MPM
      nl80211: user_mpm overrides auto_open_plinks
      mac80211: disallow changing auto_open_plinks
      mac80211: init mesh timer for user authed STAs

Tim Gardner (1):
      rt2x00: rt2x00pci_regbusy_read() - only print register access failure once

Vladimir Kondratiev (14):
      wil6210: Remove local implementation of dynamic hexdump
      wil6210: handle linkup/linkdown WMI events
      wil6210: handle WMI_BA_STATUS_EVENTID
      wil6210: do not set IE's for beacon
      wil6210: Fix garbage sent to the FW with wmi_set_ie()
      wil6210: refactor connect_worker
      wil6210: use cfg80211_inform_bss_frame()
      wil6210: report all received mgmt frames
      wil6210: fix FW error notification
      wil6210: use WLAN_CAPABILITY_DMG_TYPE_MASK
      wil6210: headers clean-up
      wil6210: new SW reset
      wil6210: sync with new firmware
      wil6210: temperature measurement

W. Trevor King (1):
      b43: Fix 'me' -> 'be' typo in Kconfig

Wei Yongjun (3):
      iwlwifi: convert to use simple_open()
      wil6210: convert to use simple_open()
      wil6210: remove unused including <linux/version.h>

Yogesh Ashok Powar (1):
      mwifiex: cleanup VHT cap

 MAINTAINERS                                        |    2 +-
 drivers/bcma/core.c                                |    8 +-
 drivers/bcma/main.c                                |    5 +
 drivers/net/wireless/ath/ath5k/ath5k.h             |    3 +-
 drivers/net/wireless/ath/ath5k/eeprom.c            |    6 +-
 drivers/net/wireless/ath/ath5k/eeprom.h            |    3 -
 drivers/net/wireless/ath/ath5k/phy.c               |   20 +-
 drivers/net/wireless/ath/ath5k/reset.c             |    4 +-
 drivers/net/wireless/ath/ath6kl/Kconfig            |    9 +
 drivers/net/wireless/ath/ath6kl/Makefile           |    5 +
 drivers/net/wireless/ath/ath6kl/cfg80211.c         |   15 +-
 drivers/net/wireless/ath/ath6kl/core.h             |    3 -
 drivers/net/wireless/ath/ath6kl/debug.c            |   72 +-
 drivers/net/wireless/ath/ath6kl/debug.h            |   11 +-
 drivers/net/wireless/ath/ath6kl/hif.c              |    3 +
 drivers/net/wireless/ath/ath6kl/htc_mbox.c         |   21 +-
 drivers/net/wireless/ath/ath6kl/htc_pipe.c         |   15 +-
 drivers/net/wireless/ath/ath6kl/init.c             |  116 +-
 drivers/net/wireless/ath/ath6kl/main.c             |   41 +-
 drivers/net/wireless/ath/ath6kl/sdio.c             |   16 +-
 drivers/net/wireless/ath/ath6kl/target.h           |    2 +-
 drivers/net/wireless/ath/ath6kl/trace.c            |   23 +
 drivers/net/wireless/ath/ath6kl/trace.h            |  332 ++++
 drivers/net/wireless/ath/ath6kl/txrx.c             |    5 +-
 drivers/net/wireless/ath/ath6kl/usb.c              |   38 +-
 drivers/net/wireless/ath/ath6kl/wmi.c              |    6 +
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c     |   17 +
 .../net/wireless/ath/ath9k/ar9462_2p0_initvals.h   |   49 +-
 drivers/net/wireless/ath/ath9k/calib.c             |    4 +-
 drivers/net/wireless/ath/ath9k/common.h            |    2 +-
 drivers/net/wireless/ath/ath9k/debug.c             |    5 +
 drivers/net/wireless/ath/ath9k/debug.h             |    2 +
 drivers/net/wireless/ath/ath9k/hw.c                |  188 +-
 drivers/net/wireless/ath/ath9k/hw.h                |    1 -
 drivers/net/wireless/ath/carl9170/tx.c             |   69 +-
 drivers/net/wireless/ath/wil6210/Makefile          |    4 +-
 drivers/net/wireless/ath/wil6210/cfg80211.c        |   33 +-
 drivers/net/wireless/ath/wil6210/dbg_hexdump.h     |   20 -
 drivers/net/wireless/ath/wil6210/debugfs.c         |   58 +-
 drivers/net/wireless/ath/wil6210/interrupt.c       |   25 +-
 drivers/net/wireless/ath/wil6210/main.c            |   60 +-
 drivers/net/wireless/ath/wil6210/netdev.c          |    3 -
 drivers/net/wireless/ath/wil6210/pcie_bus.c        |    3 -
 drivers/net/wireless/ath/wil6210/txrx.c            |    5 +-
 drivers/net/wireless/ath/wil6210/wil6210.h         |   17 +-
 drivers/net/wireless/ath/wil6210/wmi.c             |  154 +-
 drivers/net/wireless/ath/wil6210/wmi.h             |  363 +++-
 drivers/net/wireless/b43/Kconfig                   |    6 +-
 drivers/net/wireless/b43/b43.h                     |    6 +
 drivers/net/wireless/b43/main.c                    |    7 +-
 drivers/net/wireless/b43/phy_ht.c                  |  610 ++++++-
 drivers/net/wireless/b43/phy_ht.h                  |   77 +-
 drivers/net/wireless/brcm80211/Kconfig             |    5 +-
 drivers/net/wireless/brcm80211/brcmfmac/Makefile   |    3 +
 drivers/net/wireless/brcm80211/brcmfmac/dhd.h      |    7 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h  |    2 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c  |   30 +-
 .../net/wireless/brcm80211/brcmfmac/dhd_common.c   |   33 +
 drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c  |   42 +
 drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h  |   34 +-
 .../net/wireless/brcm80211/brcmfmac/dhd_linux.c    |   39 +-
 .../net/wireless/brcm80211/brcmfmac/dhd_proto.h    |    2 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c |   28 +-
 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c |  382 ++++
 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h |   25 +
 .../net/wireless/brcm80211/brcmfmac/tracepoint.c   |   22 +
 .../net/wireless/brcm80211/brcmfmac/tracepoint.h   |   87 +
 drivers/net/wireless/brcm80211/brcmfmac/usb.c      |   37 +-
 .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c  |    6 +-
 drivers/net/wireless/brcm80211/brcmsmac/Makefile   |    4 +
 drivers/net/wireless/brcm80211/brcmsmac/led.c      |  126 ++
 drivers/net/wireless/brcm80211/brcmsmac/led.h      |   36 +
 .../net/wireless/brcm80211/brcmsmac/mac80211_if.c  |    4 +
 .../net/wireless/brcm80211/brcmsmac/mac80211_if.h  |    4 +
 drivers/net/wireless/brcm80211/brcmsmac/main.c     |   11 +-
 drivers/net/wireless/brcm80211/brcmutil/utils.c    |   25 +
 .../net/wireless/brcm80211/include/brcmu_utils.h   |   27 +
 drivers/net/wireless/iwlegacy/3945-mac.c           |    2 +-
 drivers/net/wireless/iwlegacy/3945.h               |    4 -
 drivers/net/wireless/iwlegacy/4965-mac.c           |   29 +-
 drivers/net/wireless/iwlegacy/common.c             |    2 +-
 drivers/net/wireless/iwlegacy/common.h             |    4 -
 drivers/net/wireless/iwlwifi/Kconfig               |   11 +-
 drivers/net/wireless/iwlwifi/Makefile              |    3 +-
 drivers/net/wireless/iwlwifi/dvm/agn.h             |    2 +-
 drivers/net/wireless/iwlwifi/dvm/calib.c           |    2 +-
 drivers/net/wireless/iwlwifi/dvm/calib.h           |    2 +-
 drivers/net/wireless/iwlwifi/dvm/commands.h        |    3 +-
 drivers/net/wireless/iwlwifi/dvm/debugfs.c         |   26 +-
 drivers/net/wireless/iwlwifi/dvm/lib.c             |    2 +-
 drivers/net/wireless/iwlwifi/dvm/mac80211.c        |    3 +-
 drivers/net/wireless/iwlwifi/dvm/scan.c            |    2 +-
 drivers/net/wireless/iwlwifi/dvm/testmode.c        |    2 +-
 drivers/net/wireless/iwlwifi/dvm/tx.c              |   13 +-
 drivers/net/wireless/iwlwifi/dvm/ucode.c           |    2 +-
 .../wireless/iwlwifi/{pcie/1000.c => iwl-1000.c}   |    1 -
 .../wireless/iwlwifi/{pcie/2000.c => iwl-2000.c}   |    1 -
 .../wireless/iwlwifi/{pcie/5000.c => iwl-5000.c}   |    1 -
 .../wireless/iwlwifi/{pcie/6000.c => iwl-6000.c}   |    1 -
 .../wireless/iwlwifi/{pcie/7000.c => iwl-7000.c}   |   63 +-
 drivers/net/wireless/iwlwifi/iwl-agn-hw.h          |    2 +-
 drivers/net/wireless/iwlwifi/iwl-config.h          |   49 +-
 drivers/net/wireless/iwlwifi/iwl-csr.h             |    2 +-
 drivers/net/wireless/iwlwifi/iwl-debug.c           |   13 +-
 drivers/net/wireless/iwlwifi/iwl-devtrace.h        |    2 +-
 drivers/net/wireless/iwlwifi/iwl-drv.c             |   14 +-
 drivers/net/wireless/iwlwifi/iwl-drv.h             |   17 +-
 drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c    |    9 +-
 drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h    |    2 +-
 drivers/net/wireless/iwlwifi/iwl-eeprom-read.c     |    5 +-
 drivers/net/wireless/iwlwifi/iwl-eeprom-read.h     |    2 +-
 drivers/net/wireless/iwlwifi/iwl-fh.h              |    2 +-
 drivers/net/wireless/iwlwifi/iwl-fw-file.h         |    2 +-
 drivers/net/wireless/iwlwifi/iwl-fw.h              |    4 +-
 drivers/net/wireless/iwlwifi/iwl-io.c              |   19 +-
 drivers/net/wireless/iwlwifi/iwl-modparams.h       |    4 +-
 drivers/net/wireless/iwlwifi/iwl-notif-wait.c      |   15 +-
 drivers/net/wireless/iwlwifi/iwl-notif-wait.h      |    2 +-
 drivers/net/wireless/iwlwifi/iwl-nvm-parse.c       |   51 +-
 drivers/net/wireless/iwlwifi/iwl-nvm-parse.h       |    2 +-
 drivers/net/wireless/iwlwifi/iwl-op-mode.h         |    2 +-
 drivers/net/wireless/iwlwifi/iwl-phy-db.c          |   11 +-
 drivers/net/wireless/iwlwifi/iwl-phy-db.h          |    2 +-
 drivers/net/wireless/iwlwifi/iwl-prph.h            |    2 +-
 drivers/net/wireless/iwlwifi/iwl-test.c            |   11 +-
 drivers/net/wireless/iwlwifi/iwl-test.h            |    2 +-
 drivers/net/wireless/iwlwifi/iwl-testmode.h        |    2 +-
 drivers/net/wireless/iwlwifi/iwl-trans.h           |    5 +-
 drivers/net/wireless/iwlwifi/mvm/Makefile          |    2 +-
 drivers/net/wireless/iwlwifi/mvm/binding.c         |    2 +-
 drivers/net/wireless/iwlwifi/mvm/bt-coex.c         |  347 ++++
 drivers/net/wireless/iwlwifi/mvm/d3.c              |  260 ++-
 drivers/net/wireless/iwlwifi/mvm/debugfs.c         |  138 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-bt-coex.h  |  319 ++++
 drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h       |   53 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h      |    2 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-power.h    |    2 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h       |    2 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h     |    2 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h      |    2 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h       |    2 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api.h          |   12 +-
 drivers/net/wireless/iwlwifi/mvm/fw.c              |   14 +-
 drivers/net/wireless/iwlwifi/mvm/led.c             |    2 +-
 drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c        |   45 +-
 drivers/net/wireless/iwlwifi/mvm/mac80211.c        |   57 +-
 drivers/net/wireless/iwlwifi/mvm/mvm.h             |   17 +-
 drivers/net/wireless/iwlwifi/mvm/nvm.c             |   11 +-
 drivers/net/wireless/iwlwifi/mvm/ops.c             |   12 +-
 drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c        |    2 +-
 drivers/net/wireless/iwlwifi/mvm/power.c           |    2 +-
 drivers/net/wireless/iwlwifi/mvm/quota.c           |    2 +-
 drivers/net/wireless/iwlwifi/mvm/rs.c              |   14 +-
 drivers/net/wireless/iwlwifi/mvm/rx.c              |    2 +-
 drivers/net/wireless/iwlwifi/mvm/scan.c            |    2 +-
 drivers/net/wireless/iwlwifi/mvm/sta.c             |   91 +-
 drivers/net/wireless/iwlwifi/mvm/sta.h             |    4 +-
 drivers/net/wireless/iwlwifi/mvm/time-event.c      |    2 +-
 drivers/net/wireless/iwlwifi/mvm/time-event.h      |    2 +-
 drivers/net/wireless/iwlwifi/mvm/tx.c              |    4 +-
 drivers/net/wireless/iwlwifi/mvm/utils.c           |    2 +-
 drivers/net/wireless/iwlwifi/pcie/cfg.h            |  115 --
 drivers/net/wireless/iwlwifi/pcie/drv.c            |    4 +-
 drivers/net/wireless/iwlwifi/pcie/trans.c          |   25 +-
 drivers/net/wireless/iwlwifi/pcie/tx.c             |    2 +-
 drivers/net/wireless/mac80211_hwsim.c              |    3 +-
 drivers/net/wireless/mwifiex/Makefile              |    1 +
 drivers/net/wireless/mwifiex/cfg80211.c            |  218 ++-
 drivers/net/wireless/mwifiex/cmdevt.c              |    2 +-
 drivers/net/wireless/mwifiex/ethtool.c             |   70 +
 drivers/net/wireless/mwifiex/fw.h                  |   72 +-
 drivers/net/wireless/mwifiex/init.c                |    6 +-
 drivers/net/wireless/mwifiex/ioctl.h               |   23 +
 drivers/net/wireless/mwifiex/main.c                |   15 +-
 drivers/net/wireless/mwifiex/main.h                |    9 +
 drivers/net/wireless/mwifiex/pcie.c                |  156 +-
 drivers/net/wireless/mwifiex/sta_cmd.c             |   79 +-
 drivers/net/wireless/mwifiex/sta_cmdresp.c         |    2 +
 drivers/net/wireless/mwifiex/sta_ioctl.c           |   10 +-
 drivers/net/wireless/mwifiex/txrx.c                |    2 +
 drivers/net/wireless/mwifiex/util.c                |    5 +-
 drivers/net/wireless/mwl8k.c                       |  111 +-
 drivers/net/wireless/orinoco/orinoco_usb.c         |    2 +-
 drivers/net/wireless/ray_cs.c                      |    6 +-
 drivers/net/wireless/rndis_wlan.c                  |    5 +-
 drivers/net/wireless/rt2x00/Kconfig                |    7 +
 drivers/net/wireless/rt2x00/rt2800.h               |  103 +-
 drivers/net/wireless/rt2x00/rt2800lib.c            |  857 ++++++++-
 drivers/net/wireless/rt2x00/rt2800pci.c            |  116 +-
 drivers/net/wireless/rt2x00/rt2800usb.c            |   63 +-
 drivers/net/wireless/rt2x00/rt2x00.h               |   10 +-
 drivers/net/wireless/rt2x00/rt2x00pci.c            |    4 +-
 drivers/net/wireless/rt2x00/rt2x00queue.c          |   10 +-
 drivers/net/wireless/rt2x00/rt2x00queue.h          |    9 +-
 drivers/net/wireless/rt2x00/rt2x00usb.c            |   20 +-
 drivers/net/wireless/rtlwifi/usb.c                 |    3 +-
 drivers/net/wireless/rtlwifi/wifi.h                |    3 -
 drivers/net/wireless/ti/wlcore/main.c              |    3 +-
 drivers/nfc/microread/mei.c                        |    2 +-
 drivers/ssb/driver_chipcommon.c                    |    2 +-
 drivers/ssb/driver_chipcommon_pmu.c                |   41 +-
 drivers/ssb/driver_mipscore.c                      |   25 +-
 drivers/ssb/driver_pcicore.c                       |   15 +-
 drivers/ssb/embedded.c                             |    5 +-
 drivers/ssb/main.c                                 |   51 +-
 drivers/ssb/pci.c                                  |   97 +-
 drivers/ssb/pcmcia.c                               |   46 +-
 drivers/ssb/scan.c                                 |   31 +-
 drivers/ssb/sprom.c                                |    4 +-
 drivers/ssb/ssb_private.h                          |   19 +-
 include/linux/ieee80211.h                          |   52 +-
 include/linux/socket.h                             |    1 +
 include/linux/ssb/ssb.h                            |    6 +-
 include/net/cfg80211.h                             |  126 +-
 include/net/mac80211.h                             |   29 +-
 include/uapi/linux/nfc.h                           |   16 +
 include/uapi/linux/nl80211.h                       |  117 +-
 net/mac80211/cfg.c                                 |  151 +-
 net/mac80211/debugfs_sta.c                         |   31 +
 net/mac80211/driver-ops.h                          |    7 +-
 net/mac80211/ht.c                                  |   52 +-
 net/mac80211/ibss.c                                |   29 +-
 net/mac80211/ieee80211_i.h                         |   26 +-
 net/mac80211/iface.c                               |   14 +-
 net/mac80211/key.c                                 |  103 +-
 net/mac80211/key.h                                 |    5 +-
 net/mac80211/main.c                                |   55 +-
 net/mac80211/mesh.c                                |   59 +-
 net/mac80211/mesh.h                                |   12 -
 net/mac80211/mesh_plink.c                          |   37 +-
 net/mac80211/mlme.c                                |  100 +-
 net/mac80211/offchannel.c                          |    2 +-
 net/mac80211/pm.c                                  |  117 +-
 net/mac80211/rc80211_minstrel.c                    |  204 ++-
 net/mac80211/rc80211_minstrel.h                    |   31 +-
 net/mac80211/rc80211_minstrel_debugfs.c            |   12 +-
 net/mac80211/rc80211_minstrel_ht.c                 |   79 +-
 net/mac80211/rc80211_minstrel_ht.h                 |    6 +-
 net/mac80211/rx.c                                  |   61 +-
 net/mac80211/sta_info.c                            |   11 +-
 net/mac80211/sta_info.h                            |    2 -
 net/mac80211/trace.h                               |   11 +-
 net/mac80211/util.c                                |   73 +-
 net/mac80211/vht.c                                 |  212 ++-
 net/nfc/llcp/commands.c                            |  205 ++-
 net/nfc/llcp/llcp.c                                |  112 +-
 net/nfc/llcp/llcp.h                                |   36 +-
 net/nfc/llcp/sock.c                                |  130 +-
 net/nfc/netlink.c                                  |  172 ++
 net/nfc/nfc.h                                      |   14 +
 net/rfkill/rfkill-regulator.c                      |    2 +-
 net/wireless/ap.c                                  |   62 -
 net/wireless/core.c                                |   73 +-
 net/wireless/core.h                                |   22 +-
 net/wireless/mesh.c                                |   15 +-
 net/wireless/mlme.c                                |  230 +--
 net/wireless/nl80211.c                             | 1885 +++++++++++++-------
 net/wireless/nl80211.h                             |   68 -
 net/wireless/rdev-ops.h                            |   20 +-
 net/wireless/reg.c                                 |    6 +-
 net/wireless/sme.c                                 |   26 +-
 net/wireless/sysfs.c                               |   25 +-
 net/wireless/trace.h                               |   46 +
 263 files changed, 9534 insertions(+), 3414 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath6kl/trace.c
 create mode 100644 drivers/net/wireless/ath/ath6kl/trace.h
 delete mode 100644 drivers/net/wireless/ath/wil6210/dbg_hexdump.h
 create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
 create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
 create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/tracepoint.c
 create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/tracepoint.h
 create mode 100644 drivers/net/wireless/brcm80211/brcmsmac/led.c
 create mode 100644 drivers/net/wireless/brcm80211/brcmsmac/led.h
 rename drivers/net/wireless/iwlwifi/{pcie/1000.c => iwl-1000.c} (99%)
 rename drivers/net/wireless/iwlwifi/{pcie/2000.c => iwl-2000.c} (99%)
 rename drivers/net/wireless/iwlwifi/{pcie/5000.c => iwl-5000.c} (99%)
 rename drivers/net/wireless/iwlwifi/{pcie/6000.c => iwl-6000.c} (99%)
 rename drivers/net/wireless/iwlwifi/{pcie/7000.c => iwl-7000.c} (58%)
 create mode 100644 drivers/net/wireless/iwlwifi/mvm/bt-coex.c
 create mode 100644 drivers/net/wireless/iwlwifi/mvm/fw-api-bt-coex.h
 delete mode 100644 drivers/net/wireless/iwlwifi/pcie/cfg.h
 create mode 100644 drivers/net/wireless/mwifiex/ethtool.c
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* [PATCH] fec: Unify fec_ptp.c and fec.c
From: Fabio Estevam @ 2013-03-20 20:11 UTC (permalink / raw)
  To: davem; +Cc: Frank.Li, u.kleine-koenig, netdev, Fabio Estevam

From: Fabio Estevam <fabio.estevam@freescale.com>

Currently CONFIG_FEC=y generates two separate modules: fec_ptp.ko and fec.ko.

These modules cannot be used independently, so it is better to unify them.

Move fec_ptp.c code into fec.c and its definitions into fec.h.

Suggested-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/net/ethernet/freescale/Makefile  |    2 +-
 drivers/net/ethernet/freescale/fec.c     |  315 ++++++++++++++++++++++++
 drivers/net/ethernet/freescale/fec.h     |   23 ++
 drivers/net/ethernet/freescale/fec_ptp.c |  388 ------------------------------
 4 files changed, 339 insertions(+), 389 deletions(-)
 delete mode 100644 drivers/net/ethernet/freescale/fec_ptp.c

diff --git a/drivers/net/ethernet/freescale/Makefile b/drivers/net/ethernet/freescale/Makefile
index b7d58fe..3d1839a 100644
--- a/drivers/net/ethernet/freescale/Makefile
+++ b/drivers/net/ethernet/freescale/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the Freescale network device drivers.
 #
 
-obj-$(CONFIG_FEC) += fec.o fec_ptp.o
+obj-$(CONFIG_FEC) += fec.o
 obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx.o
 ifeq ($(CONFIG_FEC_MPC52xx_MDIO),y)
 	obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx_phy.o
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 8ca2cf6..d5bea99 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -1586,6 +1586,321 @@ static const struct net_device_ops fec_netdev_ops = {
 #endif
 };
 
+/**
+ * fec_ptp_read - read raw cycle counter (to be used by time counter)
+ * @cc: the cyclecounter structure
+ *
+ * this function reads the cyclecounter registers and is called by the
+ * cyclecounter structure used to construct a ns counter from the
+ * arbitrary fixed point registers
+ */
+static cycle_t fec_ptp_read(const struct cyclecounter *cc)
+{
+	struct fec_enet_private *fep =
+		container_of(cc, struct fec_enet_private, cc);
+	u32 tempval;
+
+	tempval = readl(fep->hwp + FEC_ATIME_CTRL);
+	tempval |= FEC_T_CTRL_CAPTURE;
+	writel(tempval, fep->hwp + FEC_ATIME_CTRL);
+
+	return readl(fep->hwp + FEC_ATIME);
+}
+
+/**
+ * fec_ptp_start_cyclecounter - create the cycle counter from hw
+ * @ndev: network device
+ *
+ * this function initializes the timecounter and cyclecounter
+ * structures for use in generated a ns counter from the arbitrary
+ * fixed point cycles registers in the hardware.
+ */
+void fec_ptp_start_cyclecounter(struct net_device *ndev)
+{
+	struct fec_enet_private *fep = netdev_priv(ndev);
+	unsigned long flags;
+	int inc;
+
+	inc = 1000000000 / fep->cycle_speed;
+
+	/* grab the ptp lock */
+	spin_lock_irqsave(&fep->tmreg_lock, flags);
+
+	/* 1ns counter */
+	writel(inc << FEC_T_INC_OFFSET, fep->hwp + FEC_ATIME_INC);
+
+	/* use free running count */
+	writel(0, fep->hwp + FEC_ATIME_EVT_PERIOD);
+
+	writel(FEC_T_CTRL_ENABLE, fep->hwp + FEC_ATIME_CTRL);
+
+	memset(&fep->cc, 0, sizeof(fep->cc));
+	fep->cc.read = fec_ptp_read;
+	fep->cc.mask = CLOCKSOURCE_MASK(32);
+	fep->cc.shift = 31;
+	fep->cc.mult = FEC_CC_MULT;
+
+	/* reset the ns time counter */
+	timecounter_init(&fep->tc, &fep->cc, ktime_to_ns(ktime_get_real()));
+
+	spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+}
+
+/**
+ * fec_ptp_adjfreq - adjust ptp cycle frequency
+ * @ptp: the ptp clock structure
+ * @ppb: parts per billion adjustment from base
+ *
+ * Adjust the frequency of the ptp cycle counter by the
+ * indicated ppb from the base frequency.
+ *
+ * Because ENET hardware frequency adjust is complex,
+ * using software method to do that.
+ */
+static int fec_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
+{
+	u64 diff;
+	unsigned long flags;
+	int neg_adj = 0;
+	u32 mult = FEC_CC_MULT;
+
+	struct fec_enet_private *fep =
+	    container_of(ptp, struct fec_enet_private, ptp_caps);
+
+	if (ppb < 0) {
+		ppb = -ppb;
+		neg_adj = 1;
+	}
+
+	diff = mult;
+	diff *= ppb;
+	diff = div_u64(diff, 1000000000ULL);
+
+	spin_lock_irqsave(&fep->tmreg_lock, flags);
+	/*
+	 * dummy read to set cycle_last in tc to now.
+	 * So use adjusted mult to calculate when next call
+	 * timercounter_read.
+	 */
+	timecounter_read(&fep->tc);
+
+	fep->cc.mult = neg_adj ? mult - diff : mult + diff;
+
+	spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+
+	return 0;
+}
+
+/**
+ * fec_ptp_adjtime
+ * @ptp: the ptp clock structure
+ * @delta: offset to adjust the cycle counter by
+ *
+ * adjust the timer by resetting the timecounter structure.
+ */
+static int fec_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
+{
+	struct fec_enet_private *fep =
+	    container_of(ptp, struct fec_enet_private, ptp_caps);
+	unsigned long flags;
+	u64 now;
+
+	spin_lock_irqsave(&fep->tmreg_lock, flags);
+
+	now = timecounter_read(&fep->tc);
+	now += delta;
+
+	/* reset the timecounter */
+	timecounter_init(&fep->tc, &fep->cc, now);
+
+	spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+
+	return 0;
+}
+
+/**
+ * fec_ptp_gettime
+ * @ptp: the ptp clock structure
+ * @ts: timespec structure to hold the current time value
+ *
+ * read the timecounter and return the correct value on ns,
+ * after converting it into a struct timespec.
+ */
+static int fec_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
+{
+	struct fec_enet_private *adapter =
+	    container_of(ptp, struct fec_enet_private, ptp_caps);
+	u64 ns;
+	u32 remainder;
+	unsigned long flags;
+
+	spin_lock_irqsave(&adapter->tmreg_lock, flags);
+	ns = timecounter_read(&adapter->tc);
+	spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
+
+	ts->tv_sec = div_u64_rem(ns, 1000000000ULL, &remainder);
+	ts->tv_nsec = remainder;
+
+	return 0;
+}
+
+/**
+ * fec_ptp_settime
+ * @ptp: the ptp clock structure
+ * @ts: the timespec containing the new time for the cycle counter
+ *
+ * reset the timecounter to use a new base value instead of the kernel
+ * wall timer value.
+ */
+static int fec_ptp_settime(struct ptp_clock_info *ptp,
+			   const struct timespec *ts)
+{
+	struct fec_enet_private *fep =
+	    container_of(ptp, struct fec_enet_private, ptp_caps);
+
+	u64 ns;
+	unsigned long flags;
+
+	ns = ts->tv_sec * 1000000000ULL;
+	ns += ts->tv_nsec;
+
+	spin_lock_irqsave(&fep->tmreg_lock, flags);
+	timecounter_init(&fep->tc, &fep->cc, ns);
+	spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+	return 0;
+}
+
+/**
+ * fec_ptp_enable
+ * @ptp: the ptp clock structure
+ * @rq: the requested feature to change
+ * @on: whether to enable or disable the feature
+ *
+ */
+static int fec_ptp_enable(struct ptp_clock_info *ptp,
+			  struct ptp_clock_request *rq, int on)
+{
+	return -EOPNOTSUPP;
+}
+
+/**
+ * fec_ptp_hwtstamp_ioctl - control hardware time stamping
+ * @ndev: pointer to net_device
+ * @ifreq: ioctl data
+ * @cmd: particular ioctl requested
+ */
+int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
+{
+	struct fec_enet_private *fep = netdev_priv(ndev);
+
+	struct hwtstamp_config config;
+
+	if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
+		return -EFAULT;
+
+	/* reserved for future extensions */
+	if (config.flags)
+		return -EINVAL;
+
+	switch (config.tx_type) {
+	case HWTSTAMP_TX_OFF:
+		fep->hwts_tx_en = 0;
+		break;
+	case HWTSTAMP_TX_ON:
+		fep->hwts_tx_en = 1;
+		break;
+	default:
+		return -ERANGE;
+	}
+
+	switch (config.rx_filter) {
+	case HWTSTAMP_FILTER_NONE:
+		if (fep->hwts_rx_en)
+			fep->hwts_rx_en = 0;
+		config.rx_filter = HWTSTAMP_FILTER_NONE;
+		break;
+
+	default:
+		/*
+		 * register RXMTRL must be set in order to do V1 packets,
+		 * therefore it is not possible to time stamp both V1 Sync and
+		 * Delay_Req messages and hardware does not support
+		 * timestamping all packets => return error
+		 */
+		fep->hwts_rx_en = 1;
+		config.rx_filter = HWTSTAMP_FILTER_ALL;
+		break;
+	}
+
+	return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
+	    -EFAULT : 0;
+}
+
+/**
+ * fec_time_keep - call timecounter_read every second to avoid timer overrun
+ *                 because ENET just support 32bit counter, will timeout in 4s
+ */
+static void fec_time_keep(unsigned long _data)
+{
+	struct fec_enet_private *fep = (struct fec_enet_private *)_data;
+	u64 ns;
+	unsigned long flags;
+
+	spin_lock_irqsave(&fep->tmreg_lock, flags);
+	ns = timecounter_read(&fep->tc);
+	spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+
+	mod_timer(&fep->time_keep, jiffies + HZ);
+}
+
+/**
+ * fec_ptp_init
+ * @ndev: The FEC network adapter
+ *
+ * This function performs the required steps for enabling ptp
+ * support. If ptp support has already been loaded it simply calls the
+ * cyclecounter init routine and exits.
+ */
+
+void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev)
+{
+	struct fec_enet_private *fep = netdev_priv(ndev);
+
+	fep->ptp_caps.owner = THIS_MODULE;
+	snprintf(fep->ptp_caps.name, 16, "fec ptp");
+
+	fep->ptp_caps.max_adj = 250000000;
+	fep->ptp_caps.n_alarm = 0;
+	fep->ptp_caps.n_ext_ts = 0;
+	fep->ptp_caps.n_per_out = 0;
+	fep->ptp_caps.pps = 0;
+	fep->ptp_caps.adjfreq = fec_ptp_adjfreq;
+	fep->ptp_caps.adjtime = fec_ptp_adjtime;
+	fep->ptp_caps.gettime = fec_ptp_gettime;
+	fep->ptp_caps.settime = fec_ptp_settime;
+	fep->ptp_caps.enable = fec_ptp_enable;
+
+	fep->cycle_speed = clk_get_rate(fep->clk_ptp);
+
+	spin_lock_init(&fep->tmreg_lock);
+
+	fec_ptp_start_cyclecounter(ndev);
+
+	init_timer(&fep->time_keep);
+	fep->time_keep.data = (unsigned long)fep;
+	fep->time_keep.function = fec_time_keep;
+	fep->time_keep.expires = jiffies + HZ;
+	add_timer(&fep->time_keep);
+
+	fep->ptp_clock = ptp_clock_register(&fep->ptp_caps, &pdev->dev);
+	if (IS_ERR(fep->ptp_clock)) {
+		fep->ptp_clock = NULL;
+		pr_err("ptp_clock_register failed\n");
+	} else {
+		pr_info("registered PHC device on %s\n", ndev->name);
+	}
+}
+
  /*
   * XXX:  We need to clean up on failure exits here.
   *
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index eb43729..2a01f79 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -191,6 +191,29 @@ struct bufdesc_ex {
 #define BD_ENET_RX_INT          0x00800000
 #define BD_ENET_RX_PTP          ((ushort)0x0400)
 
+/* FEC 1588 register bits */
+#define FEC_T_CTRL_SLAVE                0x00002000
+#define FEC_T_CTRL_CAPTURE              0x00000800
+#define FEC_T_CTRL_RESTART              0x00000200
+#define FEC_T_CTRL_PERIOD_RST           0x00000030
+#define FEC_T_CTRL_PERIOD_EN		0x00000010
+#define FEC_T_CTRL_ENABLE               0x00000001
+
+#define FEC_T_INC_MASK                  0x0000007f
+#define FEC_T_INC_OFFSET                0
+#define FEC_T_INC_CORR_MASK             0x00007f00
+#define FEC_T_INC_CORR_OFFSET           8
+
+#define FEC_ATIME_CTRL		0x400
+#define FEC_ATIME		0x404
+#define FEC_ATIME_EVT_OFFSET	0x408
+#define FEC_ATIME_EVT_PERIOD	0x40c
+#define FEC_ATIME_CORR		0x410
+#define FEC_ATIME_INC		0x414
+#define FEC_TS_TIMESTAMP	0x418
+
+#define FEC_CC_MULT	(1 << 31)
+
 /* The FEC buffer descriptors track the ring buffers.  The rx_bd_base and
  * tx_bd_base always point to the base of the buffer descriptors.  The
  * cur_rx and cur_tx point to the currently available buffer.
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
deleted file mode 100644
index 0d8df40..0000000
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * Fast Ethernet Controller (ENET) PTP driver for MX6x.
- *
- * Copyright (C) 2012 Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/ptrace.h>
-#include <linux/errno.h>
-#include <linux/ioport.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/pci.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/spinlock.h>
-#include <linux/workqueue.h>
-#include <linux/bitops.h>
-#include <linux/io.h>
-#include <linux/irq.h>
-#include <linux/clk.h>
-#include <linux/platform_device.h>
-#include <linux/phy.h>
-#include <linux/fec.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
-#include <linux/of_gpio.h>
-#include <linux/of_net.h>
-
-#include "fec.h"
-
-/* FEC 1588 register bits */
-#define FEC_T_CTRL_SLAVE                0x00002000
-#define FEC_T_CTRL_CAPTURE              0x00000800
-#define FEC_T_CTRL_RESTART              0x00000200
-#define FEC_T_CTRL_PERIOD_RST           0x00000030
-#define FEC_T_CTRL_PERIOD_EN		0x00000010
-#define FEC_T_CTRL_ENABLE               0x00000001
-
-#define FEC_T_INC_MASK                  0x0000007f
-#define FEC_T_INC_OFFSET                0
-#define FEC_T_INC_CORR_MASK             0x00007f00
-#define FEC_T_INC_CORR_OFFSET           8
-
-#define FEC_ATIME_CTRL		0x400
-#define FEC_ATIME		0x404
-#define FEC_ATIME_EVT_OFFSET	0x408
-#define FEC_ATIME_EVT_PERIOD	0x40c
-#define FEC_ATIME_CORR		0x410
-#define FEC_ATIME_INC		0x414
-#define FEC_TS_TIMESTAMP	0x418
-
-#define FEC_CC_MULT	(1 << 31)
-/**
- * fec_ptp_read - read raw cycle counter (to be used by time counter)
- * @cc: the cyclecounter structure
- *
- * this function reads the cyclecounter registers and is called by the
- * cyclecounter structure used to construct a ns counter from the
- * arbitrary fixed point registers
- */
-static cycle_t fec_ptp_read(const struct cyclecounter *cc)
-{
-	struct fec_enet_private *fep =
-		container_of(cc, struct fec_enet_private, cc);
-	u32 tempval;
-
-	tempval = readl(fep->hwp + FEC_ATIME_CTRL);
-	tempval |= FEC_T_CTRL_CAPTURE;
-	writel(tempval, fep->hwp + FEC_ATIME_CTRL);
-
-	return readl(fep->hwp + FEC_ATIME);
-}
-
-/**
- * fec_ptp_start_cyclecounter - create the cycle counter from hw
- * @ndev: network device
- *
- * this function initializes the timecounter and cyclecounter
- * structures for use in generated a ns counter from the arbitrary
- * fixed point cycles registers in the hardware.
- */
-void fec_ptp_start_cyclecounter(struct net_device *ndev)
-{
-	struct fec_enet_private *fep = netdev_priv(ndev);
-	unsigned long flags;
-	int inc;
-
-	inc = 1000000000 / fep->cycle_speed;
-
-	/* grab the ptp lock */
-	spin_lock_irqsave(&fep->tmreg_lock, flags);
-
-	/* 1ns counter */
-	writel(inc << FEC_T_INC_OFFSET, fep->hwp + FEC_ATIME_INC);
-
-	/* use free running count */
-	writel(0, fep->hwp + FEC_ATIME_EVT_PERIOD);
-
-	writel(FEC_T_CTRL_ENABLE, fep->hwp + FEC_ATIME_CTRL);
-
-	memset(&fep->cc, 0, sizeof(fep->cc));
-	fep->cc.read = fec_ptp_read;
-	fep->cc.mask = CLOCKSOURCE_MASK(32);
-	fep->cc.shift = 31;
-	fep->cc.mult = FEC_CC_MULT;
-
-	/* reset the ns time counter */
-	timecounter_init(&fep->tc, &fep->cc, ktime_to_ns(ktime_get_real()));
-
-	spin_unlock_irqrestore(&fep->tmreg_lock, flags);
-}
-EXPORT_SYMBOL(fec_ptp_start_cyclecounter);
-
-/**
- * fec_ptp_adjfreq - adjust ptp cycle frequency
- * @ptp: the ptp clock structure
- * @ppb: parts per billion adjustment from base
- *
- * Adjust the frequency of the ptp cycle counter by the
- * indicated ppb from the base frequency.
- *
- * Because ENET hardware frequency adjust is complex,
- * using software method to do that.
- */
-static int fec_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
-{
-	u64 diff;
-	unsigned long flags;
-	int neg_adj = 0;
-	u32 mult = FEC_CC_MULT;
-
-	struct fec_enet_private *fep =
-	    container_of(ptp, struct fec_enet_private, ptp_caps);
-
-	if (ppb < 0) {
-		ppb = -ppb;
-		neg_adj = 1;
-	}
-
-	diff = mult;
-	diff *= ppb;
-	diff = div_u64(diff, 1000000000ULL);
-
-	spin_lock_irqsave(&fep->tmreg_lock, flags);
-	/*
-	 * dummy read to set cycle_last in tc to now.
-	 * So use adjusted mult to calculate when next call
-	 * timercounter_read.
-	 */
-	timecounter_read(&fep->tc);
-
-	fep->cc.mult = neg_adj ? mult - diff : mult + diff;
-
-	spin_unlock_irqrestore(&fep->tmreg_lock, flags);
-
-	return 0;
-}
-
-/**
- * fec_ptp_adjtime
- * @ptp: the ptp clock structure
- * @delta: offset to adjust the cycle counter by
- *
- * adjust the timer by resetting the timecounter structure.
- */
-static int fec_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
-{
-	struct fec_enet_private *fep =
-	    container_of(ptp, struct fec_enet_private, ptp_caps);
-	unsigned long flags;
-	u64 now;
-
-	spin_lock_irqsave(&fep->tmreg_lock, flags);
-
-	now = timecounter_read(&fep->tc);
-	now += delta;
-
-	/* reset the timecounter */
-	timecounter_init(&fep->tc, &fep->cc, now);
-
-	spin_unlock_irqrestore(&fep->tmreg_lock, flags);
-
-	return 0;
-}
-
-/**
- * fec_ptp_gettime
- * @ptp: the ptp clock structure
- * @ts: timespec structure to hold the current time value
- *
- * read the timecounter and return the correct value on ns,
- * after converting it into a struct timespec.
- */
-static int fec_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
-{
-	struct fec_enet_private *adapter =
-	    container_of(ptp, struct fec_enet_private, ptp_caps);
-	u64 ns;
-	u32 remainder;
-	unsigned long flags;
-
-	spin_lock_irqsave(&adapter->tmreg_lock, flags);
-	ns = timecounter_read(&adapter->tc);
-	spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
-
-	ts->tv_sec = div_u64_rem(ns, 1000000000ULL, &remainder);
-	ts->tv_nsec = remainder;
-
-	return 0;
-}
-
-/**
- * fec_ptp_settime
- * @ptp: the ptp clock structure
- * @ts: the timespec containing the new time for the cycle counter
- *
- * reset the timecounter to use a new base value instead of the kernel
- * wall timer value.
- */
-static int fec_ptp_settime(struct ptp_clock_info *ptp,
-			   const struct timespec *ts)
-{
-	struct fec_enet_private *fep =
-	    container_of(ptp, struct fec_enet_private, ptp_caps);
-
-	u64 ns;
-	unsigned long flags;
-
-	ns = ts->tv_sec * 1000000000ULL;
-	ns += ts->tv_nsec;
-
-	spin_lock_irqsave(&fep->tmreg_lock, flags);
-	timecounter_init(&fep->tc, &fep->cc, ns);
-	spin_unlock_irqrestore(&fep->tmreg_lock, flags);
-	return 0;
-}
-
-/**
- * fec_ptp_enable
- * @ptp: the ptp clock structure
- * @rq: the requested feature to change
- * @on: whether to enable or disable the feature
- *
- */
-static int fec_ptp_enable(struct ptp_clock_info *ptp,
-			  struct ptp_clock_request *rq, int on)
-{
-	return -EOPNOTSUPP;
-}
-
-/**
- * fec_ptp_hwtstamp_ioctl - control hardware time stamping
- * @ndev: pointer to net_device
- * @ifreq: ioctl data
- * @cmd: particular ioctl requested
- */
-int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
-{
-	struct fec_enet_private *fep = netdev_priv(ndev);
-
-	struct hwtstamp_config config;
-
-	if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
-		return -EFAULT;
-
-	/* reserved for future extensions */
-	if (config.flags)
-		return -EINVAL;
-
-	switch (config.tx_type) {
-	case HWTSTAMP_TX_OFF:
-		fep->hwts_tx_en = 0;
-		break;
-	case HWTSTAMP_TX_ON:
-		fep->hwts_tx_en = 1;
-		break;
-	default:
-		return -ERANGE;
-	}
-
-	switch (config.rx_filter) {
-	case HWTSTAMP_FILTER_NONE:
-		if (fep->hwts_rx_en)
-			fep->hwts_rx_en = 0;
-		config.rx_filter = HWTSTAMP_FILTER_NONE;
-		break;
-
-	default:
-		/*
-		 * register RXMTRL must be set in order to do V1 packets,
-		 * therefore it is not possible to time stamp both V1 Sync and
-		 * Delay_Req messages and hardware does not support
-		 * timestamping all packets => return error
-		 */
-		fep->hwts_rx_en = 1;
-		config.rx_filter = HWTSTAMP_FILTER_ALL;
-		break;
-	}
-
-	return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
-	    -EFAULT : 0;
-}
-EXPORT_SYMBOL(fec_ptp_ioctl);
-
-/**
- * fec_time_keep - call timecounter_read every second to avoid timer overrun
- *                 because ENET just support 32bit counter, will timeout in 4s
- */
-static void fec_time_keep(unsigned long _data)
-{
-	struct fec_enet_private *fep = (struct fec_enet_private *)_data;
-	u64 ns;
-	unsigned long flags;
-
-	spin_lock_irqsave(&fep->tmreg_lock, flags);
-	ns = timecounter_read(&fep->tc);
-	spin_unlock_irqrestore(&fep->tmreg_lock, flags);
-
-	mod_timer(&fep->time_keep, jiffies + HZ);
-}
-
-/**
- * fec_ptp_init
- * @ndev: The FEC network adapter
- *
- * This function performs the required steps for enabling ptp
- * support. If ptp support has already been loaded it simply calls the
- * cyclecounter init routine and exits.
- */
-
-void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev)
-{
-	struct fec_enet_private *fep = netdev_priv(ndev);
-
-	fep->ptp_caps.owner = THIS_MODULE;
-	snprintf(fep->ptp_caps.name, 16, "fec ptp");
-
-	fep->ptp_caps.max_adj = 250000000;
-	fep->ptp_caps.n_alarm = 0;
-	fep->ptp_caps.n_ext_ts = 0;
-	fep->ptp_caps.n_per_out = 0;
-	fep->ptp_caps.pps = 0;
-	fep->ptp_caps.adjfreq = fec_ptp_adjfreq;
-	fep->ptp_caps.adjtime = fec_ptp_adjtime;
-	fep->ptp_caps.gettime = fec_ptp_gettime;
-	fep->ptp_caps.settime = fec_ptp_settime;
-	fep->ptp_caps.enable = fec_ptp_enable;
-
-	fep->cycle_speed = clk_get_rate(fep->clk_ptp);
-
-	spin_lock_init(&fep->tmreg_lock);
-
-	fec_ptp_start_cyclecounter(ndev);
-
-	init_timer(&fep->time_keep);
-	fep->time_keep.data = (unsigned long)fep;
-	fep->time_keep.function = fec_time_keep;
-	fep->time_keep.expires = jiffies + HZ;
-	add_timer(&fep->time_keep);
-
-	fep->ptp_clock = ptp_clock_register(&fep->ptp_caps, &pdev->dev);
-	if (IS_ERR(fep->ptp_clock)) {
-		fep->ptp_clock = NULL;
-		pr_err("ptp_clock_register failed\n");
-	} else {
-		pr_info("registered PHC device on %s\n", ndev->name);
-	}
-}
-EXPORT_SYMBOL(fec_ptp_init);
-- 
1.7.9.5

^ permalink raw reply related

* Re: [Xen-devel] [PATCH 2/4] xen-netfront: drop skb when skb->len > 65535
From: David Vrabel @ 2013-03-20 20:02 UTC (permalink / raw)
  To: David Vrabel
  Cc: Ian Campbell, netdev@vger.kernel.org, annie.li@oracle.com,
	konrad.wilk@oracle.com, Wei Liu, xen-devel@lists.xen.org
In-Reply-To: <51471DE0.9060506@citrix.com>

On 18/03/13 14:00, David Vrabel wrote:
> On 18/03/13 13:48, Ian Campbell wrote:
>> On Mon, 2013-03-18 at 13:46 +0000, David Vrabel wrote:
>>> On 18/03/13 10:35, Wei Liu wrote:
>>>> The `size' field of Xen network wire format is uint16_t, anything bigger than
>>>> 65535 will cause overflow.
>>>
>>> The backend needs to be able to handle these bad packets without
>>> disconnecting the VIF -- we can't fix all the frontend drivers.
>>
>> Agreed, although that doesn't imply that we shouldn't fix the frontend
>> where we can -- such as upstream as Wei does here.
> 
> Yes, frontends should be fixed where possible.
> 
> This is what I came up with for the backend.  I don't have time to look
> into it further but, Wei, feel free to use it as a starting point.

Got some time to test this (or more correctly, something similar with
XCP's kernel) and some fixes to the suggested patch are needed.  See below.

> diff --git a/drivers/net/xen-netback/netback.c
> b/drivers/net/xen-netback/netback.c
> index cd49ba9..18e2671 100644
> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -899,10 +899,11 @@ static void netbk_fatal_tx_err(struct xenvif *vif)
>  static int netbk_count_requests(struct xenvif *vif,
>  				struct xen_netif_tx_request *first,
>  				struct xen_netif_tx_request *txp,
> -				int work_to_do)
> +				int work_to_do, int idx)

idx should be of RING_IDX type.

>  {
>  	RING_IDX cons = vif->tx.req_cons;
>  	int frags = 0;
> +	bool drop = false;
> 
>  	if (!(first->flags & XEN_NETTXF_more_data))
>  		return 0;
> @@ -922,10 +923,20 @@ static int netbk_count_requests(struct xenvif *vif,
> 
>  		memcpy(txp, RING_GET_REQUEST(&vif->tx, cons + frags),
>  		       sizeof(*txp));
> -		if (txp->size > first->size) {
> -			netdev_err(vif->dev, "Frag is bigger than frame.\n");
> -			netbk_fatal_tx_err(vif);
> -			return -EIO;
> +
> +		/*
> +		 * If the guest submitted a frame >= 64 KiB then
> +		 * first->size overflowed and following frags will
> +		 * appear to be larger than the frame.
> +		 *
> +		 * This cannot be a fatal error as there are buggy
> +		 * frontends that do this.
> +		 *
> +		 * Consume all the frags and drop the packet.
> +		 */
> +		if (!drop && txp->size > first->size) {
> +			netdev_dbg(vif->dev, "Frag is bigger than frame.\n");
> +			drop = true;
>  		}
> 
>  		first->size -= txp->size;
> @@ -938,6 +949,12 @@ static int netbk_count_requests(struct xenvif *vif,
>  			return -EINVAL;
>  		}
>  	} while ((txp++)->flags & XEN_NETTXF_more_data);
> +
> +	if (drop) {
> +		netbk_tx_err(vif, txp, idx + frags);

This needs to be netbk_tx_err(vif, first, idx + frags) or the guest will
crash as we push a bunch of invalid responses.

David

> +		return -EIO;
> +	}
> +
>  	return frags;
>  }
> 
> @@ -1327,7 +1344,7 @@ static unsigned xen_netbk_tx_build_gops(struct
> xen_netbk *netbk)
>  				continue;
>  		}
> 
> -		ret = netbk_count_requests(vif, &txreq, txfrags, work_to_do);
> +		ret = netbk_count_requests(vif, &txreq, txfrags, work_to_do, idx);
>  		if (unlikely(ret < 0))
>  			continue;

^ permalink raw reply

* Re: sfc fixes for stable (retry)
From: David Miller @ 2013-03-20 19:43 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev, linux-net-drivers, scrum-linux
In-Reply-To: <1363807614.2677.22.camel@bwh-desktop.uk.solarflarecom.com>

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Wed, 20 Mar 2013 19:26:54 +0000

> Please consider the attached patchsets for 3.0.y, 3.2.y, 3.4.y and 3.8.y
> respectively.
> 
> They contain backports of the following fixes, respectively:
 ...
> All of these are now in Linus's tree.

Ok, will queue them up into my next -stable submission.

Thanks for doing all of this work Ben.

^ permalink raw reply

* Re: [PATCH net-next] filter: add minimal BPF JIT image disassembler
From: David Miller @ 2013-03-20 19:42 UTC (permalink / raw)
  To: dborkman; +Cc: netdev, edumazet
In-Reply-To: <1363807913-4725-1-git-send-email-dborkman@redhat.com>

From: Daniel Borkmann <dborkman@redhat.com>
Date: Wed, 20 Mar 2013 20:31:53 +0100

> This is a minimal stand-alone user space helper, that allows for debugging or
> verification of emitted BPF JIT images.

What makefile target will build this tool?

^ permalink raw reply

* [PATCH net-next] filter: add minimal BPF JIT image disassembler
From: Daniel Borkmann @ 2013-03-20 19:31 UTC (permalink / raw)
  To: davem; +Cc: netdev, Eric Dumazet

This is a minimal stand-alone user space helper, that allows for debugging or
verification of emitted BPF JIT images. This is in particular useful for
emitted opcode debugging, since minor bugs in the JIT compiler can be fatal.
The disassembler is architecture generic and uses libopcodes and libbfd.

How to get to the disassembly, example:

  1) `echo 2 > /proc/sys/net/core/bpf_jit_enable`
  2) Load a BPF filter (e.g. `tcpdump -p -n -s 0 -i eth1 host 192.168.20.0/24`)
  3) Run e.g. `bpf_jit_disasm -o` to disassemble the most recent JIT code output

`bpf_jit_disasm -o` will display the related opcodes to a particular instruction
as well. Example for x86_64:

$./bpf_jit_disasm
94 bytes emitted from JIT compiler (pass:3, flen:9)
ffffffffa0356000 + <x>:
   0:	push   %rbp
   1:	mov    %rsp,%rbp
   4:	sub    $0x60,%rsp
   8:	mov    %rbx,-0x8(%rbp)
   c:	mov    0x68(%rdi),%r9d
  10:	sub    0x6c(%rdi),%r9d
  14:	mov    0xe0(%rdi),%r8
  1b:	mov    $0xc,%esi
  20:	callq  0xffffffffe0d01b71
  25:	cmp    $0x86dd,%eax
  2a:	jne    0x000000000000003d
  2c:	mov    $0x14,%esi
  31:	callq  0xffffffffe0d01b8d
  36:	cmp    $0x6,%eax
[...]
  5c:	leaveq
  5d:	retq

$ ./bpf_jit_disasm -o
94 bytes emitted from JIT compiler (pass:3, flen:9)
ffffffffa0356000 + <x>:
   0:	push   %rbp
	55
   1:	mov    %rsp,%rbp
	48 89 e5
   4:	sub    $0x60,%rsp
	48 83 ec 60
   8:	mov    %rbx,-0x8(%rbp)
	48 89 5d f8
   c:	mov    0x68(%rdi),%r9d
	44 8b 4f 68
  10:	sub    0x6c(%rdi),%r9d
	44 2b 4f 6c
[...]
  5c:	leaveq
	c9
  5d:	retq
	c3

Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Eric Dumazet <edumazet@google.com>
---
 I have added Eric's Acked-by, since nothing in the code has changed, only the
 location that we agreed upon, namely tools/net/. I hope that's okay.

 v1 -> v2: change location of file from scripts/ to tools/net/

 tools/net/bpf_jit_disasm.c | 216 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 216 insertions(+)
 create mode 100644 tools/net/bpf_jit_disasm.c

diff --git a/tools/net/bpf_jit_disasm.c b/tools/net/bpf_jit_disasm.c
new file mode 100644
index 0000000..1fe9fb5
--- /dev/null
+++ b/tools/net/bpf_jit_disasm.c
@@ -0,0 +1,216 @@
+/*
+ * Minimal BPF JIT image disassembler
+ *
+ * Disassembles BPF JIT compiler emitted opcodes back to asm insn's for
+ * debugging or verification purposes.
+ *
+ * There is no Makefile. Compile with
+ *
+ *   `gcc -Wall -O2 bpf_jit_disasm.c -o bpf_jit_disasm -lopcodes -lbfd -ldl`
+ *
+ * or similar.
+ *
+ * To get the disassembly of the JIT code, do the following:
+ *
+ *  1) `echo 2 > /proc/sys/net/core/bpf_jit_enable`
+ *  2) Load a BPF filter (e.g. `tcpdump -p -n -s 0 -i eth1 host 192.168.20.0/24`)
+ *  3) Run e.g. `./bpf_jit_disasm -o` to read out the last JIT code
+ *
+ * Copyright 2013 Daniel Borkmann <borkmann@redhat.com>
+ * Licensed under the GNU General Public License, version 2.0 (GPLv2)
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <unistd.h>
+#include <string.h>
+#include <bfd.h>
+#include <dis-asm.h>
+#include <sys/klog.h>
+#include <sys/types.h>
+#include <regex.h>
+
+#define VERSION_STRING	"1.0"
+
+static void get_exec_path(char *tpath, size_t size)
+{
+	char *path;
+	ssize_t len;
+
+	snprintf(tpath, size, "/proc/%d/exe", (int) getpid());
+	tpath[size - 1] = 0;
+
+	path = strdup(tpath);
+	assert(path);
+
+	len = readlink(path, tpath, size);
+	tpath[len] = 0;
+
+	free(path);
+}
+
+static void get_asm_insns(uint8_t *image, size_t len, unsigned long base,
+			  int opcodes)
+{
+	int count, i, pc = 0;
+	char tpath[256];
+	struct disassemble_info info;
+	disassembler_ftype disassemble;
+	bfd *bfdf;
+
+	memset(tpath, 0, sizeof(tpath));
+	get_exec_path(tpath, sizeof(tpath));
+
+	bfdf = bfd_openr(tpath, NULL);
+	assert(bfdf);
+	assert(bfd_check_format(bfdf, bfd_object));
+
+	init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf);
+	info.arch = bfd_get_arch(bfdf);
+	info.mach = bfd_get_mach(bfdf);
+	info.buffer = image;
+	info.buffer_length = len;
+
+	disassemble_init_for_target(&info);
+
+	disassemble = disassembler(bfdf);
+	assert(disassemble);
+
+	do {
+		printf("%4x:\t", pc);
+
+		count = disassemble(pc, &info);
+
+		if (opcodes) {
+			printf("\n\t");
+			for (i = 0; i < count; ++i)
+				printf("%02x ", (uint8_t) image[pc + i]);
+		}
+		printf("\n");
+
+		pc += count;
+	} while(count > 0 && pc < len);
+
+	bfd_close(bfdf);
+}
+
+static char *get_klog_buff(int *klen)
+{
+	int ret, len = klogctl(10, NULL, 0);
+	char *buff = malloc(len);
+
+	assert(buff && klen);
+	ret = klogctl(3, buff, len);
+	assert(ret >= 0);
+	*klen = ret;
+
+	return buff;
+}
+
+static void put_klog_buff(char *buff)
+{
+	free(buff);
+}
+
+static int get_last_jit_image(char *haystack, size_t hlen,
+			      uint8_t *image, size_t ilen,
+			      unsigned long *base)
+{
+	char *ptr, *pptr, *tmp;
+	off_t off = 0;
+	int ret, flen, proglen, pass, ulen = 0;
+	regmatch_t pmatch[1];
+	regex_t regex;
+
+	if (hlen == 0)
+		return 0;
+
+	ret = regcomp(&regex, "flen=[[:alnum:]]+ proglen=[[:digit:]]+ "
+		      "pass=[[:digit:]]+ image=[[:xdigit:]]+", REG_EXTENDED);
+	assert(ret == 0);
+
+	ptr = haystack;
+	while (1) {
+		ret = regexec(&regex, ptr, 1, pmatch, 0);
+		if (ret == 0) {
+			ptr += pmatch[0].rm_eo;
+			off += pmatch[0].rm_eo;
+			assert(off < hlen);
+		} else
+			break;
+	}
+
+	ptr = haystack + off - (pmatch[0].rm_eo - pmatch[0].rm_so);
+	ret = sscanf(ptr, "flen=%d proglen=%d pass=%d image=%lx",
+		     &flen, &proglen, &pass, base);
+	if (ret != 4)
+		return 0;
+
+	tmp = ptr = haystack + off;
+	while ((ptr = strtok(tmp, "\n")) != NULL && ulen < ilen) {
+		tmp = NULL;
+		if (!strstr(ptr, "JIT code"))
+			continue;
+		pptr = ptr;
+		while ((ptr = strstr(pptr, ":")))
+			pptr = ptr + 1;
+		ptr = pptr;
+		do {
+			image[ulen++] = (uint8_t) strtoul(pptr, &pptr, 16);
+			if (ptr == pptr || ulen >= ilen) {
+				ulen--;
+				break;
+			}
+			ptr = pptr;
+		} while (1);
+	}
+
+	assert(ulen == proglen);
+	printf("%d bytes emitted from JIT compiler (pass:%d, flen:%d)\n",
+	       proglen, pass, flen);
+	printf("%lx + <x>:\n", *base);
+
+	regfree(&regex);
+	return ulen;
+}
+
+static void help(void)
+{
+	printf("Usage: bpf_jit_disasm [-ohv]\n");
+	printf("Version %s, written by Daniel Borkmann <borkmann@redhat.com>\n",
+	       VERSION_STRING);
+	printf("  -o                             Include opcodes in output\n");
+	printf("  -h|-v                          Show help/version\n");
+	exit(0);
+}
+
+int main(int argc, char **argv)
+{
+	int len, klen, opcodes = 0;
+	char *kbuff;
+	unsigned long base;
+	uint8_t image[4096];
+
+	if (argc > 1) {
+		if (!strncmp("-o", argv[argc - 1], 2))
+			opcodes = 1;
+		if (!strncmp("-h", argv[argc - 1], 2) ||
+		    !strncmp("-v", argv[argc - 1], 2))
+			help();
+	}
+
+	bfd_init();
+	memset(image, 0, sizeof(image));
+
+	kbuff = get_klog_buff(&klen);
+
+	len = get_last_jit_image(kbuff, klen, image, sizeof(image), &base);
+	if (len > 0 && base > 0)
+		get_asm_insns(image, len, base, opcodes);
+
+	put_klog_buff(kbuff);
+
+	return 0;
+}
-- 
1.7.11.7

^ permalink raw reply related

* Re: [PATCH] net: Add socket() system call self test.
From: Daniel Baluta @ 2013-03-20 19:29 UTC (permalink / raw)
  To: David Miller
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, Alexandru Copot
In-Reply-To: <20130320.151055.2179062291630664090.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>

On Wed, Mar 20, 2013 at 9:10 PM, David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> wrote:
> From: Daniel Baluta <daniel.baluta-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Date: Wed, 20 Mar 2013 00:14:05 +0200
>
>> I think it's better to have a selftests/net directory dedicated for
>> networking tests. Over time
>> the number of net-{x} directories may become very large.
>
> Good idea, here's what I've done for now:
>
> ====================
> net: Move selftests to common net/ subdirectory.
>
> Suggested-by: Daniel Baluta <daniel.baluta-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> ---
>  tools/testing/selftests/Makefile                         |  3 +--
>  tools/testing/selftests/net-socket/Makefile              | 16 ----------------
>  tools/testing/selftests/{net-afpacket => net}/Makefile   |  9 +++++----
>  .../selftests/{net-afpacket => net}/psock_fanout.c       |  0
>  .../selftests/{net-afpacket => net}/run_afpackettests    |  0
>  .../selftests/{net-socket => net}/run_netsocktests       |  0
>  tools/testing/selftests/{net-socket => net}/socket.c     |  0
>  7 files changed, 6 insertions(+), 22 deletions(-)
>  delete mode 100644 tools/testing/selftests/net-socket/Makefile
>  rename tools/testing/selftests/{net-afpacket => net}/Makefile (55%)
>  rename tools/testing/selftests/{net-afpacket => net}/psock_fanout.c (100%)
>  rename tools/testing/selftests/{net-afpacket => net}/run_afpackettests (100%)
>  rename tools/testing/selftests/{net-socket => net}/run_netsocktests (100%)
>  rename tools/testing/selftests/{net-socket => net}/socket.c (100%)
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 7f50078..a480593 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -5,8 +5,7 @@ TARGETS += vm
>  TARGETS += cpu-hotplug
>  TARGETS += memory-hotplug
>  TARGETS += efivarfs
> -TARGETS += net-socket
> -TARGETS += net-afpacket
> +TARGETS += net
>
>  all:
>         for TARGET in $(TARGETS); do \
> diff --git a/tools/testing/selftests/net-socket/Makefile b/tools/testing/selftests/net-socket/Makefile
> deleted file mode 100644
> index 2450fd8..0000000
> --- a/tools/testing/selftests/net-socket/Makefile
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -# Makefile for net-socket selftests
> -
> -CC = $(CROSS_COMPILE)gcc
> -CFLAGS = -Wall
> -
> -NET_SOCK_PROGS = socket
> -
> -all: $(NET_SOCK_PROGS)
> -%: %.c
> -       $(CC) $(CFLAGS) -o $@ $^
> -
> -run_tests: all
> -       @/bin/sh ./run_netsocktests || echo "sockettests: [FAIL]"
> -
> -clean:
> -       $(RM) $(NET_SOCK_PROGS)
> diff --git a/tools/testing/selftests/net-afpacket/Makefile b/tools/testing/selftests/net/Makefile
> similarity index 55%
> rename from tools/testing/selftests/net-afpacket/Makefile
> rename to tools/testing/selftests/net/Makefile
> index 45f2ffb..bd6e272 100644
> --- a/tools/testing/selftests/net-afpacket/Makefile
> +++ b/tools/testing/selftests/net/Makefile
> @@ -1,18 +1,19 @@
> -# Makefile for net-socket selftests
> +# Makefile for net selftests
>
>  CC = $(CROSS_COMPILE)gcc
>  CFLAGS = -Wall
>
>  CFLAGS += -I../../../../usr/include/
>
> -AF_PACKET_PROGS = psock_fanout
> +NET_PROGS = socket psock_fanout
>
> -all: $(AF_PACKET_PROGS)
> +all: $(NET_PROGS)
>  %: %.c
>         $(CC) $(CFLAGS) -o $@ $^
>
>  run_tests: all
> +       @/bin/sh ./run_netsocktests || echo "sockettests: [FAIL]"
>         @/bin/sh ./run_afpackettests || echo "afpackettests: [FAIL]"
>
>  clean:
> -       $(RM) $(AF_PACKET_PROGS)
> +       $(RM) $(NET_PROGS)
> diff --git a/tools/testing/selftests/net-afpacket/psock_fanout.c b/tools/testing/selftests/net/psock_fanout.c
> similarity index 100%
> rename from tools/testing/selftests/net-afpacket/psock_fanout.c
> rename to tools/testing/selftests/net/psock_fanout.c
> diff --git a/tools/testing/selftests/net-afpacket/run_afpackettests b/tools/testing/selftests/net/run_afpackettests
> similarity index 100%
> rename from tools/testing/selftests/net-afpacket/run_afpackettests
> rename to tools/testing/selftests/net/run_afpackettests
> diff --git a/tools/testing/selftests/net-socket/run_netsocktests b/tools/testing/selftests/net/run_netsocktests
> similarity index 100%
> rename from tools/testing/selftests/net-socket/run_netsocktests
> rename to tools/testing/selftests/net/run_netsocktests
> diff --git a/tools/testing/selftests/net-socket/socket.c b/tools/testing/selftests/net/socket.c
> similarity index 100%
> rename from tools/testing/selftests/net-socket/socket.c
> rename to tools/testing/selftests/net/socket.c
> --
> 1.7.11.7
>
Looks good. Thanks!
--
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

* Re: [PATCH] fec: Fix the build as module
From: Fabio Estevam @ 2013-03-20 19:27 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: davem, Frank.Li, netdev, Fabio Estevam
In-Reply-To: <20130320191630.GJ20530@pengutronix.de>

On Wed, Mar 20, 2013 at 4:16 PM, Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> Hello,
>
> On Wed, Mar 20, 2013 at 03:19:32PM -0300, Fabio Estevam wrote:
>> From: Fabio Estevam <fabio.estevam@freescale.com>
>>
>> Since commit ff43da86c69 (NET: FEC: dynamtic check DMA desc buff type) the
>> following build error happens when CONFIG_FEC=m
>>
>> ERROR: "fec_ptp_init" [drivers/net/ethernet/freescale/fec.ko] undefined!
>> ERROR: "fec_ptp_ioctl" [drivers/net/ethernet/freescale/fec.ko] undefined!
>> ERROR: "fec_ptp_start_cyclecounter" [drivers/net/ethernet/freescale/fec.ko] undefined!
>>
>> Fix it by exporting the required fec_ptp symbols.
> IMHO this is not sensible. There is no need to make the fec driver 2
> modules. Just loading one is impossible (fec.ko) or useless
> (fec_ptp.ko). That's why I suggested to make them a single module.

Ok, I wil do as you suggested on a subsequent patch.

Regards,

Fabio Estevam

^ permalink raw reply

* sfc fixes for stable (retry)
From: Ben Hutchings @ 2013-03-20 19:26 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers, scrum-linux

[-- Attachment #1: Type: text/plain, Size: 2208 bytes --]

David,

Please consider the attached patchsets for 3.0.y, 3.2.y, 3.4.y and 3.8.y
respectively.

They contain backports of the following fixes, respectively:

3.0             4017dbdc14af sfc: Fix loop condition for efx_filter_search() when !for_insert
3.0             a659b2a94d87 sfc: Fix Siena mac statistics on big endian platforms
3.0 3.2 3.4     3dca9d2dc285 sfc: Do not attempt to flush queues if DMA is disabled
3.0 3.2 3.4     bfeed902946a sfc: Convert firmware subtypes to native byte order in efx_mcdi_get_board_cfg()
        3.4     9724a8504c87 sfc: Add parentheses around use of bitfield macro arguments
        3.4     0a6e5008a9df sfc: Fix MCDI structure field lookup
3.0 3.2         a606f4325dca sfc: Disable flow control during flushes
3.0 3.2 3.4     d5e8cc6c946e sfc: Really disable flow control while flushing
3.0 3.2 3.4     525d9e824018 sfc: Work-around flush timeout when flushes have completed
3.0 3.2 3.4     c2f3b8e3a44b sfc: lock TX queues when calling netif_device_detach()
3.0 3.2 3.4     ebf98e797b4e sfc: Fix timekeeping in efx_mcdi_poll()
        3.4     d4f2cecce138 sfc: Disable VF queues during register self-test
        3.4     450783747f42 sfc: Avoid generating over-length MC_CMD_FLUSH_RX_QUEUES request
        3.4     ef492f11efed sfc: Correctly initialise reset_method in siena_test_chip()
            3.8 56567c6f8751 drivers/net/ethernet/sfc/ptp.c: adjust duplicate test
3.0 3.2 3.4 3.8 3a68f19d7afb sfc: Properly sync RX DMA buffer when it is not the last in the page
3.0 3.2 3.4 3.8 b590ace09d51 sfc: Fix efx_rx_buf_offset() in the presence of swiotlb
3.0 3.2 3.4 3.8 c73e787a8db9 sfc: Correct efx_rx_buffer::page_offset when EFX_PAGE_IP_ALIGN != 0
3.0 3.2 3.4 3.8 29c69a488264 sfc: Detach net device when stopping queues for reconfiguration
3.0 3.2 3.4 3.8 35205b211c8d sfc: Disable soft interrupt handling during efx_device_detach_sync()
3.0 3.2 3.4 3.8 fae8563b25f7 sfc: Only use TX push if a single descriptor is to be written

All of these are now in Linus's tree.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


[-- Attachment #2: sfc_3.0.mbox --]
[-- Type: application/mbox, Size: 35238 bytes --]

[-- Attachment #3: sfc_3.2.mbox --]
[-- Type: application/mbox, Size: 31246 bytes --]

[-- Attachment #4: sfc_3.4.mbox --]
[-- Type: application/mbox, Size: 51892 bytes --]

[-- Attachment #5: sfc_3.8.mbox --]
[-- Type: application/mbox, Size: 13636 bytes --]

^ permalink raw reply

* Re: [PATCH v2] chelsio: use netdev_alloc_skb_ip_align
From: David Miller @ 2013-03-20 19:25 UTC (permalink / raw)
  To: stephen; +Cc: eric.dumazet, netdev
In-Reply-To: <20130320120241.19314ab6@nehalam.linuxnetplumber.net>

From: Stephen Hemminger <stephen@networkplumber.org>
Date: Wed, 20 Mar 2013 12:02:41 -0700

> Use netdev_alloc_sk_ip_align in the case where packet is copied.
> This handles case where NET_IP_ALIGN == 0 as well as adding required header
> padding.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Applied, thanks Stephen.

^ permalink raw reply

* Re: pull request: wireless 2013-03-20
From: David Miller @ 2013-03-20 19:21 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <20130320191107.GA9978@tuxdriver.com>

From: "John W. Linville" <linville@tuxdriver.com>
Date: Wed, 20 Mar 2013 15:11:08 -0400

> I present to you another batch of fixes intended for the 3.9 stream...
> 
> On the bluetooth bits, Gustavo says:
> 
> "I put together 3 fixes intended for 3.9, there are support for two
> new devices and a NULL dereference fix in the SCO code."
> 
> Amitkumar Karwar fixes a command queueing race in mwifiex.
> 
> Bing Zhao provides a pair of mwifiex related to cleaning-up before
> a shutdown.
> 
> Felix Fietkau provides an ath9k fix for a regression caused by an
> earlier calibration fix, and another ath9k fix to avoid race conditions
> that unnecessarily lead to chip resets.
> 
> Jussi Kivilinna prevents and skbuff leak in rtlwifi.
> 
> Stanislaw Gruszka corrects a length paramater for a DMA buffer mapping
> operation in iwlegacy.

Pulled, thanks John!

^ permalink raw reply

* Re: [PATCH] fec: Fix the build as module
From: Uwe Kleine-König @ 2013-03-20 19:16 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: davem, Frank.Li, netdev, Fabio Estevam
In-Reply-To: <1363803572-17039-1-git-send-email-festevam@gmail.com>

Hello,

On Wed, Mar 20, 2013 at 03:19:32PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Since commit ff43da86c69 (NET: FEC: dynamtic check DMA desc buff type) the 
> following build error happens when CONFIG_FEC=m
> 
> ERROR: "fec_ptp_init" [drivers/net/ethernet/freescale/fec.ko] undefined!
> ERROR: "fec_ptp_ioctl" [drivers/net/ethernet/freescale/fec.ko] undefined!
> ERROR: "fec_ptp_start_cyclecounter" [drivers/net/ethernet/freescale/fec.ko] undefined!
> 
> Fix it by exporting the required fec_ptp symbols.
IMHO this is not sensible. There is no need to make the fec driver 2
modules. Just loading one is impossible (fec.ko) or useless
(fec_ptp.ko). That's why I suggested to make them a single module.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply

* Re: [PATCH] igb: fix PHC stopping on max freq
From: Jiri Benc @ 2013-03-20 19:11 UTC (permalink / raw)
  To: Vick, Matthew
  Cc: netdev@vger.kernel.org, e1000-devel@lists.sourceforge.net,
	Kirsher, Jeffrey T, Stefan Assmann, Miroslav Lichvar
In-Reply-To: <CD6E221E.1657D%matthew.vick@intel.com>

On Tue, 19 Mar 2013 21:17:25 +0000, Vick, Matthew wrote:
> Good catch on this, Jiri! I know the math works out the same, but I'd
> prefer it if you changed the max_adj value to 999999999, since that is
> technically what we can accept before we have any issues. If you re-submit
> with this change, I'll add my ACK and we can run it through our internal
> testing. Thanks!

But the real maximum value is actually 999999881, as anything higher
than that would be capped to 999999881 by the driver. I don't think the
driver should advertise higher max_adj than it is able to fulfill,
otherwise there would be no need for the field.

 Jiri

-- 
Jiri Benc

^ permalink raw reply

* pull request: wireless 2013-03-20
From: John W. Linville @ 2013-03-20 19:11 UTC (permalink / raw)
  To: davem; +Cc: linux-wireless, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 16112 bytes --]

Dave,

I present to you another batch of fixes intended for the 3.9 stream...

On the bluetooth bits, Gustavo says:

"I put together 3 fixes intended for 3.9, there are support for two
new devices and a NULL dereference fix in the SCO code."

Amitkumar Karwar fixes a command queueing race in mwifiex.

Bing Zhao provides a pair of mwifiex related to cleaning-up before
a shutdown.

Felix Fietkau provides an ath9k fix for a regression caused by an
earlier calibration fix, and another ath9k fix to avoid race conditions
that unnecessarily lead to chip resets.

Jussi Kivilinna prevents and skbuff leak in rtlwifi.

Stanislaw Gruszka corrects a length paramater for a DMA buffer mapping
operation in iwlegacy.

Please let me know if there are problems!

John

---

The following changes since commit da2191e31409d1058dcbed44e8f53e39a40e86b3:

  net: fec: Define indexes as 'unsigned int' (2013-03-20 12:28:59 -0400)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git for-davem

for you to fetch changes up to b9d5319041999401d29e7efcd5d15664edfaad2e:

  Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless into for-davem (2013-03-20 14:26:37 -0400)

----------------------------------------------------------------

Amitkumar Karwar (1):
      mwifiex: fix race when queuing commands

Bing Zhao (2):
      mwifiex: skip pending commands after function shutdown
      mwifiex: cancel cmd timer and free curr_cmd in shutdown process

Felix Fietkau (2):
      ath9k_hw: revert chainmask to user configuration after calibration
      ath9k: limit tx path hang check to normal data queues

John W. Linville (2):
      Merge branch 'master' of git://git.kernel.org/.../bluetooth/bluetooth
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem

Jussi Kivilinna (1):
      rtlwifi: usb: add missing freeing of skbuff

Ming Lei (2):
      Bluetooth: Add support for Dell[QCA 0cf3:0036]
      Bluetooth: Add support for Dell[QCA 0cf3:817a]

Stanislaw Gruszka (1):
      iwl3945: fix length of dma buffers

Vinicius Costa Gomes (1):
      Bluetooth: Fix not closing SCO sockets in the BT_CONNECT2 state

 drivers/bluetooth/ath3k.c                     |  4 ++++
 drivers/bluetooth/btusb.c                     |  2 ++
 drivers/net/wireless/ath/ath9k/ar9003_calib.c |  4 ++++
 drivers/net/wireless/ath/ath9k/link.c         | 26 +++++++++++++-------------
 drivers/net/wireless/iwlegacy/3945-mac.c      | 22 ++++++++++++----------
 drivers/net/wireless/mwifiex/cmdevt.c         | 22 ++++++++++++++++------
 drivers/net/wireless/mwifiex/init.c           |  8 ++++++++
 drivers/net/wireless/mwifiex/main.h           |  4 ++--
 drivers/net/wireless/mwifiex/scan.c           |  8 ++++----
 drivers/net/wireless/mwifiex/sta_ioctl.c      | 10 ++--------
 drivers/net/wireless/rtlwifi/usb.c            |  1 +
 net/bluetooth/sco.c                           |  1 +
 12 files changed, 69 insertions(+), 43 deletions(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index b282af1..6aab00e 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -73,9 +73,11 @@ static struct usb_device_id ath3k_table[] = {
 	{ USB_DEVICE(0x03F0, 0x311D) },
 
 	/* Atheros AR3012 with sflash firmware*/
+	{ USB_DEVICE(0x0CF3, 0x0036) },
 	{ USB_DEVICE(0x0CF3, 0x3004) },
 	{ USB_DEVICE(0x0CF3, 0x3008) },
 	{ USB_DEVICE(0x0CF3, 0x311D) },
+	{ USB_DEVICE(0x0CF3, 0x817a) },
 	{ USB_DEVICE(0x13d3, 0x3375) },
 	{ USB_DEVICE(0x04CA, 0x3004) },
 	{ USB_DEVICE(0x04CA, 0x3005) },
@@ -107,9 +109,11 @@ MODULE_DEVICE_TABLE(usb, ath3k_table);
 static struct usb_device_id ath3k_blist_tbl[] = {
 
 	/* Atheros AR3012 with sflash firmware*/
+	{ USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index e547851..2cc5f77 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -131,9 +131,11 @@ static struct usb_device_id blacklist_table[] = {
 	{ USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE },
 
 	/* Atheros 3012 with sflash firmware */
+	{ USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x0cf3, 0x817a), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 4cc1394..f76c3ca 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -1023,6 +1023,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
 					  AR_PHY_AGC_CONTROL_FLTR_CAL   |
 					  AR_PHY_AGC_CONTROL_PKDET_CAL;
 
+	/* Use chip chainmask only for calibration */
 	ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask);
 
 	if (rtt) {
@@ -1150,6 +1151,9 @@ skip_tx_iqcal:
 		ar9003_hw_rtt_disable(ah);
 	}
 
+	/* Revert chainmask to runtime parameters */
+	ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
+
 	/* Initialize list pointers */
 	ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
 
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c
index ade3afb..39c84ec 100644
--- a/drivers/net/wireless/ath/ath9k/link.c
+++ b/drivers/net/wireless/ath/ath9k/link.c
@@ -28,21 +28,21 @@ void ath_tx_complete_poll_work(struct work_struct *work)
 	int i;
 	bool needreset = false;
 
-	for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
-		if (ATH_TXQ_SETUP(sc, i)) {
-			txq = &sc->tx.txq[i];
-			ath_txq_lock(sc, txq);
-			if (txq->axq_depth) {
-				if (txq->axq_tx_inprogress) {
-					needreset = true;
-					ath_txq_unlock(sc, txq);
-					break;
-				} else {
-					txq->axq_tx_inprogress = true;
-				}
+	for (i = 0; i < IEEE80211_NUM_ACS; i++) {
+		txq = sc->tx.txq_map[i];
+
+		ath_txq_lock(sc, txq);
+		if (txq->axq_depth) {
+			if (txq->axq_tx_inprogress) {
+				needreset = true;
+				ath_txq_unlock(sc, txq);
+				break;
+			} else {
+				txq->axq_tx_inprogress = true;
 			}
-			ath_txq_unlock_complete(sc, txq);
 		}
+		ath_txq_unlock_complete(sc, txq);
+	}
 
 	if (needreset) {
 		ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index 3630a41..c353b5f 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -475,6 +475,7 @@ il3945_tx_skb(struct il_priv *il,
 	dma_addr_t txcmd_phys;
 	int txq_id = skb_get_queue_mapping(skb);
 	u16 len, idx, hdr_len;
+	u16 firstlen, secondlen;
 	u8 id;
 	u8 unicast;
 	u8 sta_id;
@@ -589,21 +590,22 @@ il3945_tx_skb(struct il_priv *il,
 	len =
 	    sizeof(struct il3945_tx_cmd) + sizeof(struct il_cmd_header) +
 	    hdr_len;
-	len = (len + 3) & ~3;
+	firstlen = (len + 3) & ~3;
 
 	/* Physical address of this Tx command's header (not MAC header!),
 	 * within command buffer array. */
 	txcmd_phys =
-	    pci_map_single(il->pci_dev, &out_cmd->hdr, len, PCI_DMA_TODEVICE);
+	    pci_map_single(il->pci_dev, &out_cmd->hdr, firstlen,
+			   PCI_DMA_TODEVICE);
 	if (unlikely(pci_dma_mapping_error(il->pci_dev, txcmd_phys)))
 		goto drop_unlock;
 
 	/* Set up TFD's 2nd entry to point directly to remainder of skb,
 	 * if any (802.11 null frames have no payload). */
-	len = skb->len - hdr_len;
-	if (len) {
+	secondlen = skb->len - hdr_len;
+	if (secondlen > 0) {
 		phys_addr =
-		    pci_map_single(il->pci_dev, skb->data + hdr_len, len,
+		    pci_map_single(il->pci_dev, skb->data + hdr_len, secondlen,
 				   PCI_DMA_TODEVICE);
 		if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr)))
 			goto drop_unlock;
@@ -611,12 +613,12 @@ il3945_tx_skb(struct il_priv *il,
 
 	/* Add buffer containing Tx command and MAC(!) header to TFD's
 	 * first entry */
-	il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, len, 1, 0);
+	il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, firstlen, 1, 0);
 	dma_unmap_addr_set(out_meta, mapping, txcmd_phys);
-	dma_unmap_len_set(out_meta, len, len);
-	if (len)
-		il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, len, 0,
-					       U32_PAD(len));
+	dma_unmap_len_set(out_meta, len, firstlen);
+	if (secondlen > 0)
+		il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, secondlen, 0,
+					       U32_PAD(secondlen));
 
 	if (!ieee80211_has_morefrags(hdr->frame_control)) {
 		txq->need_update = 1;
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index 20a6c55..b5c8b96 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -157,6 +157,20 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
 		return -1;
 	}
 
+	cmd_code = le16_to_cpu(host_cmd->command);
+	cmd_size = le16_to_cpu(host_cmd->size);
+
+	if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET &&
+	    cmd_code != HostCmd_CMD_FUNC_SHUTDOWN &&
+	    cmd_code != HostCmd_CMD_FUNC_INIT) {
+		dev_err(adapter->dev,
+			"DNLD_CMD: FW in reset state, ignore cmd %#x\n",
+			cmd_code);
+		mwifiex_complete_cmd(adapter, cmd_node);
+		mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
+		return -1;
+	}
+
 	/* Set command sequence number */
 	adapter->seq_num++;
 	host_cmd->seq_num = cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO
@@ -168,9 +182,6 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
 	adapter->curr_cmd = cmd_node;
 	spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
 
-	cmd_code = le16_to_cpu(host_cmd->command);
-	cmd_size = le16_to_cpu(host_cmd->size);
-
 	/* Adjust skb length */
 	if (cmd_node->cmd_skb->len > cmd_size)
 		/*
@@ -484,8 +495,6 @@ int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no,
 
 	ret = mwifiex_send_cmd_async(priv, cmd_no, cmd_action, cmd_oid,
 				     data_buf);
-	if (!ret)
-		ret = mwifiex_wait_queue_complete(adapter);
 
 	return ret;
 }
@@ -588,9 +597,10 @@ int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no,
 	if (cmd_no == HostCmd_CMD_802_11_SCAN) {
 		mwifiex_queue_scan_cmd(priv, cmd_node);
 	} else {
-		adapter->cmd_queued = cmd_node;
 		mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true);
 		queue_work(adapter->workqueue, &adapter->main_work);
+		if (cmd_node->wait_q_enabled)
+			ret = mwifiex_wait_queue_complete(adapter, cmd_node);
 	}
 
 	return ret;
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c
index e38aa9b..0ff4c37 100644
--- a/drivers/net/wireless/mwifiex/init.c
+++ b/drivers/net/wireless/mwifiex/init.c
@@ -709,6 +709,14 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
 		return ret;
 	}
 
+	/* cancel current command */
+	if (adapter->curr_cmd) {
+		dev_warn(adapter->dev, "curr_cmd is still in processing\n");
+		del_timer(&adapter->cmd_timer);
+		mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd);
+		adapter->curr_cmd = NULL;
+	}
+
 	/* shut down mwifiex */
 	dev_dbg(adapter->dev, "info: shutdown mwifiex...\n");
 
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 553adfb..7035ade 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -723,7 +723,6 @@ struct mwifiex_adapter {
 	u16 cmd_wait_q_required;
 	struct mwifiex_wait_queue cmd_wait_q;
 	u8 scan_wait_q_woken;
-	struct cmd_ctrl_node *cmd_queued;
 	spinlock_t queue_lock;		/* lock for tx queues */
 	struct completion fw_load;
 	u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
@@ -1018,7 +1017,8 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv,
 			struct mwifiex_multicast_list *mcast_list);
 int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist,
 			    struct net_device *dev);
-int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter);
+int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter,
+				struct cmd_ctrl_node *cmd_queued);
 int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
 		      struct cfg80211_ssid *req_ssid);
 int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type);
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index bb60c27..d215b4d 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1388,10 +1388,13 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
 			list_del(&cmd_node->list);
 			spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
 					       flags);
-			adapter->cmd_queued = cmd_node;
 			mwifiex_insert_cmd_to_pending_q(adapter, cmd_node,
 							true);
 			queue_work(adapter->workqueue, &adapter->main_work);
+
+			/* Perform internal scan synchronously */
+			if (!priv->scan_request)
+				mwifiex_wait_queue_complete(adapter, cmd_node);
 		} else {
 			spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
 					       flags);
@@ -1946,9 +1949,6 @@ int mwifiex_request_scan(struct mwifiex_private *priv,
 		/* Normal scan */
 		ret = mwifiex_scan_networks(priv, NULL);
 
-	if (!ret)
-		ret = mwifiex_wait_queue_complete(priv->adapter);
-
 	up(&priv->async_sem);
 
 	return ret;
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 9f33c92..13100f8 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -54,16 +54,10 @@ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist,
  * This function waits on a cmd wait queue. It also cancels the pending
  * request after waking up, in case of errors.
  */
-int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter)
+int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter,
+				struct cmd_ctrl_node *cmd_queued)
 {
 	int status;
-	struct cmd_ctrl_node *cmd_queued;
-
-	if (!adapter->cmd_queued)
-		return 0;
-
-	cmd_queued = adapter->cmd_queued;
-	adapter->cmd_queued = NULL;
 
 	dev_dbg(adapter->dev, "cmd pending\n");
 	atomic_inc(&adapter->cmd_pending);
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index 156b527..5847d6d 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -851,6 +851,7 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb,
 	if (unlikely(!_urb)) {
 		RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
 			 "Can't allocate urb. Drop skb!\n");
+		kfree_skb(skb);
 		return;
 	}
 	_rtl_submit_tx_urb(hw, _urb);
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 79d87d8..fad0302 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -359,6 +359,7 @@ static void __sco_sock_close(struct sock *sk)
 			sco_chan_del(sk, ECONNRESET);
 		break;
 
+	case BT_CONNECT2:
 	case BT_CONNECT:
 	case BT_DISCONN:
 		sco_chan_del(sk, ECONNRESET);
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply related

* Re: [PATCH] net: Add socket() system call self test.
From: David Miller @ 2013-03-20 19:10 UTC (permalink / raw)
  To: daniel.baluta; +Cc: netdev, netfilter-devel, linux-wireless
In-Reply-To: <CAEnQRZDOwE592qXK0h-u1B7R-9oWP1CZ2rbt197QTn4oagdwgw@mail.gmail.com>

From: Daniel Baluta <daniel.baluta@gmail.com>
Date: Wed, 20 Mar 2013 00:14:05 +0200

> I think it's better to have a selftests/net directory dedicated for
> networking tests. Over time
> the number of net-{x} directories may become very large.

Good idea, here's what I've done for now:

====================
net: Move selftests to common net/ subdirectory.

Suggested-by: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 tools/testing/selftests/Makefile                         |  3 +--
 tools/testing/selftests/net-socket/Makefile              | 16 ----------------
 tools/testing/selftests/{net-afpacket => net}/Makefile   |  9 +++++----
 .../selftests/{net-afpacket => net}/psock_fanout.c       |  0
 .../selftests/{net-afpacket => net}/run_afpackettests    |  0
 .../selftests/{net-socket => net}/run_netsocktests       |  0
 tools/testing/selftests/{net-socket => net}/socket.c     |  0
 7 files changed, 6 insertions(+), 22 deletions(-)
 delete mode 100644 tools/testing/selftests/net-socket/Makefile
 rename tools/testing/selftests/{net-afpacket => net}/Makefile (55%)
 rename tools/testing/selftests/{net-afpacket => net}/psock_fanout.c (100%)
 rename tools/testing/selftests/{net-afpacket => net}/run_afpackettests (100%)
 rename tools/testing/selftests/{net-socket => net}/run_netsocktests (100%)
 rename tools/testing/selftests/{net-socket => net}/socket.c (100%)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 7f50078..a480593 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -5,8 +5,7 @@ TARGETS += vm
 TARGETS += cpu-hotplug
 TARGETS += memory-hotplug
 TARGETS += efivarfs
-TARGETS += net-socket
-TARGETS += net-afpacket
+TARGETS += net
 
 all:
 	for TARGET in $(TARGETS); do \
diff --git a/tools/testing/selftests/net-socket/Makefile b/tools/testing/selftests/net-socket/Makefile
deleted file mode 100644
index 2450fd8..0000000
--- a/tools/testing/selftests/net-socket/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-# Makefile for net-socket selftests
-
-CC = $(CROSS_COMPILE)gcc
-CFLAGS = -Wall
-
-NET_SOCK_PROGS = socket
-
-all: $(NET_SOCK_PROGS)
-%: %.c
-	$(CC) $(CFLAGS) -o $@ $^
-
-run_tests: all
-	@/bin/sh ./run_netsocktests || echo "sockettests: [FAIL]"
-
-clean:
-	$(RM) $(NET_SOCK_PROGS)
diff --git a/tools/testing/selftests/net-afpacket/Makefile b/tools/testing/selftests/net/Makefile
similarity index 55%
rename from tools/testing/selftests/net-afpacket/Makefile
rename to tools/testing/selftests/net/Makefile
index 45f2ffb..bd6e272 100644
--- a/tools/testing/selftests/net-afpacket/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -1,18 +1,19 @@
-# Makefile for net-socket selftests
+# Makefile for net selftests
 
 CC = $(CROSS_COMPILE)gcc
 CFLAGS = -Wall
 
 CFLAGS += -I../../../../usr/include/
 
-AF_PACKET_PROGS = psock_fanout
+NET_PROGS = socket psock_fanout
 
-all: $(AF_PACKET_PROGS)
+all: $(NET_PROGS)
 %: %.c
 	$(CC) $(CFLAGS) -o $@ $^
 
 run_tests: all
+	@/bin/sh ./run_netsocktests || echo "sockettests: [FAIL]"
 	@/bin/sh ./run_afpackettests || echo "afpackettests: [FAIL]"
 
 clean:
-	$(RM) $(AF_PACKET_PROGS)
+	$(RM) $(NET_PROGS)
diff --git a/tools/testing/selftests/net-afpacket/psock_fanout.c b/tools/testing/selftests/net/psock_fanout.c
similarity index 100%
rename from tools/testing/selftests/net-afpacket/psock_fanout.c
rename to tools/testing/selftests/net/psock_fanout.c
diff --git a/tools/testing/selftests/net-afpacket/run_afpackettests b/tools/testing/selftests/net/run_afpackettests
similarity index 100%
rename from tools/testing/selftests/net-afpacket/run_afpackettests
rename to tools/testing/selftests/net/run_afpackettests
diff --git a/tools/testing/selftests/net-socket/run_netsocktests b/tools/testing/selftests/net/run_netsocktests
similarity index 100%
rename from tools/testing/selftests/net-socket/run_netsocktests
rename to tools/testing/selftests/net/run_netsocktests
diff --git a/tools/testing/selftests/net-socket/socket.c b/tools/testing/selftests/net/socket.c
similarity index 100%
rename from tools/testing/selftests/net-socket/socket.c
rename to tools/testing/selftests/net/socket.c
-- 
1.7.11.7

^ permalink raw reply related

* Re: [PATCH v3 1/1 net-next] NET: FEC: dynamtic check DMA desc buff type
From: Ben Hutchings @ 2013-03-20 19:09 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Frank Li, lznuaa, davem, s.hauer, netdev, shawn.guo,
	linux-arm-kernel, kernel
In-Reply-To: <1363800515.2677.13.camel@bwh-desktop.uk.solarflarecom.com>

On Wed, 2013-03-20 at 17:28 +0000, Ben Hutchings wrote:
> On Wed, 2013-03-20 at 17:04 +0100, Uwe Kleine-König wrote:
> > Hello,
> > 
> > On Fri, Jan 04, 2013 at 10:04:23AM +0800, Frank Li wrote:
> > > MX6 and mx28 support enhanced DMA descriptor buff to support 1588
> > > ptp. But MX25, MX3x, MX5x can't support enhanced DMA descriptor buff.
> > > Check fec type and choose correct DMA descriptor buff type.
> > > 
> > > Remove static config CONFIG_FEC_PTP.
> > > ptp function will be auto detected.
> > Your patch (now as ff43da86c69d76a726ffe7d1666148960dc1d108 in v3.9-rc1)
> > breaks building with CONFIG_FEC=m:
> > 
> > 	ERROR: "fec_ptp_init" [drivers/net/ethernet/freescale/fec.ko] undefined!
> > 	ERROR: "fec_ptp_ioctl" [drivers/net/ethernet/freescale/fec.ko] undefined!
> > 	ERROR: "fec_ptp_start_cyclecounter" [drivers/net/ethernet/freescale/fec.ko] undefined!
> > 
> > IMHO you should build fec.o and fec_ptp.o into the same module as they
> > cannot live without each other anyhow.
> 
> They are in the same module.  So I don't see how that error is possible.

Sorry, I misread the Makefile.  They are either both built as modules or
both built-in, but they are separate modules.

Ben.

> > Having said I wonder if it would be worthwile to support FEC without
> > PTP_1588_CLOCK. For example make the above three functions static
> > inlines if CONFIG_PTP_1588_CLOCK=n and drop the select on the latter.
> 
> See previous discussions:
> <http://thread.gmane.org/gmane.linux.kernel/1363200/focus=1376659>,
> <http://thread.gmane.org/gmane.linux.network/247963>,
> <http://thread.gmane.org/gmane.linux.network/247823/focus=248173>
> 
> Ben.
> 

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* [PATCH v2] chelsio: use netdev_alloc_skb_ip_align
From: Stephen Hemminger @ 2013-03-20 19:02 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev
In-Reply-To: <1363804952.3333.29.camel@edumazet-glaptop>

Use netdev_alloc_sk_ip_align in the case where packet is copied.
This handles case where NET_IP_ALIGN == 0 as well as adding required header
padding.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>


--- a/drivers/net/ethernet/chelsio/cxgb/sge.c	2013-03-20 11:13:47.950986878 -0700
+++ b/drivers/net/ethernet/chelsio/cxgb/sge.c	2013-03-20 12:00:01.551115729 -0700
@@ -1046,11 +1046,10 @@ static inline struct sk_buff *get_packet
 	const struct freelQ_ce *ce = &fl->centries[fl->cidx];
 
 	if (len < copybreak) {
-		skb = alloc_skb(len + 2, GFP_ATOMIC);
+		skb = netdev_alloc_skb_ip_align(NULL, len);
 		if (!skb)
 			goto use_orig_buf;
 
-		skb_reserve(skb, 2);	/* align IP header */
 		skb_put(skb, len);
 		pci_dma_sync_single_for_cpu(pdev,
 					    dma_unmap_addr(ce, dma_addr),

^ permalink raw reply

* Re: [PATCH v3 net-next 4/4] filter: add minimal BPF JIT emitted image disassembler
From: Daniel Borkmann @ 2013-03-20 18:57 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, eric.dumazet
In-Reply-To: <20130320.131713.988538863586629681.davem@davemloft.net>

On 03/20/2013 06:17 PM, David Miller wrote:
> From: Daniel Borkmann <dborkman@redhat.com>
> Date: Tue, 19 Mar 2013 17:39:32 +0100
>
>> This is a minimal stand-alone user space helper, that allows for debugging or
>> verification of emitted BPF JIT images.
>
> As Ben Hutchings suggested, please respin this such that the tool
> goes somewhere under tools/
>
> Creating a tools/net/ subdirectory for small programs like this is
> fine.

Thanks, I'll do that!

^ permalink raw reply

* Re: [PATCH] fec: Fix the build as module
From: David Miller @ 2013-03-20 18:46 UTC (permalink / raw)
  To: festevam; +Cc: Frank.Li, u.kleine-koenig, netdev, fabio.estevam
In-Reply-To: <1363803572-17039-1-git-send-email-festevam@gmail.com>

From: Fabio Estevam <festevam@gmail.com>
Date: Wed, 20 Mar 2013 15:19:32 -0300

> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Since commit ff43da86c69 (NET: FEC: dynamtic check DMA desc buff type) the 
> following build error happens when CONFIG_FEC=m
> 
> ERROR: "fec_ptp_init" [drivers/net/ethernet/freescale/fec.ko] undefined!
> ERROR: "fec_ptp_ioctl" [drivers/net/ethernet/freescale/fec.ko] undefined!
> ERROR: "fec_ptp_start_cyclecounter" [drivers/net/ethernet/freescale/fec.ko] undefined!
> 
> Fix it by exporting the required fec_ptp symbols.
> 
> Reported-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Applied and queued up for -stable.

^ permalink raw reply

* Re: [PATCH] chelsio: use netdev_alloc_skb
From: Eric Dumazet @ 2013-03-20 18:44 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20130320113024.00377b99@nehalam.linuxnetplumber.net>

On Wed, 2013-03-20 at 11:30 -0700, Stephen Hemminger wrote:

> -		skb = alloc_skb(len + 2, GFP_ATOMIC);
> +		skb = netdev_alloc_skb_ip_align(netdev, len + 2);
>  		if (!skb)
>  			goto use_orig_buf;
>  


If you use the helper, no need for 'len + 2' but :

netdev_alloc_skb_ip_align(netdev, len);

^ permalink raw reply

* Re: [PATCH 2/2] sh_eth: check TSU registers ioremap() error
From: Sergei Shtylyov @ 2013-03-20 19:45 UTC (permalink / raw)
  To: Denis Kirjanov; +Cc: David Miller, netdev, nobuhiro.iwamatsu.yj
In-Reply-To: <CAOJe8K2aoQLi0B4SaHEv0GPMe2g0YvuRQc1vwBZhLVJPZLsYCQ@mail.gmail.com>

Hello.

On 03/20/2013 09:20 PM, Denis Kirjanov wrote:

> It doesn't make sense to worry about branch misprediction during probe() :)

     You misunderstood. I didn't mean using unlikely() at all, just that 
the ioremap() failure is unlikely.


PS: Please, don't top post.

> On 3/20/13, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
>> On 03/20/2013 10:04 PM, Sergei Shtylyov wrote:
>>
>>>>> One must check the result of ioremap() -- in this case it prevents
>>>>> potential
>>>>> kernel oops when initializing TSU registers further on...
>>>>>
>>>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>>> Applied and queued up for -stable.
>>>     Thanks. However, do you really think it's needed in stable? It's
>>> only error path, after all...
>>      I forgot to add "unlikely" to the "error path". I usually don't mark
>> such patches for stable, when I'm not in a hurry. :-)
>>

WBR, Sergei

^ permalink raw reply

* Re: [PATCH] chelsio: use netdev_alloc_skb
From: Eric Dumazet @ 2013-03-20 18:42 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20130320113024.00377b99@nehalam.linuxnetplumber.net>

On Wed, 2013-03-20 at 11:30 -0700, Stephen Hemminger wrote:
> This extends on Eric's patch. It uses netdev_alloc_skb which fixes a couple of
> other issues.
>   * driver was never setting skb->dev on the received buffer
>   * copybreak allocation wasn't padding buffer
>   * copybreak assumed that ip alignment padding was always 2 (it is platform dependent)
> 
> Compile tested only, don't have this hardware.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> 
> 
> --- a/drivers/net/ethernet/chelsio/cxgb/sge.c	2013-03-20 11:13:47.950986878 -0700
> +++ b/drivers/net/ethernet/chelsio/cxgb/sge.c	2013-03-20 11:24:26.942722757 -0700
> @@ -835,7 +835,7 @@ static void refill_free_list(struct sge
>  		struct sk_buff *skb;
>  		dma_addr_t mapping;
>  
> -		skb = dev_alloc_skb(q->rx_buffer_size);
> +		skb = netdev_alloc_skb(sge->netdev, q->rx_buffer_size);
>  		if (!skb)
>  			break;

Well, this (skb->dev = dev) is done in eth_type_trans()

Many drivers use dev_alloc_skb(), I am not sure we really want to change
them.

^ permalink raw reply

* [PATCH] chelsio: use netdev_alloc_skb
From: Stephen Hemminger @ 2013-03-20 18:30 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev
In-Reply-To: <1363797199.3333.18.camel@edumazet-glaptop>

This extends on Eric's patch. It uses netdev_alloc_skb which fixes a couple of
other issues.
  * driver was never setting skb->dev on the received buffer
  * copybreak allocation wasn't padding buffer
  * copybreak assumed that ip alignment padding was always 2 (it is platform dependent)

Compile tested only, don't have this hardware.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>


--- a/drivers/net/ethernet/chelsio/cxgb/sge.c	2013-03-20 11:13:47.950986878 -0700
+++ b/drivers/net/ethernet/chelsio/cxgb/sge.c	2013-03-20 11:24:26.942722757 -0700
@@ -835,7 +835,7 @@ static void refill_free_list(struct sge
 		struct sk_buff *skb;
 		dma_addr_t mapping;
 
-		skb = dev_alloc_skb(q->rx_buffer_size);
+		skb = netdev_alloc_skb(sge->netdev, q->rx_buffer_size);
 		if (!skb)
 			break;
 
@@ -1039,18 +1039,18 @@ MODULE_PARM_DESC(copybreak, "Receive cop
  *	threshold and the packet is too big to copy, or (b) the packet should
  *	be copied but there is no memory for the copy.
  */
-static inline struct sk_buff *get_packet(struct pci_dev *pdev,
+static inline struct sk_buff *get_packet(struct net_device *netdev,
+					 struct pci_dev *pdev,
 					 struct freelQ *fl, unsigned int len)
 {
 	struct sk_buff *skb;
 	const struct freelQ_ce *ce = &fl->centries[fl->cidx];
 
 	if (len < copybreak) {
-		skb = alloc_skb(len + 2, GFP_ATOMIC);
+		skb = netdev_alloc_skb_ip_align(netdev, len + 2);
 		if (!skb)
 			goto use_orig_buf;
 
-		skb_reserve(skb, 2);	/* align IP header */
 		skb_put(skb, len);
 		pci_dma_sync_single_for_cpu(pdev,
 					    dma_unmap_addr(ce, dma_addr),
@@ -1360,7 +1360,7 @@ static void sge_rx(struct sge *sge, stru
 	struct sge_port_stats *st;
 	struct net_device *dev;
 
-	skb = get_packet(adapter->pdev, fl, len - sge->rx_pkt_pad);
+	skb = get_packet(sge->netdev, adapter->pdev, fl, len - sge->rx_pkt_pad);
 	if (unlikely(!skb)) {
 		sge->stats.rx_drops++;
 		return;

^ permalink raw reply

* Re: How to assign sockaddr_nl->nl_groups when using connector
From: Evgeniy Polyakov @ 2013-03-20 18:29 UTC (permalink / raw)
  To: vaughan; +Cc: netdev, KY Srinivasan, devel@linuxdriverproject.org
In-Reply-To: <5147CA4F.5050801@oracle.com>

Hi

On Tue, Mar 19, 2013 at 10:15:43AM +0800, vaughan (vaughan.cao@oracle.com) wrote:
> I am not quite sure how to assign nl_groups when using connector. You
> Documentation/connector/connector.txt don't explain it very clearly. I
> thought it's a bitmask representing only 32 groups.
> If I just want to subscribe only one group such as CN_KVP_IDX, what
> shall I do? Which one below is correct?
> a) l_local.nl_groups = CN_KVP_IDX;
> Or
> b) l_local.nl_groups = 1 << (CN_KVP_IDX -1)
> and bind with bind(s, (struct sockaddr *)&l_local, sizeof(struct
> sockaddr_nl)).

Iirc, first groups, created before bitmap-to-number conversion were
actually bitmaps, but then broadcast interface was obsoleted.

One should use NETLINK_ADD_MEMBERSHIP interface and specify gruop number
directly.

> I ran your example in Documentation/connector/. 'l_local.nl_groups = -1'
> in ucon.c seems subscribe all channels, because if I start cgred
> service, ucon will receive messages with idx=1.
> 
> And it seems setsockopt is not needed now, for it is done by
> netlink_autobind? You even comment it out using '#if 0' in
> Documentation/connector/ucon.c.
> 
> Could you do me a favor to check
> http://driverdev.linuxdriverproject.org/pipermail/devel/2013-March/036306.html
> to see if my understanding is correct or not? Thanks.

Yes, you are right.

-- 
	Evgeniy Polyakov

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox