Netdev List
 help / color / mirror / Atom feed
* Re: [Uclinux-dist-devel] [PATCH 1/2] net: dsa: introduce STPID switch tagging handling code
From: Mike Frysinger @ 2010-07-29 17:50 UTC (permalink / raw)
  To: Lennert Buytenhek
  Cc: Karl Beldan, netdev, uclinux-dist-devel, David S. Miller
In-Reply-To: <AANLkTinPtd2xXzq0MpR517OsbZWUZjdp25x8FndhQ2CP@mail.gmail.com>

On Wed, Jul 21, 2010 at 12:08, Mike Frysinger wrote:
> On Wed, Jul 21, 2010 at 11:35, Lennert Buytenhek wrote:
>> On Wed, Jul 21, 2010 at 11:29:30AM -0400, Mike Frysinger wrote:
>>> >> +     source_port = dsa_header[1] & 0x03;
>>> >> +     if (source_port >= DSA_MAX_PORTS || ds->ports[source_port] == NULL)
>>> >> +             goto out_drop;
>>> >> +
>>> >> +     if (((dsa_header[0] & ETH_P_8021QH) == ETH_P_8021QH) &&
>>> >
>>> > This is bogus -- what it does is:
>>> >
>>> >        if ((dsa_header[0] & 0x81) == 0x81)
>>> >
>>> > It doesn't look like you need to mask here at all.
>>>
>>> where does it say dsa_header[0] will always have 0x81 set ?
>>
>> Eh?
>>
>> This code is checking whether the packet has a STPID tag on it or not.
>> A STPID tag exists if the first 12 nibbles are 0x810.
>>
>> You are checking whether the first 8 nibbles of this are equal to 0x81
>> by doing:
>>
>>        if ((byte & 0x81) == 0x81)
>>
>> What if the first byte is 0x93?  Or 0xc5?
>
> that was my point.  should it be masking or doing a raw compare ?

and the answer is ... ?  so i can send an updated patch ;)
-mike

^ permalink raw reply

* RE: [PATCH V4] Export SMBIOS provided firmware instance and label to sysfs
From: Narendra_K @ 2010-07-29 18:58 UTC (permalink / raw)
  To: netdev, linux-hotplug, linux-pci
  Cc: Matt_Domsch, Charles_Rose, Jordan_Hargrave, Vijay_Nijhawan,
	jbarnes
In-Reply-To: <20100726105650.GA19738@auslistsprd01.us.dell.com>

> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-
> owner@vger.kernel.org] On Behalf Of Narendra K
> Sent: Monday, July 26, 2010 4:27 PM
> To: netdev@vger.kernel.org; linux-hotplug@vger.kernel.org; linux-
> pci@vger.kernel.org
> Cc: Domsch, Matt; Rose, Charles; Hargrave, Jordan; Nijhawan, Vijay
> Subject: [PATCH V4] Export SMBIOS provided firmware instance and label
> to sysfs
> 
> Hello,
> 
> V3 -> V4:
> 
> Updated the contact field in Documentation/ABI directory.
> 
> Please consider for inclusion -
> 
> From: Narendra K <narendra_k@dell.com>
> Subject: [PATCH] Export SMBIOS provided firmware instance and label to
> sysfs
> 
> This patch exports SMBIOS provided firmware instance and label
> of onboard pci devices to sysfs
> 
> Signed-off-by: Jordan Hargrave <jordan_hargrave@dell.com>
> Signed-off-by: Narendra K <narendra_k@dell.com>

Jesse,

Please let us know if there are any concerns with this patch. If the
patch is acceptable,
please consider it for inclusion.

With regards,
Narendra K




^ permalink raw reply

* pull request: wireless-next-2.6 2010-07-29
From: John W. Linville @ 2010-07-29 19:12 UTC (permalink / raw)
  To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA

Dave,

Yet another slew of changes intended for 2.6.36...

For the first time, this pull request includes a batch of bluetooth
stuff by way of Marcel.  Some upcoming developments are likely to
require more extensive integration between 802.11 and Bluetooth bits, so
Marcel's tree will be feeding wireless-next-2.6 for a while.

The rest is the usual stuff from the usual suspects -- mostly driver
updates with the usual strong showings from ath9k and iwlwifi, this time
joined by libertas in particular.

This is a "for-davem" branch, so hopefully there will be no pain for you
to pull this time. :-)

Please let me know if there are problems!

John

---

The following changes since commit 7f3e01fee41a322747db2d7574516d9fbd3785c0:

  net: bnx2x_cmn.c needs net/ip6_checksum.h for csum_ipv6_magic (2010-07-28 22:20:34 -0700)

are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6.git for-davem

Amitkumar Karwar (1):
      Bluetooth: Process interrupt in main thread of btmrvl driver as well

Christian Lamparter (1):
      cfg80211: fix dev <-> wiphy typo

Cyril Lacoux (1):
      Bluetooth: Added support for controller shipped with iMac i5

Dan Carpenter (6):
      ath9k: snprintf() returns largish values
      ath5k: snprintf() returns largish values
      mac80211: freeing the wrong variable
      wireless: remove unneeded variable from regulatory_hint_11d()
      libertas: precedence bug
      Bluetooth: Fix kfree() => kfree_skb() in hci_ath.c

Dan Williams (16):
      libertas: clean up MONITOR_MODE command
      libertas: clean up RSSI command
      libertas: convert 11D_DOMAIN_INFO to a direct command
      libertas: remove unused indirect TPC_CFG command leftovers
      libertas: remove unused Automatic Frequency Control command
      libertas: remove Beacon Control
      libertas: convert LED_GPIO_CTRL to a direct command
      libertas: convert register access to direct commands
      libertas: convert Mesh Blinding Table access to a direct command
      libertas: convert CMD_FWT_ACCESS to a direct command
      libertas: remove unused indirect command response handler
      libertas: convert PS_MODE to a direct command
      libertas: convert DEEP_SLEEP timer to a direct command
      libertas: kill unused lbs_prepare_and_send_command()
      libertas: rename lbs_get_cmd_ctrl_node() to lbs_get_free_cmd_node()
      libertas: remove unused cmd_pending waitq

Felix Fietkau (5):
      ath9k: fix yet another buffer leak in the tx aggregation code
      ath9k_hw: fix invalid extension channel noisefloor readings in HT20
      ath9k_hw: fix a small typo in the noisefloor calibration debug code
      ath9k_hw: simplify noisefloor calibration chainmask calculation
      mac80211: inform drivers about the off-channel status on channel changes

Gustavo F. Padovan (44):
      Bluetooth: Remove max_tx and tx_window module paramenters from L2CAP
      Bluetooth: Remove L2CAP Extended Features from Kconfig
      Bluetooth: Fix drop of packets with invalid req_seq/tx_seq
      Bluetooth: Fix bug with ERTM vars increment
      Bluetooth: Only check SAR bits if frame is an I-frame
      Bluetooth: Fix bug in l2cap_ertm_send() behavior
      Bluetooth: Proper shutdown ERTM when closing the channel
      Bluetooth: Fix L2CAP control bit field corruption
      Bluetooth: Stop ack_timer if ERTM enters in Local Busy or SREJ_SENT
      Bluetooth: Update buffer_seq before retransmit frames
      Bluetooth: Fix handle of received P-bit
      Bluetooth: Check the tx_window size on setsockopt
      Bluetooth: Check packet FCS earlier
      Bluetooth: Fix missing retransmission action with RR(P=1)
      Bluetooth: Fix ERTM error reporting to the userspace
      Bluetooth: Add debug output to ERTM code
      Bluetooth: Tweaks to l2cap_send_i_or_rr_or_rnr() flow
      Bluetooth: Change the way we set ERTM mode as mandatory
      Bluetooth: Disconnect the channel if we don't want the proposed mode
      Bluetooth: Prefer Basic Mode on receipt of ConfigReq
      Bluetooth: Actively send request for Basic Mode
      Bluetooth: Refuse ConfigRsp with different mode
      Bluetooth: Remove check for supported mode
      Bluetooth: Disconnect early if mode is not supported
      Bluetooth: Don't accept ConfigReq if we aren't in the BT_CONFIG state
      Bluetooth: Remove the send_lock spinlock from ERTM
      Bluetooth: Add backlog queue to ERTM code
      Bluetooth: Improve ERTM local busy handling
      Bluetooth: Send ConfigReq after send a ConnectionRsp
      Bluetooth: Fix bug in kzalloc allocation size
      Bluetooth: Keep code under column 80
      Bluetooth: Add Copyright notice to L2CAP
      Bluetooth: Update L2CAP version information
      Bluetooth: Add Google's copyright to L2CAP
      Bluetooth: Move bit-field variable in USB driver to data->flags
      Bluetooth: Fix typo in hci_event.c
      Bluetooth: Enable L2CAP Extended features by default
      Bluetooth: Use __packed annotation
      Bluetooth: Use __packed annotation for drivers
      Bluetooth: Fix permission of hci_ath.c
      Bluetooth: Test 'count' value before enter the loop
      Bluetooth: Use hci_recv_stream_fragment() in UART driver
      Bluetooth: Add __init and __exit marks to UART drivers
      Bluetooth: Add __init and __exit marks to RFCOMM

Ivo van Doorn (1):
      rt2x00: Fix regression for rt2500pci

Joe Perches (5):
      Bluetooth: Remove unnecessary casts of private_data in drivers
      include/net/cfg80211.h: Add wiphy_<level> printk equivalents
      drivers/net/wireless: Use wiphy_<level>
      drivers/net/wireless/at76c50x-usb.c: Neaten macros
      wireless: Convert wiphy_debug macro to function

Johan Hedberg (4):
      Bluetooth: Add blacklist support for incoming connections
      Bluetooth: Add debugfs support for showing the blacklist
      Bluetooth: Add missing HCIUARTGETDEVICE ioctl to compat_ioctl.c
      Bluetooth: Add HCIUARTSETFLAGS and HCIUARTGETFLAGS ioctls

Johannes Berg (8):
      iwlagn: fix firmware loading TLV error path
      iwlwifi: make iwl_mac_beacon_update static
      iwlwifi: reduce beacon fill conditions
      iwlwifi: remove spurious semicolons
      mac80211: remove bogus rcu_read_lock()
      cfg80211: fix IBSS default management key
      mac80211: fix sta assignment
      mac80211: allow drivers to request DTIM period

John W. Linville (24):
      iwlagn: use __packed on new structure definitions
      wl1251: fix sparse-generated warnings
      rtl8180: improve signal reporting for actual rtl8180 hardware
      rtl8180: silence "dubious: x | !y" sparse warning
      MAINTAINERS: mark prism54 obsolete
      MAINTAINERS: orphan the raylink wireless driver
      MAINTAINERS: orphan the zd1201 wireless driver
      MAINTAINERS: remove entry for wavelan
      iwlwifi: assume vif is NULL for internal scans and non-NULL otherwise
      minstrel_ht: remove unnecessary NULL check in minstrel_ht_update_caps
      minstrel: don't complain about feedback for unrequested rates
      lib80211: remove unused host_build_iv option
      Merge branch 'master' of git://git.kernel.org/.../holtmann/bluetooth-next-2.6
      p54: Added get_survey callback in order to get channel noise
      Merge branch 'master' of git://git.kernel.org/.../holtmann/bluetooth-next-2.6
      ath9k: enable serialize_regmode for non-PCIE AR9160
      mwl8k: add get_survey callback in order to get channel noise
      ar9170: add get_survey callback in order to get channel noise
      wl1251: add get_survey callback in order to get channel noise
      libertas_tf: add get_survey callback in order to get channel noise
      wl1271: add get_survey callback in order to get channel noise
      wl1251: update hw/fw version info in wiphy struct
      wl1271: update hw/fw version info in wiphy struct
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless-next-2.6 into for-davem

Jouni Malinen (1):
      mac80211: Fix key freeing to handle unlinked keys

João Paulo Rechi Vita (8):
      Bluetooth: Fix SREJ_QUEUE corruption in L2CAP
      Bluetooth: Fix l2cap_sock_connect error return.
      Bluetooth: Make l2cap_streaming_send() void.
      Bluetooth: Fix error return value on sendmsg.
      Bluetooth: Fix error return value on sendmsg.
      Bluetooth: Fix error return for l2cap_connect_rsp().
      Bluetooth: Fix error value for wrong FCS.
      Bluetooth: Fix error return on L2CAP-HCI interface.

Julia Lawall (3):
      Bluetooth: Use kmemdup for drivers
      Bluetooth: Use kzalloc for drivers
      drivers/net/wireless/wl12xx: Use kmemdup

Justin P. Mattock (1):
      Bluetooth: Fix warning: variable 'tty' set but not used

Kulikov Vasiliy (1):
      Bluetooth: Silence warning in btmrvl SDIO driver

Lennert Buytenhek (1):
      mwl8k: change maintenance status

