Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 2/3] netlink: Mark dumps as inconsistent which have been interrupted by a resize
From: Patrick McHardy @ 2015-01-22 10:07 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Thomas Graf, Ying Xue, davem, paulmck, netdev, netfilter-devel
In-Reply-To: <20150122092212.GA5035@gondor.apana.org.au>

On 22.01, Herbert Xu wrote:
> On Thu, Jan 22, 2015 at 08:56:44AM +0000, Patrick McHardy wrote:
> >
> > Hope it will still be possible, I need it for GC in timeout support for
> > nftables sets.
> 
> This should be able to use the same walk that you're currently
> using for dump once we add the restart, no?

Yes, should even be possible to use the walk function with some small
adjustments.

^ permalink raw reply

* Re: [PATCH v5 2/5] can: kvaser_usb: Consolidate and unify state change handling
From: Andri Yngvason @ 2015-01-22 10:14 UTC (permalink / raw)
  To: Marc Kleine-Budde, Ahmed S. Darwish, Olivier Sobrie,
	Oliver Hartkopp, Wolfgang Grandegger
  Cc: Linux-CAN, netdev, LKML
In-Reply-To: <54C02F4B.80206@pengutronix.de>

Quoting Marc Kleine-Budde (2015-01-21 22:59:23)
> On 01/21/2015 05:20 PM, Andri Yngvason wrote:
> > Marc, could you merge the "move bus_off++" patch before you merge this so that I
> > won't have to incorporate this patch-set into it?
> 
> ...included in the lastest pull-request to David. Use
> tags/linux-can-next-for-3.20-20150121 of the can-next repo as you new base.
> 

Thanks!

--
Andri

^ permalink raw reply

* Re: [PATCH] ethernet: atheros: Add nss-gmac driver
From: Arnd Bergmann @ 2015-01-22 10:18 UTC (permalink / raw)
  To: wstephen-sgV2jX0FEOL9JmXXK+q4OQ
  Cc: jcliburn-Re5JQEeQqe8AvxtiuMwx3w,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <f9cbb34c9228b2af7ed6c1c96a6aa61c.squirrel-mMfbam+mt9083fI46fginR2eb7JE58TQ@public.gmane.org>

On Thursday 22 January 2015 00:20:59 wstephen-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org wrote:
> > Right. For review purposes, I think it would be helpful to split this
> > huge patch into several steps then:
> >
> > - add a base driver
> > - add the overlay interface
> > - add the nss driver
> >
> > Ideally more of them.
> 
> The nss-drv driver is open sourced but we are currently not planning to
> upstream to linux kernel yet because we are still actively adding new
> features
> https://www.codeaurora.org/cgit/quic/qsdk/oss/lklm/nss-drv
> 
> > Thanks for the description, this sounds very interesting indeed. I do
> > have more questions though: how do you get the rules into the NSS driver?
> > Does this get handled transparently by the openvswitch driver or
> > did you have to add new user interfaces for it?
> >
> 
> No, we are not using openvswitch. We have a connection manager monitoring
> conntrack events and creates rules then send it through the interface
> built in nss-drv.
> 

I see. In this case, I think merging your new driver is not a good idea:

- We already have a driver (dwmac1000) for the ethernet hardware,
  which is known to work on a lot of hardware and has an established
  binding.

- The main difference in your new driver is the plug-in interface,
  but that has no upstream users

- The nss driver is not getting submitted, and has little chance of
  getting merged if you do, because it introduces a driver-specific
  API for something that should be hardware independent.

You can simplify your private nss code a lot if you remove the
abstraction layer and only implement ethernet features you need
in the same module, and then load either the upstream driver or
your nss driver. Make sure they use a compatible binding so the
device gets attached to just one of the two drivers. For the
built-in case, you can use the 'unbind' interface from user space
to remove the device from the dwmac1000 driver.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" 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 1/2] if_link: Add VF multicast promiscuous mode control
From: Jeff Kirsher @ 2015-01-22 10:52 UTC (permalink / raw)
  To: David Laight
  Cc: e1000-devel@lists.sourceforge.net, Choi, Sy Jong,
	linux-kernel@vger.kernel.org, Hayato Momma,
	netdev@vger.kernel.org, Hiroshi Shimamoto, Bjørn Mork
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CAD0C8A@AcuExch.aculab.com>


[-- Attachment #1.1: Type: text/plain, Size: 2595 bytes --]

On Thu, 2015-01-22 at 09:50 +0000, David Laight wrote:
> From: Skidmore, Donald C 
> > > > From: Hiroshi Shimamoto
> > > > > My concern is what is the real issue that VF multicast
> promiscuous mode
> > > can cause.
> > > > > I think there is the 4k entries to filter multicast address,
> and the
> > > > > current ixgbe/ixgbevf can turn all bits on from VM. That is
> almost same as
> > > enabling multicast promiscuous mode.
> > > > > I mean that we can receive all multicast addresses by an
> onerous
> > > operation in untrusted VM.
> > > > > I think we should clarify what is real security issue in this
> context.
> > > >
> > > > If you are worried about passing un-enabled multicasts to users
> then
> > > > what about doing a software hash of received multicasts and
> checking
> > > > against an actual list of multicasts enabled for that hash
> entry.
> > > > Under normal conditions there is likely to be only a single
> address to check.
> > > >
> > > > It may (or may not) be best to use the same hash as any hashing
> > > > hardware filter uses.
> > >
> > > thanks for the comment. But I don't think that is the point.
> > >
> > > I guess, introducing VF multicast promiscuous mode seems to add
> new
> > > privilege to peek every multicast packet in VM and that doesn't
> look good.
> > > On the other hand, I think that there has been the same privilege
> in the
> > > current ixgbe/ixgbevf implementation already. Or I'm reading the
> code
> > > wrongly.
> > > I'd like to clarify what is the issue of allowing to receive all
> multicast packets.
> > 
> > Allowing a VM to give itself the privilege of seeing every multicast
> packet
> > could be seen as a hole in VM isolation.
> > Now if the host system allows this policy I don't see this as an
> issue as
> > someone specifically allowed this to happen and then must not be
> concerned.
> > We could even log that it has occurred, which I believe your patch
> did do.
> > The issue is also further muddied, as you mentioned above, since
> some of
> > these multicast packets are leaking anyway (the HW currently uses a
> 12 bit mask).
> > It's just that this change would greatly enlarge that hole from a
> fraction to
> > all multicast packets.
> 
> Why does it have anything to do with VM isolation?
> Isn't is just the same as if the VM were connected directly to the
> ethernet cable?

So give an example of when the VF driver is connected directly to the
ethernet cable and a PF driver (ixgbe) does not exist, at least that is
what you are suggesting.

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 392 bytes --]

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet

[-- Attachment #3: Type: text/plain, Size: 257 bytes --]

_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply

* Re: [1/1] MAINTAINERS: remove ath5k mailing list
From: Kalle Valo @ 2015-01-22 11:00 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: davem, netdev, linux-kernel, Jiri Slaby, Nick Kossifidis,
	Luis R. Rodriguez, linux-wireless, Michael Renzmann
In-Reply-To: <1420887760-9979-1-git-send-email-jslaby@suse.cz>


> The list is in the process of closing.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Nick Kossifidis <mickflemm@gmail.com>
> Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
> Cc: linux-wireless@vger.kernel.org
> Cc: "Michael Renzmann" <mrenzmann@madwifi-project.org>

Thanks, applied to wireless-drivers-next.git.

Kalle Valo

^ permalink raw reply

* Re: [PATCH net] ipv6: Prevent ipv6_find_hdr() from returning ENOENT for valid non-first fragments
From: Rahul Sharma @ 2015-01-22 11:24 UTC (permalink / raw)
  To: Hannes Frederic Sowa
  Cc: Pablo Neira Ayuso, netdev, linux-kernel, netfilter-devel
In-Reply-To: <1421143884.13626.1.camel@stressinduktion.org>

Hi Hannes,

On Tue, Jan 13, 2015 at 3:41 PM, Hannes Frederic Sowa
<hannes@stressinduktion.org> wrote:
> On Di, 2015-01-13 at 09:53 +0530, Rahul Sharma wrote:
>> On Mon, Jan 12, 2015 at 5:21 PM, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
>> > On Mon, Jan 12, 2015 at 04:38:16PM +0530, Rahul Sharma wrote:
>> >> Hi Pablo, Hannes
>> >>
>> >> On Fri, Jan 9, 2015 at 9:20 PM, Hannes Frederic Sowa
>> >> <hannes@stressinduktion.org> wrote:
>> >> > On Fr, 2015-01-09 at 12:45 +0100, Pablo Neira Ayuso wrote:
>> >> >> Hi Hannes,
>> >> >>
>> >> >> On Fri, Jan 09, 2015 at 12:34:15PM +0100, Hannes Frederic Sowa wrote:
>> >> >> > On Fri, Jan 9, 2015, at 08:18, Rahul Sharma wrote:
>> >> >> > > Hi Pablo,
>> >> >> > >
>> >> >> > > On Fri, Jan 9, 2015 at 5:35 AM, Pablo Neira Ayuso <pablo@netfilter.org>
>> >> >> > > wrote:
>> >> >> > > > On Thu, Jan 08, 2015 at 11:39:16PM +0100, Hannes Frederic Sowa wrote:
>> >> >> > > >> Hi Pablo,
>> >> >> > > >>
>> >> >> > > >> On Thu, Jan 8, 2015, at 21:53, Pablo Neira Ayuso wrote:
>> >> >> > > >> > I'm afraid we cannot just get rid of that !ipv6_ext_hdr() check. The
>> >> >> > > >> > ipv6_find_hdr() function is designed to return the transport protocol.
>> >> >> > > >> > After the proposed change, it will return extension header numbers.
>> >> >> > > >> > This will break existing ip6tables rulesets since the `-p' option
>> >> >> > > >> > relies on this function to match the transport protocol.
>> >> >> > > >> >
>> >> >> > > >> > Note that the AH header is skipped (see code a bit below this
>> >> >> > > >> > problematic fragmentation handling) so the follow up header after the
>> >> >> > > >> > AH header is returned as the transport header.
>> >> >> > > >> >
>> >> >> > > >> > We can probably return the AH protocol number for non-1st fragments.
>> >> >> > > >> > However, that would be something new to ip6tables since nobody has
>> >> >> > > >> > ever seen packet matching `-p ah' rules. Thus, we restore control to
>> >> >> > > >> > the user to allow this, but we would accept all kind of fragmented AH
>> >> >> > > >> > traffic through the firewall since we cannot know what transport
>> >> >> > > >> > protocol contains from non-1st fragments (unless I'm missing anything,
>> >> >> > > >> > I need to have a closer look at this again tomorrow with fresher
>> >> >> > > >> > mind).
>> >> >> > > >>
>> >> >> > > >> The code in question is guarded by (_frag_off != 0), so we are
>> >> >> > > >> definitely processing a non-1st fragment currently. The -p match would
>> >> >> > > >> happen at the time when the packet is reassembled and thus ipv6_find_hdr
>> >> >> > > >> will find the real transport (final) header at this point (I hope I
>> >> >> > > >> followed the code correctly here).
>> >> >> > > >
>> >> >> > > > Then, Rahul should get things working by modprobing nf_defrag_ipv6.
>> >> >> > >
>> >> >> > > I already had nf_defrag_ipv6 installed when the issue occured. But I
>> >> >> > > see ip6table_raw_hook returning NF_DROP for the second fragment.
>> >> >> >
>> >> >> > That's what I expected. I think the change only affects hooks before
>> >> >> > reassembly.
>> >> >>
>> >> >> reassembly happens at NF_IP6_PRI_CONNTRACK_DEFRAG (-400), so that
>> >> >> happens before NF_IP6_PRI_RAW (-300) in IPv6 which is where the raw
>> >> >> table is placed.
>> >> >
>> >> > I tried to reproduce it, but couldn't get non-1st fragments getting
>> >> > dropped during traversal of the raw table. They get dropped earlier at
>> >> > during reassembly or pass.
>> >> >
>> >> > I agree with Pablo, I also would like to see more data.
>> >> >
>> >> > Thanks,
>> >> > Hannes
>> >> >
>> >> >
>> >>
>> >> I enabled pr_debug() and there was no error in nf_ct_frag6_gather().
>> >> It seems to have defragmented the packet correctly. As expected,
>> >> ipv6_defrag() returns NF_STOLEN for the first packet after queuing it.
>> >> For the next fragment, ipv6_defrag() calls nf_ct_frag6_output() after
>> >> after reassembling it.
>> >
>> > nf_ct_frag6_output() doesn't exist anymore. You're using an old
>> > kernel, you should have started by telling so in your report.
>> >
>> > See 6aafeef ("netfilter: push reasm skb through instead of original
>> > frag skbs").
>>
>>  I apologize for not mentioning the kernel version in my first mail. I
>> had suspected problem in ipv6_find_hdr, the code for which was same.
>> Anyway, thanks for the help. I ll try to figure out how to make this
>> work in my kernel.
>
> If you have time could you quickly test a recent net-next kernel?
>
> Thanks,
> Hannes
>

I could not test the latest net-next kernel with my current setup.
However, I ported the portion of the patch which pushes reasm skb
through instead of original frags. The rest of the patch was mostly
cleanup of some code which didn't exist in my kernel, so it was
ignored. I could test it thoroughly and it seems to work all fine.

Thanks,
Rahul

^ permalink raw reply

* Re: [PATCH mac80211-next] nl80211: Allow set network namespace by fd
From: Vadim Kochan @ 2015-01-22 11:32 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Vadim Kochan, Eric W. Biederman, linux-wireless, netdev
In-Reply-To: <20150119143457.GA6988@angus-think.wlc.globallogic.com>

On Mon, Jan 19, 2015 at 04:34:57PM +0200, Vadim Kochan wrote:
> On Wed, Jan 14, 2015 at 09:47:26AM +0100, Johannes Berg wrote:
> > On Mon, 2015-01-12 at 16:34 +0200, Vadim Kochan wrote:
> > 
> > > --- a/net/core/net_namespace.c
> > > +++ b/net/core/net_namespace.c
> > > @@ -361,6 +361,7 @@ struct net *get_net_ns_by_fd(int fd)
> > >  	return ERR_PTR(-EINVAL);
> > >  }
> > >  #endif
> > > +EXPORT_SYMBOL_GPL(get_net_ns_by_fd);
> > 
> > Does this seem OK? Vadim is adding support for using the ns-by-fd in
> > nl80211, which can be a module as part of cfg80211.
> > 
> > johannes
> > 
> PING ... in case if this email was missed ...
> 
> Thanks,

Hi Johannes,

Does it mean that patch will be rejected in case if no one answer on
this ?:)

Thanks,

^ permalink raw reply

* Re: [PATCH mac80211-next] nl80211: Allow set network namespace by fd
From: Johannes Berg @ 2015-01-22 11:50 UTC (permalink / raw)
  To: Vadim Kochan; +Cc: Eric W. Biederman, linux-wireless, netdev
In-Reply-To: <20150122113259.GA20706@angus-think.local>

On Thu, 2015-01-22 at 13:32 +0200, Vadim Kochan wrote:
> On Mon, Jan 19, 2015 at 04:34:57PM +0200, Vadim Kochan wrote:
> > On Wed, Jan 14, 2015 at 09:47:26AM +0100, Johannes Berg wrote:
> > > On Mon, 2015-01-12 at 16:34 +0200, Vadim Kochan wrote:
> > > 
> > > > --- a/net/core/net_namespace.c
> > > > +++ b/net/core/net_namespace.c
> > > > @@ -361,6 +361,7 @@ struct net *get_net_ns_by_fd(int fd)
> > > >  	return ERR_PTR(-EINVAL);
> > > >  }
> > > >  #endif
> > > > +EXPORT_SYMBOL_GPL(get_net_ns_by_fd);
> > > 
> > > Does this seem OK? Vadim is adding support for using the ns-by-fd in
> > > nl80211, which can be a module as part of cfg80211.
> > > 
> > > johannes
> > > 
> > PING ... in case if this email was missed ...
> > 
> > Thanks,
> 
> Hi Johannes,
> 
> Does it mean that patch will be rejected in case if no one answer on
> this ?:)

Nah, I'll eventually take it :)

johannes

^ permalink raw reply

* pull-request: wireless-drivers-next 2015-01-22
From: Kalle Valo @ 2015-01-22 11:52 UTC (permalink / raw)
  To: David Miller; +Cc: linux-wireless, netdev

Hi Dave,

now a bigger pull request for net-next. Rafal found a UTF-8 bug in
patchwork[1] and because of that two commits (d0c102f70aec and
d0f66df5392a) have his name corrupted:

    Acked-by: Rafa? Mi?ecki <zajec5@gmail.com>

Somehow I failed to spot that when I commited the patches. As rebasing
public git trees is bad, I thought we can live with these and decided
not to rebase. But I'll pay close attention to this in the future to
make sure that it won't happen again. Also we requested an update to
patchwork.kernel.org, the latest patchwork doesn't seem to have this
bug.

Also please note this pull request also adds one DT binding doc, but
this was reviewed in the device tree list:

 .../bindings/net/wireless/qcom,ath10k.txt          |   30 +

Please let me know if you have any issues.

Kalle

[1] https://lists.ozlabs.org/pipermail/patchwork/2015-January/001261.html

The following changes since commit dd9553988879a3ff71a86323b88409e7631c4e5d:

  Merge branch 'timecounter-next' (2015-01-02 16:47:51 -0500)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master

for you to fetch changes up to bc48a51c2a29e231256c2f96daf80c2b7a45f390:

  MAINTAINERS: remove ath5k mailing list (2015-01-22 12:59:46 +0200)

----------------------------------------------------------------
iwlwifi:

* more work on d0i3 power state
* enhancements to the firmware debugging infrastructure
* support for 2 concurrent channel contexts
* fixes / cleanups in the rate control
* general cleanups

brcmfmac:

* add support for the BCM43340 and BCM43341 SDIO chipsets
* number of changes are related to AP mode

mwifiex:

* debug enhancements:
  * dump SDIO function registers/scratch registers
    upon FW crash
  * histogram support
  * adapter structure dump
  * TDLS peer information via debugfs
* control auto deepsleep via module load parameter
* recovery mechanism when host fails to wakeup the firmware
* wowlan disconnect feature

wlcore:

* add DFS support
* enable AP wowlan so that the host can sleep while AP mode is enabled

rtlwifi:

* simplify the drivers and convert them to share more code

ath10k:

* Device tree support
* Major restructuring how to handle different WMI interface versions
* Add WMI TLV interface in preparation for new firmware interface support
* Support new firmware branch 10.2.4
* Add thermal cooling interface
* Add hwmon interface to read temparture from the device

ath9k:

* add support QCA956x
* per-packet Transmit Power Control for AR9002

wil6210:

* block ack with secure and insecure connection
* fix MTU calculation
* some infrastructure fixes
* some debugfs changes

----------------------------------------------------------------
Amitkumar Karwar (5):
      mwifiex: remove redundant flag MWIFIEX_HW_STATUS_FW_READY
      mwifiex: add wakeup timer based recovery mechanism
      mwifiex: wakeup pending wait queues
      mwifiex: do not release lock during list_for_each_entry_safe()
      mwifiex: Increase priority of firmware download message

Arend van Spriel (6):
      brcmfmac: remove unused/duplicate defines in chip.c
      brcmfmac: follow user-space regulatory domain selection
      brcmfmac: enable 802.11d support in firmware
      brcmfmac: Add support for bcm43340/1 wireless chipsets
      brcmfmac: get rid of duplicate SDIO device identifiers
      ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries

Avinash Patil (3):
      mwifiex: module parameter for deep sleep configuration
      mwifiex: enable -D__CHECK_ENDIAN__ for sparse by default
      mwifiex: get supported BA stream info from FW

Chen Gang (1):
      wil6210: use 'uint64_t' instead of 'cycles_t' to avoid warnings

Dor Shaish (1):
      Revert "iwlwifi: use correct fw file in 8000 b-step"

Eliad Peller (18):
      iwlwifi: pcie: add basic reference accounting
      iwlwifi: mvm: allow both d0i3 and d3 wowlan configuration modes
      iwlwifi: support multiple d0i3 modes
      iwlwifi: mvm: support IWL_D0I3_MODE_ON_SUSPEND d0i3 mode
      iwlwifi: mvm: consider d0i3_disable in iwl_mvm_is_d0i3_supported()
      iwlwifi: mvm: wait for d0i3 exit on hw restart
      iwlwifi: mvm: clean refs before stop_device()
      iwlwifi: mvm: ask the fw to wakeup (from d0i3) on sysassert
      wlcore: fix WLCORE_VENDOR_ATTR_GROUP_KEY policy
      wlcore: fix sparse warning
      wlcore/wl18xx: handle rc updates in a separate work
      wlcore: enable AP wowlan
      wl18xx: add radar detection implementation
      wl18xx: add debugfs file to emulate radar event
      wlcore: add support for ap csa
      wlcore: add dfs master restart calls
      wlcore: allow using dfs channels
      wl18xx: declare radar_detect_widths support for ap interfaces

Emmanuel Grumbach (7):
      iwlwifi: pcie: let the Manageability Engine know when we leave
      iwlwifi: mvm: add debugfs to trigger fw debug logs collection
      iwlwifi: mvm: allow RSSI compensation
      iwlwifi: mvm: change SMEM dump to general purpose memory dump
      iwlwifi: mvm: convert the SRAM dump to the generic memory dump
      iwlwifi: mvm: support 2 different channels
      iwlwifi: remove useless extern definition of iwl4265_2ac_sdio_cfg

Eran Harary (2):
      iwlwifi: mvm: support additional nvm_file in family 8000 B step
      iwlwifi: mvm: call to pcie_apply_destination also on family 8000 B step

Eyal Shapira (2):
      iwlwifi: mvm: rs: fix max rate allowed if no rate is allowed
      iwlwifi: mvm: rs: organize and cleanup consts

Fred Chou (1):
      rt2x00: use helper to check capability/requirement

Guy Mishol (1):
      wlcore: add dfs region to reg domain update cmd

Haim Dreyfuss (2):
      iwlwifi: mvm: Configure EBS scan ratio
      iwlwifi: mvm: Alter passive scan fragmentation parameters in case of multi-MAC

Hante Meuleman (4):
      brcmfmac: Fix incorrect casting of 64 bit physical address.
      brcmfmac: Fix WEP configuration for AP mode.
      brcmfmac: Change error log in standard log for rxbufpost.
      brcmfmac: signal completion of 802.1x.

Ido Yariv (1):
      iwlwifi: mvm: Set the HW step in the core dump

Janusz Dziedzic (2):
      ath10k: fix low TX rates when IBSS and HT
      ath10k: send (re)assoc peer command when NSS changed

Jiri Slaby (1):
      MAINTAINERS: remove ath5k mailing list

Johannes Berg (4):
      iwlwifi: remove MODULE_VERSION
      iwlwifi: mvm: use iwl_mvm_vif_from_mac80211() consistently
      iwlwifi: mvm: use iwl_mvm_sta_from_mac80211() consistently
      orinoco/hermes: select CFG80211_WEXT

Julia Lawall (12):
      iwlwifi: dvm: tt: Use setup_timer
      iwlwifi: dvm: main: Use setup_timer
      wireless: cw1200: Use setup_timer
      cw1200: main: Use setup_timer
      cw1200: queue: Use setup_timer
      iwl4965: Use setup_timer
      iwl3945: Use setup_timer
      orinoco_usb: Use setup_timer
      mwifiex: main: Use setup_timer
      mwifiex: 11n_rxreorder: Use setup_timer
      mwifiex: tdls: Use setup_timer
      adm8211: fix error return code

Kalle Valo (11):
      dt: bindings: add ath10k wireless device
      ath10k: clean up error handling in ath10k_core_probe_fw()
      ath10k: create ath10k_core_init_features()
      ath10k: add ATH10K_FW_IE_WMI_OP_VERSION
      ath10k: set max_num_pending_tx in ath10k_core_init_firmware_features()
      ath10k: set max_num_vdevs based on wmi op version
      ath10k: use wmi op version to check which iface combination to use
      ath10k: print ath10k wmi op version
      Merge tag 'iwlwifi-next-for-kalle-2014-12-30' of https://git.kernel.org/.../iwlwifi/iwlwifi-next
      ath10k: fix build error when hwmon is off
      Merge ath-next from ath.git

Kobi L (1):
      wlcore: enable sleep during AP mode operation

Larry Finger (11):
      rtlwifi: Unify variable naming for all drivers
      rtlwifi: rtl8723be: Improve modinfo output
      rtlwifi: Create new routine to initialize the DM tables
      rtlwifi: rtl8188ee: Convert driver to use the common DM table init routine
      rtlwifi: rtl8192c-common: Convert driver to use common DM table initialization
      rtlwifi: rtl8192de: Convert driver to use common DM table initialization
      rtlwifi: rtl8192ee: Convert driver to use common DM table initialization
      rtlwifi: rtl8723ae: Convert driver to use common DM table initialization
      rtlwifi: rtl8723be: Convert driver to use common DM table initialization
      rtlwifi: rtl8821ae: Convert driver to use common DM table initialization
      rtlwifi: Move macro definitions to core

Liad Kaufman (3):
      iwlwifi: mvm: add fw runtime stack to dump data
      iwlwifi: mvm: add smem content to dump data
      iwlwifi: tlv: add support for IWL_UCODE_TLV_SDIO_ADMA_ADDR TLV

Lorenzo Bianconi (3):
      ath9k: add power per-rate tables for AR9002 chips
      ath9k: add TPC to TX path for AR9002 based chips
      ath9k: enable per-packet TPC on AR9002 based chips

Luciano Coelho (1):
      iwlwifi: mvm: clear tt values when entering CT-kill

Maithili Hinge (2):
      mwifiex: Move code for wowlan magic-packet and patterns to a function
      mwifiex: Add support for wowlan disconnect

Marc Yang (2):
      mwifiex: Adjust calling place of mwifiex_terminate_workqueue
      mwifiex: increase delay during card reset

Miaoqing Pan (4):
      ath9k: Add HW IDs for QCA956x
      ath9k: Add initvals for QCA956x
      ath9k: Fix register definitions for QCA956x
      ath9k: Add QCA956x HW support

Michal Kazior (12):
      ath10k: create a chip revision whitelist
      ath10k: put board size into hw_params
      ath10k: move uart pin config into hw_params
      ath10k: implement intermediate event args
      ath10k: introduce wmi ops
      ath10k: make some wmi functions public
      ath10k: implement wmi-tlv backend
      ath10k: improve 11b coex
      ath10k: fix STA u-APSD
      ath10k: prevent invalid ps timeout config
      ath10k: enable per-vif sta powersave
      ath10k: advertise p2p dev support

Moshe Harel (1):
      iwlwifi: mvm: support LnP 1x1 antenna configuration

Oscar Forner Martinez (1):
      bcma: fix three coding style issues, more than 80 characters per line

Peter Oh (4):
      ath10k: add new pdev parameters for fw 10.2
      ath10k: add new wmi interface of NF cal period
      ath10k: unregister and remove frag_threshold callback
      ath10k: set phymode to 11b when NO_OFDM flag set