Luis R. Rodriguez (2):
      ath9k: remove the two wiphys scanning at the same time message
      Revert "mac80211: fix sw scan bracketing"

Marcel Holtmann (1):
      Bluetooth: Defer SCO setup if mode change is pending

Nathan Holstein (1):
      Bluetooth: Fix bug with ERTM minimum packet length

Ron Shaffer (2):
      Bluetooth: Remove extraneous white space
      Bluetooth: Reassigned copyright to Code Aurora Forum

Senthil Balasubramanian (4):
      ath9k: Introduce bit masks for valid and valid_single_stream.
      ath9k: Add three stream rate control support for AR938X.
      ath9k: Fix incorrect user ratekbs of MCS15 ShortGI
      ath9k: remove unused base_index from rate table.

Stanislaw Gruszka (4):
      rt2500usb: write keys to proper registers
      rt2500usb: truly disable encryption when initialize
      rt2500usb: disallow to set WEP key with non zero index
      iwlwifi: fix scan abort

Sujith (1):
      mac80211: Don't set per-BSS QoS for monitor interfaces

Suraj Sumangala (5):
      Bluetooth: Add one more buffer for HCI stream reassembly
      Bluetooth: Implement hci_reassembly helper to reassemble RX packets
      Bluetooth: Modified hci_recv_fragment() to use hci_reassembly helper
      Bluetooth: Implemented HCI frame reassembly for RX from stream
      Bluetooth: Support for Atheros AR300x serial chip

Vasanthakumar Thiagarajan (1):
      ath9k: Fix inconsistency between txq->stopped and the actual queue state

Wey-Yi Guy (6):
      iwlagn: add statistic notification structure for WiFi/BT devices
      iwlagn: add .cfg flag to idenfity the need for bt statistics
      iwlagn: Add support for bluetooth statistics notification
      iwlagn: add bluetooth stats to debugfs
      iwlwifi: add TLV to specify the size of phy calibration table
      iwlwifi: read multiple MAC addresses

Yuri Ershov (3):
      mac80211: Put some code under MESH macro
      nl80211: Fix memory leaks
      cfg80211: Update of regulatory request initiator handling

 MAINTAINERS                                    |   20 +-
 drivers/bluetooth/Kconfig                      |   12 +
 drivers/bluetooth/Makefile                     |    1 +
 drivers/bluetooth/bcm203x.c                    |    3 +-
 drivers/bluetooth/bpa10x.c                     |    2 +-
 drivers/bluetooth/btmrvl_debugfs.c             |    2 +-
 drivers/bluetooth/btmrvl_drv.h                 |    5 +-
 drivers/bluetooth/btmrvl_main.c                |    5 +-
 drivers/bluetooth/btmrvl_sdio.c                |  111 ++--
 drivers/bluetooth/btusb.c                      |   13 +-
 drivers/bluetooth/dtl1_cs.c                    |    2 +-
 drivers/bluetooth/hci_ath.c                    |  235 ++++++++
 drivers/bluetooth/hci_bcsp.c                   |    4 +-
 drivers/bluetooth/hci_h4.c                     |  107 +----
 drivers/bluetooth/hci_ldisc.c                  |   20 +-
 drivers/bluetooth/hci_ll.c                     |    6 +-
 drivers/bluetooth/hci_uart.h                   |   15 +-
 drivers/net/wireless/adm8211.c                 |   53 +-
 drivers/net/wireless/at76c50x-usb.c            |  168 +++---
 drivers/net/wireless/ath/ar9170/cmd.c          |    7 +-
 drivers/net/wireless/ath/ar9170/led.c          |    4 +-
 drivers/net/wireless/ath/ar9170/main.c         |  191 ++++---
 drivers/net/wireless/ath/ar9170/phy.c          |    8 +-
 drivers/net/wireless/ath/ath5k/debug.c         |   18 +
 drivers/net/wireless/ath/ath9k/ahb.c           |    7 +-
 drivers/net/wireless/ath/ath9k/ar5008_phy.c    |    3 +
 drivers/net/wireless/ath/ath9k/ar9002_phy.c    |    6 +-
 drivers/net/wireless/ath/ath9k/ar9003_phy.c    |    3 +
 drivers/net/wireless/ath/ath9k/ath9k.h         |    2 +-
 drivers/net/wireless/ath/ath9k/calib.c         |   21 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c  |    9 +
 drivers/net/wireless/ath/ath9k/hw.c            |    3 +-
 drivers/net/wireless/ath/ath9k/main.c          |   13 +-
 drivers/net/wireless/ath/ath9k/pci.c           |    7 +-
 drivers/net/wireless/ath/ath9k/rc.c            |  601 ++++++++++++--------
 drivers/net/wireless/ath/ath9k/rc.h            |   89 +++-
 drivers/net/wireless/ath/ath9k/virtual.c       |    6 +-
 drivers/net/wireless/ath/ath9k/xmit.c          |   20 +-
 drivers/net/wireless/ipw2x00/libipw.h          |    1 -
 drivers/net/wireless/ipw2x00/libipw_tx.c       |   16 +-
 drivers/net/wireless/ipw2x00/libipw_wx.c       |    2 +-
 drivers/net/wireless/iwlwifi/iwl-1000.c        |    1 +
 drivers/net/wireless/iwlwifi/iwl-4965.c        |    5 +-
 drivers/net/wireless/iwlwifi/iwl-5000.c        |    3 +-
 drivers/net/wireless/iwlwifi/iwl-6000.c        |    7 +
 drivers/net/wireless/iwlwifi/iwl-agn-calib.c   |   64 ++-
 drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c |  225 ++++++--
 drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h |    7 +
 drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c    |    4 +-
 drivers/net/wireless/iwlwifi/iwl-agn-lib.c     |    7 +-
 drivers/net/wireless/iwlwifi/iwl-agn-rx.c      |  167 ++++--
 drivers/net/wireless/iwlwifi/iwl-agn.c         |  141 +++--
 drivers/net/wireless/iwlwifi/iwl-calib.h       |    6 +-
 drivers/net/wireless/iwlwifi/iwl-commands.h    |   55 ++-
 drivers/net/wireless/iwlwifi/iwl-core.c        |   65 +--
 drivers/net/wireless/iwlwifi/iwl-core.h        |    4 +-
 drivers/net/wireless/iwlwifi/iwl-debugfs.c     |   13 +
 drivers/net/wireless/iwlwifi/iwl-dev.h         |   16 +
 drivers/net/wireless/iwlwifi/iwl-eeprom.h      |    1 +
 drivers/net/wireless/iwlwifi/iwl-scan.c        |   18 +-
 drivers/net/wireless/iwlwifi/iwl3945-base.c    |   22 +-
 drivers/net/wireless/libertas/cfg.c            |  197 +------
 drivers/net/wireless/libertas/cfg.h            |    6 -
 drivers/net/wireless/libertas/cmd.c            |  718 ++++++++++--------------
 drivers/net/wireless/libertas/cmd.h            |   25 +-
 drivers/net/wireless/libertas/cmdresp.c        |  179 +------
 drivers/net/wireless/libertas/debugfs.c        |   67 +--
 drivers/net/wireless/libertas/decl.h           |    5 -
 drivers/net/wireless/libertas/defs.h           |   18 -
 drivers/net/wireless/libertas/dev.h            |    6 -
 drivers/net/wireless/libertas/host.h           |  142 ++---
 drivers/net/wireless/libertas/if_usb.c         |    4 +-
 drivers/net/wireless/libertas/main.c           |   35 +-
 drivers/net/wireless/libertas/mesh.c           |  216 ++++++--
 drivers/net/wireless/libertas/mesh.h           |   14 +-
 drivers/net/wireless/libertas/tx.c             |    2 +-
 drivers/net/wireless/libertas_tf/libertas_tf.h |    3 +
 drivers/net/wireless/libertas_tf/main.c        |   18 +
 drivers/net/wireless/mac80211_hwsim.c          |   99 ++--
 drivers/net/wireless/mwl8k.c                   |  154 +++---
 drivers/net/wireless/orinoco/cfg.c             |    5 +-
 drivers/net/wireless/p54/eeprom.c              |   76 ++--
 drivers/net/wireless/p54/fwio.c                |   53 +-
 drivers/net/wireless/p54/led.c                 |    8 +-
 drivers/net/wireless/p54/main.c                |   17 +
 drivers/net/wireless/p54/p54pci.c              |    3 +-
 drivers/net/wireless/p54/txrx.c                |   36 +-
 drivers/net/wireless/rt2x00/rt2500usb.c        |   11 +-
 drivers/net/wireless/rt2x00/rt2x00mac.c        |   19 +-
 drivers/net/wireless/rtl818x/rtl8180_dev.c     |   35 +-
 drivers/net/wireless/rtl818x/rtl8180_grf5101.c |   12 +-
 drivers/net/wireless/rtl818x/rtl8180_max2820.c |   19 +-
 drivers/net/wireless/rtl818x/rtl8180_rtl8225.c |    5 +-
 drivers/net/wireless/rtl818x/rtl8180_sa2400.c  |   28 +-
 drivers/net/wireless/rtl818x/rtl8187_dev.c     |   11 +-
 drivers/net/wireless/rtl818x/rtl8187_rtl8225.c |    8 +-
 drivers/net/wireless/rtl818x/rtl818x.h         |    1 +
 drivers/net/wireless/wl12xx/wl1251.h           |    3 +
 drivers/net/wireless/wl12xx/wl1251_boot.c      |    8 +-
 drivers/net/wireless/wl12xx/wl1251_cmd.h       |   12 +-
 drivers/net/wireless/wl12xx/wl1251_main.c      |   22 +
 drivers/net/wireless/wl12xx/wl1251_rx.c        |    6 +
 drivers/net/wireless/wl12xx/wl1251_tx.c        |   10 +-
 drivers/net/wireless/wl12xx/wl1251_tx.h        |    8 +-
 drivers/net/wireless/wl12xx/wl1271.h           |    3 +
 drivers/net/wireless/wl12xx/wl1271_main.c      |   32 +-
 drivers/net/wireless/wl12xx/wl1271_rx.c        |    7 +
 fs/compat_ioctl.c                              |    9 +-
 include/net/bluetooth/bluetooth.h              |    3 +-
 include/net/bluetooth/hci.h                    |  187 ++++---
 include/net/bluetooth/hci_core.h               |   30 +-
 include/net/bluetooth/l2cap.h                  |   34 +-
 include/net/bluetooth/rfcomm.h                 |   14 +-
 include/net/cfg80211.h                         |   65 +++-
 include/net/lib80211.h                         |    3 -
 include/net/mac80211.h                         |   12 +-
 net/bluetooth/Kconfig                          |   13 -
 net/bluetooth/hci_conn.c                       |   34 +-
 net/bluetooth/hci_core.c                       |  204 +++++--
 net/bluetooth/hci_event.c                      |   39 +-
 net/bluetooth/hci_sock.c                       |   90 +++
 net/bluetooth/hci_sysfs.c                      |   38 ++
 net/bluetooth/l2cap.c                          |  669 ++++++++++++++---------
 net/bluetooth/rfcomm/sock.c                    |    2 +-
 net/bluetooth/rfcomm/tty.c                     |    4 +-
 net/mac80211/cfg.c                             |   13 +-
 net/mac80211/ieee80211_i.h                     |    1 +
 net/mac80211/key.c                             |   13 +-
 net/mac80211/key.h                             |    3 +-
 net/mac80211/main.c                            |    3 +
 net/mac80211/mlme.c                            |   32 +-
 net/mac80211/rc80211_minstrel.c                |    1 -
 net/mac80211/rc80211_minstrel_ht.c             |    4 +-
 net/mac80211/scan.c                            |    8 +-
 net/mac80211/sta_info.c                        |    2 +-
 net/mac80211/tx.c                              |   19 +-
 net/mac80211/util.c                            |    8 +-
 net/mac80211/work.c                            |   43 ++
 net/wireless/core.c                            |   49 ++
 net/wireless/ibss.c                            |    4 +-
 net/wireless/lib80211_crypt_ccmp.c             |    1 -
 net/wireless/lib80211_crypt_tkip.c             |    1 -
 net/wireless/lib80211_crypt_wep.c              |    1 -
 net/wireless/nl80211.c                         |    2 +
 net/wireless/reg.c                             |    8 +-
 145 files changed, 3858 insertions(+), 2826 deletions(-)
 create mode 100644 drivers/bluetooth/hci_ath.c

Omnibus patch is available here:

	http://www.kernel.org/pub/linux/kernel/people/linville/wireless-next-2.6-2010-07-29.patch.bz2

-- 
John W. Linville		Someday the world will need a hero, and you
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org			might be all we have.  Be ready.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [RFC PATCH v8 00/16] Provide a zero-copy method on KVM virtio-net.
From: Shirley Ma @ 2010-07-29 22:31 UTC (permalink / raw)
  To: xiaohui.xin; +Cc: netdev, kvm, linux-kernel, mst, mingo, davem, herbert, jdike