Rajkumar Manoharan (5):
      ath10k: add 10.2.4 firmware support
      ath10k: add wmi support for pdev_set_quiet_mode
      ath10k: add thermal cooling device support
      ath10k: add wmi interface for pdev_get_temperature
      ath10k: add thermal sensor device support

Ram Amrani (1):
      wlcore: add ability to reduce FW interrupts during suspend

Rickard Strandqvist (1):
      b43legacy: Remove unused b43legacy_radio_set_tx_iq()

Sujith Manoharan (1):
      ath9k: Update PCI IDs for AR9565

Toshi Kikuchi (1):
      ath10k: read calibration data from Device Tree

Vladimir Kondratiev (22):
      wil6210: ADDBA/DELBA flows
      wil6210: simple ADDBA on originator (Tx) side
      wil6210: allow to configure ADDBA request
      wil6210: improve debugfs for reorder buffer
      wil6210: fix disconnect 1 STA in AP
      wil6210: improve debugfs for VRING
      wil6210: control AMSDU on Tx side of Block Ack
      wil6210: delba for responder
      wil6210: fix max. MPDU size
      wil6210: consider SNAP header in MTU calculations
      wil6210: Increase number of associated stations
      wil6210: use bitmap API for "status"
      wil6210: fix Tx VRING for STA mode
      wil6210: rework debugfs for BACK
      wil6210: detect HW capabilities
      wil6210: use HW capabilities mask in reset
      wil6210: add advanced interrupt moderation
      wil6210: RX high threshold interrupt configuration
      wil6210: fix reordering for MCAST
      wil6210: Tx/Rx descriptors documentation
      wil6210: workaround for BACK establishment race
      wil6210: relax spinlocks in rx reorder

Wolfram Sang (1):
      ath5k: drop owner assignment from platform_drivers

Xinming Hu (9):
      mwifiex: report tdls peers in debugfs
      mwifiex: add bcn_rcv_cnt and bcn_miss_cnt in getlog debugfs
      mwifiex: add rx histogram statistics support
      mwifiex: move pm_wakeup_card_complete definition to usb.c
      mwifiex: move debug_data dump function to common utililty file
      mwifiex: save driver information to file when firmware dump
      mwifiex: save sdio register values before firmware dump
      mwifiex: do not send key material cmd when delete wep key
      mwifiex: make tx packet 64 byte DMA aligned

 .../bindings/net/wireless/qcom,ath10k.txt          |   30 +
 MAINTAINERS                                        |    1 -
 drivers/bcma/driver_chipcommon.c                   |   10 +-
 drivers/net/wireless/adm8211.c                     |    1 +
 drivers/net/wireless/ath/ath10k/Makefile           |    2 +
 drivers/net/wireless/ath/ath10k/ce.c               |    2 +
 drivers/net/wireless/ath/ath10k/core.c             |  250 ++-
 drivers/net/wireless/ath/ath10k/core.h             |   21 +-
 drivers/net/wireless/ath/ath10k/debug.c            |   88 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c           |    5 -
 drivers/net/wireless/ath/ath10k/hw.h               |   30 +
 drivers/net/wireless/ath/ath10k/mac.c              |  192 +-
 drivers/net/wireless/ath/ath10k/pci.c              |   31 +
 drivers/net/wireless/ath/ath10k/pci.h              |    5 +
 drivers/net/wireless/ath/ath10k/spectral.c         |    1 +
 drivers/net/wireless/ath/ath10k/testmode.c         |    5 +-
 drivers/net/wireless/ath/ath10k/thermal.c          |  243 +++
 drivers/net/wireless/ath/ath10k/thermal.h          |   58 +
 drivers/net/wireless/ath/ath10k/wmi-ops.h          |  860 ++++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c          | 2222 ++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h          | 1380 ++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c              | 1737 ++++++++++-----
 drivers/net/wireless/ath/ath10k/wmi.h              |  302 ++-
 drivers/net/wireless/ath/ath5k/ahb.c               |    1 -
 drivers/net/wireless/ath/ath9k/ahb.c               |    4 +
 drivers/net/wireless/ath/ath9k/ani.c               |    3 +-
 drivers/net/wireless/ath/ath9k/ar5008_phy.c        |   80 +
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c     |   15 +-
 drivers/net/wireless/ath/ath9k/ar9003_hw.c         |   61 +-
 drivers/net/wireless/ath/ath9k/ar9003_phy.c        |   47 +-
 drivers/net/wireless/ath/ath9k/ar9003_phy.h        |   19 +-
 drivers/net/wireless/ath/ath9k/ar956x_initvals.h   | 1046 +++++++++
 drivers/net/wireless/ath/ath9k/debug.c             |  134 +-
 drivers/net/wireless/ath/ath9k/eeprom_4k.c         |   14 +
 drivers/net/wireless/ath/ath9k/eeprom_9287.c       |   15 +
 drivers/net/wireless/ath/ath9k/eeprom_def.c        |   14 +
 drivers/net/wireless/ath/ath9k/hw.c                |   44 +-
 drivers/net/wireless/ath/ath9k/hw.h                |    3 +
 drivers/net/wireless/ath/ath9k/mac.c               |    3 +-
 drivers/net/wireless/ath/ath9k/pci.c               |   85 +
 drivers/net/wireless/ath/ath9k/recv.c              |    3 +-
 drivers/net/wireless/ath/ath9k/reg.h               |    4 +
 drivers/net/wireless/ath/ath9k/xmit.c              |   68 +-
 drivers/net/wireless/ath/wil6210/cfg80211.c        |   12 +-
 drivers/net/wireless/ath/wil6210/debugfs.c         |  164 +-
 drivers/net/wireless/ath/wil6210/ethtool.c         |   46 +-
 drivers/net/wireless/ath/wil6210/interrupt.c       |  109 +-
 drivers/net/wireless/ath/wil6210/main.c            |  194 +-
 drivers/net/wireless/ath/wil6210/pcie_bus.c        |   65 +-
 drivers/net/wireless/ath/wil6210/rx_reorder.c      |  275 ++-
 drivers/net/wireless/ath/wil6210/txrx.c            |   70 +-
 drivers/net/wireless/ath/wil6210/txrx.h            |  158 +-
 drivers/net/wireless/ath/wil6210/wil6210.h         |  161 +-
 drivers/net/wireless/ath/wil6210/wmi.c             |  221 +-
 drivers/net/wireless/ath/wil6210/wmi.h             |   12 +-
 drivers/net/wireless/b43legacy/radio.c             |   19 -
 drivers/net/wireless/b43legacy/radio.h             |    1 -
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c   |   20 +-
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c |  176 +-
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h |    5 +
 drivers/net/wireless/brcm80211/brcmfmac/chip.c     |   15 +-
 drivers/net/wireless/brcm80211/brcmfmac/common.c   |    3 +
 drivers/net/wireless/brcm80211/brcmfmac/common.h   |   20 +
 drivers/net/wireless/brcm80211/brcmfmac/core.c     |    3 +-
 drivers/net/wireless/brcm80211/brcmfmac/core.h     |    4 +-
 drivers/net/wireless/brcm80211/brcmfmac/flowring.c |    6 +-
 drivers/net/wireless/brcm80211/brcmfmac/fwil.h     |    4 +
 .../net/wireless/brcm80211/brcmfmac/fwil_types.h   |   14 +
 drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c   |   24 +-
 drivers/net/wireless/brcm80211/brcmfmac/pcie.c     |   10 +-
 drivers/net/wireless/brcm80211/brcmfmac/sdio.c     |    7 +-
 .../net/wireless/brcm80211/include/brcm_hw_ids.h   |   12 +-
 drivers/net/wireless/cw1200/main.c                 |    5 +-
 drivers/net/wireless/cw1200/pm.c                   |    5 +-
 drivers/net/wireless/cw1200/queue.c                |    4 +-
 drivers/net/wireless/iwlegacy/3945-mac.c           |    4 +-
 drivers/net/wireless/iwlegacy/4965-mac.c           |    9 +-
 drivers/net/wireless/iwlwifi/dvm/main.c            |   24 +-
 drivers/net/wireless/iwlwifi/dvm/tt.c              |   13 +-
 drivers/net/wireless/iwlwifi/iwl-7000.c            |   23 +-
 drivers/net/wireless/iwlwifi/iwl-8000.c            |   17 +-
 drivers/net/wireless/iwlwifi/iwl-config.h          |   10 +-
 drivers/net/wireless/iwlwifi/iwl-csr.h             |    1 +
 drivers/net/wireless/iwlwifi/iwl-drv.c             |   81 +-
 drivers/net/wireless/iwlwifi/iwl-drv.h             |    1 -
 drivers/net/wireless/iwlwifi/iwl-fw-error-dump.h   |   22 +-
 drivers/net/wireless/iwlwifi/iwl-fw-file.h         |    1 +
 drivers/net/wireless/iwlwifi/iwl-fw.h              |    4 +
 drivers/net/wireless/iwlwifi/iwl-modparams.h       |    2 +
 drivers/net/wireless/iwlwifi/iwl-nvm-parse.c       |    6 +
 drivers/net/wireless/iwlwifi/iwl-prph.h            |    5 +
 drivers/net/wireless/iwlwifi/iwl-trans.h           |   21 +
 drivers/net/wireless/iwlwifi/mvm/coex.c            |    4 +-
 drivers/net/wireless/iwlwifi/mvm/coex_legacy.c     |    4 +-
 drivers/net/wireless/iwlwifi/mvm/constants.h       |   28 +
 drivers/net/wireless/iwlwifi/mvm/d3.c              |   51 +-
 drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c     |    2 +-
 drivers/net/wireless/iwlwifi/mvm/debugfs.c         |   56 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h     |    7 +-
 drivers/net/wireless/iwlwifi/mvm/fw.c              |   31 +-
 drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c        |    2 +-
 drivers/net/wireless/iwlwifi/mvm/mac80211.c        |  102 +-
 drivers/net/wireless/iwlwifi/mvm/mvm.h             |   34 +
 drivers/net/wireless/iwlwifi/mvm/ops.c             |   41 +-
 drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c        |    2 +-
 drivers/net/wireless/iwlwifi/mvm/rs.c              |  169 +-
 drivers/net/wireless/iwlwifi/mvm/rs.h              |   39 -
 drivers/net/wireless/iwlwifi/mvm/scan.c            |   28 +-
 drivers/net/wireless/iwlwifi/mvm/sta.c             |   16 +-
 drivers/net/wireless/iwlwifi/mvm/tt.c              |    7 +-
 drivers/net/wireless/iwlwifi/mvm/tx.c              |    2 +-
 drivers/net/wireless/iwlwifi/mvm/utils.c           |    4 +-
 drivers/net/wireless/iwlwifi/pcie/internal.h       |    8 +
 drivers/net/wireless/iwlwifi/pcie/trans.c          |   64 +-
 drivers/net/wireless/iwlwifi/pcie/tx.c             |   34 +-
 drivers/net/wireless/mwifiex/11n.h                 |   14 +-
 drivers/net/wireless/mwifiex/11n_aggr.c            |   15 +-
 drivers/net/wireless/mwifiex/11n_rxreorder.c       |    6 +-
 drivers/net/wireless/mwifiex/Makefile              |    2 +
 drivers/net/wireless/mwifiex/cfg80211.c            |   99 +-
 drivers/net/wireless/mwifiex/cfp.c                 |   18 +
 drivers/net/wireless/mwifiex/cmdevt.c              |    6 -
 drivers/net/wireless/mwifiex/debugfs.c             |  281 +--
 drivers/net/wireless/mwifiex/decl.h                |   34 +-
 drivers/net/wireless/mwifiex/ethtool.c             |   16 +-
 drivers/net/wireless/mwifiex/fw.h                  |    3 +
 drivers/net/wireless/mwifiex/init.c                |   23 +
 drivers/net/wireless/mwifiex/ioctl.h               |   11 +-
 drivers/net/wireless/mwifiex/main.c                |  133 +-
 drivers/net/wireless/mwifiex/main.h                |   24 +-
 drivers/net/wireless/mwifiex/pcie.c                |    5 +-
 drivers/net/wireless/mwifiex/sdio.c                |  104 +-
 drivers/net/wireless/mwifiex/sdio.h                |   26 +
 drivers/net/wireless/mwifiex/sta_cmd.c             |    7 +-
 drivers/net/wireless/mwifiex/sta_cmdresp.c         |    2 +
 drivers/net/wireless/mwifiex/sta_event.c           |    7 +
 drivers/net/wireless/mwifiex/sta_ioctl.c           |    6 +-
 drivers/net/wireless/mwifiex/sta_rx.c              |    9 +
 drivers/net/wireless/mwifiex/sta_tx.c              |   19 +-
 drivers/net/wireless/mwifiex/tdls.c                |   35 +-
 drivers/net/wireless/mwifiex/uap_event.c           |    2 +
 drivers/net/wireless/mwifiex/uap_txrx.c            |   28 +-
 drivers/net/wireless/mwifiex/usb.c                 |   11 +-
 drivers/net/wireless/mwifiex/usb.h                 |    7 -
 drivers/net/wireless/mwifiex/util.c                |  220 ++
 drivers/net/wireless/mwifiex/util.h                |   20 +
 drivers/net/wireless/orinoco/Kconfig               |    3 +-
 drivers/net/wireless/orinoco/orinoco_usb.c         |    4 +-
 drivers/net/wireless/rt2x00/rt2x00config.c         |    4 +-
 drivers/net/wireless/rt2x00/rt2x00dev.c            |   18 +-
 drivers/net/wireless/rt2x00/rt2x00firmware.c       |    2 +-
 drivers/net/wireless/rt2x00/rt2x00mac.c            |    2 +-
 drivers/net/wireless/rt2x00/rt2x00queue.c          |   18 +-
 drivers/net/wireless/rt2x00/rt2x00usb.c            |    8 +-
 drivers/net/wireless/rtlwifi/core.c                |   37 +
 drivers/net/wireless/rtlwifi/core.h                |   41 +
 drivers/net/wireless/rtlwifi/rtl8188ee/dm.c        |   36 +-
 drivers/net/wireless/rtlwifi/rtl8188ee/dm.h        |   41 -
 drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c  |   45 +-
 drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h  |   38 -
 drivers/net/wireless/rtlwifi/rtl8192ce/dm.c        |    1 +
 drivers/net/wireless/rtlwifi/rtl8192ce/dm.h        |   13 -
 drivers/net/wireless/rtlwifi/rtl8192de/dm.c        |   33 +-
 drivers/net/wireless/rtlwifi/rtl8192de/dm.h        |   38 -
 drivers/net/wireless/rtlwifi/rtl8192ee/dm.c        |   55 +-
 drivers/net/wireless/rtlwifi/rtl8192ee/dm.h        |   16 -
 drivers/net/wireless/rtlwifi/rtl8192se/dm.c        |    7 +-
 drivers/net/wireless/rtlwifi/rtl8192se/dm.h        |   28 -
 drivers/net/wireless/rtlwifi/rtl8723ae/dm.c        |   42 +-
 drivers/net/wireless/rtlwifi/rtl8723ae/dm.h        |   38 -
 drivers/net/wireless/rtlwifi/rtl8723be/dm.c        |   55 +-
 drivers/net/wireless/rtlwifi/rtl8723be/dm.h        |   33 -
 drivers/net/wireless/rtlwifi/rtl8723be/sw.c        |   10 +-
 drivers/net/wireless/rtlwifi/rtl8821ae/dm.c        |   58 +-
 drivers/net/wireless/rtlwifi/rtl8821ae/dm.h        |   41 -
 drivers/net/wireless/rtlwifi/wifi.h                |    2 -
 drivers/net/wireless/ti/wl12xx/main.c              |    4 +
 drivers/net/wireless/ti/wl18xx/acx.c               |   88 +
 drivers/net/wireless/ti/wl18xx/acx.h               |   46 +-
 drivers/net/wireless/ti/wl18xx/cmd.c               |   93 +-
 drivers/net/wireless/ti/wl18xx/cmd.h               |   27 +
 drivers/net/wireless/ti/wl18xx/conf.h              |   23 +-
 drivers/net/wireless/ti/wl18xx/debugfs.c           |   43 +
 drivers/net/wireless/ti/wl18xx/event.c             |   21 +
 drivers/net/wireless/ti/wl18xx/event.h             |   14 +-
 drivers/net/wireless/ti/wl18xx/main.c              |   37 +-
 drivers/net/wireless/ti/wl18xx/wl18xx.h            |    4 +-
 drivers/net/wireless/ti/wlcore/cmd.c               |   20 +-
 drivers/net/wireless/ti/wlcore/cmd.h               |    8 +
 drivers/net/wireless/ti/wlcore/conf.h              |    7 +-
 drivers/net/wireless/ti/wlcore/debugfs.c           |    9 +-
 drivers/net/wireless/ti/wlcore/event.c             |   11 +-
 drivers/net/wireless/ti/wlcore/hw_ops.h            |   48 +-
 drivers/net/wireless/ti/wlcore/init.c              |    8 +-
 drivers/net/wireless/ti/wlcore/main.c              |  381 +++-
 drivers/net/wireless/ti/wlcore/ps.c                |    8 +-
 drivers/net/wireless/ti/wlcore/vendor_cmd.c        |    2 +-
 drivers/net/wireless/ti/wlcore/wlcore.h            |   12 +-
 drivers/net/wireless/ti/wlcore/wlcore_i.h          |    7 +
 include/linux/mmc/sdio_ids.h                       |    6 +-
 200 files changed, 12262 insertions(+), 2587 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
 create mode 100644 drivers/net/wireless/ath/ath10k/thermal.c
 create mode 100644 drivers/net/wireless/ath/ath10k/thermal.h
 create mode 100644 drivers/net/wireless/ath/ath10k/wmi-ops.h
 create mode 100644 drivers/net/wireless/ath/ath10k/wmi-tlv.c
 create mode 100644 drivers/net/wireless/ath/ath10k/wmi-tlv.h
 create mode 100644 drivers/net/wireless/ath/ath9k/ar956x_initvals.h
 create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/common.h

-- 
Kalle Valo

^ permalink raw reply

* Re: [PATCH v2] net: stmmac: add BQL support
From: Giuseppe CAVALLARO @ 2015-01-22 11:58 UTC (permalink / raw)
  To: Beniamino Galvani, David S. Miller
  Cc: Florian Fainelli, Dave Taht, netdev, linux-kernel
In-Reply-To: <1421863647-20048-1-git-send-email-b.galvani@gmail.com>

On 1/21/2015 7:07 PM, Beniamino Galvani wrote:
> Add support for Byte Queue Limits to the STMicro MAC driver.
>
> Tested on a Amlogic S802 quad Cortex-A9 board, where the use of BQL
> decreases the latency of a high priority ping from ~12ms to ~1ms when
> the 100Mbit link is saturated by 20 TCP streams.
>
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>


Ciao Beniamino

thx for the patch, I also see some improvements on my side

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
> Changes since v1:
>   - don't access skb->len after the start of DMA transmission in
>     stmmac_xmit(), to avoid potential use after free in case tx_lock is
>     removed in the future
>
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 118a427..1d74313 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1097,6 +1097,7 @@ static int init_dma_desc_rings(struct net_device *dev, gfp_t flags)
>
>   	priv->dirty_tx = 0;
>   	priv->cur_tx = 0;
> +	netdev_reset_queue(priv->dev);
>
>   	stmmac_clear_descriptors(priv);
>
> @@ -1300,6 +1301,7 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
>   static void stmmac_tx_clean(struct stmmac_priv *priv)
>   {
>   	unsigned int txsize = priv->dma_tx_size;
> +	unsigned int bytes_compl = 0, pkts_compl = 0;
>
>   	spin_lock(&priv->tx_lock);
>
> @@ -1356,6 +1358,8 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
>   		priv->hw->mode->clean_desc3(priv, p);
>
>   		if (likely(skb != NULL)) {
> +			pkts_compl++;
> +			bytes_compl += skb->len;
>   			dev_consume_skb_any(skb);
>   			priv->tx_skbuff[entry] = NULL;
>   		}
> @@ -1364,6 +1368,9 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
>
>   		priv->dirty_tx++;
>   	}
> +
> +	netdev_completed_queue(priv->dev, pkts_compl, bytes_compl);
> +
>   	if (unlikely(netif_queue_stopped(priv->dev) &&
>   		     stmmac_tx_avail(priv) > STMMAC_TX_THRESH(priv))) {
>   		netif_tx_lock(priv->dev);
> @@ -1418,6 +1425,7 @@ static void stmmac_tx_err(struct stmmac_priv *priv)
>   						     (i == txsize - 1));
>   	priv->dirty_tx = 0;
>   	priv->cur_tx = 0;
> +	netdev_reset_queue(priv->dev);
>   	priv->hw->dma->start_tx(priv->ioaddr);
>
>   	priv->dev->stats.tx_errors++;
> @@ -2048,6 +2056,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
>   	if (!priv->hwts_tx_en)
>   		skb_tx_timestamp(skb);
>
> +	netdev_sent_queue(dev, skb->len);
>   	priv->hw->dma->enable_dma_transmission(priv->ioaddr);
>
>   	spin_unlock(&priv->tx_lock);
>

^ permalink raw reply

* [PATCH v2] net: mv643xx_eth: Fix highmem support in non-TSO egress path
From: Ezequiel Garcia @ 2015-01-22 12:14 UTC (permalink / raw)
  To: David Miller, Russell King; +Cc: netdev, B38611, fabio.estevam, Ezequiel Garcia

Commit 69ad0dd7af22b61d9e0e68e56b6290121618b0fb
Author: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Date:   Mon May 19 13:59:59 2014 -0300

    net: mv643xx_eth: Use dma_map_single() to map the skb fragments

caused a nasty regression by removing the support for highmem skb
fragments. By using page_address() to get the address of a fragment's
page, we are assuming a lowmem page. However, such assumption is incorrect,
as fragments can be in highmem pages, resulting in very nasty issues.

This commit fixes this by using the skb_frag_dma_map() helper,
which takes care of mapping the skb fragment properly. Additionally,
the type of mapping is now tracked, so it can be unmapped using
dma_unmap_page or dma_unmap_single when appropriate.

Fixes: 69ad0dd7af22 ("net: mv643xx_eth: Use dma_map_single() to map the skb fragments")
Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
Changes from v1: 
  * Sending the mv643xx_eth fix for now.
  * Fix DMA mapping type track, to use the correct unmap call.

 drivers/net/ethernet/marvell/mv643xx_eth.c | 41 +++++++++++++++++++++++++-----
 1 file changed, 34 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index a62fc38..e4c8461 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -192,6 +192,10 @@ static char mv643xx_eth_driver_version[] = "1.4";
 #define IS_TSO_HEADER(txq, addr) \
 	((addr >= txq->tso_hdrs_dma) && \
 	 (addr < txq->tso_hdrs_dma + txq->tx_ring_size * TSO_HEADER_SIZE))
+
+#define DESC_DMA_MAP_SINGLE 0
+#define DESC_DMA_MAP_PAGE 1
+
 /*
  * RX/TX descriptors.
  */