In-Reply-To: <1280402088-5849-1-git-send-email-xiaohui.xin@intel.com>

Hello Xiaohui,

On Thu, 2010-07-29 at 19:14 +0800, xiaohui.xin@intel.com wrote:
> The idea is simple, just to pin the guest VM user space and then
> let host NIC driver has the chance to directly DMA to it. 
> The patches are based on vhost-net backend driver. We add a device
> which provides proto_ops as sendmsg/recvmsg to vhost-net to
> send/recv directly to/from the NIC driver. KVM guest who use the
> vhost-net backend may bind any ethX interface in the host side to
> get copyless data transfer thru guest virtio-net frontend.

Since vhost-net already supports macvtap/tun backends, do you think
whether it's better to implement zero copy in macvtap/tun than inducing
a new media passthrough device here? 

> Our goal is to improve the bandwidth and reduce the CPU usage.
> Exact performance data will be provided later.

I did some vhost performance measurement over 10Gb ixgbe, and found that
in order to get consistent BW results, netperf/netserver, qemu, vhost
threads smp affinities are required.

Looking forward to these results for small message size comparison. For
large message size 10Gb ixgbe BW already reached by doing vhost smp
affinity w/i offloading support, we will see how much CPU utilization it
can be reduced. 

Please provide latency results as well. I did some experimental on
macvtap zero copy sendmsg, what I have found that get_user_pages latency
pretty high.

Thanks
Shirley





^ permalink raw reply

* [PATCH net-next 0/3] drivers/net/bfin_mac.c: Neatening
From: Joe Perches @ 2010-07-29 23:58 UTC (permalink / raw)
  To: Michael Hennerich
  Cc: Mike Frysinger, uclinux-dist-devel, netdev, linux-kernel

Ho-hum, broken up into pieces just for Mike Frysinger.

Still uncompiled, untested

Joe Perches (3):
  drivers/net/bfin_mac.c: Neatening
  drivers/net/bfin_mac.c: Use pr_<level>, netdev_<level>
  drivers/net/bfin_mac.c: Misc function cleanups, neatening

 drivers/net/bfin_mac.c |  329 ++++++++++++++++++++++++++----------------------
 1 files changed, 176 insertions(+), 153 deletions(-)

-- 
1.7.2.19.g9a302

^ permalink raw reply

* [PATCH net-next 2/3] drivers/net/bfin_mac.c: Use pr_<level>, netdev_<level>
From: Joe Perches @ 2010-07-29 23:58 UTC (permalink / raw)
  To: Michael Hennerich
  Cc: uclinux-dist-devel, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <cover.1280447281.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>

Add and use pr_fmt, pr_<level> and netdev_<level>

Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
---
 drivers/net/bfin_mac.c |   56 +++++++++++++++++++++--------------------------
 1 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 0b032a5..a1d8119 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -195,8 +195,7 @@ static int desc_list_init(void)
 		/* allocate a new skb for next time receive */
 		new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN);
 		if (!new_skb) {
-			printk(KERN_NOTICE DRV_NAME
-			       ": init: low on mem - packet dropped\n");
+			pr_notice("init: low on mem - packet dropped\n");
 			goto init_error;
 		}
 		skb_reserve(new_skb, NET_IP_ALIGN);
@@ -247,7 +246,7 @@ static int desc_list_init(void)
 
 init_error:
 	desc_list_free();
-	printk(KERN_ERR DRV_NAME ": kmalloc failed\n");
+	pr_err("kmalloc failed\n");
 	return -ENOMEM;
 }
 
@@ -264,12 +263,11 @@ static int bfin_mdio_poll(void)
 
 	/* poll the STABUSY bit */
 	while ((bfin_read_EMAC_STAADD()) & STABUSY) {
-		udelay(1);
 		if (timeout_cnt-- < 0) {
-			printk(KERN_ERR DRV_NAME
-			": wait MDC/MDIO transaction to complete timeout\n");
+			pr_err("wait MDC/MDIO transaction to complete timeout\n");
 			return -ETIMEDOUT;
 		}
+		udelay(1);
 	}
 
 	return 0;
@@ -357,9 +355,9 @@ static void bfin_mac_adjust_link(struct net_device *dev)
 				opmode &= ~(RMII_10);
 				break;
 			default:
-				printk(KERN_WARNING
-					"%s: Ack!  Speed (%d) is not 10/100!\n",
-					DRV_NAME, phydev->speed);
+				netdev_warn(dev,
+					    "Ack!  Speed (%d) is not 10/100!\n",
+					    phydev->speed);
 				break;
 			}
 			bfin_write_EMAC_OPMODE(opmode);
@@ -383,7 +381,7 @@ static void bfin_mac_adjust_link(struct net_device *dev)
 	if (new_state) {
 		u32 opmode = bfin_read_EMAC_OPMODE();
 		phy_print_status(phydev);
-		pr_debug("EMAC_OPMODE = 0x%08x\n", opmode);
+		netdev_dbg(dev, "EMAC_OPMODE = 0x%08x\n", opmode);
 	}
 
 	spin_unlock_irqrestore(&lp->lock, flags);
@@ -424,8 +422,7 @@ static int mii_probe(struct net_device *dev)
 
 	/* now we are supposed to have a proper phydev to attach to... */
 	if (!phydev) {
-		printk(KERN_INFO "%s: Don't found any phy device at all\n",
-			dev->name);
+		netdev_info(dev, "No PHY device found\n");
 		return -ENODEV;
 	}
 
@@ -438,7 +435,7 @@ static int mii_probe(struct net_device *dev)
 #endif
 
 	if (IS_ERR(phydev)) {
-		printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
+		netdev_err(dev, "Could not attach to PHY\n");
 		return PTR_ERR(phydev);
 	}
 
@@ -460,11 +457,11 @@ static int mii_probe(struct net_device *dev)
 	lp->old_duplex = -1;
 	lp->phydev = phydev;
 
-	printk(KERN_INFO "%s: attached PHY driver [%s] "
-	       "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)"
-	       "@sclk=%dMHz)\n",
-	       DRV_NAME, phydev->drv->name, dev_name(&phydev->dev), phydev->irq,
-	       MDC_CLK, mdc_div, sclk/1000000);
+	netdev_info(dev, "attached PHY driver [%s] "
+		    "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)"
+		    "@sclk=%dMHz)\n",
+		    phydev->drv->name, dev_name(&phydev->dev), phydev->irq,
+		    MDC_CLK, mdc_div, sclk/1000000);
 
 	return 0;
 }
@@ -833,8 +830,7 @@ static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
 		       (--timeout_cnt))
 			udelay(1);
 		if (timeout_cnt == 0)
-			printk(KERN_ERR DRV_NAME
-					": fails to timestamp the TX packet\n");
+			pr_err("failed to timestamp the TX packet\n");
 		else {
 			struct skb_shared_hwtstamps shhwtstamps;
 			u64 ns;
@@ -1091,8 +1087,7 @@ static void bfin_mac_rx(struct net_device *dev)
 	 * we which case we simply drop the packet
 	 */
 	if (current_rx_ptr->status.status_word & RX_ERROR_MASK) {
-		printk(KERN_NOTICE DRV_NAME
-		       ": rx: receive error - packet dropped\n");
+		netdev_notice(dev, "rx: receive error - packet dropped\n");
 		dev->stats.rx_dropped++;
 		goto out;
 	}
@@ -1102,8 +1097,7 @@ static void bfin_mac_rx(struct net_device *dev)
 
 	new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN);
 	if (!new_skb) {
-		printk(KERN_NOTICE DRV_NAME
-		       ": rx: low on mem - packet dropped\n");
+		pr_notice("rx: low on mem - packet dropped\n");
 		dev->stats.rx_dropped++;
 		goto out;
 	}
@@ -1226,7 +1220,7 @@ static int bfin_mac_enable(void)
 	int ret;
 	u32 opmode;
 
-	pr_debug("%s: %s\n", DRV_NAME, __func__);
+	pr_debug("%s\n", __func__);
 
 	/* Set RX DMA */
 	bfin_write_DMA1_NEXT_DESC_PTR(&(rx_list_head->desc_a));
@@ -1268,7 +1262,7 @@ static void bfin_mac_timeout(struct net_device *dev)
 {
 	struct bfin_mac_local *lp = netdev_priv(dev);
 
-	pr_debug("%s: %s\n", dev->name, __func__);
+	netdev_dbg(dev, "%s\n", __func__);
 
 	bfin_mac_disable();
 
@@ -1335,7 +1329,7 @@ static void bfin_mac_set_multicast_list(struct net_device *dev)
 	u32 sysctl;
 
 	if (dev->flags & IFF_PROMISC) {
-		printk(KERN_INFO "%s: set to promisc mode\n", dev->name);
+		netdev_info(dev, "set to promisc mode\n");
 		sysctl = bfin_read_EMAC_OPMODE();
 		sysctl |= PR;
 		bfin_write_EMAC_OPMODE(sysctl);
@@ -1389,7 +1383,7 @@ static int bfin_mac_open(struct net_device *dev)
 {
 	struct bfin_mac_local *lp = netdev_priv(dev);
 	int ret;
-	pr_debug("%s: %s\n", dev->name, __func__);
+	netdev_dbg(dev, "%s\n", __func__);
 
 	/*
 	 * Check that the address is valid.  If its not, refuse
@@ -1397,7 +1391,7 @@ static int bfin_mac_open(struct net_device *dev)
 	 * address using ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
 	 */
 	if (!is_valid_ether_addr(dev->dev_addr)) {
-		printk(KERN_WARNING DRV_NAME ": no valid ethernet hw addr\n");
+		netdev_warn(dev, "no valid ethernet hw addr\n");
 		return -EINVAL;
 	}
 
@@ -1415,7 +1409,7 @@ static int bfin_mac_open(struct net_device *dev)
 	ret = bfin_mac_enable();
 	if (ret)
 		return ret;
-	pr_debug("hardware init finished\n");
+	netdev_dbg(dev, "hardware init finished\n");
 
 	netif_start_queue(dev);
 	netif_carrier_on(dev);
@@ -1431,7 +1425,7 @@ static int bfin_mac_open(struct net_device *dev)
 static int bfin_mac_close(struct net_device *dev)
 {
 	struct bfin_mac_local *lp = netdev_priv(dev);
-	pr_debug("%s: %s\n", dev->name, __func__);
+	netdev_dbg(dev, "%s\n", __func__);
 
 	netif_stop_queue(dev);
 	netif_carrier_off(dev);
-- 
1.7.2.19.g9a302

^ permalink raw reply related

* [PATCH net-next 3/3] drivers/net/bfin_mac.c: Misc function cleanups, neatening
From: Joe Perches @ 2010-07-29 23:58 UTC (permalink / raw)
  To: Michael Hennerich
  Cc: uclinux-dist-devel, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <cover.1280447281.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>

Use new bfin_alloc_skb to centralize skb allocations
Add and use get_mac_addr function
Neaten bfin_mac_init
Neaten bfin_mac_hard_start_xmit

Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
---
 drivers/net/bfin_mac.c |   93 ++++++++++++++++++++++++++---------------------
 1 files changed, 51 insertions(+), 42 deletions(-)

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index a1d8119..68afb2a 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -81,6 +81,26 @@ static u16 pin_req[] = P_RMII0;
 static u16 pin_req[] = P_MII0;
 #endif
 
+static struct sk_buff *bfin_alloc_skb(void)
+{
+	/* allocate a new skb */
+	struct sk_buff *new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN);
+
+	if (!new_skb)
+		return NULL;
+
+	skb_reserve(new_skb, NET_IP_ALIGN);
+	/*
+	 * Invalidate the data cache of skb->data range
+	 * when it is write back cache to prevent overwriting
+	 * the new data from DMA.
+	 */
+	blackfin_dcache_invalidate_range((unsigned long)new_skb->head,
+					 (unsigned long)new_skb->end);
+
+	return new_skb;
+}
+
 static void desc_list_free(void)
 {
 	struct net_dma_desc_rx *r;
@@ -193,18 +213,12 @@ static int desc_list_init(void)
 		struct dma_descriptor *b = &(r->desc_b);
 
 		/* allocate a new skb for next time receive */
-		new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN);
+		new_skb = bfin_alloc_skb();
 		if (!new_skb) {
 			pr_notice("init: low on mem - packet dropped\n");
 			goto init_error;
 		}
-		skb_reserve(new_skb, NET_IP_ALIGN);
-		/* Invalidate the data cache of skb->data range when it is
-		 * write back cache.
-		 * It will prevent overwriting the new data from DMA
-		 */
-		blackfin_dcache_invalidate_range((unsigned long)new_skb->head,
-					 (unsigned long)new_skb->end);
+
 		r->skb = new_skb;
 
 		/*
@@ -598,6 +612,16 @@ void setup_system_regs(struct net_device *dev)
 	bfin_write_DMA1_Y_MODIFY(0);
 }
 
+/* Grab the MAC address in the MAC */
+static void get_mac_addr(u8 *mac_addr)
+{
+	__le32 addr_low = cpu_to_le32(bfin_read_EMAC_ADDRLO());
+	__le16 addr_hi = cpu_to_le16((u16)bfin_read_EMAC_ADDRHI());
+
+	memcpy(mac_addr, &addr_low, 4);
+	memcpy(mac_addr + 4, &addr_hi, 2);
+}
+
 static void setup_mac_addr(u8 *mac_addr)
 {
 	u32 addr_low = le32_to_cpu(*(__le32 *)&mac_addr[0]);
@@ -994,15 +1018,17 @@ static void tx_reclaim_skb_timeout(unsigned long lp)
 static int bfin_mac_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct bfin_mac_local *lp = netdev_priv(dev);
-	u16 *data;
 	u32 data_align = (unsigned long)(skb->data) & 0x3;
+	unsigned long buf_start;
+	unsigned long buf_len;
 	union skb_shared_tx *shtx = skb_tx(skb);
 
 	current_tx_ptr->skb = skb;
 
 	if (data_align == 0x2) {
 		/* move skb->data to current_tx_ptr payload */
-		data = (u16 *)(skb->data) - 1;
+		u16 *data = (u16 *)(skb->data) - 1;
+
 		*data = (u16)(skb->len);
 		/*
 		 * When transmitting an Ethernet packet, the PTP_TSYNC module
@@ -1014,23 +1040,21 @@ static int bfin_mac_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		if (shtx->hardware)
 			*data |= 0x1000;
 
-		current_tx_ptr->desc_a.start_addr = (u32)data;
-		/* this is important! */
-		blackfin_dcache_flush_range((u32)data,
-					    (u32)((u8 *)data + skb->len + 4));
+		buf_start = (unsigned long)data;
+		buf_len = skb->len + 4;
 	} else {
 		*((u16 *)(current_tx_ptr->packet)) = (u16)(skb->len);
 		/* enable timestamping for the sent packet */
 		if (shtx->hardware)
 			*((u16 *)(current_tx_ptr->packet)) |= 0x1000;
-		memcpy((u8 *)(current_tx_ptr->packet + 2), skb->data,
-			skb->len);
-		current_tx_ptr->desc_a.start_addr =
-			(u32)current_tx_ptr->packet;
-		blackfin_dcache_flush_range(
-			(u32)current_tx_ptr->packet,
-			(u32)(current_tx_ptr->packet + skb->len + 2));
+		memcpy(current_tx_ptr->packet + 2, skb->data, skb->len);
+
+		buf_start = (unsigned long)current_tx_ptr->packet;
+		buf_len = skb->len + 2;
 	}
+	current_tx_ptr->desc_a.start_addr = buf_start;
+	/* this is important! */
+	blackfin_dcache_flush_range(buf_start, buf_start + buf_len);
 
 	/*
 	 * Make sure the internal data buffers in the core are drained
@@ -1095,20 +1119,12 @@ static void bfin_mac_rx(struct net_device *dev)
 	/* allocate a new skb for next time receive */
 	skb = current_rx_ptr->skb;
 
-	new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN);
+	new_skb = bfin_alloc_skb();
 	if (!new_skb) {
 		pr_notice("rx: low on mem - packet dropped\n");
 		dev->stats.rx_dropped++;
 		goto out;
 	}
-	/* reserve 2 bytes for RXDWA padding */
-	skb_reserve(new_skb, NET_IP_ALIGN);
-	/*
-	 * Invalidate the data cache of skb->data range when it is write back
-	 * cache. It will prevent overwriting the new data from DMA
-	 */
-	blackfin_dcache_invalidate_range((unsigned long)new_skb->head,
-					 (unsigned long)new_skb->end);
 
 	current_rx_ptr->skb = new_skb;
 	current_rx_ptr->desc_a.start_addr = (unsigned long)new_skb->data - 2;
@@ -1475,14 +1491,10 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev)
 	lp = netdev_priv(ndev);
 	lp->ndev = ndev;
 
-	/* Grab the MAC address in the MAC */
-	*(__le32 *)(&(ndev->dev_addr[0])) =
-		cpu_to_le32(bfin_read_EMAC_ADDRLO());
-	*(__le16 *)(&(ndev->dev_addr[4])) =
-		cpu_to_le16((u16)bfin_read_EMAC_ADDRHI());
+	get_mac_addr(ndev->dev_addr);
 
 	/* probe mac */
-	/*todo: how to proble? which is revision_register */
+	/* todo: how to probe? which is revision_register */
 	bfin_write_EMAC_ADDRLO(0x12345678);
 	if (bfin_read_EMAC_ADDRLO() != 0x12345678) {
 		dev_err(&pdev->dev, "Cannot detect Blackfin on-chip ethernet MAC controller!\n");
@@ -1718,12 +1730,9 @@ static struct platform_driver bfin_mac_driver = {
 
 static int __init bfin_mac_init(void)
 {
-	int ret;
-
-	ret = platform_driver_register(&bfin_mii_bus_driver);
-	if (!ret)
-		return platform_driver_register(&bfin_mac_driver);
-	return -ENODEV;
+	if (platform_driver_register(&bfin_mii_bus_driver))
+		return -ENODEV;
+	return platform_driver_register(&bfin_mac_driver);
 }
 
 module_init(bfin_mac_init);
-- 
1.7.2.19.g9a302

^ permalink raw reply related

* [PATCH net-next 1/3] drivers/net/bfin_mac.c: Neatening
From: Joe Perches @ 2010-07-29 23:58 UTC (permalink / raw)
  To: Michael Hennerich
  Cc: Mike Frysinger, uclinux-dist-devel, netdev, linux-kernel
In-Reply-To: <cover.1280447281.git.joe@perches.com>

80 column fixes
Spelling/typo corrections
Argument alignment

checkpatch clean

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/bfin_mac.c |  204 ++++++++++++++++++++++++++----------------------
 1 files changed, 112 insertions(+), 92 deletions(-)

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 012613f..0b032a5 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -132,14 +132,14 @@ static int desc_list_init(void)
 #endif
 
 	tx_desc = bfin_mac_alloc(&dma_handle,
-				sizeof(struct net_dma_desc_tx) *
-				CONFIG_BFIN_TX_DESC_NUM);
+				 sizeof(struct net_dma_desc_tx) *
+				 CONFIG_BFIN_TX_DESC_NUM);
 	if (tx_desc == NULL)
 		goto init_error;
 
 	rx_desc = bfin_mac_alloc(&dma_handle,
-				sizeof(struct net_dma_desc_rx) *
-				CONFIG_BFIN_RX_DESC_NUM);
+				 sizeof(struct net_dma_desc_rx) *
+				 CONFIG_BFIN_RX_DESC_NUM);
 	if (rx_desc == NULL)
 		goto init_error;
 
@@ -200,8 +200,9 @@ static int desc_list_init(void)
 			goto init_error;
 		}
 		skb_reserve(new_skb, NET_IP_ALIGN);
-		/* Invidate the data cache of skb->data range when it is write back
-		 * cache. It will prevent overwritting the new data from DMA
+		/* Invalidate the data cache of skb->data range when it is
+		 * write back cache.
+		 * It will prevent overwriting the new data from DMA
 		 */
 		blackfin_dcache_invalidate_range((unsigned long)new_skb->head,
 					 (unsigned long)new_skb->end);
@@ -229,8 +230,8 @@ static int desc_list_init(void)
 		 * 6 half words is desc size
 		 * large desc flow
 		 */
-		b->config = DMAEN | WNR | WDSIZE_32 | DI_EN |
-				NDSIZE_6 | DMAFLOW_LARGE;
+		b->config = (DMAEN | WNR | WDSIZE_32 | DI_EN |
+			     NDSIZE_6 | DMAFLOW_LARGE);
 		b->start_addr = (unsigned long)(&(r->status));
 		b->x_count = 0;
 
@@ -284,15 +285,15 @@ static int bfin_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
 		return ret;
 
 	/* read mode */
-	bfin_write_EMAC_STAADD(SET_PHYAD((u16) phy_addr) |
-				SET_REGAD((u16) regnum) |
-				STABUSY);
+	bfin_write_EMAC_STAADD((SET_PHYAD((u16)phy_addr) |
+				SET_REGAD((u16)regnum) |
+				STABUSY));
 
 	ret = bfin_mdio_poll();
 	if (ret)
 		return ret;
 
-	return (int) bfin_read_EMAC_STADAT();
+	return (int)bfin_read_EMAC_STADAT();
 }
 
 /* Write an off-chip register in a PHY through the MDC/MDIO port */
@@ -308,10 +309,10 @@ static int bfin_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum,
 	bfin_write_EMAC_STADAT((u32) value);
 
 	/* write mode */
-	bfin_write_EMAC_STAADD(SET_PHYAD((u16) phy_addr) |
-				SET_REGAD((u16) regnum) |
+	bfin_write_EMAC_STAADD((SET_PHYAD((u16)phy_addr) |
+				SET_REGAD((u16)regnum) |
 				STAOP |
-				STABUSY);
+				STABUSY));
 
 	return bfin_mdio_poll();
 }
@@ -421,7 +422,7 @@ static int mii_probe(struct net_device *dev)
 		break; /* found it */
 	}
 
-	/* now we are supposed to have a proper phydev, to attach to... */
+	/* now we are supposed to have a proper phydev to attach to... */
 	if (!phydev) {
 		printk(KERN_INFO "%s: Don't found any phy device at all\n",
 			dev->name);
@@ -430,10 +431,10 @@ static int mii_probe(struct net_device *dev)
 
 #if defined(CONFIG_BFIN_MAC_RMII)
 	phydev = phy_connect(dev, dev_name(&phydev->dev), &bfin_mac_adjust_link,
-			0, PHY_INTERFACE_MODE_RMII);
+			     0, PHY_INTERFACE_MODE_RMII);
 #else
 	phydev = phy_connect(dev, dev_name(&phydev->dev), &bfin_mac_adjust_link,
-			0, PHY_INTERFACE_MODE_MII);
+			     0, PHY_INTERFACE_MODE_MII);
 #endif
 
 	if (IS_ERR(phydev)) {
@@ -442,14 +443,15 @@ static int mii_probe(struct net_device *dev)
 	}
 
 	/* mask with MAC supported features */
-	phydev->supported &= (SUPPORTED_10baseT_Half
-			      | SUPPORTED_10baseT_Full
-			      | SUPPORTED_100baseT_Half
-			      | SUPPORTED_100baseT_Full
-			      | SUPPORTED_Autoneg
-			      | SUPPORTED_Pause | SUPPORTED_Asym_Pause
-			      | SUPPORTED_MII
-			      | SUPPORTED_TP);
+	phydev->supported &= (SUPPORTED_10baseT_Half |
+			      SUPPORTED_10baseT_Full |
+			      SUPPORTED_100baseT_Half |
+			      SUPPORTED_100baseT_Full |
+			      SUPPORTED_Autoneg |
+			      SUPPORTED_Pause |
+			      SUPPORTED_Asym_Pause |
+			      SUPPORTED_MII |
+			      SUPPORTED_TP);
 
 	phydev->advertising = phydev->supported;
 
@@ -514,7 +516,7 @@ static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev,
 }
 
 static void bfin_mac_ethtool_getwol(struct net_device *dev,
-	struct ethtool_wolinfo *wolinfo)
+				    struct ethtool_wolinfo *wolinfo)
 {
 	struct bfin_mac_local *lp = netdev_priv(dev);
 
@@ -523,7 +525,7 @@ static void bfin_mac_ethtool_getwol(struct net_device *dev,
 }
 
 static int bfin_mac_ethtool_setwol(struct net_device *dev,
-	struct ethtool_wolinfo *wolinfo)
+				   struct ethtool_wolinfo *wolinfo)
 {
 	struct bfin_mac_local *lp = netdev_priv(dev);
 	int rc;
@@ -601,8 +603,8 @@ void setup_system_regs(struct net_device *dev)
 
 static void setup_mac_addr(u8 *mac_addr)
 {
-	u32 addr_low = le32_to_cpu(*(__le32 *) & mac_addr[0]);
-	u16 addr_hi = le16_to_cpu(*(__le16 *) & mac_addr[4]);
+	u32 addr_low = le32_to_cpu(*(__le32 *)&mac_addr[0]);
+	u16 addr_hi = le16_to_cpu(*(__le16 *)&mac_addr[4]);
 
 	/* this depends on a little-endian machine */
 	bfin_write_EMAC_ADDRLO(addr_low);
@@ -612,6 +614,7 @@ static void setup_mac_addr(u8 *mac_addr)
 static int bfin_mac_set_mac_address(struct net_device *dev, void *p)
 {
 	struct sockaddr *addr = p;
+
 	if (netif_running(dev))
 		return -EBUSY;
 	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
@@ -623,7 +626,7 @@ static int bfin_mac_set_mac_address(struct net_device *dev, void *p)
 #define bfin_mac_hwtstamp_is_none(cfg) ((cfg) == HWTSTAMP_FILTER_NONE)
 
 static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
-		struct ifreq *ifr, int cmd)
+				   struct ifreq *ifr, int cmd)
 {
 	struct hwtstamp_config config;
 	struct bfin_mac_local *lp = netdev_priv(netdev);
@@ -634,14 +637,14 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
 		return -EFAULT;
 
 	pr_debug("%s config flag:0x%x, tx_type:0x%x, rx_filter:0x%x\n",
-			__func__, config.flags, config.tx_type, config.rx_filter);
+		 __func__, config.flags, config.tx_type, config.rx_filter);
 
 	/* reserved for future extensions */
 	if (config.flags)
 		return -EINVAL;
 
 	if ((config.tx_type != HWTSTAMP_TX_OFF) &&
-			(config.tx_type != HWTSTAMP_TX_ON))
+	    (config.tx_type != HWTSTAMP_TX_ON))
 		return -ERANGE;
 
 	ptpctl = bfin_read_EMAC_PTP_CTL();