@@ -362,6 +366,7 @@ struct tx_queue {
 	dma_addr_t tso_hdrs_dma;
 
 	struct tx_desc *tx_desc_area;
+	char *tx_desc_mapping; /* array to track the type of the dma mapping */
 	dma_addr_t tx_desc_dma;
 	int tx_desc_area_size;
 
@@ -750,6 +755,7 @@ txq_put_data_tso(struct net_device *dev, struct tx_queue *txq,
 	if (txq->tx_curr_desc == txq->tx_ring_size)
 		txq->tx_curr_desc = 0;
 	desc = &txq->tx_desc_area[tx_index];
+	txq->tx_desc_mapping[tx_index] = DESC_DMA_MAP_SINGLE;
 
 	desc->l4i_chk = 0;
 	desc->byte_cnt = length;
@@ -879,14 +885,13 @@ static void txq_submit_frag_skb(struct tx_queue *txq, struct sk_buff *skb)
 		skb_frag_t *this_frag;
 		int tx_index;
 		struct tx_desc *desc;
-		void *addr;
 
 		this_frag = &skb_shinfo(skb)->frags[frag];
-		addr = page_address(this_frag->page.p) + this_frag->page_offset;
 		tx_index = txq->tx_curr_desc++;
 		if (txq->tx_curr_desc == txq->tx_ring_size)
 			txq->tx_curr_desc = 0;
 		desc = &txq->tx_desc_area[tx_index];
+		txq->tx_desc_mapping[tx_index] = DESC_DMA_MAP_PAGE;
 
 		/*
 		 * The last fragment will generate an interrupt
@@ -902,8 +907,9 @@ static void txq_submit_frag_skb(struct tx_queue *txq, struct sk_buff *skb)
 
 		desc->l4i_chk = 0;
 		desc->byte_cnt = skb_frag_size(this_frag);
-		desc->buf_ptr = dma_map_single(mp->dev->dev.parent, addr,
-					       desc->byte_cnt, DMA_TO_DEVICE);
+		desc->buf_ptr = skb_frag_dma_map(mp->dev->dev.parent,
+						 this_frag, 0, desc->byte_cnt,
+						 DMA_TO_DEVICE);
 	}
 }
 
@@ -936,6 +942,7 @@ static int txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb,
 	if (txq->tx_curr_desc == txq->tx_ring_size)
 		txq->tx_curr_desc = 0;
 	desc = &txq->tx_desc_area[tx_index];
+	txq->tx_desc_mapping[tx_index] = DESC_DMA_MAP_SINGLE;
 
 	if (nr_frags) {
 		txq_submit_frag_skb(txq, skb);
@@ -1047,9 +1054,12 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
 		int tx_index;
 		struct tx_desc *desc;
 		u32 cmd_sts;
+		char desc_dma_map;
 
 		tx_index = txq->tx_used_desc;
 		desc = &txq->tx_desc_area[tx_index];
+		desc_dma_map = txq->tx_desc_mapping[tx_index];
+
 		cmd_sts = desc->cmd_sts;
 
 		if (cmd_sts & BUFFER_OWNED_BY_DMA) {
@@ -1065,9 +1075,19 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
 		reclaimed++;
 		txq->tx_desc_count--;
 
-		if (!IS_TSO_HEADER(txq, desc->buf_ptr))
-			dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr,
-					 desc->byte_cnt, DMA_TO_DEVICE);
+		if (!IS_TSO_HEADER(txq, desc->buf_ptr)) {
+
+			if (desc_dma_map == DESC_DMA_MAP_PAGE)
+				dma_unmap_page(mp->dev->dev.parent,
+					       desc->buf_ptr,
+					       desc->byte_cnt,
+					       DMA_TO_DEVICE);
+			else
+				dma_unmap_single(mp->dev->dev.parent,
+						 desc->buf_ptr,
+						 desc->byte_cnt,
+						 DMA_TO_DEVICE);
+		}
 
 		if (cmd_sts & TX_ENABLE_INTERRUPT) {
 			struct sk_buff *skb = __skb_dequeue(&txq->tx_skb);
@@ -2048,6 +2068,11 @@ static int txq_init(struct mv643xx_eth_private *mp, int index)
 					nexti * sizeof(struct tx_desc);
 	}
 
+	txq->tx_desc_mapping = kcalloc(txq->tx_ring_size, sizeof(char),
+				       GFP_KERNEL);
+	if (!txq->tx_desc_mapping)
+		return -ENOMEM;
+
 	/* Allocate DMA buffers for TSO MAC/IP/TCP headers */
 	txq->tso_hdrs = dma_alloc_coherent(mp->dev->dev.parent,
 					   txq->tx_ring_size * TSO_HEADER_SIZE,
@@ -2077,6 +2102,8 @@ static void txq_deinit(struct tx_queue *txq)
 	else
 		dma_free_coherent(mp->dev->dev.parent, txq->tx_desc_area_size,
 				  txq->tx_desc_area, txq->tx_desc_dma);
+	kfree(txq->tx_desc_mapping);
+
 	if (txq->tso_hdrs)
 		dma_free_coherent(mp->dev->dev.parent,
 				  txq->tx_ring_size * TSO_HEADER_SIZE,
-- 
2.2.1

^ permalink raw reply related

* Re: NULL pointer dereference at skb_queue_tail()
From: Tetsuo Handa @ 2015-01-22 12:18 UTC (permalink / raw)
  To: eric.dumazet; +Cc: cwang, netdev
In-Reply-To: <1420818314.5947.77.camel@edumazet-glaptop2.roam.corp.google.com>

Eric Dumazet wrote:
> On Fri, 2015-01-09 at 22:20 +0900, Tetsuo Handa wrote:
> 
> > Would you tell me which versions to test?
> 
> Could you do a bisection ?
> 
> I do not see obvious bugs in af_unix.c, so it might be a corruption from
> another part of the code, reusing a freed skb.
> 

It looks like a bug in drm subsystem. Thank you.
http://lists.freedesktop.org/archives/dri-devel/2015-January/075922.html

^ permalink raw reply

* Re: [PATCH 2/2] net: mv643xx_eth: Fix highmem support in non-TSO egress path
From: Ezequiel Garcia @ 2015-01-22 12:17 UTC (permalink / raw)
  To: Russell King - ARM Linux; +Cc: netdev, David Miller, B38611, fabio.estevam
In-Reply-To: <20150122001103.GY26493@n2100.arm.linux.org.uk>

On 01/21/2015 09:11 PM, Russell King - ARM Linux wrote:
> On Wed, Jan 21, 2015 at 08:34:30PM -0300, Ezequiel Garcia wrote:
>> I have just realised that the non-TSO and the TSO paths must work
>> simultaneously (we don't know which path an egress skb will take).
>>
>> So, with these patches, the unmapping is done using dma_unmap_page() which
>> is only correct if the skb took the non-TSO paths. In other words,
>> these fixes are wrong (although I have no idea the effect of
>> using dma_unmap_page on a mapping done with dma_map_single).
>>
>> And the problem is that in the TSO path, the linear and the non-linear
>> fragments use the same kind of descriptors, so we can't distinguish
>> them in the cleanup, and can't decide if _single or _page should be used.
>>
>> Any ideas?
> 
> Or, maybe, if davem would reply, we might come to the conclusion (as
> I previously pointed out) that it's not a driver issue, but a netdev
> core issue:
> 
> static netdev_features_t harmonize_features(struct sk_buff *skb,
>         netdev_features_t features)
> {
> ...
>         if (skb->ip_summed != CHECKSUM_NONE &&
>             !can_checksum_protocol(features, type)) {
>                 features &= ~NETIF_F_ALL_CSUM;
>         } else if (illegal_highdma(skb->dev, skb)) {
>                 features &= ~NETIF_F_SG;
>         }
> 
> The problem is when the first "if" is true (as is the case with IPv6 on
> mv643xx_eth.c), we clear NETIF_F_ALL_CSUM, but leave NETIF_F_SG set.
> 
> Had that first if been false, we would've called illegal_highdma(), and
> found that the skb contains some highmem fragments, but the device does
> *not* have NETIF_F_HIGHDMA set, and so that second "if" would be true.
> The result of that is NETIF_F_SG is cleared.
> 
> In this case, in validate_xmit_skb(), skb_needs_linearize() would be
> false for a skb with fragments, causing the skb to be linearised.  I've
> not completely traced the GSO path, but I'd assume that does something
> similar (which I think skb_segment() handles.)
> 
> So, I'm wondering whether the above should be:
> 
> static netdev_features_t harmonize_features(struct sk_buff *skb,
>         netdev_features_t features)
> {
> ...
>         if (skb->ip_summed != CHECKSUM_NONE &&
>             !can_checksum_protocol(features, type)) {
>                 features &= ~NETIF_F_ALL_CSUM;
>         }
> 
>         if (illegal_highdma(skb->dev, skb)) {
>                 features &= ~NETIF_F_SG;
>         }
> 
> So that we get NETIF_F_SG turned off for all cases (irrespective of the
> NETIF_F_ALL_CSUM test) if we see a skb with highmem and we the device
> does not support highdma.
> 
> Yes, the code above hasn't changed in functionality for a long time, but
> that doesn't mean it isn't buggy, and isn't the cause of our current bug.
> 

Hm, that's interesting.

> However, it would be far better to have the drivers fixed for the sake
> of performance - it's only this dma_map_page() thing that is the real
> cause of the problem in these drivers.
> 

Yes, I have just sent a v2 to fix the mv643xx_eth driver (non-TSO path).
If that works, I'll see about preparing a fix for mvneta, and for both
egress paths.

> Looking at TSO, it seems madness that it doesn't support highmem:
> 
> void tso_start(struct sk_buff *skb, struct tso_t *tso)
> {
> ...
>         tso->data = skb->data + hdr_len;
> ...
>                 tso->data = page_address(frag->page.p) + frag->page_offset;
> 
> Of course, this would all be a lot easier for drivers if all drivers had
> to worry about was a struct page, offset and size, rather than having to
> track whether each individual mapping of a transmit packet was mapped
> with dma_map_single() or dma_map_page().
> 
> That all said, what I really care about is the regression which basically
> makes 3.18 unusable on this hardware and seeing _some_ kind of resolution
> to that regression - I don't care if it doesn't quite perform, what I care
> about is that the network driver doesn't oops the kernel.
> 

Thanks for all the info!
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

^ permalink raw reply

* Re: pull-request: wireless-drivers-next 2015-01-22
From: Kalle Valo @ 2015-01-22 12:31 UTC (permalink / raw)
  To: David Miller; +Cc: linux-wireless, netdev
In-Reply-To: <87h9vjnic4.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo@codeaurora.org> writes:

> Hi Dave,
>
> now a bigger pull request for net-next. Rafal found a UTF-8 bug in
> patchwork[1] and because of that two commits (d0c102f70aec and
> d0f66df5392a) have his name corrupted:
>
>     Acked-by: Rafa? Mi?ecki <zajec5@gmail.com>
>
> Somehow I failed to spot that when I commited the patches. As rebasing
> public git trees is bad, I thought we can live with these and decided
> not to rebase. But I'll pay close attention to this in the future to
> make sure that it won't happen again. Also we requested an update to
> patchwork.kernel.org, the latest patchwork doesn't seem to have this
> bug.
>
> Also please note this pull request also adds one DT binding doc, but
> this was reviewed in the device tree list:
>
>  .../bindings/net/wireless/qcom,ath10k.txt          |   30 +
>
> Please let me know if you have any issues.

I almost missed that there's actually a small conflict with net-next:

CONFLICT (content): Merge conflict in drivers/net/wireless/ath/wil6210/cfg80211.c

Please fix it like this in wil_cid_fill_sinfo():

	if (test_bit(wil_status_fwconnected, wil->status)) {
		sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
		sinfo->signal = reply.evt.sqi;
	}

-- 
Kalle Valo

^ permalink raw reply

* Re: [PATCH net v2] ipv4: try to cache dst_entries which would cause a redirect
From: Hannes Frederic Sowa @ 2015-01-22 12:34 UTC (permalink / raw)
  To: Julian Anastasov; +Cc: netdev, Marcelo Leitner, Florian Westphal
In-Reply-To: <alpine.LFD.2.11.1501212144530.2701@ja.home.ssi.bg>

Hi,

On Mi, 2015-01-21 at 23:26 +0200, Julian Anastasov wrote:
> On Wed, 21 Jan 2015, Hannes Frederic Sowa wrote:
> 
> > Not caching dst_entries which cause redirects could be exploited by hosts
> > on the same subnet, causing a severe DoS attack. This effect aggravated
> > since commit f88649721268999 ("ipv4: fix dst race in sk_dst_get()").
> > 
> > Lookups causing redirects will be allocated with DST_NOCACHE set which
> > will force dst_release to free them via RCU.  Unfortunately waiting for
> > RCU grace period just takes too long, we can end up with >1M dst_entries
> > waiting to be released and the system will run OOM. rcuos threads cannot
> > catch up under high softirq load.
> > 
> > Attaching the flag to emit a redirect later on to the specific skb allows
> > us to cache those dst_entries thus reducing the pressure on allocation
> > and deallocation.
> > 
> > This issue was discovered by Marcelo Leitner.
> 
> 	After more thinking and after checking all
> ip_route_input places other issues popup :(
> 
> 	Another place with non-trivial handling is
> icmp_route_lookup(), only called by icmp_send(). We do
> lookup and then revert it. ip_options_rcv_srr() too.
> In this case we even can replace initial route (which
> should be to local host, without redirect flag) with
> new route (which can be with  IPSKB_DOREDIRECT).
> So, for this case we do not wrongly leave some
> IPSKB_DOREDIRECT flag.
> 
> 	But in icmp_route_lookup() should we restore the
> original IPSKB_DOREDIRECT bit when_skb_refdst is restored?
> I.e. I'm not sure if some icmp_send() caller continues to
> use the skb. For now I see only one place where we continue
> to use skb after icmp_send: ip_rt_send_redirect(). But
> it is after our check for RTCF_DOREDIRECT. Other places
> free the skb.
> 
> 	If we want to be pedantic, should we create some
> helper functions and structure to save old state? For now
> we are ok but using IPCB looks risky. For example:

I would try to not introduce this complexity. I am currently researching
if this change does improve things:

        do_cache = res->fi && !itag;
-       if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) &&
-           (IN_DEV_SHARED_MEDIA(out_dev) ||
-            inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) {
-               flags |= RTCF_DOREDIRECT;
-               do_cache = false;
+       if (skb->protocol == htons(ETH_P_IP)) {
+               if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) &&
+                   skb->protocol == htons(ETH_P_IP) &&
+                   (IN_DEV_SHARED_MEDIA(out_dev) ||
+                    inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res))))
+                       IPCB(skb)->flags |= IPSKB_DOREDIRECT;
+               else if (IPCB(skb)->flags & IPSKB_DOREDIRECT)
+                       IPCB(skb)->flags &= ~IPSKB_DOREDIRECT;
        }

So we do reset the IPSKB_DOREDIRECT flag on every lookup. This would
keep the ip_options_rcv_srr() lookup happy, as we only use the flag as
we would do before when keeping the last dst_entry.

icmp_route_lookup actually looks fine to me just because the skb will
never end up in ip_forward, thus the state of the flag does not matter.

What do you think?

The problem with NEIGHCB and IPCB is solved by the snippet above, too.

Thanks for the review,
Hannes

^ permalink raw reply

* [PATCH net 0/4] Fixes for sh_eth #2
From: Ben Hutchings @ 2015-01-22 12:38 UTC (permalink / raw)
  To: David S.Miller
  Cc: netdev, linux-kernel, Nobuhiro Iwamatsu, Mitsuhiro Kimura,
	Hisashi Nakamura, Yoshihiro Kaneko

I'm continuing review and testing of Ethernet support on the R-Car H2
chip.  This series fixes more of the issues I've found, but it won't be
the last set.

These are not tested on any of the other supported chips.

Ben.

Ben Hutchings (4):
  sh_eth: Fix padding of short frames on TX
  sh_eth: Detach net device when stopping queue to resize DMA rings
  sh_eth: Fix crash or memory leak when resizing rings on device that
    is down
  sh_eth: Fix serialisation of interrupt disable with interrupt & NAPI
    handlers

 drivers/net/ethernet/renesas/sh_eth.c |   84 +++++++++++++++++++++------------
 drivers/net/ethernet/renesas/sh_eth.h |    1 +
 2 files changed, 55 insertions(+), 30 deletions(-)

-- 
1.7.10.4

^ permalink raw reply

* [PATCH net 1/4] sh_eth: Fix padding of short frames on TX
From: Ben Hutchings @ 2015-01-22 12:40 UTC (permalink / raw)
  To: David S.Miller
  Cc: netdev, linux-kernel, Nobuhiro Iwamatsu, Mitsuhiro Kimura,
	Hisashi Nakamura, Yoshihiro Kaneko
In-Reply-To: <1421930284.1222.285.camel@xylophone.i.decadent.org.uk>

If an skb to be transmitted is shorter than the minimum Ethernet frame
length, we currently set the DMA descriptor length to the minimum but
do not add zero-padding.  This could result in leaking sensitive
data.  We also pass different lengths to dma_map_single() and
dma_unmap_single().

Use skb_padto() to pad properly, before calling dma_map_single().

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
 drivers/net/ethernet/renesas/sh_eth.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 28e3822..69f9fff 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2117,6 +2117,9 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	}
 	spin_unlock_irqrestore(&mdp->lock, flags);
 
+	if (skb_padto(skb, ETH_ZLEN))
+		return NETDEV_TX_OK;
+
 	entry = mdp->cur_tx % mdp->num_tx_ring;
 	mdp->tx_skbuff[entry] = skb;
 	txdesc = &mdp->tx_ring[entry];
@@ -2126,10 +2129,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 				 skb->len + 2);
 	txdesc->addr = dma_map_single(&ndev->dev, skb->data, skb->len,
 				      DMA_TO_DEVICE);
-	if (skb->len < ETH_ZLEN)
-		txdesc->buffer_length = ETH_ZLEN;
-	else
-		txdesc->buffer_length = skb->len;
+	txdesc->buffer_length = skb->len;
 
 	if (entry >= mdp->num_tx_ring - 1)
 		txdesc->status |= cpu_to_edmac(mdp, TD_TACT | TD_TDLE);
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH net 2/4] sh_eth: Detach net device when stopping queue to resize DMA rings
From: Ben Hutchings @ 2015-01-22 12:40 UTC (permalink / raw)
  To: David S.Miller
  Cc: netdev, linux-kernel, Nobuhiro Iwamatsu, Mitsuhiro Kimura,
	Hisashi Nakamura, Yoshihiro Kaneko
In-Reply-To: <1421930284.1222.285.camel@xylophone.i.decadent.org.uk>

We must only ever stop TX queues when they are full or the net device
is not 'ready' so far as the net core, and specifically the watchdog,
is concerned.  Otherwise, the watchdog may fire *immediately* if no
packets have been added to the queue in the last 5 seconds.

What's more, sh_eth_tx_timeout() will likely crash if called while
we're resizing the TX ring.

I could easily trigger this by running the loop:

   while ethtool -G eth0 rx 128 && ethtool -G eth0 rx 64; do echo -n .; done

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
 drivers/net/ethernet/renesas/sh_eth.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 69f9fff..0be16dd 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1968,6 +1968,7 @@ static int sh_eth_set_ringparam(struct net_device *ndev,
 		return -EINVAL;
 
 	if (netif_running(ndev)) {
+		netif_device_detach(ndev);
 		netif_tx_disable(ndev);
 		/* Disable interrupts by clearing the interrupt mask. */
 		sh_eth_write(ndev, 0x0000, EESIPR);
@@ -2001,7 +2002,7 @@ static int sh_eth_set_ringparam(struct net_device *ndev,
 		sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
 		/* Setting the Rx mode will start the Rx process. */
 		sh_eth_write(ndev, EDRRR_R, EDRRR);
-		netif_wake_queue(ndev);
+		netif_device_attach(ndev);
 	}
 
 	return 0;
-- 
1.7.10.4

^ permalink raw reply related

* RE: [PATCH v2] net: mv643xx_eth: Fix highmem support in non-TSO egress path
From: David Laight @ 2015-01-22 12:40 UTC (permalink / raw)
  To: 'Ezequiel Garcia', David Miller, Russell King
  Cc: netdev@vger.kernel.org, B38611@freescale.com,
	fabio.estevam@freescale.com
In-Reply-To: <1421928859-17923-1-git-send-email-ezequiel.garcia@free-electrons.com>

From: Ezequiel Garcia
> Commit 69ad0dd7af22b61d9e0e68e56b6290121618b0fb
> Author: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> Date:   Mon May 19 13:59:59 2014 -0300
> 
>     net: mv643xx_eth: Use dma_map_single() to map the skb fragments
> 
> caused a nasty regression by removing the support for highmem skb
> fragments. By using page_address() to get the address of a fragment's
> page, we are assuming a lowmem page. However, such assumption is incorrect,
> as fragments can be in highmem pages, resulting in very nasty issues.
> 
> This commit fixes this by using the skb_frag_dma_map() helper,
> which takes care of mapping the skb fragment properly. Additionally,
> the type of mapping is now tracked, so it can be unmapped using
> dma_unmap_page or dma_unmap_single when appropriate.
> 
> Fixes: 69ad0dd7af22 ("net: mv643xx_eth: Use dma_map_single() to map the skb fragments")
> Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
...
> @@ -2048,6 +2068,11 @@ static int txq_init(struct mv643xx_eth_private *mp, int index)
>  					nexti * sizeof(struct tx_desc);
>  	}
> 
> +	txq->tx_desc_mapping = kcalloc(txq->tx_ring_size, sizeof(char),
> +				       GFP_KERNEL);
> +	if (!txq->tx_desc_mapping)
> +		return -ENOMEM;
> +
>  	/* Allocate DMA buffers for TSO MAC/IP/TCP headers */
>  	txq->tso_hdrs = dma_alloc_coherent(mp->dev->dev.parent,
>  					   txq->tx_ring_size * TSO_HEADER_SIZE,

I'm guessing there is an error path for dma_alloc_coherent() failing.
You've not modified it to free tx_desc_mapping.

	David

^ permalink raw reply

* [PATCH net 3/4] sh_eth: Fix crash or memory leak when resizing rings on device that is down
From: Ben Hutchings @ 2015-01-22 12:41 UTC (permalink / raw)
  To: David S.Miller
  Cc: netdev, linux-kernel, Nobuhiro Iwamatsu, Mitsuhiro Kimura,
	Hisashi Nakamura, Yoshihiro Kaneko
In-Reply-To: <1421930284.1222.285.camel@xylophone.i.decadent.org.uk>

If the device is down then no packet buffers should be allocated.
We also must not touch its registers as it may be powered off.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
 drivers/net/ethernet/renesas/sh_eth.c |   34 +++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 0be16dd..be7aa43 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1976,29 +1976,31 @@ static int sh_eth_set_ringparam(struct net_device *ndev,
 		sh_eth_write(ndev, 0, EDTRR);
 		sh_eth_write(ndev, 0, EDRRR);
 		synchronize_irq(ndev->irq);
-	}
 
-	/* Free all the skbuffs in the Rx queue. */
-	sh_eth_ring_free(ndev);
-	/* Free DMA buffer */
-	sh_eth_free_dma_buffer(mdp);
+		/* Free all the skbuffs in the Rx queue. */
+		sh_eth_ring_free(ndev);
+		/* Free DMA buffer */
+		sh_eth_free_dma_buffer(mdp);
+	}
 
 	/* Set new parameters */
 	mdp->num_rx_ring = ring->rx_pending;
 	mdp->num_tx_ring = ring->tx_pending;
 
-	ret = sh_eth_ring_init(ndev);
-	if (ret < 0) {
-		netdev_err(ndev, "%s: sh_eth_ring_init failed.\n", __func__);
-		return ret;
-	}
-	ret = sh_eth_dev_init(ndev, false);
-	if (ret < 0) {
-		netdev_err(ndev, "%s: sh_eth_dev_init failed.\n", __func__);
-		return ret;
-	}
-
 	if (netif_running(ndev)) {
+		ret = sh_eth_ring_init(ndev);
+		if (ret < 0) {
+			netdev_err(ndev, "%s: sh_eth_ring_init failed.\n",
+				   __func__);
+			return ret;
+		}
+		ret = sh_eth_dev_init(ndev, false);
+		if (ret < 0) {
+			netdev_err(ndev, "%s: sh_eth_dev_init failed.\n",
+				   __func__);
+			return ret;
+		}
+
 		sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
 		/* Setting the Rx mode will start the Rx process. */
 		sh_eth_write(ndev, EDRRR_R, EDRRR);
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH net 4/4] sh_eth: Fix serialisation of interrupt disable with interrupt & NAPI handlers
From: Ben Hutchings @ 2015-01-22 12:44 UTC (permalink / raw)
  To: David S.Miller
  Cc: netdev, linux-kernel, Nobuhiro Iwamatsu, Mitsuhiro Kimura,
	Hisashi Nakamura, Yoshihiro Kaneko
In-Reply-To: <1421930284.1222.285.camel@xylophone.i.decadent.org.uk>

In order to stop the RX path accessing the RX ring while it's being
stopped or resized, we clear the interrupt mask (EESIPR) and then call
free_irq() or synchronise_irq().  This is insufficient because the
interrupt handler or NAPI poller may set EESIPR again after we clear
it.  Also, in sh_eth_set_ringparam() we currently don't disable NAPI
polling at all.

I could easily trigger a crash by running the loop:

   while ethtool -G eth0 rx 128 && ethtool -G eth0 rx 64; do echo -n .; done

and 'ping -f' toward the sh_eth port from another machine.

To fix this:
- Add a software flag (irq_enabled) to signal whether interrupts
  should be enabled
- In the interrupt handler, if the flag is clear then clear EESIPR
  and return
- In the NAPI poller, if the flag is clear then don't set EESIPR
- Set the flag before enabling interrupts in sh_eth_dev_init() and
  sh_eth_set_ringparam()
- Clear the flag and serialise with the interrupt and NAPI
  handlers before clearing EESIPR in sh_eth_close() and
  sh_eth_set_ringparam()

After this, I could run the loop for 100,000 iterations successfully.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
 drivers/net/ethernet/renesas/sh_eth.c |   39 +++++++++++++++++++++++++--------
 drivers/net/ethernet/renesas/sh_eth.h |    1 +
 2 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index be7aa43..d475929 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1316,8 +1316,10 @@ static int sh_eth_dev_init(struct net_device *ndev, bool start)
 		     RFLR);
 
 	sh_eth_write(ndev, sh_eth_read(ndev, EESR), EESR);
-	if (start)
+	if (start) {
+		mdp->irq_enabled = true;
 		sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
+	}
 
 	/* PAUSE Prohibition */
 	val = (sh_eth_read(ndev, ECMR) & ECMR_DM) |
@@ -1653,7 +1655,12 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
 	if (intr_status & (EESR_RX_CHECK | cd->tx_check | cd->eesr_err_check))
 		ret = IRQ_HANDLED;
 	else
-		goto other_irq;
+		goto out;
+
+	if (!likely(mdp->irq_enabled)) {
+		sh_eth_write(ndev, 0, EESIPR);
+		goto out;
+	}
 
 	if (intr_status & EESR_RX_CHECK) {
 		if (napi_schedule_prep(&mdp->napi)) {
@@ -1684,7 +1691,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
 		sh_eth_error(ndev, intr_status);
 	}
 
-other_irq:
+out:
 	spin_unlock(&mdp->lock);
 
 	return ret;
@@ -1712,7 +1719,8 @@ static int sh_eth_poll(struct napi_struct *napi, int budget)
 	napi_complete(napi);
 
 	/* Reenable Rx interrupts */
-	sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
+	if (mdp->irq_enabled)
+		sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
 out:
 	return budget - quota;
 }
@@ -1970,12 +1978,20 @@ static int sh_eth_set_ringparam(struct net_device *ndev,
 	if (netif_running(ndev)) {
 		netif_device_detach(ndev);
 		netif_tx_disable(ndev);
-		/* Disable interrupts by clearing the interrupt mask. */
+
+		/* Serialise with the interrupt handler and NAPI, then
+		 * disable interrupts.  We have to clear the
+		 * irq_enabled flag first to ensure that interrupts
+		 * won't be re-enabled.
+		 */
+		mdp->irq_enabled = false;
+		synchronize_irq(ndev->irq);
+		napi_synchronize(&mdp->napi);
 		sh_eth_write(ndev, 0x0000, EESIPR);
+
 		/* Stop the chip's Tx and Rx processes. */
 		sh_eth_write(ndev, 0, EDTRR);
 		sh_eth_write(ndev, 0, EDRRR);
-		synchronize_irq(ndev->irq);
 
 		/* Free all the skbuffs in the Rx queue. */
 		sh_eth_ring_free(ndev);
@@ -2001,6 +2017,7 @@ static int sh_eth_set_ringparam(struct net_device *ndev,
 			return ret;
 		}
 
+		mdp->irq_enabled = true;
 		sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
 		/* Setting the Rx mode will start the Rx process. */
 		sh_eth_write(ndev, EDRRR_R, EDRRR);
@@ -2184,7 +2201,13 @@ static int sh_eth_close(struct net_device *ndev)
 
 	netif_stop_queue(ndev);
 
-	/* Disable interrupts by clearing the interrupt mask. */
+	/* Serialise with the interrupt handler and NAPI, then disable
+	 * interrupts.  We have to clear the irq_enabled flag first to
+	 * ensure that interrupts won't be re-enabled.
+	 */
+	mdp->irq_enabled = false;
+	synchronize_irq(ndev->irq);
+	napi_disable(&mdp->napi);
 	sh_eth_write(ndev, 0x0000, EESIPR);
 
 	/* Stop the chip's Tx and Rx processes. */
@@ -2201,8 +2224,6 @@ static int sh_eth_close(struct net_device *ndev)
 
 	free_irq(ndev->irq, ndev);
 
-	napi_disable(&mdp->napi);
-
 	/* Free all the skbuffs in the Rx queue. */
 	sh_eth_ring_free(ndev);
 
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index 7bfaf1c..259d03f 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -513,6 +513,7 @@ struct sh_eth_private {
 	u32 rx_buf_sz;			/* Based on MTU+slack. */
 	int edmac_endian;
 	struct napi_struct napi;
+	bool irq_enabled;
 	/* MII transceiver section. */
 	u32 phy_id;			/* PHY ID */
 	struct mii_bus *mii_bus;	/* MDIO bus control */
-- 
1.7.10.4

^ permalink raw reply related

* Payment
From: Finance Department @ 2015-01-22 11:37 UTC (permalink / raw)


Dear Recipient,

You have been awarded the sum of  8,000,000.00 (Eight Million Pounds sterling) with reference number 77100146 by office of the ministry of finance UK.Send us your personal details to deliver your funds.

Gloria Peter

^ permalink raw reply

* Re: [net-next PATCH v3 00/12] Flow API
From: Pablo Neira Ayuso @ 2015-01-22 12:52 UTC (permalink / raw)
  To: John Fastabend
  Cc: tgraf, simon.horman, sfeldma, netdev, jhs, davem, gerlitz.or,
	andy, ast
In-Reply-To: <20150120202404.1741.8658.stgit@nitbit.x32>

Hi John,

On Tue, Jan 20, 2015 at 12:26:13PM -0800, John Fastabend wrote:
> I believe I addressed all the comments so far except for the integrate
> with 'tc'. I plan to work on the integration pieces next.

I think that postponing the integration with 'tc' means that we're
renouncing to provide some abstraction to represent the actions that
the device provides. After this patch we'll have a standard API that
exposes the vendor specific semantics, *so user configurations will
not be portable anymore*.

At least, we should come up with some abstraction / mapping as
interface, so the vendors can use them to represent their operations.
That interface will provide a trade-off: If the vendor offers an
operation that doesn't map to our abstraction, then sorry that
operation has to remain behind the curtain.

netdev is just two weeks ahead and this is an important change IMO.
I'd rather have the chance to meet you and other fellows there and
discuss if we can come up with some glue abstraction.

^ permalink raw reply

* Re: [PATCH v2] net: mv643xx_eth: Fix highmem support in non-TSO egress path
From: Ezequiel Garcia @ 2015-01-22 13:26 UTC (permalink / raw)
  To: David Laight, David Miller, Russell King
  Cc: netdev@vger.kernel.org, B38611@freescale.com,
	fabio.estevam@freescale.com
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CAD0E4F@AcuExch.aculab.com>

On 01/22/2015 09:40 AM, David Laight wrote:
> From: Ezequiel Garcia
>> Commit 69ad0dd7af22b61d9e0e68e56b6290121618b0fb
>> Author: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
>> Date:   Mon May 19 13:59:59 2014 -0300
>>
>>     net: mv643xx_eth: Use dma_map_single() to map the skb fragments
>>
>> caused a nasty regression by removing the support for highmem skb
>> fragments. By using page_address() to get the address of a fragment's
>> page, we are assuming a lowmem page. However, such assumption is incorrect,
>> as fragments can be in highmem pages, resulting in very nasty issues.
>>
>> This commit fixes this by using the skb_frag_dma_map() helper,
>> which takes care of mapping the skb fragment properly. Additionally,
>> the type of mapping is now tracked, so it can be unmapped using
>> dma_unmap_page or dma_unmap_single when appropriate.
>>
>> Fixes: 69ad0dd7af22 ("net: mv643xx_eth: Use dma_map_single() to map the skb fragments")
>> Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
>> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ...
>> @@ -2048,6 +2068,11 @@ static int txq_init(struct mv643xx_eth_private *mp, int index)
>>  					nexti * sizeof(struct tx_desc);
>>  	}
>>
>> +	txq->tx_desc_mapping = kcalloc(txq->tx_ring_size, sizeof(char),
>> +				       GFP_KERNEL);
>> +	if (!txq->tx_desc_mapping)
>> +		return -ENOMEM;
>> +
>>  	/* Allocate DMA buffers for TSO MAC/IP/TCP headers */
>>  	txq->tso_hdrs = dma_alloc_coherent(mp->dev->dev.parent,
>>  					   txq->tx_ring_size * TSO_HEADER_SIZE,
> 
> I'm guessing there is an error path for dma_alloc_coherent() failing.
> You've not modified it to free tx_desc_mapping.
> 

Yeah, you guess right.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

^ permalink raw reply

* [patch net-next RFC] tc: introduce OpenFlow classifier
From: Jiri Pirko @ 2015-01-22 13:37 UTC (permalink / raw)
  To: netdev; +Cc: davem, jhs

This patch introduces OpenFlow-based filter. So far, the very essential
packet fields are supported (according to OpenFlow v1.4 spec).

Known issues: skb_flow_dissect hashes out ipv6 addresses. That needs
to be changed to store them somewhere so they can be used later on.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 include/uapi/linux/pkt_cls.h |  33 +++
 net/sched/Kconfig            |  11 +
 net/sched/Makefile           |   1 +
 net/sched/cls_openflow.c     | 514 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 559 insertions(+)
 create mode 100644 net/sched/cls_openflow.c

diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index 25731df..d4cef16 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -402,6 +402,39 @@ enum {
 
 #define TCA_BPF_MAX (__TCA_BPF_MAX - 1)
 
+/* OpenFlow classifier */
+
+enum {
+	TCA_OF_UNSPEC,
+	TCA_OF_CLASSID,
+	TCA_OF_POLICE,
+	TCA_OF_INDEV,
+	TCA_OF_ACT,
+	TCA_OF_KEY_ETH_DST,		/* ETH_ALEN */
+	TCA_OF_KEY_ETH_DST_MASK,	/* ETH_ALEN */
+	TCA_OF_KEY_ETH_SRC,		/* ETH_ALEN */
+	TCA_OF_KEY_ETH_SRC_MASK,	/* ETH_ALEN */
+	TCA_OF_KEY_ETH_TYPE,		/* be16 */
+	TCA_OF_KEY_ETH_TYPE_MASK,	/* be16 */
+	TCA_OF_KEY_IP_PROTO,		/* u8 */
+	TCA_OF_KEY_IP_PROTO_MASK,	/* u8 */
+	TCA_OF_KEY_IPV4_SRC,		/* be32 */
+	TCA_OF_KEY_IPV4_SRC_MASK,	/* be32 */
+	TCA_OF_KEY_IPV4_DST,		/* be32 */
+	TCA_OF_KEY_IPV4_DST_MASK,	/* be32 */
+	TCA_OF_KEY_IPV6_SRC,		/* struct in6_addr */
+	TCA_OF_KEY_IPV6_SRC_MASK,	/* struct in6_addr */
+	TCA_OF_KEY_IPV6_DST,		/* struct in6_addr */
+	TCA_OF_KEY_IPV6_DST_MASK,	/* struct in6_addr */
+	TCA_OF_KEY_TP_SRC,		/* be16 */
+	TCA_OF_KEY_TP_SRC_MASK,		/* be16 */
+	TCA_OF_KEY_TP_DST,		/* be16 */
+	TCA_OF_KEY_TP_DST_MASK,		/* be16 */
+	__TCA_OF_MAX,
+};
+
+#define TCA_OF_MAX (__TCA_OF_MAX - 1)
+
 /* Extended Matches */
 
 struct tcf_ematch_tree_hdr {
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index 475e35e..9b01fae 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -477,6 +477,17 @@ config NET_CLS_BPF
 	  To compile this code as a module, choose M here: the module will
 	  be called cls_bpf.
 
+config NET_CLS_OPENFLOW
+	tristate "OpenFlow classifier"
+	select NET_CLS
+	---help---
+	  If you say Y here, you will be able to classify packets based on
+	  a configurable combination of packet keys and masks accordint to
+	  OpenFlow standard.
+
+	  To compile this code as a module, choose M here: the module will
+	  be called cls_openflow.
+
 config NET_EMATCH
 	bool "Extended Matches"
 	select NET_CLS
diff --git a/net/sched/Makefile b/net/sched/Makefile
index 7ca7f4c..5faa9ca 100644
--- a/net/sched/Makefile
+++ b/net/sched/Makefile
@@ -56,6 +56,7 @@ obj-$(CONFIG_NET_CLS_BASIC)	+= cls_basic.o
 obj-$(CONFIG_NET_CLS_FLOW)	+= cls_flow.o
 obj-$(CONFIG_NET_CLS_CGROUP)	+= cls_cgroup.o
 obj-$(CONFIG_NET_CLS_BPF)	+= cls_bpf.o
+obj-$(CONFIG_NET_CLS_OPENFLOW)	+= cls_openflow.o
 obj-$(CONFIG_NET_EMATCH)	+= ematch.o
 obj-$(CONFIG_NET_EMATCH_CMP)	+= em_cmp.o
 obj-$(CONFIG_NET_EMATCH_NBYTE)	+= em_nbyte.o
diff --git a/net/sched/cls_openflow.c b/net/sched/cls_openflow.c
new file mode 100644
index 0000000..1c261fa
--- /dev/null
+++ b/net/sched/cls_openflow.c
@@ -0,0 +1,514 @@
+/*
+ * net/sched/cls_openflow.c		OpenFlow classifier
+ *
+ * Copyright (c) 2015 Jiri Pirko <jiri@resnulli.us>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+
+#include <linux/if_ether.h>
+#include <linux/in6.h>
+
+#include <net/sch_generic.h>
+#include <net/pkt_cls.h>
+
+struct of_flow_key {
+	int	indev_ifindex;
+	struct {
+		u8	src[ETH_ALEN];
+		u8	dst[ETH_ALEN];
+		__be16	type;
+	} eth;
+	struct {
+		u8	proto;
+	} ip;
+	union {
+		struct {
+			__be32 src;
+			__be32 dst;
+		} ipv4;
+		struct {
+			struct in6_addr src;
+			struct in6_addr dst;
+		} ipv6;
+	};
+	union {
+		struct {
+			__be16 src;
+			__be16 dst;
+		} tp;
+	};
+} __aligned(BITS_PER_LONG / 8); /* Ensure that we can do comparisons as longs. */
+
+struct of_flow_match {
+	struct of_flow_key key;
+	struct of_flow_key mask;
+};
+
+struct cls_of_head {
+	struct list_head filters;
+	u32 hgen;
+	struct rcu_head rcu;
+};
+
+struct cls_of_filter {
+	struct list_head list;
+	u32 handle;
+	struct tcf_exts exts;
+	struct tcf_result res;
+	struct tcf_proto *tp;
+	struct of_flow_match match;
+	struct rcu_head	rcu;
+};
+
+static void of_extract_key(struct sk_buff *skb, struct of_flow_key *skb_key)
+{
+	struct flow_keys flow_keys;
+	struct ethhdr *eth;
+
+	skb_key->indev_ifindex = skb->skb_iif;
+
+	eth = eth_hdr(skb);
+	ether_addr_copy(skb_key->eth.src, eth->h_source);
+	ether_addr_copy(skb_key->eth.dst, eth->h_dest);
+
+	skb_flow_dissect(skb, &flow_keys);
+	skb_key->eth.type = flow_keys.n_proto;
+	skb_key->ip.proto = flow_keys.ip_proto;
+	skb_key->ipv4.src = flow_keys.src;
+	skb_key->ipv4.dst = flow_keys.dst;
+	skb_key->tp.src = flow_keys.port16[0];
+	skb_key->tp.dst = flow_keys.port16[1];
+}
+
+static bool of_match(struct of_flow_key *skb_key, struct cls_of_filter *f)
+{
+	const long *lkey = (const long *) &f->match.key;
+	const long *lmask = (const long *) &f->match.mask;
+	const long *lskb_key = (const long *) skb_key;
+	int i;
+
+	for (i = 0; i < sizeof(struct of_flow_key); i += sizeof(const long)) {
+		if ((*lkey++ & *lmask) != (*lskb_key++ & *lmask))
+			return false;
+		lmask++;
+	}
+	return true;
+}
+
+static int of_classify(struct sk_buff *skb, const struct tcf_proto *tp,
+		       struct tcf_result *res)
+{
+	struct cls_of_head *head = rcu_dereference_bh(tp->root);
+	struct cls_of_filter *f;
+	struct of_flow_key skb_key;
+	int ret;
+
+	of_extract_key(skb, &skb_key);
+
+	list_for_each_entry_rcu(f, &head->filters, list) {
+		if (!of_match(&skb_key, f))
+			continue;
+
+		*res = f->res;
+
+		ret = tcf_exts_exec(skb, &f->exts, res);
+		if (ret < 0)
+			continue;
+
+		return ret;
+	}
+	return -1;
+}
+
+static int of_init(struct tcf_proto *tp)
+{
+	struct cls_of_head *head;
+
+	head = kzalloc(sizeof(*head), GFP_KERNEL);
+	if (!head)
+		return -ENOBUFS;
+
+	INIT_LIST_HEAD_RCU(&head->filters);
+	rcu_assign_pointer(tp->root, head);
+
+	return 0;
+}
+
+static void of_destroy_filter(struct rcu_head *head)
+{
+	struct cls_of_filter *f = container_of(head, struct cls_of_filter, rcu);
+
+	tcf_exts_destroy(&f->exts);
+	kfree(f);
+}
+
+static void of_destroy(struct tcf_proto *tp)
+{
+	struct cls_of_head *head = rtnl_dereference(tp->root);
+	struct cls_of_filter *f, *next;
+
+	list_for_each_entry_safe(f, next, &head->filters, list) {
+		list_del_rcu(&f->list);
+		call_rcu(&f->rcu, of_destroy_filter);
+	}
+	RCU_INIT_POINTER(tp->root, NULL);
+	kfree_rcu(head, rcu);
+}
+
+static unsigned long of_get(struct tcf_proto *tp, u32 handle)
+{
+	struct cls_of_head *head = rtnl_dereference(tp->root);
+	struct cls_of_filter *f;
+
+	list_for_each_entry(f, &head->filters, list)
+		if (f->handle == handle)
+			return (unsigned long) f;
+	return 0;
+}
+
+static const struct nla_policy of_policy[TCA_OF_MAX + 1] = {
+	[TCA_OF_UNSPEC]			= { .type = NLA_UNSPEC },
+	[TCA_OF_CLASSID]		= { .type = NLA_U32 },
+	[TCA_OF_INDEV]			= { .type = NLA_STRING,
+					    .len = IFNAMSIZ },
+	[TCA_OF_KEY_ETH_DST]		= { .len = ETH_ALEN },
+	[TCA_OF_KEY_ETH_DST_MASK]	= { .len = ETH_ALEN },
+	[TCA_OF_KEY_ETH_SRC]		= { .len = ETH_ALEN },
+	[TCA_OF_KEY_ETH_SRC_MASK]	= { .len = ETH_ALEN },
+	[TCA_OF_KEY_ETH_TYPE]		= { .type = NLA_U16 },
+	[TCA_OF_KEY_ETH_TYPE_MASK]	= { .type = NLA_U16 },
+	[TCA_OF_KEY_IP_PROTO]		= { .type = NLA_U8 },
+	[TCA_OF_KEY_IP_PROTO_MASK]	= { .type = NLA_U8 },
+	[TCA_OF_KEY_IPV4_SRC]		= { .type = NLA_U32 },
+	[TCA_OF_KEY_IPV4_SRC_MASK]	= { .type = NLA_U32 },
+	[TCA_OF_KEY_IPV4_DST]		= { .type = NLA_U32 },
+	[TCA_OF_KEY_IPV4_DST_MASK]	= { .type = NLA_U32 },
+	[TCA_OF_KEY_IPV6_SRC]		= { .len = sizeof(struct in6_addr) },
+	[TCA_OF_KEY_IPV6_SRC_MASK]	= { .len = sizeof(struct in6_addr) },
+	[TCA_OF_KEY_IPV6_DST]		= { .len = sizeof(struct in6_addr) },
+	[TCA_OF_KEY_IPV6_DST_MASK]	= { .len = sizeof(struct in6_addr) },
+	[TCA_OF_KEY_TP_SRC]		= { .type = NLA_U16 },
+	[TCA_OF_KEY_TP_SRC_MASK]	= { .type = NLA_U16 },
+	[TCA_OF_KEY_TP_DST]		= { .type = NLA_U16 },
+	[TCA_OF_KEY_TP_DST_MASK]	= { .type = NLA_U16 },
+};
+
+static void of_set_key_val(struct nlattr **tb,
+			   void *val, int val_type,
+			   void *mask, int mask_type, int len)
+{
+	if (!tb[val_type])
+		return;
+	memcpy(val, nla_data(tb[val_type]), len);
+	if (!tb[mask_type])
+		memset(mask, 0xff, len);
+	else
+		memcpy(mask, nla_data(tb[mask_type]), len);
+}
+
+static int of_set_parms(struct net *net, struct tcf_proto *tp,
+			struct cls_of_filter *f, unsigned long base,
+			struct nlattr **tb, struct nlattr *est, bool ovr)
+{
+	struct tcf_exts e;
+	struct of_flow_key *key, *mask;
+	int err;
+
+	tcf_exts_init(&e, TCA_OF_ACT, TCA_OF_POLICE);
+	err = tcf_exts_validate(net, tp, tb, est, &e, ovr);
+	if (err < 0)
+		return err;
+
+	if (tb[TCA_OF_CLASSID]) {
+		f->res.classid = nla_get_u32(tb[TCA_OF_CLASSID]);
+		tcf_bind_filter(tp, &f->res, base);
+	}
+
+	key = &f->match.key;
+	mask = &f->match.mask;
+
+	if (tb[TCA_OF_INDEV]) {
+		err = tcf_change_indev(net, tb[TCA_OF_INDEV]);
+		if (err < 0)
+			goto errout;
+		key->indev_ifindex = err;
+		mask->indev_ifindex = 0xffffffff;
+	}
+
+	of_set_key_val(tb, key->eth.dst, TCA_OF_KEY_ETH_DST,
+		       mask->eth.dst, TCA_OF_KEY_ETH_DST_MASK,
+		       sizeof(key->eth.dst));
+	of_set_key_val(tb, key->eth.src, TCA_OF_KEY_ETH_SRC,
+		       mask->eth.src, TCA_OF_KEY_ETH_SRC_MASK,
+		       sizeof(key->eth.src));
+	of_set_key_val(tb, &key->eth.type, TCA_OF_KEY_ETH_TYPE,
+		       &mask->eth.type, TCA_OF_KEY_ETH_TYPE_MASK,
+		       sizeof(key->eth.type));
+	of_set_key_val(tb, &key->ip.proto, TCA_OF_KEY_IP_PROTO,
+		       &mask->ip.proto, TCA_OF_KEY_IP_PROTO_MASK,
+		       sizeof(key->ip.proto));
+	of_set_key_val(tb, &key->ipv4.src, TCA_OF_KEY_IPV4_SRC,
+		       &mask->ipv4.src, TCA_OF_KEY_IPV4_SRC_MASK,
+		       sizeof(key->ipv4.src));
+	of_set_key_val(tb, &key->ipv4.dst, TCA_OF_KEY_IPV4_DST,
+		       &mask->ipv4.dst, TCA_OF_KEY_IPV4_DST_MASK,
+		       sizeof(key->ipv4.dst));
+	of_set_key_val(tb, &key->ipv6.src, TCA_OF_KEY_IPV6_SRC,
+		       &mask->ipv6.src, TCA_OF_KEY_IPV6_SRC_MASK,
+		       sizeof(key->ipv6.src));
+	of_set_key_val(tb, &key->ipv6.dst, TCA_OF_KEY_IPV6_DST,
+		       &mask->ipv6.dst, TCA_OF_KEY_IPV6_DST_MASK,
+		       sizeof(key->ipv6.dst));
+	of_set_key_val(tb, &key->tp.src, TCA_OF_KEY_TP_SRC,
+		       &mask->tp.src, TCA_OF_KEY_TP_SRC_MASK,
+		       sizeof(key->tp.src));
+	of_set_key_val(tb, &key->tp.dst, TCA_OF_KEY_TP_DST,
+		       &mask->tp.dst, TCA_OF_KEY_TP_SRC_MASK,
+		       sizeof(key->tp.dst));
+
+	tcf_exts_change(tp, &f->exts, &e);
+	f->tp = tp;
+
+	return 0;
+errout:
+	tcf_exts_destroy(&e);
+	return err;
+}
+
+static u32 of_grab_new_handle(struct tcf_proto *tp,
+			      struct cls_of_head *head)
+{
+	unsigned int i = 0x80000000;
+	u32 handle;
+
+	do {
+		if (++head->hgen == 0x7FFFFFFF)
+			head->hgen = 1;
+	} while (--i > 0 && of_get(tp, head->hgen));
+
+	if (unlikely(i == 0)) {
+		pr_err("Insufficient number of handles\n");
+		handle = 0;
+	} else {
+		handle = head->hgen;
+	}
+
+	return handle;
+}
+
+static int of_change(struct net *net, struct sk_buff *in_skb,
+		     struct tcf_proto *tp, unsigned long base,
+		     u32 handle, struct nlattr **tca,
+		     unsigned long *arg, bool ovr)
+{
+	struct cls_of_head *head = rtnl_dereference(tp->root);
+	struct cls_of_filter *fold = (struct cls_of_filter *) *arg;
+	struct cls_of_filter *fnew;
+	struct nlattr *tb[TCA_OF_MAX + 1];
+	int err;
+
+	if (!tca[TCA_OPTIONS])
+		return -EINVAL;
+
+	err = nla_parse_nested(tb, TCA_OF_MAX, tca[TCA_OPTIONS], of_policy);
+	if (err < 0)
+		return err;
+
+	if (fold && handle && fold->handle != handle)
+		return -EINVAL;
+
+	fnew = kzalloc(sizeof(*fnew), GFP_KERNEL);
+	if (!fnew)
+		return -ENOBUFS;
+
+	tcf_exts_init(&fnew->exts, TCA_OF_ACT, TCA_OF_POLICE);
+
+	if (!handle) {
+		handle = of_grab_new_handle(tp, head);
+		if (!handle) {
+			err = -EINVAL;
+			goto errout;
+		}
+	}
+	fnew->handle = handle;
+
+	err = of_set_parms(net, tp, fnew, base, tb, tca[TCA_RATE], ovr);
+	if (err < 0)
+		goto errout;
+
+	*arg = (unsigned long) fnew;
+
+	if (fold) {
+		list_replace_rcu(&fnew->list, &fold->list);
+		tcf_unbind_filter(tp, &fold->res);
+		call_rcu(&fold->rcu, of_destroy_filter);
+	} else {
+		list_add_tail_rcu(&fnew->list, &head->filters);
+	}
+
+	return 0;
+
+errout:
+	kfree(fnew);
+	return err;
+}
+
+static int of_delete(struct tcf_proto *tp, unsigned long arg)
+{
+	struct cls_of_filter *f = (struct cls_of_filter *) arg;
+
+	list_del_rcu(&f->list);
+	tcf_unbind_filter(tp, &f->res);
+	call_rcu(&f->rcu, of_destroy_filter);
+	return 0;
+}
+
+static void of_walk(struct tcf_proto *tp, struct tcf_walker *arg)
+{
+	struct cls_of_head *head = rtnl_dereference(tp->root);
+	struct cls_of_filter *f;
+
+	list_for_each_entry_rcu(f, &head->filters, list) {
+		if (arg->count < arg->skip)
+			goto skip;
+		if (arg->fn(tp, (unsigned long) f, arg) < 0) {
+			arg->stop = 1;
+			break;
+		}
+skip:
+		arg->count++;
+	}
+}
+
+static int of_dump_key_val(struct sk_buff *skb,
+			   void *val, int val_type,
+			   void *mask, int mask_type, int len)
+{
+	int err;
+
+	if (!memchr_inv(mask, 0, len))
+		return 0;
+	err = nla_put(skb, val_type, len, val);
+	if (err)
+		return err;
+	err = nla_put(skb, mask_type, len, mask);
+	if (err)
+		return err;
+	return 0;
+}
+
+static int of_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
+		   struct sk_buff *skb, struct tcmsg *t)
+{
+	struct cls_of_filter *f = (struct cls_of_filter *) fh;
+	struct nlattr *nest;
+	struct of_flow_key *key, *mask;
+
+	if (!f)
+		return skb->len;
+
+	t->tcm_handle = f->handle;
+
+	nest = nla_nest_start(skb, TCA_OPTIONS);
+	if (!nest)
+		goto nla_put_failure;
+
+	if (f->res.classid &&
+	    nla_put_u32(skb, TCA_BASIC_CLASSID, f->res.classid))
+		goto nla_put_failure;
+
+	key = &f->match.key;
+	mask = &f->match.mask;
+
+	if (mask->indev_ifindex) {
+		struct net_device *dev;
+
+		dev = __dev_get_by_index(net, key->indev_ifindex);
+		if (dev && nla_put_string(skb, TCA_OF_INDEV, dev->name))
+			goto nla_put_failure;
+	}
+
+	if (of_dump_key_val(skb, key->eth.dst, TCA_OF_KEY_ETH_DST,
+			    mask->eth.dst, TCA_OF_KEY_ETH_DST_MASK,
+			    sizeof(key->eth.dst)) ||
+	    of_dump_key_val(skb, key->eth.src, TCA_OF_KEY_ETH_SRC,
+			    mask->eth.src, TCA_OF_KEY_ETH_SRC_MASK,
+			    sizeof(key->eth.src)) ||
+	    of_dump_key_val(skb, &key->eth.type, TCA_OF_KEY_ETH_TYPE,
+			    &mask->eth.type, TCA_OF_KEY_ETH_TYPE_MASK,
+			    sizeof(key->eth.type)) ||
+	    of_dump_key_val(skb, &key->ip.proto, TCA_OF_KEY_IP_PROTO,
+			    &mask->ip.proto, TCA_OF_KEY_IP_PROTO_MASK,
+			    sizeof(key->ip.proto)) ||
+	    of_dump_key_val(skb, &key->ipv4.src, TCA_OF_KEY_IPV4_SRC,
+			    &mask->ipv4.src, TCA_OF_KEY_IPV4_SRC_MASK,
+			    sizeof(key->ipv4.src)) ||
+	    of_dump_key_val(skb, &key->ipv4.dst, TCA_OF_KEY_IPV4_DST,
+			    &mask->ipv4.dst, TCA_OF_KEY_IPV4_DST_MASK,
+			    sizeof(key->ipv4.dst)) ||
+	    of_dump_key_val(skb, &key->ipv6.src, TCA_OF_KEY_IPV6_SRC,
+			    &mask->ipv6.src, TCA_OF_KEY_IPV6_SRC_MASK,
+			    sizeof(key->ipv6.src)) ||
+	    of_dump_key_val(skb, &key->ipv6.dst, TCA_OF_KEY_IPV6_DST,
+			    &mask->ipv6.dst, TCA_OF_KEY_IPV6_DST_MASK,
+			    sizeof(key->ipv6.dst)) ||
+	    of_dump_key_val(skb, &key->tp.src, TCA_OF_KEY_TP_SRC,
+			    &mask->tp.src, TCA_OF_KEY_TP_SRC_MASK,
+			    sizeof(key->tp.src)) ||
+	    of_dump_key_val(skb, &key->tp.dst, TCA_OF_KEY_TP_DST,
+			    &mask->tp.dst, TCA_OF_KEY_TP_DST_MASK,
+			    sizeof(key->tp.dst)))
+		goto nla_put_failure;
+
+	if (tcf_exts_dump(skb, &f->exts))
+		goto nla_put_failure;
+
+	nla_nest_end(skb, nest);
+
+	if (tcf_exts_dump_stats(skb, &f->exts) < 0)
+		goto nla_put_failure;
+
+	return skb->len;
+
+nla_put_failure:
+	nla_nest_cancel(skb, nest);
+	return -1;
+}
+
+static struct tcf_proto_ops cls_of_ops __read_mostly = {
+	.kind		= "openflow",
+	.classify	= of_classify,
+	.init		= of_init,
+	.destroy	= of_destroy,
+	.get		= of_get,
+	.change		= of_change,
+	.delete		= of_delete,
+	.walk		= of_walk,
+	.dump		= of_dump,
+	.owner		= THIS_MODULE,
+};
+
+static int __init cls_of_init(void)
+{
+	return register_tcf_proto_ops(&cls_of_ops);
+}
+
+static void __exit cls_of_exit(void)
+{
+	unregister_tcf_proto_ops(&cls_of_ops);
+}
+
+module_init(cls_of_init);
+module_exit(cls_of_exit);
+
+MODULE_AUTHOR("Jiri Pirko <jiri@resnulli.us>");
+MODULE_DESCRIPTION("OpenFlow classifier");
+MODULE_LICENSE("GPL v2");
-- 
1.9.3

^ 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