@@ -658,7 +661,8 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
 	case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
 	case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
 		/*
-		 * Clear the five comparison mask bits (bits[12:8]) in EMAC_PTP_CTL)
+		 * Clear the five comparison mask bits
+		 * (bits[12:8] in EMAC_PTP_CTL)
 		 * to enable all the field matches.
 		 */
 		ptpctl &= ~0x1F00;
@@ -694,8 +698,8 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
 		ptpctl &= ~0x1F00;
 		bfin_write_EMAC_PTP_CTL(ptpctl);
 		/*
-		 * Keep the default values of the EMAC_PTP_FOFF register, except set
-		 * the PTPCOF field to 0x2A.
+		 * Keep the default values of the EMAC_PTP_FOFF register,
+		 * except set the PTPCOF field to 0x2A.
 		 */
 		ptpfoff = 0x2A24170C;
 		bfin_write_EMAC_PTP_FOFF(ptpfoff);
@@ -720,20 +724,20 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
 	case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
 	case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
 		/*
-		 * Clear bits 8 and 12 of the EMAC_PTP_CTL register to enable only the
-		 * EFTM and PTPCM field comparison.
+		 * Clear bits 8 and 12 of the EMAC_PTP_CTL register to enable
+		 * only the EFTM and PTPCM field comparison.
 		 */
 		ptpctl &= ~0x1100;
 		bfin_write_EMAC_PTP_CTL(ptpctl);
 		/*
-		 * Keep the default values of all the fields of the EMAC_PTP_FOFF
-		 * register, except set the PTPCOF field to 0x0E.
+		 * Keep the default values of all the fields of the
+		 * EMAC_PTP_FOFF register, except set the PTPCOF field to 0x0E.
 		 */
 		ptpfoff = 0x0E24170C;
 		bfin_write_EMAC_PTP_FOFF(ptpfoff);
 		/*
-		 * Program bits [15:0] of the EMAC_PTP_FV1 register to 0x88F7, which
-		 * corresponds to PTP messages on the MAC layer.
+		 * Program bits [15:0] of the EMAC_PTP_FV1 register to 0x88F7,
+		 * which corresponds to PTP messages on the MAC layer.
 		 */
 		ptpfv1 = 0x110488F7;
 		bfin_write_EMAC_PTP_FV1(ptpfv1);
@@ -780,24 +784,29 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
 		SSYNC();
 
 		lp->compare.last_update = 0;
-		timecounter_init(&lp->clock,
-				&lp->cycles,
-				ktime_to_ns(ktime_get_real()));
+		timecounter_init(&lp->clock, &lp->cycles,
+				 ktime_to_ns(ktime_get_real()));
 		timecompare_update(&lp->compare, 0);
 	}
 
 	lp->stamp_cfg = config;
-	return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
-		-EFAULT : 0;
+	if (copy_to_user(ifr->ifr_data, &config, sizeof(config)))
+		return -EFAULT;
+
+	return 0;
 }
 
-static void bfin_dump_hwtamp(char *s, ktime_t *hw, ktime_t *ts, struct timecompare *cmp)
+static void bfin_dump_hwtamp(char *s, ktime_t *hw, ktime_t *ts,
+			     struct timecompare *cmp)
 {
 	ktime_t sys = ktime_get_real();
 
 	pr_debug("%s %s hardware:%d,%d transform system:%d,%d system:%d,%d, cmp:%lld, %lld\n",
-			__func__, s, hw->tv.sec, hw->tv.nsec, ts->tv.sec, ts->tv.nsec, sys.tv.sec,
-			sys.tv.nsec, cmp->offset, cmp->skew);
+		 __func__, s,
+		 hw->tv.sec, hw->tv.nsec,
+		 ts->tv.sec, ts->tv.nsec,
+		 sys.tv.sec, sys.tv.nsec,
+		 cmp->offset, cmp->skew);
 }
 
 static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
@@ -814,12 +823,14 @@ static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
 		shtx->in_progress = 1;
 
 		/*
-		 * The timestamping is done at the EMAC module's MII/RMII interface
-		 * when the module sees the Start of Frame of an event message packet. This
-		 * interface is the closest possible place to the physical Ethernet transmission
+		 * The timestamping is done at the EMAC module's MII/RMII
+		 * interface when the module sees the Start of Frame of an
+		 * event message packet. This interface is the closest
+		 * possible place to the physical Ethernet transmission
 		 * medium, providing the best timing accuracy.
 		 */
-		while ((!(bfin_read_EMAC_PTP_ISTAT() & TXTL)) && (--timeout_cnt))
+		while ((!(bfin_read_EMAC_PTP_ISTAT() & TXTL)) &&
+		       (--timeout_cnt))
 			udelay(1);
 		if (timeout_cnt == 0)
 			printk(KERN_ERR DRV_NAME
@@ -832,15 +843,15 @@ static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
 			regval = bfin_read_EMAC_PTP_TXSNAPLO();
 			regval |= (u64)bfin_read_EMAC_PTP_TXSNAPHI() << 32;
 			memset(&shhwtstamps, 0, sizeof(shhwtstamps));
-			ns = timecounter_cyc2time(&lp->clock,
-					regval);
+			ns = timecounter_cyc2time(&lp->clock, regval);
 			timecompare_update(&lp->compare, ns);
 			shhwtstamps.hwtstamp = ns_to_ktime(ns);
 			shhwtstamps.syststamp =
 				timecompare_transform(&lp->compare, ns);
 			skb_tstamp_tx(skb, &shhwtstamps);
 
-			bfin_dump_hwtamp("TX", &shhwtstamps.hwtstamp, &shhwtstamps.syststamp, &lp->compare);
+			bfin_dump_hwtamp("TX", &shhwtstamps.hwtstamp,
+					 &shhwtstamps.syststamp, &lp->compare);
 		}
 	}
 }
@@ -869,7 +880,8 @@ static void bfin_rx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
 	shhwtstamps->hwtstamp = ns_to_ktime(ns);
 	shhwtstamps->syststamp = timecompare_transform(&lp->compare, ns);
 
-	bfin_dump_hwtamp("RX", &shhwtstamps->hwtstamp, &shhwtstamps->syststamp, &lp->compare);
+	bfin_dump_hwtamp("RX", &shhwtstamps->hwtstamp,
+			 &shhwtstamps->syststamp, &lp->compare);
 }
 
 /*
@@ -879,8 +891,8 @@ static cycle_t bfin_read_clock(const struct cyclecounter *tc)
 {
 	u64 stamp;
 
-	stamp =  bfin_read_EMAC_PTP_TIMELO();
-	stamp |= (u64)bfin_read_EMAC_PTP_TIMEHI() << 32ULL;
+	stamp = bfin_read_EMAC_PTP_TIMELO();
+	stamp |= ((u64)bfin_read_EMAC_PTP_TIMEHI()) << 32;
 
 	return stamp;
 }
@@ -961,7 +973,7 @@ static void tx_reclaim_skb(struct bfin_mac_local *lp)
 	}
 
 	if (current_tx_ptr->next != tx_list_head &&
-		netif_queue_stopped(lp->ndev))
+	    netif_queue_stopped(lp->ndev))
 		netif_wake_queue(lp->ndev);
 
 	if (tx_list_head != current_tx_ptr) {
@@ -974,10 +986,8 @@ static void tx_reclaim_skb(struct bfin_mac_local *lp)
 				jiffies + TX_RECLAIM_JIFFIES;
 
 		mod_timer(&lp->tx_reclaim_timer,
-			lp->tx_reclaim_timer.expires);
+			  lp->tx_reclaim_timer.expires);
 	}
-
-	return;
 }
 
 static void tx_reclaim_skb_timeout(unsigned long lp)
@@ -985,8 +995,7 @@ static void tx_reclaim_skb_timeout(unsigned long lp)
 	tx_reclaim_skb((struct bfin_mac_local *)lp);
 }
 
-static int bfin_mac_hard_start_xmit(struct sk_buff *skb,
-				struct net_device *dev)
+static int bfin_mac_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct bfin_mac_local *lp = netdev_priv(dev);
 	u16 *data;
@@ -1000,10 +1009,11 @@ static int bfin_mac_hard_start_xmit(struct sk_buff *skb,
 		data = (u16 *)(skb->data) - 1;
 		*data = (u16)(skb->len);
 		/*
-		 * When transmitting an Ethernet packet, the PTP_TSYNC module requires
-		 * a DMA_Length_Word field associated with the packet. The lower 12 bits
-		 * of this field are the length of the packet payload in bytes and the higher
-		 * 4 bits are the timestamping enable field.
+		 * When transmitting an Ethernet packet, the PTP_TSYNC module
+		 * requires a DMA_Length_Word field associated with the packet.
+		 * The lower 12 bits of this field are the length of the packet
+		 * payload in bytes and the higher 4 bits are the timestamping
+		 * enable field.
 		 */
 		if (shtx->hardware)
 			*data |= 0x1000;
@@ -1011,7 +1021,7 @@ static int bfin_mac_hard_start_xmit(struct sk_buff *skb,
 		current_tx_ptr->desc_a.start_addr = (u32)data;
 		/* this is important! */
 		blackfin_dcache_flush_range((u32)data,
-				(u32)((u8 *)data + skb->len + 4));
+					    (u32)((u8 *)data + skb->len + 4));
 	} else {
 		*((u16 *)(current_tx_ptr->packet)) = (u16)(skb->len);
 		/* enable timestamping for the sent packet */
@@ -1026,7 +1036,8 @@ static int bfin_mac_hard_start_xmit(struct sk_buff *skb,
 			(u32)(current_tx_ptr->packet + skb->len + 2));
 	}
 
-	/* make sure the internal data buffers in the core are drained
+	/*
+	 * Make sure the internal data buffers in the core are drained
 	 * so that the DMA descriptors are completely written when the
 	 * DMA engine goes to fetch them below
 	 */
@@ -1063,7 +1074,8 @@ out:
 
 #define IP_HEADER_OFF  0
 #define RX_ERROR_MASK (RX_LONG | RX_ALIGN | RX_CRC | RX_LEN | \
-	RX_FRAG | RX_ADDR | RX_DMAO | RX_PHY | RX_LATE | RX_RANGE)
+		       RX_FRAG | RX_ADDR | RX_DMAO | RX_PHY | \
+		       RX_LATE | RX_RANGE)
 
 static void bfin_mac_rx(struct net_device *dev)
 {
@@ -1097,8 +1109,9 @@ static void bfin_mac_rx(struct net_device *dev)
 	}
 	/* reserve 2 bytes for RXDWA padding */
 	skb_reserve(new_skb, NET_IP_ALIGN);
-	/* Invidate the data cache of skb->data range when it is write back
-	 * cache. It will prevent overwritting the new data from DMA
+	/*
+	 * Invalidate the data cache of skb->data range when it is write back
+	 * cache. It will prevent overwriting the new data from DMA
 	 */
 	blackfin_dcache_invalidate_range((unsigned long)new_skb->head,
 					 (unsigned long)new_skb->end);
@@ -1116,25 +1129,29 @@ static void bfin_mac_rx(struct net_device *dev)
 	bfin_rx_hwtstamp(dev, skb);
 
 #if defined(BFIN_MAC_CSUM_OFFLOAD)
-	/* Checksum offloading only works for IPv4 packets with the standard IP header
-	 * length of 20 bytes, because the blackfin MAC checksum calculation is
-	 * based on that assumption. We must NOT use the calculated checksum if our
-	 * IP version or header break that assumption.
+	/*
+	 * Checksum offloading only works for IPv4 packets with the standard
+	 * IP header length of 20 bytes, because the blackfin MAC checksum
+	 * calculation is based on that assumption. We must NOT use the
+	 * calculated checksum if our IP version or header break that
+	 * assumption.
 	 */
 	if (skb->data[IP_HEADER_OFF] == 0x45) {
 		skb->csum = current_rx_ptr->status.ip_payload_csum;
 		/*
-		 * Deduce Ethernet FCS from hardware generated IP payload checksum.
-		 * IP checksum is based on 16-bit one's complement algorithm.
-		 * To deduce a value from checksum is equal to add its inversion.
-		 * If the IP payload len is odd, the inversed FCS should also
-		 * begin from odd address and leave first byte zero.
+		 * Deduce Ethernet FCS from hardware generated IP payload
+		 * checksum.  IP checksum is based on 16-bit one's complement
+		 * algorithm.  To deduce a value from checksum is equal to
+		 * add its inversion.  If the IP payload len is odd, the
+		 * inversed FCS should also begin from odd address and leave
+		 * first byte zero.
 		 */
 		if (skb->len % 2) {
 			fcs[0] = 0;
 			for (i = 0; i < ETH_FCS_LEN; i++)
 				fcs[i + 1] = ~skb->data[skb->len + i];
-			skb->csum = csum_partial(fcs, ETH_FCS_LEN + 1, skb->csum);
+			skb->csum = csum_partial(fcs, ETH_FCS_LEN + 1,
+						 skb->csum);
 		} else {
 			for (i = 0; i < ETH_FCS_LEN; i++)
 				fcs[i] = ~skb->data[skb->len + i];
@@ -1465,8 +1482,10 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev)
 	lp->ndev = ndev;
 
 	/* Grab the MAC address in the MAC */
-	*(__le32 *) (&(ndev->dev_addr[0])) = cpu_to_le32(bfin_read_EMAC_ADDRLO());
-	*(__le16 *) (&(ndev->dev_addr[4])) = cpu_to_le16((u16) bfin_read_EMAC_ADDRHI());
+	*(__le32 *)(&(ndev->dev_addr[0])) =
+		cpu_to_le32(bfin_read_EMAC_ADDRLO());
+	*(__le16 *)(&(ndev->dev_addr[4])) =
+		cpu_to_le16((u16)bfin_read_EMAC_ADDRHI());
 
 	/* probe mac */
 	/*todo: how to proble? which is revision_register */
@@ -1526,8 +1545,8 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev)
 
 	/* now, enable interrupts */
 	/* register irq handler */
-	rc = request_irq(IRQ_MAC_RX, bfin_mac_interrupt,
-			IRQF_DISABLED, "EMAC_RX", ndev);
+	rc = request_irq(IRQ_MAC_RX, bfin_mac_interrupt, IRQF_DISABLED,
+			 "EMAC_RX", ndev);
 	if (rc) {
 		dev_err(&pdev->dev, "Cannot request Blackfin MAC RX IRQ!\n");
 		rc = -EBUSY;
@@ -1647,7 +1666,7 @@ static int __devinit bfin_mii_bus_probe(struct platform_device *pdev)
 	miibus->parent = &pdev->dev;
 	miibus->name = "bfin_mii_bus";
 	snprintf(miibus->id, MII_BUS_ID_SIZE, "0");
-	miibus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
+	miibus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
 	if (miibus->irq == NULL)
 		goto out_err_alloc;
 	for (i = 0; i < PHY_MAX_ADDR; ++i)
@@ -1674,6 +1693,7 @@ out_err_alloc:
 static int __devexit bfin_mii_bus_remove(struct platform_device *pdev)
 {
 	struct mii_bus *miibus = platform_get_drvdata(pdev);
+
 	platform_set_drvdata(pdev, NULL);
 	mdiobus_unregister(miibus);
 	kfree(miibus->irq);
@@ -1698,13 +1718,14 @@ static struct platform_driver bfin_mac_driver = {
 	.suspend = bfin_mac_suspend,
 	.driver = {
 		.name = DRV_NAME,
-		.owner	= THIS_MODULE,
+		.owner = THIS_MODULE,
 	},
 };
 
 static int __init bfin_mac_init(void)
 {
 	int ret;
+
 	ret = platform_driver_register(&bfin_mii_bus_driver);
 	if (!ret)
 		return platform_driver_register(&bfin_mac_driver);
@@ -1720,4 +1741,3 @@ static void __exit bfin_mac_cleanup(void)
 }
 
 module_exit(bfin_mac_cleanup);
-
-- 
1.7.2.19.g9a302


^ permalink raw reply related

* [PATCH] act_nat: the checksum of ICMP doesn't have pseudo header
From: Changli Gao @ 2010-07-30  0:04 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Jamal Hadi Salim, David S. Miller, netdev, linux-kernel,
	Changli Gao

after updating the value of the ICMP payload, inet_proto_csum_replace4() should
be called with zero pseudohdr.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
 net/sched/act_nat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 24e614c..59f05ee 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -246,7 +246,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
 			iph->saddr = new_addr;
 
 		inet_proto_csum_replace4(&icmph->checksum, skb, addr, new_addr,
-					 1);
+					 0);
 		break;
 	}
 	default:

^ permalink raw reply related

* Re: [PATCH net-next 2/3] drivers/net/bfin_mac.c: Use pr_<level>, netdev_<level>
From: Mike Frysinger @ 2010-07-30  0:17 UTC (permalink / raw)
  To: Joe Perches; +Cc: Michael Hennerich, uclinux-dist-devel, netdev, linux-kernel
In-Reply-To: <61ca890fdbff3397e15328685ba6d86eaabf8fec.1280447281.git.joe@perches.com>

On Thu, Jul 29, 2010 at 19:58, Joe Perches wrote:
> Add and use pr_fmt, pr_<level> and netdev_<level>

your changelog says add pr_fmt, but i dont see it in the patch ...

> @@ -833,8 +830,7 @@ static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
>                       (--timeout_cnt))
>                        udelay(1);
>                if (timeout_cnt == 0)
> -                       printk(KERN_ERR DRV_NAME
> -                                       ": fails to timestamp the TX packet\n");
> +                       pr_err("failed to timestamp the TX packet\n");

this func has a net_device, so cant you use netdev_err here ?

> @@ -1102,8 +1097,7 @@ static void bfin_mac_rx(struct net_device *dev)
>
>        new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN);
>        if (!new_skb) {
> -               printk(KERN_NOTICE DRV_NAME
> -                      ": rx: low on mem - packet dropped\n");
> +               pr_notice("rx: low on mem - packet dropped\n");

same here

otherwise this patch looks good
-mike

^ permalink raw reply

* Re: [PATCH net-next 3/3] drivers/net/bfin_mac.c: Misc function cleanups, neatening
From: Mike Frysinger @ 2010-07-30  0:18 UTC (permalink / raw)
  To: Joe Perches; +Cc: Michael Hennerich, uclinux-dist-devel, netdev, linux-kernel
In-Reply-To: <e90ce59d7dcbbdb24e1882a4e99b0c3db2bd116a.1280447281.git.joe@perches.com>

On Thu, Jul 29, 2010 at 19:58, Joe Perches wrote:
> Use new bfin_alloc_skb to centralize skb allocations
> Add and use get_mac_addr function
> Neaten bfin_mac_init
> Neaten bfin_mac_hard_start_xmit

i'll ack the idea, but i think it better i pull these patches into the
Blackfin repo to get some real hardware testing before i forward them
back to David/netdev ...

that OK with you ?
-mike

^ permalink raw reply

* Is it a possible bug in dev_gro_receive()?
From: Xin Xiaohui @ 2010-07-30  1:54 UTC (permalink / raw)
  To: netdev, herbert, davem; +Cc: Xin Xiaohui

I looked into the code dev_gro_receive(), found the code here:
if the frags[0] is pulled to 0, then the page will be released,
and memmove() frags left.
Is that right? I'm not sure if memmove do right or not, but
frags[0].size is never set after memove at least. what I think
a simple way is not to do anything if we found frags[0].size == 0.
The patch is as followed.

Or am I missing something here?

---
 net/core/dev.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 264137f..28cdbbf 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2730,13 +2730,6 @@ pull:
 
 		skb_shinfo(skb)->frags[0].page_offset += grow;
 		skb_shinfo(skb)->frags[0].size -= grow;
-
-		if (unlikely(!skb_shinfo(skb)->frags[0].size)) {
-			put_page(skb_shinfo(skb)->frags[0].page);
-			memmove(skb_shinfo(skb)->frags,
-				skb_shinfo(skb)->frags + 1,
-				--skb_shinfo(skb)->nr_frags);
-		}
 	}
 
 ok:
-- 
1.5.4.4


^ permalink raw reply related

* [PATCH V2 net-next 2/3] drivers/net/bfin_mac.c: Use pr_<level>, netdev_<level>
From: Joe Perches @ 2010-07-30  1:44 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: Michael Hennerich, uclinux-dist-devel, netdev, linux-kernel
In-Reply-To: <AANLkTi=jTj7g7STZCTYYBsw5zmij3jmEedBoEnZE4TgW@mail.gmail.com>

Add and use pr_fmt, pr_<level> and netdev_<level>

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/bfin_mac.c |   64 +++++++++++++++++++++++------------------------
 1 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 0b032a5..7543b07 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -8,6 +8,8 @@
  * Licensed under the GPL-2 or later.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -195,8 +197,7 @@ static int desc_list_init(void)
 		/* allocate a new skb for next time receive */
 		new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN);
 		if (!new_skb) {
-			printk(KERN_NOTICE DRV_NAME
-			       ": init: low on mem - packet dropped\n");
+			pr_notice("init: low on mem - packet dropped\n");
 			goto init_error;
 		}
 		skb_reserve(new_skb, NET_IP_ALIGN);
@@ -247,7 +248,7 @@ static int desc_list_init(void)
 
 init_error:
 	desc_list_free();
-	printk(KERN_ERR DRV_NAME ": kmalloc failed\n");
+	pr_err("kmalloc failed\n");
 	return -ENOMEM;
 }
 
@@ -264,12 +265,11 @@ static int bfin_mdio_poll(void)
 
 	/* poll the STABUSY bit */
 	while ((bfin_read_EMAC_STAADD()) & STABUSY) {
-		udelay(1);
 		if (timeout_cnt-- < 0) {
-			printk(KERN_ERR DRV_NAME
-			": wait MDC/MDIO transaction to complete timeout\n");
+			pr_err("wait MDC/MDIO transaction to complete timeout\n");
 			return -ETIMEDOUT;
 		}
+		udelay(1);
 	}
 
 	return 0;
@@ -357,9 +357,9 @@ static void bfin_mac_adjust_link(struct net_device *dev)
 				opmode &= ~(RMII_10);
 				break;
 			default:
-				printk(KERN_WARNING
-					"%s: Ack!  Speed (%d) is not 10/100!\n",
-					DRV_NAME, phydev->speed);
+				netdev_warn(dev,
+					    "Ack!  Speed (%d) is not 10/100!\n",
+					    phydev->speed);
 				break;
 			}
 			bfin_write_EMAC_OPMODE(opmode);
@@ -383,7 +383,7 @@ static void bfin_mac_adjust_link(struct net_device *dev)
 	if (new_state) {
 		u32 opmode = bfin_read_EMAC_OPMODE();
 		phy_print_status(phydev);
-		pr_debug("EMAC_OPMODE = 0x%08x\n", opmode);
+		netdev_dbg(dev, "EMAC_OPMODE = 0x%08x\n", opmode);
 	}
 
 	spin_unlock_irqrestore(&lp->lock, flags);
@@ -424,8 +424,7 @@ static int mii_probe(struct net_device *dev)
 
 	/* now we are supposed to have a proper phydev to attach to... */
 	if (!phydev) {
-		printk(KERN_INFO "%s: Don't found any phy device at all\n",
-			dev->name);
+		netdev_info(dev, "No PHY device found\n");
 		return -ENODEV;
 	}
 
@@ -438,7 +437,7 @@ static int mii_probe(struct net_device *dev)
 #endif
 
 	if (IS_ERR(phydev)) {
-		printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
+		netdev_err(dev, "Could not attach to PHY\n");
 		return PTR_ERR(phydev);
 	}
 
@@ -460,11 +459,11 @@ static int mii_probe(struct net_device *dev)
 	lp->old_duplex = -1;
 	lp->phydev = phydev;
 
-	printk(KERN_INFO "%s: attached PHY driver [%s] "
-	       "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)"
-	       "@sclk=%dMHz)\n",
-	       DRV_NAME, phydev->drv->name, dev_name(&phydev->dev), phydev->irq,
-	       MDC_CLK, mdc_div, sclk/1000000);
+	netdev_info(dev, "attached PHY driver [%s] "
+		    "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)"
+		    "@sclk=%dMHz)\n",
+		    phydev->drv->name, dev_name(&phydev->dev), phydev->irq,
+		    MDC_CLK, mdc_div, sclk/1000000);
 
 	return 0;
 }
@@ -636,8 +635,9 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
 	if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
 		return -EFAULT;
 
-	pr_debug("%s config flag:0x%x, tx_type:0x%x, rx_filter:0x%x\n",
-		 __func__, config.flags, config.tx_type, config.rx_filter);
+	netdev_dbg(netdev,
+		   "%s config flag:0x%x, tx_type:0x%x, rx_filter:0x%x\n",
+		   __func__, config.flags, config.tx_type, config.rx_filter);
 
 	/* reserved for future extensions */
 	if (config.flags)
@@ -833,8 +833,8 @@ static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
 		       (--timeout_cnt))
 			udelay(1);
 		if (timeout_cnt == 0)
-			printk(KERN_ERR DRV_NAME
-					": fails to timestamp the TX packet\n");
+			netdev_err(netdev,
+				   "failed to timestamp the TX packet\n");
 		else {
 			struct skb_shared_hwtstamps shhwtstamps;
 			u64 ns;
@@ -1091,8 +1091,7 @@ static void bfin_mac_rx(struct net_device *dev)
 	 * we which case we simply drop the packet
 	 */
 	if (current_rx_ptr->status.status_word & RX_ERROR_MASK) {
-		printk(KERN_NOTICE DRV_NAME
-		       ": rx: receive error - packet dropped\n");
+		netdev_notice(dev, "rx: receive error - packet dropped\n");
 		dev->stats.rx_dropped++;
 		goto out;
 	}
@@ -1102,8 +1101,7 @@ static void bfin_mac_rx(struct net_device *dev)
 
 	new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN);
 	if (!new_skb) {
-		printk(KERN_NOTICE DRV_NAME
-		       ": rx: low on mem - packet dropped\n");
+		netdev_notice(dev, "rx: low on mem - packet dropped\n");
 		dev->stats.rx_dropped++;
 		goto out;
 	}
@@ -1226,7 +1224,7 @@ static int bfin_mac_enable(void)
 	int ret;
 	u32 opmode;
 
-	pr_debug("%s: %s\n", DRV_NAME, __func__);
+	pr_debug("%s\n", __func__);
 
 	/* Set RX DMA */
 	bfin_write_DMA1_NEXT_DESC_PTR(&(rx_list_head->desc_a));
@@ -1268,7 +1266,7 @@ static void bfin_mac_timeout(struct net_device *dev)
 {
 	struct bfin_mac_local *lp = netdev_priv(dev);
 
-	pr_debug("%s: %s\n", dev->name, __func__);
+	netdev_dbg(dev, "%s\n", __func__);
 
 	bfin_mac_disable();
 
@@ -1335,7 +1333,7 @@ static void bfin_mac_set_multicast_list(struct net_device *dev)
 	u32 sysctl;
 
 	if (dev->flags & IFF_PROMISC) {
-		printk(KERN_INFO "%s: set to promisc mode\n", dev->name);
+		netdev_info(dev, "set to promisc mode\n");
 		sysctl = bfin_read_EMAC_OPMODE();
 		sysctl |= PR;
 		bfin_write_EMAC_OPMODE(sysctl);
@@ -1389,7 +1387,7 @@ static int bfin_mac_open(struct net_device *dev)
 {
 	struct bfin_mac_local *lp = netdev_priv(dev);
 	int ret;
-	pr_debug("%s: %s\n", dev->name, __func__);
+	netdev_dbg(dev, "%s\n", __func__);
 
 	/*
 	 * Check that the address is valid.  If its not, refuse
@@ -1397,7 +1395,7 @@ static int bfin_mac_open(struct net_device *dev)
 	 * address using ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
 	 */
 	if (!is_valid_ether_addr(dev->dev_addr)) {
-		printk(KERN_WARNING DRV_NAME ": no valid ethernet hw addr\n");
+		netdev_warn(dev, "no valid ethernet hw addr\n");
 		return -EINVAL;
 	}
 
@@ -1415,7 +1413,7 @@ static int bfin_mac_open(struct net_device *dev)
 	ret = bfin_mac_enable();
 	if (ret)
 		return ret;
-	pr_debug("hardware init finished\n");
+	netdev_dbg(dev, "hardware init finished\n");
 
 	netif_start_queue(dev);
 	netif_carrier_on(dev);
@@ -1431,7 +1429,7 @@ static int bfin_mac_open(struct net_device *dev)
 static int bfin_mac_close(struct net_device *dev)
 {
 	struct bfin_mac_local *lp = netdev_priv(dev);
-	pr_debug("%s: %s\n", dev->name, __func__);
+	netdev_dbg(dev, "%s\n", __func__);
 
 	netif_stop_queue(dev);
 	netif_carrier_off(dev);
-- 
1.7.2.19.g9a302

^ permalink raw reply related

* Re: [PATCH net-next 3/3] drivers/net/bfin_mac.c: Misc function cleanups, neatening
From: Joe Perches @ 2010-07-30  1:45 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: Michael Hennerich, uclinux-dist-devel, netdev, linux-kernel
In-Reply-To: <AANLkTikYn+qpDxxLeJ4eu5SsEs=7n_wAu5RzM5pZhVwU@mail.gmail.com>

On Thu, 2010-07-29 at 20:18 -0400, Mike Frysinger wrote:
> i'll ack the idea, but i think it better i pull these patches into the
> Blackfin repo to get some real hardware testing before i forward them
> back to David/netdev ...
> 
> that OK with you ?

Fine by me.  These are trivial patches.
I don't have the hardware.



^ permalink raw reply

* [PATCH V2 net-next 3/3] drivers/net/bfin_mac.c: Misc function cleanups, neatening
From: Joe Perches @ 2010-07-30  1:47 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: Michael Hennerich, uclinux-dist-devel, netdev, linux-kernel
In-Reply-To: <AANLkTikYn+qpDxxLeJ4eu5SsEs=7n_wAu5RzM5pZhVwU@mail.gmail.com>

Use new bfin_alloc_skb to centralize skb allocations
Add and use get_mac_addr function
Neaten bfin_mac_init
Neaten bfin_mac_hard_start_xmit

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/bfin_mac.c |   93 ++++++++++++++++++++++++++---------------------
 1 files changed, 51 insertions(+), 42 deletions(-)

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 7543b07..6c23a91 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -83,6 +83,26 @@ static u16 pin_req[] = P_RMII0;
 static u16 pin_req[] = P_MII0;
 #endif
 
+static struct sk_buff *bfin_alloc_skb(void)
+{
+	/* allocate a new skb */
+	struct sk_buff *new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN);
+
+	if (!new_skb)
+		return NULL;
+
+	skb_reserve(new_skb, NET_IP_ALIGN);
+	/*
+	 * Invalidate the data cache of skb->data range
+	 * when it is write back cache to prevent overwriting
+	 * the new data from DMA.
+	 */
+	blackfin_dcache_invalidate_range((unsigned long)new_skb->head,
+					 (unsigned long)new_skb->end);
+
+	return new_skb;
+}
+
 static void desc_list_free(void)
 {
 	struct net_dma_desc_rx *r;
@@ -195,18 +215,12 @@ static int desc_list_init(void)
 		struct dma_descriptor *b = &(r->desc_b);
 
 		/* allocate a new skb for next time receive */
-		new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN);
+		new_skb = bfin_alloc_skb();
 		if (!new_skb) {
 			pr_notice("init: low on mem - packet dropped\n");
 			goto init_error;
 		}
-		skb_reserve(new_skb, NET_IP_ALIGN);
-		/* Invalidate the data cache of skb->data range when it is
-		 * write back cache.
-		 * It will prevent overwriting the new data from DMA
-		 */
-		blackfin_dcache_invalidate_range((unsigned long)new_skb->head,
-					 (unsigned long)new_skb->end);
+
 		r->skb = new_skb;
 
 		/*
@@ -600,6 +614,16 @@ void setup_system_regs(struct net_device *dev)
 	bfin_write_DMA1_Y_MODIFY(0);
 }
 
+/* Grab the MAC address in the MAC */
+static void get_mac_addr(u8 *mac_addr)
+{
+	__le32 addr_low = cpu_to_le32(bfin_read_EMAC_ADDRLO());
+	__le16 addr_hi = cpu_to_le16((u16)bfin_read_EMAC_ADDRHI());
+
+	memcpy(mac_addr, &addr_low, 4);
+	memcpy(mac_addr + 4, &addr_hi, 2);
+}
+
 static void setup_mac_addr(u8 *mac_addr)
 {
 	u32 addr_low = le32_to_cpu(*(__le32 *)&mac_addr[0]);
@@ -998,15 +1022,17 @@ static void tx_reclaim_skb_timeout(unsigned long lp)
 static int bfin_mac_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct bfin_mac_local *lp = netdev_priv(dev);
-	u16 *data;
 	u32 data_align = (unsigned long)(skb->data) & 0x3;
+	unsigned long buf_start;
+	unsigned long buf_len;
 	union skb_shared_tx *shtx = skb_tx(skb);
 
 	current_tx_ptr->skb = skb;
 
 	if (data_align == 0x2) {
 		/* move skb->data to current_tx_ptr payload */
-		data = (u16 *)(skb->data) - 1;
+		u16 *data = (u16 *)(skb->data) - 1;
+
 		*data = (u16)(skb->len);
 		/*
 		 * When transmitting an Ethernet packet, the PTP_TSYNC module
@@ -1018,23 +1044,21 @@ static int bfin_mac_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		if (shtx->hardware)
 			*data |= 0x1000;
 
-		current_tx_ptr->desc_a.start_addr = (u32)data;
-		/* this is important! */
-		blackfin_dcache_flush_range((u32)data,
-					    (u32)((u8 *)data + skb->len + 4));
+		buf_start = (unsigned long)data;
+		buf_len = skb->len + 4;
 	} else {
 		*((u16 *)(current_tx_ptr->packet)) = (u16)(skb->len);
 		/* enable timestamping for the sent packet */
 		if (shtx->hardware)
 			*((u16 *)(current_tx_ptr->packet)) |= 0x1000;
-		memcpy((u8 *)(current_tx_ptr->packet + 2), skb->data,
-			skb->len);
-		current_tx_ptr->desc_a.start_addr =
-			(u32)current_tx_ptr->packet;
-		blackfin_dcache_flush_range(
-			(u32)current_tx_ptr->packet,
-			(u32)(current_tx_ptr->packet + skb->len + 2));
+		memcpy(current_tx_ptr->packet + 2, skb->data, skb->len);
+
+		buf_start = (unsigned long)current_tx_ptr->packet;
+		buf_len = skb->len + 2;
 	}
+	current_tx_ptr->desc_a.start_addr = buf_start;
+	/* this is important! */
+	blackfin_dcache_flush_range(buf_start, buf_start + buf_len);
 
 	/*
 	 * Make sure the internal data buffers in the core are drained
@@ -1099,20 +1123,12 @@ static void bfin_mac_rx(struct net_device *dev)
 	/* allocate a new skb for next time receive */
 	skb = current_rx_ptr->skb;
 
-	new_skb = dev_alloc_skb(PKT_BUF_SZ + NET_IP_ALIGN);
+	new_skb = bfin_alloc_skb();
 	if (!new_skb) {
 		netdev_notice(dev, "rx: low on mem - packet dropped\n");
 		dev->stats.rx_dropped++;
 		goto out;
 	}
-	/* reserve 2 bytes for RXDWA padding */
-	skb_reserve(new_skb, NET_IP_ALIGN);
-	/*
-	 * Invalidate the data cache of skb->data range when it is write back
-	 * cache. It will prevent overwriting the new data from DMA
-	 */
-	blackfin_dcache_invalidate_range((unsigned long)new_skb->head,
-					 (unsigned long)new_skb->end);
 
 	current_rx_ptr->skb = new_skb;
 	current_rx_ptr->desc_a.start_addr = (unsigned long)new_skb->data - 2;
@@ -1479,14 +1495,10 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev)
 	lp = netdev_priv(ndev);
 	lp->ndev = ndev;
 
-	/* Grab the MAC address in the MAC */
-	*(__le32 *)(&(ndev->dev_addr[0])) =
-		cpu_to_le32(bfin_read_EMAC_ADDRLO());
-	*(__le16 *)(&(ndev->dev_addr[4])) =
-		cpu_to_le16((u16)bfin_read_EMAC_ADDRHI());
+	get_mac_addr(ndev->dev_addr);
 
 	/* probe mac */
-	/*todo: how to proble? which is revision_register */
+	/* todo: how to probe? which is revision_register */
 	bfin_write_EMAC_ADDRLO(0x12345678);
 	if (bfin_read_EMAC_ADDRLO() != 0x12345678) {
 		dev_err(&pdev->dev, "Cannot detect Blackfin on-chip ethernet MAC controller!\n");
@@ -1722,12 +1734,9 @@ static struct platform_driver bfin_mac_driver = {
 
 static int __init bfin_mac_init(void)
 {
-	int ret;
-
-	ret = platform_driver_register(&bfin_mii_bus_driver);
-	if (!ret)
-		return platform_driver_register(&bfin_mac_driver);
-	return -ENODEV;
+	if (platform_driver_register(&bfin_mii_bus_driver))
+		return -ENODEV;
+	return platform_driver_register(&bfin_mac_driver);
 }
 
 module_init(bfin_mac_init);
-- 
1.7.2.19.g9a302

^ permalink raw reply related

* [PATCH] act_nat: get the position info from skb->tc_verd
From: Changli Gao @ 2010-07-29 18:42 UTC (permalink / raw)
  To: David S. Miller; +Cc: Herbert Xu, Jamal Hadi Salim, netdev, Changli Gao

act_nat uses its flags field to determine where it acts. It isn't reliable,
and can't prevent users from doing wrong settings, and act_nat should get the
position info from skb->tc_verd as act_mirred does.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
 include/net/tc_act/tc_nat.h |    2 +-
 net/sched/act_nat.c         |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/net/tc_act/tc_nat.h b/include/net/tc_act/tc_nat.h
index 4a691f3..343376a 100644
--- a/include/net/tc_act/tc_nat.h
+++ b/include/net/tc_act/tc_nat.h
@@ -10,7 +10,7 @@ struct tcf_nat {
 	__be32 old_addr;
 	__be32 new_addr;
 	__be32 mask;
-	u32 flags;
+	u32 flags;	/* unused */
 };
 
 static inline struct tcf_nat *to_tcf_nat(struct tcf_common *pc)
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 24e614c..144e118 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -121,7 +121,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
 	old_addr = p->old_addr;
 	new_addr = p->new_addr;
 	mask = p->mask;
-	egress = p->flags & TCA_NAT_FLAG_EGRESS;
+	egress = G_TC_AT(skb->tc_verd) & AT_EGRESS;
 	action = p->tcf_action;
 
 	p->tcf_bstats.bytes += qdisc_pkt_len(skb);

^ permalink raw reply related

* Re: [PATCH] act_nat: get the position info from skb->tc_verd
From: Herbert Xu @ 2010-07-30  2:36 UTC (permalink / raw)
  To: Changli Gao; +Cc: David S. Miller, Jamal Hadi Salim, netdev
In-Reply-To: <1280428952-14151-1-git-send-email-xiaosuo@gmail.com>

On Fri, Jul 30, 2010 at 02:42:32AM +0800, Changli Gao wrote:
> act_nat uses its flags field to determine where it acts. It isn't reliable,
> and can't prevent users from doing wrong settings, and act_nat should get the
> position info from skb->tc_verd as act_mirred does.
> 
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>

Nack, the direction controls whether we NAT saddr or daddr.  It's
perfectly OK for someone to NAT daddr on the way out.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* Re: [PATCH] act_nat: get the position info from skb->tc_verd
From: Changli Gao @ 2010-07-30  2:57 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, Jamal Hadi Salim, netdev
In-Reply-To: <20100730023649.GA5798@gondor.apana.org.au>

On Fri, Jul 30, 2010 at 10:36 AM, Herbert Xu
<herbert@gondor.apana.org.au> wrote:
> On Fri, Jul 30, 2010 at 02:42:32AM +0800, Changli Gao wrote:
>> act_nat uses its flags field to determine where it acts. It isn't reliable,
>> and can't prevent users from doing wrong settings, and act_nat should get the
>> position info from skb->tc_verd as act_mirred does.
>>
>> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
>
> Nack, the direction controls whether we NAT saddr or daddr.  It's
> perfectly OK for someone to NAT daddr on the way out.
>

Thanks for your explanation. However, ingress and egress aren't as
comprehensive as DNAT and SNAT. BTW I am planning to add stateless
PAT(Port Address Translation) support into act_nat. Any comment?

-- 
Regards,
Changli Gao(xiaosuo@gmail.com)

^ permalink raw reply

* Re: [RFC PATCH v8 00/16] Provide a zero-copy method on KVM virtio-net.
From: Avi Kivity @ 2010-07-30  5:02 UTC (permalink / raw)
  To: Shirley Ma
  Cc: xiaohui.xin, netdev, kvm, linux-kernel, mst, mingo, davem,
	herbert, jdike
In-Reply-To: <1280442682.9058.15.camel@localhost.localdomain>

  On 07/30/2010 01:31 AM, Shirley Ma wrote:
>
>> Our goal is to improve the bandwidth and reduce the CPU usage.
>> Exact performance data will be provided later.
> I did some vhost performance measurement over 10Gb ixgbe, and found that
> in order to get consistent BW results, netperf/netserver, qemu, vhost
> threads smp affinities are required.
>
> Looking forward to these results for small message size comparison. For
> large message size 10Gb ixgbe BW already reached by doing vhost smp
> affinity w/i offloading support, we will see how much CPU utilization it
> can be reduced.
>
> Please provide latency results as well. I did some experimental on
> macvtap zero copy sendmsg, what I have found that get_user_pages latency
> pretty high.
>

get_user_pages() is indeed slow.  But what about get_user_pages_fast()?

Note that when the page is first touched, get_user_pages_fast() falls 
back to get_user_pages(), so the latency needs to be measured after 
quite a bit of warm-up.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

^ permalink raw reply

* [PATCH] act_nat: fix wild pointer
From: Changli Gao @ 2010-07-29 23:41 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Jamal Hadi Salim, David S. Miller, netdev, Changli Gao

pskb_may_pull() may change skb pointers, so adjust icmph after pskb_may_pull().

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
 net/sched/act_nat.c |    1 +
 1 file changed, 1 insertion(+)
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 24e614c..b6d7c6f 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -218,6 +218,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
 		if (!pskb_may_pull(skb, ihl + sizeof(*icmph) + sizeof(*iph)))
 			goto drop;
 
+		icmph = (void *)(skb_network_header(skb) + ihl);
 		iph = (void *)(icmph + 1);
 		if (egress)
 			addr = iph->daddr;

^ permalink raw reply related

* Re: [PATCH] act_nat: fix wild pointer
From: Herbert Xu @ 2010-07-30  7:18 UTC (permalink / raw)
  To: Changli Gao; +Cc: Jamal Hadi Salim, David S. Miller, netdev
In-Reply-To: <1280446906-29032-1-git-send-email-xiaosuo@gmail.com>

On Fri, Jul 30, 2010 at 07:41:46AM +0800, Changli Gao wrote:
> pskb_may_pull() may change skb pointers, so adjust icmph after pskb_may_pull().
> 
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* RE: [RFC PATCH v8 00/16] Provide a zero-copy method on KVM virtio-net.
From: Xin, Xiaohui @ 2010-07-30  8:53 UTC (permalink / raw)
  To: Shirley Ma
  Cc: netdev@vger.kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, mst@redhat.com, mingo@elte.hu,
	davem@davemloft.net, herbert@gondor.apana.org.au,
	jdike@linux.intel.com
In-Reply-To: <1280442682.9058.15.camel@localhost.localdomain>

>Hello Xiaohui,
>
>On Thu, 2010-07-29 at 19:14 +0800, xiaohui.xin@intel.com wrote:
>> The idea is simple, just to pin the guest VM user space and then
>> let host NIC driver has the chance to directly DMA to it.
>> The patches are based on vhost-net backend driver. We add a device
>> which provides proto_ops as sendmsg/recvmsg to vhost-net to
>> send/recv directly to/from the NIC driver. KVM guest who use the
>> vhost-net backend may bind any ethX interface in the host side to
>> get copyless data transfer thru guest virtio-net frontend.
>
>Since vhost-net already supports macvtap/tun backends, do you think
>whether it's better to implement zero copy in macvtap/tun than inducing
>a new media passthrough device here?
>

I'm not sure if there will be more duplicated code in the kernel.

>> Our goal is to improve the bandwidth and reduce the CPU usage.
>> Exact performance data will be provided later.
>
>I did some vhost performance measurement over 10Gb ixgbe, and found that
>in order to get consistent BW results, netperf/netserver, qemu, vhost
>threads smp affinities are required.
>
>Looking forward to these results for small message size comparison. For
>large message size 10Gb ixgbe BW already reached by doing vhost smp
>affinity w/i offloading support, we will see how much CPU utilization it
>can be reduced.
>
>Please provide latency results as well. I did some experimental on
>macvtap zero copy sendmsg, what I have found that get_user_pages latency
>pretty high.
>
Ok, I will try that.

>Thanks
>Shirley
>
>
>

^ permalink raw reply

* [patch] hp100: unmap memory on error path
From: Dan Carpenter @ 2010-07-30  9:06 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: David S. Miller, Jiri Pirko, Stephen Hemminger, netdev,
	kernel-janitors

There was an error path where "mem_ptr_virt" didn't get unmapped.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index acbf0d0..ce587f4 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -720,9 +720,10 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr,
 		/* Conversion to new PCI API :
 		 * Pages are always aligned and zeroed, no need to it ourself.
 		 * Doc says should be OK for EISA bus as well - Jean II */
-		if ((lp->page_vaddr_algn = pci_alloc_consistent(lp->pci_dev, MAX_RINGSIZE, &page_baddr)) == NULL) {
+		lp->page_vaddr_algn = pci_alloc_consistent(lp->pci_dev, MAX_RINGSIZE, &page_baddr);
+		if (!lp->page_vaddr_algn) {
 			err = -ENOMEM;
-			goto out2;
+			goto out_mem_ptr;
 		}
 		lp->whatever_offset = ((u_long) page_baddr) - ((u_long) lp->page_vaddr_algn);
 
@@ -798,6 +799,7 @@ out3:
 		pci_free_consistent(lp->pci_dev, MAX_RINGSIZE + 0x0f,
 				    lp->page_vaddr_algn,
 				    virt_to_whatever(dev, lp->page_vaddr_algn));
+out_mem_ptr:
 	if (mem_ptr_virt)
 		iounmap(mem_ptr_virt);
 out2:

^ permalink raw reply related

* Re: [PATCH] act_nat: the checksum of ICMP doesn't have pseudo header
From: Herbert Xu @ 2010-07-30  9:09 UTC (permalink / raw)
  To: Changli Gao; +Cc: Jamal Hadi Salim, David S. Miller, netdev, linux-kernel
In-Reply-To: <1280448258-1893-1-git-send-email-xiaosuo@gmail.com>

On Fri, Jul 30, 2010 at 08:04:18AM +0800, Changli Gao wrote:
> after updating the value of the ICMP payload, inet_proto_csum_replace4() should
> be called with zero pseudohdr.
> 
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>

No, the code is correct as is.  We need to update the checksum
even if the checksum is partial, which is what the 1 is for.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* [PATCH] can-raw: Fix skb_orphan_try handling
From: Oliver Hartkopp @ 2010-07-30  9:44 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: SocketCAN Core Mailing List, Linux Netdev List, Patrick Ohly

Hello Eric, hello Patrick,

Commit fc6055a5ba31e2c14e36e8939f9bf2b6d586a7f5 (net: Introduce
skb_orphan_try()) allows an early orphan of the skb and takes care on
tx timestamping, which needs the sk-reference in the skb on driver level.
So does the can-raw socket, which has not been taken into account here.

The patch below adds a 'prevent_sk_orphan' bit in the skb tx shared info,
which fixes the problem discovered by Matthias Fuchs here:

      http://marc.info/?t=128030411900003&r=1&w=2

Even if it's not a primary tx timestamp topic it fits well into some skb
shared tx context. Or should be find a different place for the information to
protect the sk reference until it reaches the driver level?

Regards,
Oliver

This patch applies on net-2.6 and would be a candidate for stable 2.6.34 also.

Signed-off-by: Oliver Hartkopp <socketcan-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>

---

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index f89e7fd..eb674b7 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -169,6 +169,7 @@ struct skb_shared_hwtstamps {
  * @software:		generate software time stamp
  * @in_progress:	device driver is going to provide
  *			hardware time stamp
+ * @prevent_sk_orphan:	make sk reference available on driver level
  * @flags:		all shared_tx flags
  *
  * These flags are attached to packets as part of the
@@ -178,7 +179,8 @@ union skb_shared_tx {
 	struct {
 		__u8	hardware:1,
 			software:1,
-			in_progress:1;
+			in_progress:1,
+			prevent_sk_orphan:1;
 	};
 	__u8 flags;
 };
diff --git a/net/can/raw.c b/net/can/raw.c
index da99cf1..eedab37 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -655,6 +655,10 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
 	err = sock_tx_timestamp(msg, sk, skb_tx(skb));
 	if (err < 0)
 		goto free_skb;
+
+	/* to be able to check the received tx sock reference in raw_rcv() */
+	(skb_tx(skb))->prevent_sk_orphan = 1;
+
 	skb->dev = dev;
 	skb->sk  = sk;

^ permalink raw reply related


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