Netdev List
 help / color / mirror / Atom feed
* Re: Ethernet: how to disable gigabit support
From: Bruno Prémont @ 2015-02-07 14:35 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel, Florian Fainelli, netdev
In-Reply-To: <20150206135706.GB25683@amd>

On Fri, 06 February 2015 Pavel Machek wrote:
> On Thu 2015-02-05 14:44:55, Florian Fainelli wrote:
> > On 05/02/15 12:25, Pavel Machek wrote:
> > > This happened on more than one project: there's gigabit-capable chip,
> > > but the connector is not designed for gigabit speed.
> > > 
> > > I'd like to have speed autonegotiation, but not offer gigabit (as it
> > > will not work).
> > > 
> > > Is there way to do that without hacking the kernel? Should mii-tool do
> > > that?
> > 
> > Since you use the PHY library, you should be able to do something like
> > this in your PHY driver prior to starting the PHY state machine:
> > 
> > phydev->supported &= PHY_BASIC_FEATURES (effectively masking Gigabit
> > capability)
> 
> Thanks, that did the trick.
> 								Pavel
> (But still it would be nice to have a generic way of doing this,
> using something like mii-tool.)

You can use ethtool to do so:

  ethtool -s ethX advertise 0x0f

c.f. man ethtool:
  advertise N
    Sets the speed and duplex advertised by autonegotiation. The argument is
    a hexadecimal value using one or a combination of the following values:

      0x001     10 Half
      0x002     10 Full
      0x004     100 Half
      0x008     100 Full
      0x010     1000 Half        (not supported by IEEE standards)
      0x020     1000 Full
      0x8000    2500 Full        (not supported by IEEE standards)
      0x1000    10000 Full
      0x20000   20000MLD2 Full   (not supported by IEEE standards)
      0x40000   20000KR2 Full    (not supported by IEEE standards)

Bruno

^ permalink raw reply

* [PATCH v3] net: bluetooth: hci_sock: Use 'const u32 *' instead of 'void *' for 2nd parameter of hci_test_bit()
From: Chen Gang S @ 2015-02-07 13:24 UTC (permalink / raw)
  To: David Laight, Marcel Holtmann, Sergei Shtylyov, Joe Perches
  Cc: Gustavo F. Padovan, Johan Hedberg, David S. Miller,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org

hci_test_bit() does not modify 2nd parameter, so it is better to let it
be constant, or may cause build warning. The related warning (with
allmodconfig under xtensa):

  net/bluetooth/hci_sock.c: In function 'hci_sock_sendmsg':
  net/bluetooth/hci_sock.c:955:8: warning: passing argument 2 of 'hci_test_bit' discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
          &hci_sec_filter.ocf_mask[ogf])) &&
          ^
  net/bluetooth/hci_sock.c:49:19: note: expected 'void *' but argument is of type 'const __u32 (*)[4] {aka const unsigned int (*)[4]}'
   static inline int hci_test_bit(int nr, void *addr)
                     ^

hci_test_bit() always treats 2nd parameter is u32, and all callers also
know about it, so 2nd parameter of hci_test_bit() need use 'const u32 *'
instead of 'void *'.

C language treats the array function parameter as a pointer, so the
caller need not use '&' for the 2 demotion array, or it reports warning:
'const unsigned int (*)[4]' is different with 'const unsigned int *'.


Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 net/bluetooth/hci_sock.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 1d65c5b..04124ec 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -46,9 +46,9 @@ struct hci_pinfo {
 	unsigned short    channel;
 };
 
-static inline int hci_test_bit(int nr, void *addr)
+static inline int hci_test_bit(int nr, const u32 *addr)
 {
-	return *((__u32 *) addr + (nr >> 5)) & ((__u32) 1 << (nr & 31));
+	return *(addr + (nr >> 5)) & ((u32) 1 << (nr & 31));
 }
 
 /* Security filter */
@@ -107,7 +107,7 @@ static bool is_filtered_packet(struct sock *sk, struct sk_buff *skb)
 
 	flt_event = (*(__u8 *)skb->data & HCI_FLT_EVENT_BITS);
 
-	if (!hci_test_bit(flt_event, &flt->event_mask))
+	if (!hci_test_bit(flt_event, (u32 *)&flt->event_mask))
 		return true;
 
 	/* Check filter only when opcode is set */
@@ -952,7 +952,7 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
 
 		if (((ogf > HCI_SFLT_MAX_OGF) ||
 		     !hci_test_bit(ocf & HCI_FLT_OCF_BITS,
-				   &hci_sec_filter.ocf_mask[ogf])) &&
+				   hci_sec_filter.ocf_mask[ogf])) &&
 		    !capable(CAP_NET_RAW)) {
 			err = -EPERM;
 			goto drop;
-- 
1.9.3

^ permalink raw reply related

* Re: [PATCH] vxlan: Wrong type passed to %pIS
From: Rasmus Villemoes @ 2015-02-07 12:38 UTC (permalink / raw)
  To: Joe Perches
  Cc: David S. Miller, Pravin B Shelar, Nicolas Dichtel, netdev,
	linux-kernel, Dan Carpenter
In-Reply-To: <1423280138.2933.3.camel@perches.com>

On Sat, Feb 07 2015, Joe Perches <joe@perches.com> wrote:

> On Sat, 2015-02-07 at 03:17 +0100, Rasmus Villemoes wrote:
>> src_ip is a pointer to a union vxlan_addr, one member of which is a
>> struct sockaddr. Passing a pointer to src_ip is wrong; one should pass
>> the value of src_ip itself. Since %pIS formally expects something of
>> type struct sockaddr*, let's pass a pointer to the appropriate union
>> member, though this of course doesn't change the generated code.
>
> Hello Rasmus
>
> Are you finding these mismatches by hand or
> are you using some tool?

I've extended smatch to do format checking (mostly for the %p
extensions; gcc already does all the other stuff just fine). I'll try
and see if I can get it on github sometime in the coming week.

Rasmus

^ permalink raw reply

* Re: [PATCH] vxlan: Wrong type passed to %pIS
From: Rasmus Villemoes @ 2015-02-07 12:34 UTC (permalink / raw)
  To: Cong Wang
  Cc: David S. Miller, Pravin B Shelar, Nicolas Dichtel,
	Linux Kernel Network Developers, LKML
In-Reply-To: <CAM_iQpWGR6zLrGLGsMPM1Y-z45Nd4XO3X_H1KDTedsz2=5mXng@mail.gmail.com>

On Sat, Feb 07 2015, Cong Wang <xiyou.wangcong@gmail.com> wrote:

> On Fri, Feb 6, 2015 at 6:17 PM, Rasmus Villemoes
> <linux@rasmusvillemoes.dk> wrote:
>> src_ip is a pointer to a union vxlan_addr, one member of which is a
>> struct sockaddr. Passing a pointer to src_ip is wrong; one should pass
>> the value of src_ip itself. Since %pIS formally expects something of
>> type struct sockaddr*, let's pass a pointer to the appropriate union
>> member, though this of course doesn't change the generated code.
>>
>
>
> It is a union, this doesn't harm.
>

Just to be clear: This fixes a real bug. The minimal fix had been

-                     src_mac, &rdst->remote_ip, &src_ip);
+                     src_mac, &rdst->remote_ip, src_ip);

but I through in the cosmetic improvements while the line needed
changing anyway.

> Since you are on it, there is another similar place in vxlan too.

... which is why I didn't change that other occurrence.

Rasmus

^ permalink raw reply

* Re: Implementing Deficit Round Robin for different irtual interfaces
From: ronald pina @ 2015-02-07 11:53 UTC (permalink / raw)
  To: netdev
In-Reply-To: <CAONBAaeKZNCv42a+HY4TtXtYxnAr6-fX1GXEndKJ=r3nZ-1LhQ@mail.gmail.com>

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

Hello
I am working for my Msc thesis on computer engineering,  my primary
goal is to introduce scheduling with priorities over different
networking interfaces, it can be very valuable on virtual machines
like Xen and as far as i have studied, Xen is scheduling the virtual
network interfaces  in round-robin fashion, i would like to improve
this and to use Deficit Round Robin, I think the better way is to
integrate the DRR in tc  and   to make the scheduling decisions based
on virtual network interfaces which belongs to different guests as
shown from the diagram in atach.

I would like to ask which function on source code may be a starting
point to realize that kind of scheduling? What are the opportunities
to involve the DRR as a standard scheduler in tc for later use?

Kind regards
Ronald

On Sat, Feb 7, 2015 at 12:52 PM, ronald pina <pinaronald@gmail.com> wrote:
> Hello
> I am working for my Msc thesis on computer engineering,  my primary
> goal is to introduce scheduling with priorities over different
> networking interfaces, it can be very valuable on virtual machines
> like Xen and as far as i have studied, Xen is scheduling the virtual
> network interfaces  in round-robin fashion, i would like to improve
> this and to use Deficit Round Robin, I think the better way is to
> integrate the DRR in tc  and   to make the scheduling decisions based
> on virtual network interfaces which belongs to different guests as
> shown from the diagram in atach.
>
> I would like to ask which function on source code may be a starting
> point to realize that kind of scheduling? What are the opportunities
> to involve the DRR as a standard scheduler in tc for later use?
>
> Kind regards
> Ronald

[-- Attachment #2: drr-on-xen.jpg --]
[-- Type: image/jpeg, Size: 27832 bytes --]

^ permalink raw reply

* Implementing Deficit Round Robin for different irtual interfaces
From: ronald pina @ 2015-02-07 11:52 UTC (permalink / raw)
  To: netdev

Hello
I am working for my Msc thesis on computer engineering,  my primary
goal is to introduce scheduling with priorities over different
networking interfaces, it can be very valuable on virtual machines
like Xen and as far as i have studied, Xen is scheduling the virtual
network interfaces  in round-robin fashion, i would like to improve
this and to use Deficit Round Robin, I think the better way is to
integrate the DRR in tc  and   to make the scheduling decisions based
on virtual network interfaces which belongs to different guests as
shown from the diagram in atach.

I would like to ask which function on source code may be a starting
point to realize that kind of scheduling? What are the opportunities
to involve the DRR as a standard scheduler in tc for later use?

Kind regards
Ronald

^ permalink raw reply

* pull-request: wireless-drivers-next 2015-02-07
From: Kalle Valo @ 2015-02-07 11:40 UTC (permalink / raw)
  To: David Miller
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA

Hi Dave,

here's one more pull request for 3.20. I hope I'm not too late, I didn't
realise that the merge window is getting so close. Please note that I
had to merge from mac80211-next due to a build time dependency in a
patch but it should be ok as you had already pulled the same patches
into net-next. Also there are few bcma and ssb patches, we agreed with
John that I'll start taking them as well.

There's a small conflict in drivers/net/wireless/rtlwifi/pci.c, the fix
is to leave the two labels like this:

			schedule_work(&rtlpriv->works.lps_change_work);
		}
end:
		skb = new_skb;
no_new:
		if (rtlpriv->use_new_trx_flow) {


Please let me know if there are any issues and sorry for being late.

Kalle

The following changes since commit c5ed1df781cb544d4e4d189bb5b6ec7336d8888c:

  bcma: use standard bus scanning during early register (2015-01-23 21:47:55 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git tags/wireless-drivers-next-for-davem-2015-02-07

for you to fetch changes up to d53071143aa5a7cb37cf7db8101042e700b5413f:

  Merge ath-next from ath.git (2015-02-06 16:14:11 +0200)

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

Major changes:

iwlwifi:

* more work for new devices (4165 / 8260)
* cleanups / improvemnts in rate control
* fixes for TDLS
* major statistics work from Johannes - more to come
* improvements for the fw error dump infrastructure
* usual amount of small fixes here and there (scan, D0i3 etc...)
* add support for beamforming
* enable stuck queue detection for iwlmvm
* a few fixes for EBS scan
* fixes for various failure paths
* improvements for TDLS Offchannel

wil6210:

* performance tuning
* some AP features

brcm80211:

* rework some code in SDIO part of the brcmfmac driver related to
  suspend/resume that were found doing stress testing
* in PCIe part scheduling of worker thread needed to be relaxed
* minor fixes and exposing firmware revision information to
  user-space, ie. ethtool.

mwifiex:

* enhancements for change virtual interface handling
* remove coupling between netdev and FW supported interface
  combination, now conversion from any type of supported interface
  types to any other type is possible
* DFS support in AP mode

ath9k:

* fix calibration issues on some boards
* Wake-on-WLAN improvements

ath10k:

* add support for qca6174 hardware
* enable RX batching to reduce CPU load

----------------------------------------------------------------
Amitkumar Karwar (4):
      mwifiex: correction in wakeup timer handling
      mwifiex: fix memory leak in mwifiex_send_processed_packet()
      mwifiex: fix NULL packet downloading issues
      mwifiex: disable UAPSD mode when AP starts

Arend van Spriel (9):
      brcmfmac: pass DEAUTH/DISASSOC reason code to user-space
      brcmfmac: wait for driver to go idle during suspend
      brcmfmac: do not load firmware when device is already running
      brcmutil: use define for boardrev string function
      brcmfmac: determine chip info when not provided by bus layer
      brcmfmac: always obtain device revision info upon intialization
      brcmfmac: show firmware release info in ethtool driver info
      brcmfmac: store revinfo retrieval result
      brcmfmac: fix nvram processing

Arik Nemtsov (2):
      iwlwifi: mvm: improve TDLS ch-sw state machine
      iwlwifi: mvm: ignore stale TDLS ch-switch responses

Avinash Patil (19):
      mwifiex: selectively choose ext_scan support
      mwifiex: remove redundant nick_name variable
      mwifiex: set wiphy params only once
      mwifiex: do not declare wdev as pointer
      mwifiex: store permanant mac address in adapter structure
      mwifiex: add init parameter to init command routine
      mwifiex: manage virtual interface limits efficiently
      mwifiex: handle PS events on AP interface as well
      mwifiex: support conversion to any virtual interface type
      mwifiex: do not send regulatory update while starting AP
      mwifiex: store AP configuration in private structure
      mwifiex: update IEs after AP has started
      mwifiex: refactor start_ap handler
      mwifiex: separate function for parsing head and tail IEs
      mwifiex: add cfg80211 start_radar_detection handler
      mwifiex: support for channel report for radar detection
      mwifiex: handle radar detect event from FW
      mwifiex: channel switch support for mwifiex
      mwifiex: 11h handling for AP interface

Chun-Yeow Yeoh (1):
      rtl8192cu: fix the mesh beaconing

Dedy Lansky (2):
      wil6210: fix timing of netif_carrier_on indication
      wil6210: ignore firmware failure to gracefully stop AP

Emmanuel Grumbach (7):
      iwlwifi: mvm: check IWL_UCODE_TLV_API_SCD_CFG in API and not in capa
      iwlwifi: pcie: don't dump useless data when a TFD queue hangs
      iwlwifi: pcie: prepare the enablement of 31 TFD queues
      iwlwifi: pcie: disable the SCD_BASE_ADDR when we resume from WoWLAN
      iwlwifi: mvm: enable watchdog on Tx queues for mvm
      iwlwifi: allow to define the stuck queue timer per queue
      iwlwifi: mvm: don't send a command the firmware doesn't know

Eyal Shapira (2):
      iwlwifi: mvm: add beamformer support
      iwlwifi: mvm: rs: enable forcing single stream Tx decision

Haim Dreyfuss (2):
      iwlwifi: mvm: Fix a few EBS error handling bugs
      iwlwifi: mvm: Enable EBS also in single scan on umac interface

Hamad Kadmany (1):
      wil6210: Remove msm platform related code

Hante Meuleman (5):
      brcmfmac: Relax scheduling of msgbuf worker on high throughput.
      brcmfmac: prevent possible deadlock on resuming SDIO device.
      brcmfmac: use SDIO DPC for control frames.
      brcmfmac: SDIO: avoid using bus state for private states.
      brcmfmac: Reopen netdev queue on bus state data.

Helmut Schaa (1):
      ath10k: Use TX cksum offload only for CHECKSUM_PARTIAL

Hong Xu (1):
      ath9k and ath9k_htc: rename variable "led_blink"

Ilan Peer (1):
      iwlwifi: mvm: Fix building channels in scan_config_cmd

Janusz Dziedzic (2):
      ath10k: implement uapsd autotrigger command
      ath10k: implement sta keepalive command

Johannes Berg (3):
      mwifiex: set netif carrier off in ndo_open
      iwlwifi: mvm: remove space padding after sysassert description
      iwlwifi: mvm: reduce quota threshold

John W. Linville (1):
      ath10k: document switch case fall-through in __ath10k_scan_finish

Julia Lawall (1):
      ath10k: fix error return code

Kalle Valo (2):
      Merge tag 'iwlwifi-next-for-kalle-2015-02-03' of https://git.kernel.org/.../iwlwifi/iwlwifi-next
      Merge ath-next from ath.git

Larry Finger (1):
      rtlwifi: rtl8192ee: Fix problems with calculating free space in FIFO

Luciano Coelho (3):
      iwlwifi: mvm: don't reprobe if we fail during reconfig and fw_restart is false
      iwlwifi: mvm: always use mac color zero
      iwlwifi: mvm: fix failure path when power_update fails in add_interface

Marek Kwaczynski (2):
      ath10k: remove sw encryption for pmf
      ath10k: fix pmf for wmi-tlv on qca6174

Markus Elfring (6):
      cw1200: Delete an unnecessary check before the function call "release_firmware"
      cw1200: Less function calls in cw1200_load_firmware_cw1200() after error detection
      ath9k: Delete an unnecessary check before the function call "relay_close"
      orinoco: Delete an unnecessary check before the function call "kfree"
      hostap: Delete an unnecessary check before the function call "kfree"
      brcm80211: Delete unnecessary checks before two function calls

Michael Buesch (1):
      b43: Fix locking FIXME in beacon update top half

Michal Kazior (28):
      ath10k: fill max_num_vdevs for wmi-tlv
      ath10k: implement new beacon tx status event
      ath10k: implement beacon template command
      ath10k: implement prb tmpl wmi command
      ath10k: implement p2p bcn ie command
      ath10k: implement support for ap beacon offloading
      ath10k: prevent fw reg dump spam
      ath10k: implement diag data container event
      ath10k: implement diag event
      ath10k: introduce struct ath10k_skb_rxcb
      ath10k: implement rx reorder support
      ath10k: reset chip before reading chip_id in probe
      ath10k: add support for qca6174 Rx descriptors
      ath10k: add support for qca6174
      ath10k: split fw pdev stats parsing
      ath10k: fix 10.2 fw stats parsing
      ath10k: use idr api for msdu_ids
      ath10k: fix dtim period with beacon templates
      ath10k: fix nullfunc workaround
      ath10k: disable uapsd autotrigger
      ath10k: disable irqs after fw crash
      ath10k: move wmm param storage to vif
      ath10k: implement per-vdev wmm param setup command
      ath10k: use per-vif wmm param setup if possible
      ath10k: disable sta keepalive
      ath10k: change dma beacon cmd prototype
      ath10k: fix beacon deadlock
      ath10k: enable qca6174 hw3.2

Nicholas Mc Guire (5):
      ath10k: fixup wait_for_completion_timeout return handling
      cw1200: use msecs_to_jiffies for conversion
      orinoco: orinoco_plx use msecs_to_jiffies for conversion
      orinoco: orinoco_pci use msecs_to_jiffies for conversion
      orinoco: orinoco_tmd use msecs_to_jiffies for conversion

Pramod Gurav (1):
      ssb: Fix Sparse error in main

Rafał Miłecki (8):
      bcma: fix watchdog on some ARM chipsets
      bcma: simplify freeing cores (internal devices structs)
      bcma: detect SPROM revision 11
      bcma: add empty PCIe hostmode functions if support is disabled
      bcma: add early_init function for PCIe core and move some fix into it
      bcma: implement host code support for PCIe Gen 2 devices
      b43: support bcma core reset on AC-PHY hardware
      b43: AC-PHY: prepare place for developing new PHY support

Rajkumar Manoharan (12):
      ath10k: add wmi support for addba_clear_resp
      ath10k: add wmi support for addba_send
      ath10k: add wmi support for addba_set_resp
      ath10k: add wmi support for delba_send
      ath10k: Implement sta_add_debugfs
      ath10k: add support to send addba request
      ath10k: add support to send addba response
      ath10k: add support to send delba
      ath10k: fix config_enabled check for hwmon
      ath10k: fix duration calculation for quiet param
      ath10k: fix hwmon temperature input units
      ath10k: fix target wakeup timeout

SenthilKumar Jegadeesan (2):
      ath10k: prevent setting wrong key idx for station
      ath10k: add log level configuration for fw_dbglog

Sergey Ryazanov (1):
      ath5k: fix spontaneus AR5312 freezes

Sujith Manoharan (32):
      ath10k: Fix DMA burst size
      ath10k: Enable RX batching
      ath10k: Remove unused htt->max_throughput_mbps
      ath9k: Update QCA953x initvals
      ath9k: Update AR955x initvals
      ath9k: Add a macro to identify PCOEM chips
      ath9k: Fix manual peak calibration initialization
      ath9k: Set correct peak detect threshold
      ath9k: Enable manual peak detect calibration
      ath9k: Remove ATH9K_HW_WOW_DEVICE_CAPABLE
      ath9k: Return early for error conditions
      ath9k: Remove redundant device_can_wakeup() check
      ath9k: Check early for multi-vif/STA conditions
      ath9k: Check multi-channel context for WOW
      ath9k: Fix wow init/deinit
      ath9k: Check WOW triggers properly
      ath9k: Remove unused BMISS processing
      ath9k: Remove ath9k_hw_wow_event_to_string
      ath9k: Add a debugfs file for WOW
      ath9k: Simplify user pattern configuration
      ath9k: Add a HW structure for WOW
      ath9k: Register max WOW patterns
      ath9k: Move WOW registers to reg_wow.h
      ath9k: Remove incorrect register macros
      ath9k: Cleanup reg_wow.h
      ath9k: Fix max pattern check
      ath9k: Add support for more WOW patterns
      ath9k: Register correct WOW details with mac80211
      ath9k: Fix issues with WoW enable
      ath9k: Program AR_WA correctly
      ath9k: Clear TSF2 properly
      ath9k: Choose correct rate for 2GHz channel

Taehee Yoo (2):
      rtlwifi: add support to send beacon frame.
      rtlwifi: rtl8192cu: Set fw_ready flag

Troy Tan (5):
      rtlwifi: rtl8192ee: Fix adhoc fail
      rtlwifi: rtl8192ee: Fix TX hang due to failure to update TX write point
      rtlwifi: rtl8192ee: Fix parsing of received packet
      rtlwifi: rtl8192ee: Fix DMA stalls
      rtlwifi: rtl8192ee: Fix handling of new style descriptors

Vasanthakumar Thiagarajan (1):
      ath10k: Fix potential Rx ring corruption

Vladimir Kondratiev (9):
      wil6210: sync WMI with firmware
      wil6210: implement skb Tx status reporting
      wil6210: implement cfg80211 probe_client() op
      wil6210: move Rx reorder buffer allocation out of spinlock
      wil6210: remove old Tx work-around
      wil6210: avoid Tx descriptor double write
      wil6210: fix race between xmit and Tx vring de-allocation
      wil6210: more Tx debug
      wil6210: print ciphers in debug info

Vladimir Shulman (4):
      wil6210: Add Tx queue len configuration
      wil6210: tuning rings size
      wil6210: interrupt moderation configuration update
      wil6210: remove unnecessary interrupt moderation module parameters

Yanbo Li (1):
      ath10k: Enable the MCS8 and MCS9 at 2.4G band

Yogesh Ashok Powar (2):
      mwifiex: add support for SD8801
      mwifiex: add support for USB8801

 drivers/bcma/bcma_private.h                        |    8 +
 drivers/bcma/driver_chipcommon.c                   |   10 +-
 drivers/bcma/driver_pci.c                          |   68 +-
 drivers/bcma/host_pci.c                            |    6 +-
 drivers/bcma/main.c                                |   27 +-
 drivers/bcma/sprom.c                               |    3 +-
 drivers/net/wireless/ath/ath.h                     |    1 +
 drivers/net/wireless/ath/ath10k/Makefile           |    4 +-
 drivers/net/wireless/ath/ath10k/ce.c               |   12 +-
 drivers/net/wireless/ath/ath10k/ce.h               |    2 +-
 drivers/net/wireless/ath/ath10k/core.c             |   72 ++
 drivers/net/wireless/ath/ath10k/core.h             |   40 +-
 drivers/net/wireless/ath/ath10k/debug.c            |   34 +-
 drivers/net/wireless/ath/ath10k/debug.h            |   11 +-
 drivers/net/wireless/ath/ath10k/debugfs_sta.c      |  243 ++++++
 drivers/net/wireless/ath/ath10k/htc.c              |    6 +-
 drivers/net/wireless/ath/ath10k/htt.c              |    3 +-
 drivers/net/wireless/ath/ath10k/htt.h              |   87 ++-
 drivers/net/wireless/ath/ath10k/htt_rx.c           |  402 +++++++++-
 drivers/net/wireless/ath/ath10k/htt_tx.c           |   94 +--
 drivers/net/wireless/ath/ath10k/hw.c               |   58 ++
 drivers/net/wireless/ath/ath10k/hw.h               |  106 ++-
 drivers/net/wireless/ath/ath10k/mac.c              |  455 ++++++++---
 drivers/net/wireless/ath/ath10k/pci.c              |  151 +++-
 drivers/net/wireless/ath/ath10k/pci.h              |    2 +-
 drivers/net/wireless/ath/ath10k/rx_desc.h          |   25 +-
 drivers/net/wireless/ath/ath10k/targaddrs.h        |    5 +
 drivers/net/wireless/ath/ath10k/thermal.c          |    7 +-
 drivers/net/wireless/ath/ath10k/trace.h            |   68 ++
 drivers/net/wireless/ath/ath10k/txrx.c             |    9 +-
 drivers/net/wireless/ath/ath10k/wmi-ops.h          |  222 +++++-
 drivers/net/wireless/ath/ath10k/wmi-tlv.c          |  532 ++++++++++++-
 drivers/net/wireless/ath/ath10k/wmi-tlv.h          |   64 ++
 drivers/net/wireless/ath/ath10k/wmi.c              |  519 ++++++++++---
 drivers/net/wireless/ath/ath10k/wmi.h              |  155 +++-
 drivers/net/wireless/ath/ath5k/reset.c             |    2 +-
 drivers/net/wireless/ath/ath9k/ar9003_calib.c      |   61 +-
 drivers/net/wireless/ath/ath9k/ar9003_wow.c        |  315 ++++----
 drivers/net/wireless/ath/ath9k/ar953x_initvals.h   |    4 +-
 .../net/wireless/ath/ath9k/ar955x_1p0_initvals.h   |    4 +-
 drivers/net/wireless/ath/ath9k/ath9k.h             |   15 +-
 drivers/net/wireless/ath/ath9k/common-spectral.c   |    2 +-
 drivers/net/wireless/ath/ath9k/debug.c             |   68 ++
 drivers/net/wireless/ath/ath9k/gpio.c              |    2 +-
 drivers/net/wireless/ath/ath9k/htc.h               |    2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_gpio.c      |    2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_init.c      |    4 +-
 drivers/net/wireless/ath/ath9k/hw.c                |   10 +-
 drivers/net/wireless/ath/ath9k/hw.h                |   37 +-
 drivers/net/wireless/ath/ath9k/init.c              |    5 +-
 drivers/net/wireless/ath/ath9k/main.c              |    9 -
 drivers/net/wireless/ath/ath9k/pci.c               |    5 +-
 drivers/net/wireless/ath/ath9k/reg.h               |  125 +--
 drivers/net/wireless/ath/ath9k/reg_wow.h           |  128 +++
 drivers/net/wireless/ath/ath9k/wow.c               |  228 +++---
 drivers/net/wireless/ath/wil6210/Kconfig           |    9 -
 drivers/net/wireless/ath/wil6210/Makefile          |    1 -
 drivers/net/wireless/ath/wil6210/cfg80211.c        |  149 +++-
 drivers/net/wireless/ath/wil6210/main.c            |   73 +-
 drivers/net/wireless/ath/wil6210/netdev.c          |   15 +-
 drivers/net/wireless/ath/wil6210/rx_reorder.c      |    8 +-
 drivers/net/wireless/ath/wil6210/txrx.c            |   81 +-
 drivers/net/wireless/ath/wil6210/wil6210.h         |   26 +-
 drivers/net/wireless/ath/wil6210/wil_platform.c    |   12 +-
 .../net/wireless/ath/wil6210/wil_platform_msm.c    |  257 ------
 .../net/wireless/ath/wil6210/wil_platform_msm.h    |   24 -
 drivers/net/wireless/ath/wil6210/wmi.c             |   17 +-
 drivers/net/wireless/ath/wil6210/wmi.h             |   58 +-
 drivers/net/wireless/b43/Kconfig                   |    9 +
 drivers/net/wireless/b43/Makefile                  |    1 +
 drivers/net/wireless/b43/b43.h                     |    3 +
 drivers/net/wireless/b43/main.c                    |   70 +-
 drivers/net/wireless/b43/phy_ac.c                  |   92 +++
 drivers/net/wireless/b43/phy_ac.h                  |   38 +
 drivers/net/wireless/b43/phy_common.c              |    9 +-
 drivers/net/wireless/b43/phy_common.h              |    2 +
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c   |   70 +-
 drivers/net/wireless/brcm80211/brcmfmac/bus.h      |   24 +-
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c |   31 +-
 drivers/net/wireless/brcm80211/brcmfmac/common.c   |   31 +-
 .../net/wireless/brcm80211/brcmfmac/commonring.h   |    2 +
 drivers/net/wireless/brcm80211/brcmfmac/core.c     |   39 +-
 drivers/net/wireless/brcm80211/brcmfmac/core.h     |   30 +
 drivers/net/wireless/brcm80211/brcmfmac/firmware.c |    6 +-
 drivers/net/wireless/brcm80211/brcmfmac/fwil.c     |    2 +-
 drivers/net/wireless/brcm80211/brcmfmac/fwil.h     |    1 +
 .../net/wireless/brcm80211/brcmfmac/fwil_types.h   |   41 +
 drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c   |   30 +-
 drivers/net/wireless/brcm80211/brcmfmac/pcie.c     |    2 +-
 drivers/net/wireless/brcm80211/brcmfmac/sdio.c     |  171 ++--
 drivers/net/wireless/brcm80211/brcmfmac/sdio.h     |   12 +-
 drivers/net/wireless/brcm80211/brcmfmac/usb.c      |    6 +-
 drivers/net/wireless/brcm80211/brcmsmac/debug.c    |    2 +-
 drivers/net/wireless/brcm80211/brcmutil/utils.c    |   32 +-
 .../net/wireless/brcm80211/include/brcmu_utils.h   |    4 +
 drivers/net/wireless/cw1200/fwio.c                 |   40 +-
 drivers/net/wireless/cw1200/scan.c                 |    8 +-
 drivers/net/wireless/hostap/hostap_ap.c            |    2 +-
 drivers/net/wireless/iwlwifi/dvm/main.c            |    7 +-
 drivers/net/wireless/iwlwifi/dvm/tx.c              |    2 +-
 drivers/net/wireless/iwlwifi/dvm/ucode.c           |    2 +-
 drivers/net/wireless/iwlwifi/iwl-config.h          |    2 +-
 drivers/net/wireless/iwlwifi/iwl-drv.c             |    5 -
 drivers/net/wireless/iwlwifi/iwl-fw-file.h         |    2 +
 drivers/net/wireless/iwlwifi/iwl-modparams.h       |    2 -
 drivers/net/wireless/iwlwifi/iwl-prph.h            |   26 +-
 drivers/net/wireless/iwlwifi/iwl-scd.h             |   41 +-
 drivers/net/wireless/iwlwifi/iwl-trans.h           |   29 +-
 drivers/net/wireless/iwlwifi/mvm/constants.h       |    2 +-
 drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h       |   43 +-
 drivers/net/wireless/iwlwifi/mvm/fw.c              |    3 +-
 drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c        |   10 +-
 drivers/net/wireless/iwlwifi/mvm/mac80211.c        |   12 +-
 drivers/net/wireless/iwlwifi/mvm/mvm.h             |   23 +-
 drivers/net/wireless/iwlwifi/mvm/ops.c             |   28 +-
 drivers/net/wireless/iwlwifi/mvm/rs.c              |  241 +++++-
 drivers/net/wireless/iwlwifi/mvm/rs.h              |   14 +-
 drivers/net/wireless/iwlwifi/mvm/scan.c            |   24 +-
 drivers/net/wireless/iwlwifi/mvm/sta.c             |   15 +-
 drivers/net/wireless/iwlwifi/mvm/tdls.c            |   63 +-
 drivers/net/wireless/iwlwifi/mvm/utils.c           |   10 +-
 drivers/net/wireless/iwlwifi/pcie/internal.h       |   10 +-
 drivers/net/wireless/iwlwifi/pcie/trans.c          |    5 +-
 drivers/net/wireless/iwlwifi/pcie/tx.c             |   58 +-
 drivers/net/wireless/mwifiex/11h.c                 |  198 ++++-
 drivers/net/wireless/mwifiex/11n.c                 |    4 +-
 drivers/net/wireless/mwifiex/11n_rxreorder.c       |    2 +-
 drivers/net/wireless/mwifiex/cfg80211.c            |  816 +++++++++++++++-----
 drivers/net/wireless/mwifiex/cfp.c                 |    4 +-
 drivers/net/wireless/mwifiex/cmdevt.c              |   40 +-
 drivers/net/wireless/mwifiex/decl.h                |   21 +
 drivers/net/wireless/mwifiex/fw.h                  |   58 ++
 drivers/net/wireless/mwifiex/ie.c                  |   89 ++-
 drivers/net/wireless/mwifiex/init.c                |   12 +-
 drivers/net/wireless/mwifiex/main.c                |   14 +-
 drivers/net/wireless/mwifiex/main.h                |   60 +-
 drivers/net/wireless/mwifiex/pcie.c                |    2 +
 drivers/net/wireless/mwifiex/pcie.h                |    3 +
 drivers/net/wireless/mwifiex/scan.c                |   10 +-
 drivers/net/wireless/mwifiex/sdio.c                |    7 +
 drivers/net/wireless/mwifiex/sdio.h                |   23 +
 drivers/net/wireless/mwifiex/sta_cmd.c             |   17 +-
 drivers/net/wireless/mwifiex/sta_cmdresp.c         |    5 +
 drivers/net/wireless/mwifiex/sta_event.c           |   15 +-
 drivers/net/wireless/mwifiex/sta_ioctl.c           |   32 +-
 drivers/net/wireless/mwifiex/sta_tx.c              |    9 +-
 drivers/net/wireless/mwifiex/txrx.c                |    2 +-
 drivers/net/wireless/mwifiex/uap_cmd.c             |   70 ++
 drivers/net/wireless/mwifiex/uap_event.c           |   47 ++
 drivers/net/wireless/mwifiex/usb.c                 |   16 +
 drivers/net/wireless/mwifiex/usb.h                 |    4 +
 drivers/net/wireless/mwifiex/util.c                |    2 +-
 drivers/net/wireless/mwifiex/wmm.c                 |    3 +
 drivers/net/wireless/orinoco/main.c                |    2 +-
 drivers/net/wireless/orinoco/orinoco_pci.c         |    2 +-
 drivers/net/wireless/orinoco/orinoco_plx.c         |    2 +-
 drivers/net/wireless/orinoco/orinoco_tmd.c         |    2 +-
 drivers/net/wireless/rtlwifi/core.c                |   11 +
 drivers/net/wireless/rtlwifi/pci.c                 |   31 +-
 drivers/net/wireless/rtlwifi/pci.h                 |    7 +
 drivers/net/wireless/rtlwifi/rtl8192cu/hw.c        |    4 +
 drivers/net/wireless/rtlwifi/rtl8192ee/fw.c        |    6 +-
 drivers/net/wireless/rtlwifi/rtl8192ee/hw.c        |  166 +++-
 drivers/net/wireless/rtlwifi/rtl8192ee/reg.h       |    2 +
 drivers/net/wireless/rtlwifi/rtl8192ee/sw.c        |    3 +-
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.c       |   36 +-
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.h       |    3 +
 drivers/net/wireless/rtlwifi/wifi.h                |    1 +
 drivers/ssb/main.c                                 |   19 -
 include/linux/bcma/bcma.h                          |    1 +
 include/linux/bcma/bcma_driver_pci.h               |    2 +
 include/linux/bcma/bcma_regs.h                     |    2 +
 include/linux/ssb/ssb_regs.h                       |    1 +
 173 files changed, 6463 insertions(+), 2183 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/debugfs_sta.c
 create mode 100644 drivers/net/wireless/ath/ath10k/hw.c
 create mode 100644 drivers/net/wireless/ath/ath9k/reg_wow.h
 delete mode 100644 drivers/net/wireless/ath/wil6210/wil_platform_msm.c
 delete mode 100644 drivers/net/wireless/ath/wil6210/wil_platform_msm.h
 create mode 100644 drivers/net/wireless/b43/phy_ac.c
 create mode 100644 drivers/net/wireless/b43/phy_ac.h

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH next 2/6] bonding: implement bond_poll_controller()
From: Veaceslav Falico @ 2015-02-07  9:04 UTC (permalink / raw)
  To: Mahesh Bandewar
  Cc: Jay Vosburgh, Andy Gospodarek, Nikolay Aleksandrov, David Miller,
	netdev, Eric Dumazet
In-Reply-To: <1423270311-9181-1-git-send-email-maheshb@google.com>

On Fri, Feb 06, 2015 at 04:51:51PM -0800, Mahesh Bandewar wrote:
>This patches implements the poll_controller support for all
>bonding driver. If the slaves have poll_controller net_op defined,
>this implementation calls them. This is mode agnostic implementation
>and iterates through all slaves (based on mode) and calls respective
>handler.
>
>Signed-off-by: Mahesh Bandewar <maheshb@google.com>

Really good patchset, thank you. Two nitpicks below, nothing serious. Also,
please, add Doc/bonding.txt changes for every user-visible
change/enhancement, this doc is a go-to for a lot of users.

Otherwise, with the doc and other issues, pointed by Jay and Andy, fixed, I
guess it's good to go. The 0/ patch would be welcome too, btw.

>---
> drivers/net/bonding/bond_3ad.c  | 24 +++++++++++++++++++++
> drivers/net/bonding/bond_main.c | 47 +++++++++++++++++++++++++++++++++++++++++
> include/net/bond_3ad.h          |  1 +
> 3 files changed, 72 insertions(+)
>
>diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>index 9b436696b95e..14f2ebe786c5 100644
>--- a/drivers/net/bonding/bond_3ad.c
>+++ b/drivers/net/bonding/bond_3ad.c
>@@ -2477,6 +2477,30 @@ int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info)
> 	return ret;
> }
>
>+#define BOND_3AD_PORT_OPERATIONAL \
>+		(AD_STATE_DISTRIBUTING | AD_STATE_COLLECTING | \
>+		 AD_STATE_SYNCHRONIZATION | AD_STATE_AGGREGATION)
>+
>+static int bond_3ad_port_operational(struct slave *slave)
>+{
>+	port_t *port = &SLAVE_AD_INFO(slave)->port;
>+
>+	return bond_slave_can_tx(slave) &&
>+	       (port->actor_oper_port_state & port->partner_oper.port_state &
>+		BOND_3AD_PORT_OPERATIONAL) == BOND_3AD_PORT_OPERATIONAL;
>+}
>+
>+/* bond_3ad_port_is_active - check if a slave port is active or not. A port
>+ * is active when it can forward traffic.
>+ *
>+ * @slave: slave port to check state for.
>+ * Returns: 0 if not active else is active.
>+ */
>+int bond_3ad_port_is_active(struct slave *slave)
>+{
>+	return bond_3ad_port_operational(slave);
>+}
>+
> int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
> 			 struct slave *slave)
> {
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index c9e519cb9214..a50ec87486f3 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -928,6 +928,53 @@ static inline void slave_disable_netpoll(struct slave *slave)
>
> static void bond_poll_controller(struct net_device *bond_dev)
> {
>+	struct bonding *bond = netdev_priv(bond_dev);
>+	struct slave *slave = NULL;
>+	struct list_head *iter;
>+	struct ad_info ad_info;
>+	struct aggregator *agg;
>+	const struct net_device_ops *ops;
>+	bool call_slave_netpoll;
>+
>+	if (BOND_MODE(bond) == BOND_MODE_8023AD)
>+		if (bond_3ad_get_active_agg_info(bond, &ad_info))
>+			return;
>+
>+	bond_for_each_slave(bond, slave, iter) {
>+		call_slave_netpoll = false;
>+		switch (BOND_MODE(bond)) {
>+		case BOND_MODE_8023AD:
>+			agg = SLAVE_AD_INFO(slave)->port.aggregator;
>+			if (!bond_slave_is_up(slave))

bond_3ad_port_is_active() already contains the check for being up.

>+				break;
>+			if (agg && agg->aggregator_identifier !=

Hm, should we poll it without an aggregator?

>+				ad_info.aggregator_id)
>+				break;
>+			if (!bond_3ad_port_is_active(slave) &&
>+			    ad_info.ports != 1)
>+				break;
>+
>+			call_slave_netpoll = true;
>+			break;
>+		default:
>+			if (bond_slave_is_up(slave))
>+				call_slave_netpoll = true;
>+			break;
>+		}
>+
>+		if (call_slave_netpoll) {
>+			ops = slave->dev->netdev_ops;
>+			if (ops->ndo_poll_controller) {

It's weird to see this check so down the road. Maybe reorg the logic to
something like:

bond_for_each_slave() {
	if (!bond_slave_is_up() || !bond_slave_has_ndo_poll())
		continue;

	if (BOND_MODE(bond) == 3AD && !bond_3ad_port_is_active())
		continue;

	slave-do_ndo_poll_stuff();
}

Just as a thought, might be easier to read/shorter.

>+				struct netpoll_info *ni =
>+					rcu_dereference_bh(slave->dev->npinfo);
>+
>+				if (down_trylock(&ni->dev_lock))
>+					continue;
>+				ops->ndo_poll_controller(slave->dev);
>+				up(&ni->dev_lock);
>+			}
>+		}
>+	}
> }
>
> static void bond_netpoll_cleanup(struct net_device *bond_dev)
>diff --git a/include/net/bond_3ad.h b/include/net/bond_3ad.h
>index f04cdbb7848e..6c455c646d61 100644
>--- a/include/net/bond_3ad.h
>+++ b/include/net/bond_3ad.h
>@@ -278,5 +278,6 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
> 			 struct slave *slave);
> int bond_3ad_set_carrier(struct bonding *bond);
> void bond_3ad_update_lacp_rate(struct bonding *bond);
>+int bond_3ad_port_is_active(struct slave *slave);
> #endif /* _NET_BOND_3AD_H */
>
>-- 
>2.2.0.rc0.207.ga3a616c
>

^ permalink raw reply

* Re: [PATCH next 5/6] bonding: Allow userspace to set macaddr on bonding-dev
From: Maciej Żenczykowski @ 2015-02-07  7:11 UTC (permalink / raw)
  To: Jay Vosburgh
  Cc: Mahesh Bandewar, Andy Gospodarek, Veaceslav Falico,
	Nikolay Aleksandrov, David Miller, netdev, Eric Dumazet
In-Reply-To: <7179.1423291742@famine>

The worry is about other machines connected to the same switch being able
to sniff/guess-timate enough to be able to flood a switch with LACP packets
and effectively join another machines aggregate, and thus potentially break
another machines network connectivity and/or sniff their traffic and/or spoof
their connectivity.

^ permalink raw reply

* Re: [PATCH next 5/6] bonding: Allow userspace to set macaddr on bonding-dev
From: Jay Vosburgh @ 2015-02-07  6:49 UTC (permalink / raw)
  To: Mahesh Bandewar
  Cc: Andy Gospodarek, Veaceslav Falico, Nikolay Aleksandrov,
	David Miller, netdev, Eric Dumazet, Maciej Żenczykowski
In-Reply-To: <CAF2d9ji=Z+wVz7AdpSeNmOwys0jqWsx6TYsCML_+Hw=u+QMt_A@mail.gmail.com>

Mahesh Bandewar <maheshb@google.com> wrote:

>On Fri, Feb 6, 2015 at 5:54 PM, Jay Vosburgh <jay.vosburgh@canonical.com> wrote:
>> Mahesh Bandewar <maheshb@google.com> wrote:
>>
>>>On Fri, Feb 6, 2015 at 5:20 PM, Jay Vosburgh <jay.vosburgh@canonical.com> wrote:
>>>> Mahesh Bandewar <maheshb@google.com> wrote:
>>>>
>>>>>This patch allows user-space to set the mac-address on the bonding device.
>>>>>This mac-address can not be NULL or a Multicast. If the mac-address is set
>>>>>from user-space; kernel will honor it and will not overwrite it. In the
>>>>>absense (value from user space); the logic will default to using the
>>>>>masters' mac as the mac address for the bonding device.
>>>>>
>>>>>It can be set using example code below -
>>>>>
>>>>>   # modprobe bonding mode=4
>>>>>   # sys_mac_addr=$(printf '%02x:%02x:%02x:%02x:%02x:%02x' \
>>>>>                    $(( (RANDOM & 0xFE) | 0x02 )) \
>>>>>                    $(( RANDOM & 0xFF )) \
>>>>>                    $(( RANDOM & 0xFF )) \
>>>>>                    $(( RANDOM & 0xFF )) \
>>>>>                    $(( RANDOM & 0xFF )) \
>>>>>                    $(( RANDOM & 0xFF )))
>>>>>   # echo $sys_mac_addr > /sys/class/net/bond0/bonding/ad_actor_system_mac_address
>>>>>   # echo +eth1 > /sys/class/net/bond0/bonding/slaves
>>>>>   ...
>>>>>   # ip link set bond0 up
>>>>
>>>>         How is this patch functionally different from setting the
>>>> bonding master's MAC address to a particular value prior to adding any
>>>> slaves?
>>>>
>>>
>>>Maciej is correct but I think I was bit ambiguous about it in the
>>>commit message which might have made you think this way. I'll reword
>>>the commit message.
>>
>>         Thanks; presumably there is some administrative reason for this.
>>
>The idea is that in an AD system the actor-partner communication is a
>business between them two only and no one in the L2 domain should
>care. These enhancements should obscure that should anyone try to
>sniff it. Probably I assumed too much and should add this idea behind
>the implementation in the commit log.

	Well, the LACPDUs can always be sniffed on ingress to the
destination linux system with something like tcpdump, but they don't
propagate, so I'm not sure how a third party would ever see them.  The
actor_system value isn't really a secret, either, in the sense of
needing to be kept hidden (your patch even adds it to
/proc/net/bonding/*).

	Has there been some kind of issue with this?

	In any event, the requirements for the actor_system in the
standard are pretty much that it's a globally unique MAC address, so
there's no real issue with permitting it to be set from that
perspective.

>>         Also, for patches 4, 5 and 6, I believe current practice is to
>> provide a netlink / iproute2 facility for options.
>>
>OK. I'll add them (netlink enhancements) in a separate set of patch(s).

	Also, I neglected to mention that the new options should be
added to Documentation/networking/bonding.txt.

>>>>>Signed-off-by: Mahesh Bandewar <maheshb@google.com>
>>>>>---
>>>>> drivers/net/bonding/bond_3ad.c     |  7 ++++++-
>>>>> drivers/net/bonding/bond_main.c    |  1 +
>>>>> drivers/net/bonding/bond_options.c | 29 +++++++++++++++++++++++++++++
>>>>> drivers/net/bonding/bond_procfs.c  |  6 ++++++
>>>>> drivers/net/bonding/bond_sysfs.c   | 16 ++++++++++++++++
>>>>> include/net/bond_options.h         |  1 +
>>>>> include/net/bonding.h              |  1 +
>>>>> 7 files changed, 60 insertions(+), 1 deletion(-)
>>>>>
>>>>>diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>>>>>index 1177f96194dd..373d3db3809f 100644
>>>>>--- a/drivers/net/bonding/bond_3ad.c
>>>>>+++ b/drivers/net/bonding/bond_3ad.c
>>>>>@@ -1914,7 +1914,12 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution)
>>>>>
>>>>>               BOND_AD_INFO(bond).system.sys_priority =
>>>>>                       bond->params.ad_actor_sysprio;
>>>>>-              BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr *)bond->dev->dev_addr);
>>>>>+              if (is_zero_ether_addr(bond->params.ad_actor_sys_macaddr))
>>>>>+                      BOND_AD_INFO(bond).system.sys_mac_addr =
>>>>>+                          *((struct mac_addr *)bond->dev->dev_addr);
>>>>>+              else
>>>>>+                      BOND_AD_INFO(bond).system.sys_mac_addr =
>>>>>+                          *((struct mac_addr *)bond->params.ad_actor_sys_macaddr);
>>>>>
>>>>>               /* initialize how many times this module is called in one
>>>>>                * second (should be about every 100ms)
>>>>>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>>>>>index 561b2bde5aeb..1a6735ef2ea7 100644
>>>>>--- a/drivers/net/bonding/bond_main.c
>>>>>+++ b/drivers/net/bonding/bond_main.c
>>>>>@@ -4440,6 +4440,7 @@ static int bond_check_params(struct bond_params *params)
>>>>>       params->packets_per_slave = packets_per_slave;
>>>>>       params->tlb_dynamic_lb = 1; /* Default value */
>>>>>       params->ad_actor_sysprio = ad_actor_sysprio;
>>>>>+      eth_zero_addr(params->ad_actor_sys_macaddr);
>>>>>       if (packets_per_slave > 0) {
>>>>>               params->reciprocal_packets_per_slave =
>>>>>                       reciprocal_value(packets_per_slave);
>>>>>diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
>>>>>index d8f6760143ae..330d48b6a1e6 100644
>>>>>--- a/drivers/net/bonding/bond_options.c
>>>>>+++ b/drivers/net/bonding/bond_options.c
>>>>>@@ -72,6 +72,8 @@ static int bond_option_tlb_dynamic_lb_set(struct bonding *bond,
>>>>>                                 const struct bond_opt_value *newval);
>>>>> static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
>>>>>                                 const struct bond_opt_value *newval);
>>>>>+static int bond_option_ad_actor_sys_macaddr_set(struct bonding *bond,
>>>>>+                                const struct bond_opt_value *newval);
>>>>>
>>>>>
>>>>> static const struct bond_opt_value bond_mode_tbl[] = {
>>>>>@@ -396,6 +398,13 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
>>>>>               .values = bond_ad_actor_sysprio_tbl,
>>>>>               .set = bond_option_ad_actor_sysprio_set,
>>>>>       },
>>>>>+      [BOND_OPT_AD_ACTOR_SYS_MACADDR] = {
>>>>>+              .id = BOND_OPT_AD_ACTOR_SYS_MACADDR,
>>>>>+              .name = "ad_actor_system_mac_address",
>>>>>+              .unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_8023AD)),
>>>>>+              .flags = BOND_OPTFLAG_RAWVAL | BOND_OPTFLAG_IFDOWN,
>>>>>+              .set = bond_option_ad_actor_sys_macaddr_set,
>>>>>+      },
>>>>> };
>>>>>
>>>>> /* Searches for an option by name */
>>>>>@@ -1376,3 +1385,23 @@ static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
>>>>>       bond->params.ad_actor_sysprio = newval->value;
>>>>>       return 0;
>>>>> }
>>>>>+
>>>>>+static int bond_option_ad_actor_sys_macaddr_set(struct bonding *bond,
>>>>>+                                          const struct bond_opt_value *newval)
>>>>>+{
>>>>>+      u8 macaddr[ETH_ALEN];
>>>>>+      int i;
>>>>>+
>>>>>+      i = sscanf(newval->string, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
>>>>>+                 &macaddr[0], &macaddr[1], &macaddr[2],
>>>>>+                 &macaddr[3], &macaddr[4], &macaddr[5]);
>>>>>+
>>>>>+      if (i != ETH_ALEN || !is_valid_ether_addr(macaddr)) {
>>>>>+              netdev_err(bond->dev, "Invalid MAC address.\n");
>>>>>+              return -EINVAL;
>>>>>+      }
>>>>>+
>>>>>+      ether_addr_copy(bond->params.ad_actor_sys_macaddr, macaddr);

	I think this operation should probably fail if the bond has any
slaves, as the new value will not actually propagate out to what's being
used in LACPDUs in that case.

	Looking at the other two new option patches, I think this
comment also applies to them.

	-J

>>>>>+      return 0;
>>>>>+}
>>>>>diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
>>>>>index 9e33c48886ef..81452ced852f 100644
>>>>>--- a/drivers/net/bonding/bond_procfs.c
>>>>>+++ b/drivers/net/bonding/bond_procfs.c
>>>>>@@ -136,6 +136,8 @@ static void bond_info_show_master(struct seq_file *seq)
>>>>>                          optval->string);
>>>>>               seq_printf(seq, "System priority: %d\n",
>>>>>                               BOND_AD_INFO(bond).system.sys_priority);
>>>>>+              seq_printf(seq, "System MAC address: %pM\n",
>>>>>+                              &BOND_AD_INFO(bond).system.sys_mac_addr);
>>>>>
>>>>>               if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
>>>>>                       seq_printf(seq, "bond %s has no active aggregator\n",
>>>>>@@ -198,6 +200,8 @@ static void bond_info_show_slave(struct seq_file *seq,
>>>>>                       seq_puts(seq, "details actor lacp pdu:\n");
>>>>>                       seq_printf(seq, "    system priority: %d\n",
>>>>>                                  port->actor_system_priority);
>>>>>+                      seq_printf(seq, "    system mac address: %pM\n",
>>>>>+                                 &port->actor_system);
>>>>>                       seq_printf(seq, "    port key: %d\n",
>>>>>                                  port->actor_oper_port_key);
>>>>>                       seq_printf(seq, "    port priority: %d\n",
>>>>>@@ -210,6 +214,8 @@ static void bond_info_show_slave(struct seq_file *seq,
>>>>>                       seq_puts(seq, "details partner lacp pdu:\n");
>>>>>                       seq_printf(seq, "    system priority: %d\n",
>>>>>                                  port->partner_oper.system_priority);
>>>>>+                      seq_printf(seq, "    system mac address: %pM\n",
>>>>>+                                 &port->partner_oper.system);
>>>>>                       seq_printf(seq, "    oper key: %d\n",
>>>>>                                  port->partner_oper.key);
>>>>>                       seq_printf(seq, "    port priority: %d\n",
>>>>>diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
>>>>>index 4350aa06f867..91713d0b6685 100644
>>>>>--- a/drivers/net/bonding/bond_sysfs.c
>>>>>+++ b/drivers/net/bonding/bond_sysfs.c
>>>>>@@ -706,6 +706,21 @@ static ssize_t bonding_show_ad_actor_sysprio(struct device *d,
>>>>> static DEVICE_ATTR(ad_actor_system_priority, S_IRUGO | S_IWUSR,
>>>>>                  bonding_show_ad_actor_sysprio, bonding_sysfs_store_option);
>>>>>
>>>>>+static ssize_t bonding_show_ad_actor_sys_macaddr(struct device *d,
>>>>>+                                               struct device_attribute *attr,
>>>>>+                                               char *buf)
>>>>>+{
>>>>>+      struct bonding *bond = to_bond(d);
>>>>>+
>>>>>+      if (BOND_MODE(bond) == BOND_MODE_8023AD)
>>>>>+              return sprintf(buf, "%pM\n", bond->params.ad_actor_sys_macaddr);
>>>>>+
>>>>>+      return 0;
>>>>>+}
>>>>>+static DEVICE_ATTR(ad_actor_system_mac_address, S_IRUGO | S_IWUSR,
>>>>>+                 bonding_show_ad_actor_sys_macaddr,
>>>>>+                 bonding_sysfs_store_option);
>>>>>+
>>>>> static struct attribute *per_bond_attrs[] = {
>>>>>       &dev_attr_slaves.attr,
>>>>>       &dev_attr_mode.attr,
>>>>>@@ -740,6 +755,7 @@ static struct attribute *per_bond_attrs[] = {
>>>>>       &dev_attr_packets_per_slave.attr,
>>>>>       &dev_attr_tlb_dynamic_lb.attr,
>>>>>       &dev_attr_ad_actor_system_priority.attr,
>>>>>+      &dev_attr_ad_actor_system_mac_address.attr,
>>>>>       NULL,
>>>>> };
>>>>>
>>>>>diff --git a/include/net/bond_options.h b/include/net/bond_options.h
>>>>>index c2af1db37354..993ef73cd050 100644
>>>>>--- a/include/net/bond_options.h
>>>>>+++ b/include/net/bond_options.h
>>>>>@@ -64,6 +64,7 @@ enum {
>>>>>       BOND_OPT_SLAVES,
>>>>>       BOND_OPT_TLB_DYNAMIC_LB,
>>>>>       BOND_OPT_AD_ACTOR_SYSPRIO,
>>>>>+      BOND_OPT_AD_ACTOR_SYS_MACADDR,
>>>>>       BOND_OPT_LAST
>>>>> };
>>>>>
>>>>>diff --git a/include/net/bonding.h b/include/net/bonding.h
>>>>>index 7a5c79fcf866..cd2092e6bc71 100644
>>>>>--- a/include/net/bonding.h
>>>>>+++ b/include/net/bonding.h
>>>>>@@ -144,6 +144,7 @@ struct bond_params {
>>>>>       int tlb_dynamic_lb;
>>>>>       struct reciprocal_value reciprocal_packets_per_slave;
>>>>>       u16 ad_actor_sysprio;
>>>>>+      u8 ad_actor_sys_macaddr[ETH_ALEN];
>>>>> };
>>>>>
>>>>> struct bond_parm_tbl {
>>>>>--
>>>>>2.2.0.rc0.207.ga3a616c

---
	-Jay Vosburgh, jay.vosburgh@canonical.com

^ permalink raw reply

* Re: [PATCH 1/1] neighbour: Support broadcast ARP in neighbor PROPE state
From: Cong Wang @ 2015-02-07  6:46 UTC (permalink / raw)
  To: zhuyj
  Cc: Linux Kernel Network Developers, stefan.costandache,
	alexandre.dietsch, yue.tao, clinton.slabbert, eulfsam,
	David S. Miller
In-Reply-To: <1423120837-28102-1-git-send-email-zyjzyj2000@gmail.com>

On Wed, Feb 4, 2015 at 11:20 PM, zhuyj <zyjzyj2000@gmail.com> wrote:
> diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
> index bd29016..4d13edb 100644
> --- a/net/ipv4/Kconfig
> +++ b/net/ipv4/Kconfig
> @@ -259,6 +259,23 @@ config IP_PIMSM_V2
>           gated-5). This routing protocol is not used widely, so say N unless
>           you want to play with it.
>
> +config ARP_PROBE_BCAST
> +       bool "IP: ARP send broadcast ARP, if probing using unicast fails"
> +       default y

Why make it default to y? Since we use the current behavior for a long time?

^ permalink raw reply

* Re: [Patch net-next] ipv6: fix redefinition of in6_pktinfo and ip6_mtuinfo
From: Cong Wang @ 2015-02-07  6:39 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: David Miller, Linux Kernel Network Developers, vlee
In-Reply-To: <54D4512A.5080809@redhat.com>

Hi, Carlos

On Thu, Feb 5, 2015 at 9:29 PM, Carlos O'Donell <carlos@redhat.com> wrote:
>
> When does this hit mainline? I've got Cong's patch ready for glibc, but
> the usual procedure is to commit after mainline has the matching patch.
> Not that it really matters, but it's just a useful thing to be able to
> say the trickle down is linux->glibc.
>

It will be merged in the next merge window, currently it is just in net-next.

Thanks.

^ permalink raw reply

* Re: [PATCH next 4/6] bonding: Allow userspace to set system_priority
From: Jay Vosburgh @ 2015-02-07  6:19 UTC (permalink / raw)
  To: Andy Gospodarek
  Cc: Mahesh Bandewar, Andy Gospodarek, Veaceslav Falico,
	Nikolay Aleksandrov, David Miller, netdev, Eric Dumazet
In-Reply-To: <20150207033847.GD34197@gospo.home.greyhouse.net>

Andy Gospodarek <gospo@cumulusnetworks.com> wrote:

>On Fri, Feb 06, 2015 at 04:51:54PM -0800, Mahesh Bandewar wrote:
>> This patch allows user to randomize the system-priority in an ad-system.
>> The allowed range is 1 - 0xFFFF while default value is 0xFFFF. If user
>> does not specify this value, the system defaults to 0xFFFF, which is
>> what it was before this patch.
>> 
>> Following example code could set the value -
>>     # modprobe bonding mode=4
>>     # sys_prio=$(( 1 + RANDOM + RANDOM ))
>>     # echo $sys_prio > /sys/class/net/bond0/bonding/ad_actor_system_priority
>
>If I can convince you to change 'ad_actor_system_macaddr' to something
>different can I also convince you to change this to something shorter,
>too?  :)
>
>Maybe 'ad_sys_priority' or something?

	The name, verbose as it is, is from the 802.1AX standard, and
there's also a "partner_system_priority" (which is not a user-settable
thing, it's a field in the LACPDUs).  My suggestion would therefore be
"ad_actor_sys_prio" for this one, as I think there's some value in
continuity with the names from the standard.

	The MAC address one in the standard is just "actor_system";
there's a "partner_system" here, too, which is also a field in the
LACPDU.  I'm ok with calling that one just "actor_system," as presumably
anyone changing it will know what it means.

	-J

>Thanks!
>
>>     # echo +eth1 > /sys/class/net/bond0/bonding/slaves
>>     ...
>>     # ip link set bond0 up
>> 
>> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
>> ---
>>  drivers/net/bonding/bond_3ad.c     |  5 ++++-
>>  drivers/net/bonding/bond_main.c    | 14 ++++++++++++++
>>  drivers/net/bonding/bond_options.c | 29 ++++++++++++++++++++++++++++-
>>  drivers/net/bonding/bond_procfs.c  |  2 ++
>>  drivers/net/bonding/bond_sysfs.c   | 15 +++++++++++++++
>>  include/net/bond_options.h         |  1 +
>>  include/net/bonding.h              |  1 +
>>  7 files changed, 65 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>> index 2a69095266c1..1177f96194dd 100644
>> --- a/drivers/net/bonding/bond_3ad.c
>> +++ b/drivers/net/bonding/bond_3ad.c
>> @@ -1912,7 +1912,8 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution)
>>  
>>  		BOND_AD_INFO(bond).aggregator_identifier = 0;
>>  
>> -		BOND_AD_INFO(bond).system.sys_priority = 0xFFFF;
>> +		BOND_AD_INFO(bond).system.sys_priority =
>> +			bond->params.ad_actor_sysprio;
>>  		BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr *)bond->dev->dev_addr);
>>  
>>  		/* initialize how many times this module is called in one
>> @@ -1963,6 +1964,8 @@ void bond_3ad_bind_slave(struct slave *slave)
>>  			port->sm_vars &= ~AD_PORT_LACP_ENABLED;
>>  		/* actor system is the bond's system */
>>  		port->actor_system = BOND_AD_INFO(bond).system.sys_mac_addr;
>> +		port->actor_system_priority =
>> +		    BOND_AD_INFO(bond).system.sys_priority;
>>  		/* tx timer(to verify that no more than MAX_TX_IN_SECOND
>>  		 * lacpdu's are sent in one second)
>>  		 */
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> index a50ec87486f3..561b2bde5aeb 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
>> @@ -4104,6 +4104,7 @@ static int bond_check_params(struct bond_params *params)
>>  	struct bond_opt_value newval;
>>  	const struct bond_opt_value *valptr;
>>  	int arp_all_targets_value;
>> +	u16 ad_actor_sysprio = 0;
>>  
>>  	/* Convert string parameters. */
>>  	if (mode) {
>> @@ -4398,6 +4399,18 @@ static int bond_check_params(struct bond_params *params)
>>  		fail_over_mac_value = BOND_FOM_NONE;
>>  	}
>>  
>> +	if (bond_mode == BOND_MODE_8023AD) {
>> +		bond_opt_initstr(&newval, "default");
>> +		valptr = bond_opt_parse(
>> +				bond_opt_get(BOND_OPT_AD_ACTOR_SYSPRIO),
>> +					     &newval);
>> +		if (!valptr) {
>> +			pr_err("Error: No ad_actor_sysprio default value");
>> +			return -EINVAL;
>> +		}
>> +		ad_actor_sysprio = valptr->value;
>> +	}
>> +
>>  	if (lp_interval == 0) {
>>  		pr_warn("Warning: ip_interval must be between 1 and %d, so it was reset to %d\n",
>>  			INT_MAX, BOND_ALB_DEFAULT_LP_INTERVAL);
>> @@ -4426,6 +4439,7 @@ static int bond_check_params(struct bond_params *params)
>>  	params->lp_interval = lp_interval;
>>  	params->packets_per_slave = packets_per_slave;
>>  	params->tlb_dynamic_lb = 1; /* Default value */
>> +	params->ad_actor_sysprio = ad_actor_sysprio;
>>  	if (packets_per_slave > 0) {
>>  		params->reciprocal_packets_per_slave =
>>  			reciprocal_value(packets_per_slave);
>> diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
>> index 4df28943d222..d8f6760143ae 100644
>> --- a/drivers/net/bonding/bond_options.c
>> +++ b/drivers/net/bonding/bond_options.c
>> @@ -70,6 +70,8 @@ static int bond_option_slaves_set(struct bonding *bond,
>>  				  const struct bond_opt_value *newval);
>>  static int bond_option_tlb_dynamic_lb_set(struct bonding *bond,
>>  				  const struct bond_opt_value *newval);
>> +static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
>> +				  const struct bond_opt_value *newval);
>>  
>>  
>>  static const struct bond_opt_value bond_mode_tbl[] = {
>> @@ -186,6 +188,12 @@ static const struct bond_opt_value bond_tlb_dynamic_lb_tbl[] = {
>>  	{ NULL,  -1, 0}
>>  };
>>  
>> +static const struct bond_opt_value bond_ad_actor_sysprio_tbl[] = {
>> +	{ "minval",  1,     BOND_VALFLAG_MIN},
>> +	{ "maxval",  65535, BOND_VALFLAG_MAX | BOND_VALFLAG_DEFAULT},
>> +	{ NULL,      -1,    0},
>> +};
>> +
>>  static const struct bond_option bond_opts[BOND_OPT_LAST] = {
>>  	[BOND_OPT_MODE] = {
>>  		.id = BOND_OPT_MODE,
>> @@ -379,7 +387,15 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
>>  		.values = bond_tlb_dynamic_lb_tbl,
>>  		.flags = BOND_OPTFLAG_IFDOWN,
>>  		.set = bond_option_tlb_dynamic_lb_set,
>> -	}
>> +	},
>> +	[BOND_OPT_AD_ACTOR_SYSPRIO] = {
>> +		.id = BOND_OPT_AD_ACTOR_SYSPRIO,
>> +		.name = "ad_actor_system_priority",
>> +		.unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_8023AD)),
>> +		.flags = BOND_OPTFLAG_IFDOWN,
>> +		.values = bond_ad_actor_sysprio_tbl,
>> +		.set = bond_option_ad_actor_sysprio_set,
>> +	},
>>  };
>>  
>>  /* Searches for an option by name */
>> @@ -1349,3 +1365,14 @@ static int bond_option_tlb_dynamic_lb_set(struct bonding *bond,
>>  
>>  	return 0;
>>  }
>> +
>> +
>> +static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
>> +					    const struct bond_opt_value *newval)
>> +{
>> +	netdev_info(bond->dev, "Setting ad_actor_sysprio to (%llu)\n",
>> +		    newval->value);
>> +
>> +	bond->params.ad_actor_sysprio = newval->value;
>> +	return 0;
>> +}
>> diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
>> index 83095a0b4b90..9e33c48886ef 100644
>> --- a/drivers/net/bonding/bond_procfs.c
>> +++ b/drivers/net/bonding/bond_procfs.c
>> @@ -134,6 +134,8 @@ static void bond_info_show_master(struct seq_file *seq)
>>  					  bond->params.ad_select);
>>  		seq_printf(seq, "Aggregator selection policy (ad_select): %s\n",
>>  			   optval->string);
>> +		seq_printf(seq, "System priority: %d\n",
>> +				BOND_AD_INFO(bond).system.sys_priority);
>>  
>>  		if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
>>  			seq_printf(seq, "bond %s has no active aggregator\n",
>> diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
>> index 7e9e151d4d61..4350aa06f867 100644
>> --- a/drivers/net/bonding/bond_sysfs.c
>> +++ b/drivers/net/bonding/bond_sysfs.c
>> @@ -692,6 +692,20 @@ static ssize_t bonding_show_packets_per_slave(struct device *d,
>>  static DEVICE_ATTR(packets_per_slave, S_IRUGO | S_IWUSR,
>>  		   bonding_show_packets_per_slave, bonding_sysfs_store_option);
>>  
>> +static ssize_t bonding_show_ad_actor_sysprio(struct device *d,
>> +					     struct device_attribute *attr,
>> +					     char *buf)
>> +{
>> +	struct bonding *bond = to_bond(d);
>> +
>> +	if (BOND_MODE(bond) == BOND_MODE_8023AD)
>> +		return sprintf(buf, "%hu\n", bond->params.ad_actor_sysprio);
>> +
>> +	return 0;
>> +}
>> +static DEVICE_ATTR(ad_actor_system_priority, S_IRUGO | S_IWUSR,
>> +		   bonding_show_ad_actor_sysprio, bonding_sysfs_store_option);
>> +
>>  static struct attribute *per_bond_attrs[] = {
>>  	&dev_attr_slaves.attr,
>>  	&dev_attr_mode.attr,
>> @@ -725,6 +739,7 @@ static struct attribute *per_bond_attrs[] = {
>>  	&dev_attr_lp_interval.attr,
>>  	&dev_attr_packets_per_slave.attr,
>>  	&dev_attr_tlb_dynamic_lb.attr,
>> +	&dev_attr_ad_actor_system_priority.attr,
>>  	NULL,
>>  };
>>  
>> diff --git a/include/net/bond_options.h b/include/net/bond_options.h
>> index ea6546d2c946..c2af1db37354 100644
>> --- a/include/net/bond_options.h
>> +++ b/include/net/bond_options.h
>> @@ -63,6 +63,7 @@ enum {
>>  	BOND_OPT_LP_INTERVAL,
>>  	BOND_OPT_SLAVES,
>>  	BOND_OPT_TLB_DYNAMIC_LB,
>> +	BOND_OPT_AD_ACTOR_SYSPRIO,
>>  	BOND_OPT_LAST
>>  };
>>  
>> diff --git a/include/net/bonding.h b/include/net/bonding.h
>> index 29f53eacac0a..7a5c79fcf866 100644
>> --- a/include/net/bonding.h
>> +++ b/include/net/bonding.h
>> @@ -143,6 +143,7 @@ struct bond_params {
>>  	int packets_per_slave;
>>  	int tlb_dynamic_lb;
>>  	struct reciprocal_value reciprocal_packets_per_slave;
>> +	u16 ad_actor_sysprio;
>>  };
>>  
>>  struct bond_parm_tbl {
>> -- 
>> 2.2.0.rc0.207.ga3a616c

---
	-Jay Vosburgh, jay.vosburgh@canonical.com

^ permalink raw reply

* Re: [PATCH net-next] bridge: Let bridge not age 'externally' learnt FDB entries, they are removed when 'external' entity notifies the aging
From: Scott Feldman @ 2015-02-07  5:53 UTC (permalink / raw)
  To: Siva Mannem
  Cc: B Viswanath, David Miller, Roopa Prabhu, Netdev,
	Jiří Pírko
In-Reply-To: <CA+CtxLTewFxJNH0OTCqcGb31Ov=TZMwDtz=H11My1NKY=tb9Jg@mail.gmail.com>

On Thu, Feb 5, 2015 at 7:27 PM, Siva Mannem <siva.mannem.lnx@gmail.com> wrote:
> On Fri, Feb 6, 2015 at 7:15 AM, Scott Feldman <sfeldma@gmail.com> wrote:
>> On Thu, Feb 5, 2015 at 10:31 AM, B Viswanath <marichika4@gmail.com> wrote:
>>> On 5 February 2015 at 23:25, Scott Feldman <sfeldma@gmail.com> wrote:
>>> <snip>
>>>>
>>>> CONs
>>>>
>>>> 1) Scale-ability.  The bridge driver can't keep up with ageing many
>>>> (10^5, for example) entries.
>>>> 2) Scale-ability.  Keeping the entries periodically refreshed requires
>>>> a refresh sync from
>>>> the device to the bridge driver, and the bridge driver/kernel can't keep up.
>>>> 3) With the bridge driver, the ageing settings are per-bridge, not per-port.
>>>>
>>>> Did I miss any points?
>>>
>>> There is one more
>>>
>>> 4. On links with wirespeed traffic, software ageing FDB entries
>>> independently without having the knowledge of the traffic means that
>>> CPU will ageout entries it should not. I don't know if this breaks
>>> some RFC, but it can certainly cause big packet loss.
>>
>> SW would only age out expired entries.  An entry not refreshed by HW
>> will expire.  But HW will refresh (to SW) active entries based on
>> traffic seen.  So I'm not seeing how SW will age out entries
>> prematurely.  I'm missing something.
>
> Hardware does not refresh(to SW) active entries based on the traffic
> seen, at least on the switches that I worked on. Even if it were to
> refresh, if the traffic is flowing at line rate(say x packets per
> sec), the refresh rate to SW is equal to x, which is very huge for cpu
> to handle.

I meant refresh as in re-sending learn notification for entry on a
periodic basis, say once a second.  Not refreshing by presenting pkt
to SW...that wouldn't scale at all, as you say.

> There are only two notifications to SW.
>
> 1)learn notification(when packet arrives that has smac which is not in
> hardware's FDB)
> 2)When the hardware ages the entry, it sends a age notification.

I think I'm coming around to your thinking of letting HW manage ageing
on HW-learned FDB entries.  I was hoping to keep ageing in SW for the
PROs I mentioned earlier, but it's not aligning very well with real
HW.  If we modify rocker to work like real HW (that was the point of
rocker in the first place), then we can re-introduce your patch to let
bridge ignore ageing on entries marked with added_by_external_learn.
Let me work on the rocker mods and followup.

-scott

^ permalink raw reply

* Re: [PATCH] vxlan: Wrong type passed to %pIS
From: Cong Wang @ 2015-02-07  5:13 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: David S. Miller, Pravin B Shelar, Nicolas Dichtel,
	Linux Kernel Network Developers, LKML
In-Reply-To: <1423275451-3663-1-git-send-email-linux@rasmusvillemoes.dk>

On Fri, Feb 6, 2015 at 6:17 PM, Rasmus Villemoes
<linux@rasmusvillemoes.dk> wrote:
> src_ip is a pointer to a union vxlan_addr, one member of which is a
> struct sockaddr. Passing a pointer to src_ip is wrong; one should pass
> the value of src_ip itself. Since %pIS formally expects something of
> type struct sockaddr*, let's pass a pointer to the appropriate union
> member, though this of course doesn't change the generated code.
>


It is a union, this doesn't harm.

> Fixes: e4c7ed415387 ("vxlan: add ipv6 support")
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/net/vxlan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index a8c755dcab14..11defbb24183 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -991,7 +991,7 @@ static bool vxlan_snoop(struct net_device *dev,
>                 if (net_ratelimit())
>                         netdev_info(dev,
>                                     "%pM migrated from %pIS to %pIS\n",
> -                                   src_mac, &rdst->remote_ip, &src_ip);
> +                                   src_mac, &rdst->remote_ip.sa, &src_ip->sa);
>
>                 rdst->remote_ip = *src_ip;
>                 f->updated = jiffies;

Since you are on it, there is another similar place in vxlan too.

^ permalink raw reply

* [PATCH 3/3] stmmac: Add AXI burst length support to platform device.
From: Chen Baozi @ 2015-02-07  5:07 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel; +Cc: Chen Baozi, netdev
In-Reply-To: <1423285636-8623-1-git-send-email-cbz@baozis.org>

The AXI Bus Mode Register controls the AXI master behavior. It is mainly
used to control the burst splitting and the number of outstanding requests.
This register is present and valid only in GMAC-AXI configuration. The old
driver only supports this feature on PCI devices. This patch adds an
'snps,apl' properties in DT to enable it on platform devices.

Signed-off-by: Chen Baozi <chenbaozi@kylinos.com.cn>
---
 Documentation/devicetree/bindings/net/stmmac.txt      | 1 +
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/stmmac.txt b/Documentation/devicetree/bindings/net/stmmac.txt
index c41afd9..8f3c834 100644
--- a/Documentation/devicetree/bindings/net/stmmac.txt
+++ b/Documentation/devicetree/bindings/net/stmmac.txt
@@ -43,6 +43,7 @@ Optional properties:
   available this clock is used for programming the Timestamp Addend Register.
   If not passed then the system clock will be used and this is fine on some
   platforms.
+- snps,abl: AXI Burst Length
 
 Examples:
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 3039de2..abbc897 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -230,6 +230,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
 			return -ENOMEM;
 		plat->dma_cfg = dma_cfg;
 		of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
+		of_property_read_u32(np, "snps,abl", &dma_cfg->burst_len);
 		dma_cfg->fixed_burst =
 			of_property_read_bool(np, "snps,fixed-burst");
 		dma_cfg->mixed_burst =
-- 
2.1.4

^ permalink raw reply related

* Re: [PATCH next 6/6] bonding: Implement user key part of port_key in an AD system.
From: Andy Gospodarek @ 2015-02-07  3:40 UTC (permalink / raw)
  To: Mahesh Bandewar
  Cc: Jay Vosburgh, Andy Gospodarek, Veaceslav Falico,
	Nikolay Aleksandrov, David Miller, netdev, Eric Dumazet
In-Reply-To: <1423270317-9352-1-git-send-email-maheshb@google.com>

On Fri, Feb 06, 2015 at 04:51:57PM -0800, Mahesh Bandewar wrote:
> The port key has three components - user-key, speed-part, and duplex-part.
> The LSBit is for the duplex-part, next 5 bits are for the speed while the
> remaining 10 bits are the user defined key bits. Get these 10 bits
> from the user-space (through the SysFs interface) and use it to form the
> admin port-key. Allowed range for the user-key is 0 - 1023 (10 bits). If
> it is not provided then use zero for the user-key-bits (default).
> 
> It can set using following example code -
> 
>    # modprobe bonding mode=4
>    # usr_port_key=$(( RANDOM & 0x3FF ))
>    # echo $usr_port_key > /sys/class/net/bond0/bonding/ad_actor_user_port_key
>    # echo +eth1 > /sys/class/net/bond0/bonding/slaves

If the other ones don't have 'actor' maybe drop it here too.

(Sorry to be picky about these, but as someone who has typed many of
these options a bunch it would be great to have shorter names in config
files.) 

>    ...
>    # ip link set bond0 up
> 
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
> ---
>  drivers/net/bonding/bond_3ad.c     |  6 +++---
>  drivers/net/bonding/bond_main.c    | 10 ++++++++++
>  drivers/net/bonding/bond_options.c | 26 ++++++++++++++++++++++++++
>  drivers/net/bonding/bond_sysfs.c   | 15 +++++++++++++++
>  include/net/bond_options.h         |  1 +
>  include/net/bonding.h              |  1 +
>  6 files changed, 56 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
> index 373d3db3809f..c69c393ba8c5 100644
> --- a/drivers/net/bonding/bond_3ad.c
> +++ b/drivers/net/bonding/bond_3ad.c
> @@ -1955,10 +1955,10 @@ void bond_3ad_bind_slave(struct slave *slave)
>  
>  		port->slave = slave;
>  		port->actor_port_number = SLAVE_AD_INFO(slave)->id;
> -		/* key is determined according to the link speed, duplex and user key(which
> -		 * is yet not supported)
> +		/* key is determined according to the link speed, duplex and
> +		 * user key
>  		 */
> -		port->actor_admin_port_key = 0;
> +		port->actor_admin_port_key = bond->params.ad_actor_portkey << 6;
>  		port->actor_admin_port_key |= __get_duplex(port);
>  		port->actor_admin_port_key |= (__get_link_speed(port) << 1);
>  		port->actor_oper_port_key = port->actor_admin_port_key;
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 1a6735ef2ea7..f9f001f35a91 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -4105,6 +4105,7 @@ static int bond_check_params(struct bond_params *params)
>  	const struct bond_opt_value *valptr;
>  	int arp_all_targets_value;
>  	u16 ad_actor_sysprio = 0;
> +	u16 ad_actor_portkey = 0;
>  
>  	/* Convert string parameters. */
>  	if (mode) {
> @@ -4409,6 +4410,14 @@ static int bond_check_params(struct bond_params *params)
>  			return -EINVAL;
>  		}
>  		ad_actor_sysprio = valptr->value;
> +
> +		valptr = bond_opt_parse(bond_opt_get(BOND_OPT_AD_ACTOR_PORTKEY),
> +					&newval);
> +		if (!valptr) {
> +			pr_err("Error: No ad_actor_portkey default value");
> +			return -EINVAL;
> +		}
> +		ad_actor_portkey = valptr->value;
>  	}
>  
>  	if (lp_interval == 0) {
> @@ -4441,6 +4450,7 @@ static int bond_check_params(struct bond_params *params)
>  	params->tlb_dynamic_lb = 1; /* Default value */
>  	params->ad_actor_sysprio = ad_actor_sysprio;
>  	eth_zero_addr(params->ad_actor_sys_macaddr);
> +	params->ad_actor_portkey = ad_actor_portkey;
>  	if (packets_per_slave > 0) {
>  		params->reciprocal_packets_per_slave =
>  			reciprocal_value(packets_per_slave);
> diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
> index 330d48b6a1e6..c3f77c6d0d2e 100644
> --- a/drivers/net/bonding/bond_options.c
> +++ b/drivers/net/bonding/bond_options.c
> @@ -74,6 +74,8 @@ static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
>  				  const struct bond_opt_value *newval);
>  static int bond_option_ad_actor_sys_macaddr_set(struct bonding *bond,
>  				  const struct bond_opt_value *newval);
> +static int bond_option_ad_actor_portkey_set(struct bonding *bond,
> +				  const struct bond_opt_value *newval);
>  
>  
>  static const struct bond_opt_value bond_mode_tbl[] = {
> @@ -196,6 +198,12 @@ static const struct bond_opt_value bond_ad_actor_sysprio_tbl[] = {
>  	{ NULL,      -1,    0},
>  };
>  
> +static const struct bond_opt_value bond_ad_actor_portkey_tbl[] = {
> +	{ "minval",  0,     BOND_VALFLAG_MIN | BOND_VALFLAG_DEFAULT},
> +	{ "maxval",  1023,  BOND_VALFLAG_MAX},
> +	{ NULL,      -1,    0},
> +};
> +
>  static const struct bond_option bond_opts[BOND_OPT_LAST] = {
>  	[BOND_OPT_MODE] = {
>  		.id = BOND_OPT_MODE,
> @@ -405,6 +413,14 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
>  		.flags = BOND_OPTFLAG_RAWVAL | BOND_OPTFLAG_IFDOWN,
>  		.set = bond_option_ad_actor_sys_macaddr_set,
>  	},
> +	[BOND_OPT_AD_ACTOR_PORTKEY] = {
> +		.id = BOND_OPT_AD_ACTOR_PORTKEY,
> +		.name = "ad_actor_user_port_key",
> +		.unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_8023AD)),
> +		.flags = BOND_OPTFLAG_IFDOWN,
> +		.values = bond_ad_actor_portkey_tbl,
> +		.set = bond_option_ad_actor_portkey_set,
> +	}
>  };
>  
>  /* Searches for an option by name */
> @@ -1405,3 +1421,13 @@ static int bond_option_ad_actor_sys_macaddr_set(struct bonding *bond,
>  
>  	return 0;
>  }
> +
> +static int bond_option_ad_actor_portkey_set(struct bonding *bond,
> +					    const struct bond_opt_value *newval)
> +{
> +	netdev_info(bond->dev, "Setting ad_actor_portkey to (%llu)\n",
> +		    newval->value);
> +
> +	bond->params.ad_actor_portkey = newval->value;
> +	return 0;
> +}
> diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
> index 91713d0b6685..17d84d5a1608 100644
> --- a/drivers/net/bonding/bond_sysfs.c
> +++ b/drivers/net/bonding/bond_sysfs.c
> @@ -721,6 +721,20 @@ static DEVICE_ATTR(ad_actor_system_mac_address, S_IRUGO | S_IWUSR,
>  		   bonding_show_ad_actor_sys_macaddr,
>  		   bonding_sysfs_store_option);
>  
> +static ssize_t bonding_show_ad_actor_portkey(struct device *d,
> +					     struct device_attribute *attr,
> +					     char *buf)
> +{
> +	struct bonding *bond = to_bond(d);
> +
> +	if (BOND_MODE(bond) == BOND_MODE_8023AD)
> +		return sprintf(buf, "%hu\n", bond->params.ad_actor_portkey);
> +
> +	return 0;
> +}
> +static DEVICE_ATTR(ad_actor_user_port_key, S_IRUGO | S_IWUSR,
> +		   bonding_show_ad_actor_portkey, bonding_sysfs_store_option);
> +
>  static struct attribute *per_bond_attrs[] = {
>  	&dev_attr_slaves.attr,
>  	&dev_attr_mode.attr,
> @@ -756,6 +770,7 @@ static struct attribute *per_bond_attrs[] = {
>  	&dev_attr_tlb_dynamic_lb.attr,
>  	&dev_attr_ad_actor_system_priority.attr,
>  	&dev_attr_ad_actor_system_mac_address.attr,
> +	&dev_attr_ad_actor_user_port_key.attr,
>  	NULL,
>  };
>  
> diff --git a/include/net/bond_options.h b/include/net/bond_options.h
> index 993ef73cd050..4c36455aacb4 100644
> --- a/include/net/bond_options.h
> +++ b/include/net/bond_options.h
> @@ -65,6 +65,7 @@ enum {
>  	BOND_OPT_TLB_DYNAMIC_LB,
>  	BOND_OPT_AD_ACTOR_SYSPRIO,
>  	BOND_OPT_AD_ACTOR_SYS_MACADDR,
> +	BOND_OPT_AD_ACTOR_PORTKEY,
>  	BOND_OPT_LAST
>  };
>  
> diff --git a/include/net/bonding.h b/include/net/bonding.h
> index cd2092e6bc71..e91db2566437 100644
> --- a/include/net/bonding.h
> +++ b/include/net/bonding.h
> @@ -144,6 +144,7 @@ struct bond_params {
>  	int tlb_dynamic_lb;
>  	struct reciprocal_value reciprocal_packets_per_slave;
>  	u16 ad_actor_sysprio;
> +	u16 ad_actor_portkey;
>  	u8 ad_actor_sys_macaddr[ETH_ALEN];
>  };
>  
> -- 
> 2.2.0.rc0.207.ga3a616c
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH next 4/6] bonding: Allow userspace to set system_priority
From: Andy Gospodarek @ 2015-02-07  3:38 UTC (permalink / raw)
  To: Mahesh Bandewar
  Cc: Jay Vosburgh, Andy Gospodarek, Veaceslav Falico,
	Nikolay Aleksandrov, David Miller, netdev, Eric Dumazet
In-Reply-To: <1423270314-9271-1-git-send-email-maheshb@google.com>

On Fri, Feb 06, 2015 at 04:51:54PM -0800, Mahesh Bandewar wrote:
> This patch allows user to randomize the system-priority in an ad-system.
> The allowed range is 1 - 0xFFFF while default value is 0xFFFF. If user
> does not specify this value, the system defaults to 0xFFFF, which is
> what it was before this patch.
> 
> Following example code could set the value -
>     # modprobe bonding mode=4
>     # sys_prio=$(( 1 + RANDOM + RANDOM ))
>     # echo $sys_prio > /sys/class/net/bond0/bonding/ad_actor_system_priority

If I can convince you to change 'ad_actor_system_macaddr' to something
different can I also convince you to change this to something shorter,
too?  :)

Maybe 'ad_sys_priority' or something?

Thanks!

>     # echo +eth1 > /sys/class/net/bond0/bonding/slaves
>     ...
>     # ip link set bond0 up
> 
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
> ---
>  drivers/net/bonding/bond_3ad.c     |  5 ++++-
>  drivers/net/bonding/bond_main.c    | 14 ++++++++++++++
>  drivers/net/bonding/bond_options.c | 29 ++++++++++++++++++++++++++++-
>  drivers/net/bonding/bond_procfs.c  |  2 ++
>  drivers/net/bonding/bond_sysfs.c   | 15 +++++++++++++++
>  include/net/bond_options.h         |  1 +
>  include/net/bonding.h              |  1 +
>  7 files changed, 65 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
> index 2a69095266c1..1177f96194dd 100644
> --- a/drivers/net/bonding/bond_3ad.c
> +++ b/drivers/net/bonding/bond_3ad.c
> @@ -1912,7 +1912,8 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution)
>  
>  		BOND_AD_INFO(bond).aggregator_identifier = 0;
>  
> -		BOND_AD_INFO(bond).system.sys_priority = 0xFFFF;
> +		BOND_AD_INFO(bond).system.sys_priority =
> +			bond->params.ad_actor_sysprio;
>  		BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr *)bond->dev->dev_addr);
>  
>  		/* initialize how many times this module is called in one
> @@ -1963,6 +1964,8 @@ void bond_3ad_bind_slave(struct slave *slave)
>  			port->sm_vars &= ~AD_PORT_LACP_ENABLED;
>  		/* actor system is the bond's system */
>  		port->actor_system = BOND_AD_INFO(bond).system.sys_mac_addr;
> +		port->actor_system_priority =
> +		    BOND_AD_INFO(bond).system.sys_priority;
>  		/* tx timer(to verify that no more than MAX_TX_IN_SECOND
>  		 * lacpdu's are sent in one second)
>  		 */
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index a50ec87486f3..561b2bde5aeb 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -4104,6 +4104,7 @@ static int bond_check_params(struct bond_params *params)
>  	struct bond_opt_value newval;
>  	const struct bond_opt_value *valptr;
>  	int arp_all_targets_value;
> +	u16 ad_actor_sysprio = 0;
>  
>  	/* Convert string parameters. */
>  	if (mode) {
> @@ -4398,6 +4399,18 @@ static int bond_check_params(struct bond_params *params)
>  		fail_over_mac_value = BOND_FOM_NONE;
>  	}
>  
> +	if (bond_mode == BOND_MODE_8023AD) {
> +		bond_opt_initstr(&newval, "default");
> +		valptr = bond_opt_parse(
> +				bond_opt_get(BOND_OPT_AD_ACTOR_SYSPRIO),
> +					     &newval);
> +		if (!valptr) {
> +			pr_err("Error: No ad_actor_sysprio default value");
> +			return -EINVAL;
> +		}
> +		ad_actor_sysprio = valptr->value;
> +	}
> +
>  	if (lp_interval == 0) {
>  		pr_warn("Warning: ip_interval must be between 1 and %d, so it was reset to %d\n",
>  			INT_MAX, BOND_ALB_DEFAULT_LP_INTERVAL);
> @@ -4426,6 +4439,7 @@ static int bond_check_params(struct bond_params *params)
>  	params->lp_interval = lp_interval;
>  	params->packets_per_slave = packets_per_slave;
>  	params->tlb_dynamic_lb = 1; /* Default value */
> +	params->ad_actor_sysprio = ad_actor_sysprio;
>  	if (packets_per_slave > 0) {
>  		params->reciprocal_packets_per_slave =
>  			reciprocal_value(packets_per_slave);
> diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
> index 4df28943d222..d8f6760143ae 100644
> --- a/drivers/net/bonding/bond_options.c
> +++ b/drivers/net/bonding/bond_options.c
> @@ -70,6 +70,8 @@ static int bond_option_slaves_set(struct bonding *bond,
>  				  const struct bond_opt_value *newval);
>  static int bond_option_tlb_dynamic_lb_set(struct bonding *bond,
>  				  const struct bond_opt_value *newval);
> +static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
> +				  const struct bond_opt_value *newval);
>  
>  
>  static const struct bond_opt_value bond_mode_tbl[] = {
> @@ -186,6 +188,12 @@ static const struct bond_opt_value bond_tlb_dynamic_lb_tbl[] = {
>  	{ NULL,  -1, 0}
>  };
>  
> +static const struct bond_opt_value bond_ad_actor_sysprio_tbl[] = {
> +	{ "minval",  1,     BOND_VALFLAG_MIN},
> +	{ "maxval",  65535, BOND_VALFLAG_MAX | BOND_VALFLAG_DEFAULT},
> +	{ NULL,      -1,    0},
> +};
> +
>  static const struct bond_option bond_opts[BOND_OPT_LAST] = {
>  	[BOND_OPT_MODE] = {
>  		.id = BOND_OPT_MODE,
> @@ -379,7 +387,15 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
>  		.values = bond_tlb_dynamic_lb_tbl,
>  		.flags = BOND_OPTFLAG_IFDOWN,
>  		.set = bond_option_tlb_dynamic_lb_set,
> -	}
> +	},
> +	[BOND_OPT_AD_ACTOR_SYSPRIO] = {
> +		.id = BOND_OPT_AD_ACTOR_SYSPRIO,
> +		.name = "ad_actor_system_priority",
> +		.unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_8023AD)),
> +		.flags = BOND_OPTFLAG_IFDOWN,
> +		.values = bond_ad_actor_sysprio_tbl,
> +		.set = bond_option_ad_actor_sysprio_set,
> +	},
>  };
>  
>  /* Searches for an option by name */
> @@ -1349,3 +1365,14 @@ static int bond_option_tlb_dynamic_lb_set(struct bonding *bond,
>  
>  	return 0;
>  }
> +
> +
> +static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
> +					    const struct bond_opt_value *newval)
> +{
> +	netdev_info(bond->dev, "Setting ad_actor_sysprio to (%llu)\n",
> +		    newval->value);
> +
> +	bond->params.ad_actor_sysprio = newval->value;
> +	return 0;
> +}
> diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
> index 83095a0b4b90..9e33c48886ef 100644
> --- a/drivers/net/bonding/bond_procfs.c
> +++ b/drivers/net/bonding/bond_procfs.c
> @@ -134,6 +134,8 @@ static void bond_info_show_master(struct seq_file *seq)
>  					  bond->params.ad_select);
>  		seq_printf(seq, "Aggregator selection policy (ad_select): %s\n",
>  			   optval->string);
> +		seq_printf(seq, "System priority: %d\n",
> +				BOND_AD_INFO(bond).system.sys_priority);
>  
>  		if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
>  			seq_printf(seq, "bond %s has no active aggregator\n",
> diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
> index 7e9e151d4d61..4350aa06f867 100644
> --- a/drivers/net/bonding/bond_sysfs.c
> +++ b/drivers/net/bonding/bond_sysfs.c
> @@ -692,6 +692,20 @@ static ssize_t bonding_show_packets_per_slave(struct device *d,
>  static DEVICE_ATTR(packets_per_slave, S_IRUGO | S_IWUSR,
>  		   bonding_show_packets_per_slave, bonding_sysfs_store_option);
>  
> +static ssize_t bonding_show_ad_actor_sysprio(struct device *d,
> +					     struct device_attribute *attr,
> +					     char *buf)
> +{
> +	struct bonding *bond = to_bond(d);
> +
> +	if (BOND_MODE(bond) == BOND_MODE_8023AD)
> +		return sprintf(buf, "%hu\n", bond->params.ad_actor_sysprio);
> +
> +	return 0;
> +}
> +static DEVICE_ATTR(ad_actor_system_priority, S_IRUGO | S_IWUSR,
> +		   bonding_show_ad_actor_sysprio, bonding_sysfs_store_option);
> +
>  static struct attribute *per_bond_attrs[] = {
>  	&dev_attr_slaves.attr,
>  	&dev_attr_mode.attr,
> @@ -725,6 +739,7 @@ static struct attribute *per_bond_attrs[] = {
>  	&dev_attr_lp_interval.attr,
>  	&dev_attr_packets_per_slave.attr,
>  	&dev_attr_tlb_dynamic_lb.attr,
> +	&dev_attr_ad_actor_system_priority.attr,
>  	NULL,
>  };
>  
> diff --git a/include/net/bond_options.h b/include/net/bond_options.h
> index ea6546d2c946..c2af1db37354 100644
> --- a/include/net/bond_options.h
> +++ b/include/net/bond_options.h
> @@ -63,6 +63,7 @@ enum {
>  	BOND_OPT_LP_INTERVAL,
>  	BOND_OPT_SLAVES,
>  	BOND_OPT_TLB_DYNAMIC_LB,
> +	BOND_OPT_AD_ACTOR_SYSPRIO,
>  	BOND_OPT_LAST
>  };
>  
> diff --git a/include/net/bonding.h b/include/net/bonding.h
> index 29f53eacac0a..7a5c79fcf866 100644
> --- a/include/net/bonding.h
> +++ b/include/net/bonding.h
> @@ -143,6 +143,7 @@ struct bond_params {
>  	int packets_per_slave;
>  	int tlb_dynamic_lb;
>  	struct reciprocal_value reciprocal_packets_per_slave;
> +	u16 ad_actor_sysprio;
>  };
>  
>  struct bond_parm_tbl {
> -- 
> 2.2.0.rc0.207.ga3a616c
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH] vxlan: Wrong type passed to %pIS
From: Joe Perches @ 2015-02-07  3:35 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: David S. Miller, Pravin B Shelar, Nicolas Dichtel, netdev,
	linux-kernel
In-Reply-To: <1423275451-3663-1-git-send-email-linux@rasmusvillemoes.dk>

On Sat, 2015-02-07 at 03:17 +0100, Rasmus Villemoes wrote:
> src_ip is a pointer to a union vxlan_addr, one member of which is a
> struct sockaddr. Passing a pointer to src_ip is wrong; one should pass
> the value of src_ip itself. Since %pIS formally expects something of
> type struct sockaddr*, let's pass a pointer to the appropriate union
> member, though this of course doesn't change the generated code.

Hello Rasmus

Are you finding these mismatches by hand or
are you using some tool?

^ permalink raw reply

* Re: [PATCH next 5/6] bonding: Allow userspace to set macaddr on bonding-dev
From: Andy Gospodarek @ 2015-02-07  3:31 UTC (permalink / raw)
  To: Mahesh Bandewar
  Cc: Jay Vosburgh, Andy Gospodarek, Veaceslav Falico,
	Nikolay Aleksandrov, David Miller, netdev, Eric Dumazet,
	Maciej Żenczykowski
In-Reply-To: <20150207032207.GB34197@gospo.home.greyhouse.net>

On Fri, Feb 06, 2015 at 10:22:07PM -0500, Andy Gospodarek wrote:
> On Fri, Feb 06, 2015 at 06:41:05PM -0800, Mahesh Bandewar wrote:
> > On Fri, Feb 6, 2015 at 5:54 PM, Jay Vosburgh <jay.vosburgh@canonical.com> wrote:
> > > Mahesh Bandewar <maheshb@google.com> wrote:
> > >
> > >>On Fri, Feb 6, 2015 at 5:20 PM, Jay Vosburgh <jay.vosburgh@canonical.com> wrote:
> > >>> Mahesh Bandewar <maheshb@google.com> wrote:
> > >>>
> > >>>>This patch allows user-space to set the mac-address on the bonding device.
> > >>>>This mac-address can not be NULL or a Multicast. If the mac-address is set
> > >>>>from user-space; kernel will honor it and will not overwrite it. In the
> > >>>>absense (value from user space); the logic will default to using the
> > >>>>masters' mac as the mac address for the bonding device.
> > >>>>
> > >>>>It can be set using example code below -
> > >>>>
> > >>>>   # modprobe bonding mode=4
> > >>>>   # sys_mac_addr=$(printf '%02x:%02x:%02x:%02x:%02x:%02x' \
> > >>>>                    $(( (RANDOM & 0xFE) | 0x02 )) \
> > >>>>                    $(( RANDOM & 0xFF )) \
> > >>>>                    $(( RANDOM & 0xFF )) \
> > >>>>                    $(( RANDOM & 0xFF )) \
> > >>>>                    $(( RANDOM & 0xFF )) \
> > >>>>                    $(( RANDOM & 0xFF )))
> > >>>>   # echo $sys_mac_addr > /sys/class/net/bond0/bonding/ad_actor_system_mac_address
> > >>>>   # echo +eth1 > /sys/class/net/bond0/bonding/slaves
> > >>>>   ...
> > >>>>   # ip link set bond0 up
> > >>>
> > >>>         How is this patch functionally different from setting the
> > >>> bonding master's MAC address to a particular value prior to adding any
> > >>> slaves?
> > >>>
> > >>
> > >>Maciej is correct but I think I was bit ambiguous about it in the
> > >>commit message which might have made you think this way. I'll reword
> > >>the commit message.
> > >
> > >         Thanks; presumably there is some administrative reason for this.
> > >
> > The idea is that in an AD system the actor-partner communication is a
> > business between them two only and no one in the L2 domain should
> > care. These enhancements should obscure that should anyone try to
> > sniff it. Probably I assumed too much and should add this idea behind
> > the implementation in the commit log.
> > 
> > >         Also, for patches 4, 5 and 6, I believe current practice is to
> > > provide a netlink / iproute2 facility for options.
> > >
> > OK. I'll add them (netlink enhancements) in a separate set of patch(s).
> > 
> 
> Mahesh,
> 
> Overall this looks good.  My only comment (other than the suggestion
> that was already made to also add netlink support), would be a slight
> change to the name.
> 
> Would you consider renaming 'ad_actor_sys_macaddr' to something a bit
> shorter?  That is really long name.  Maybe just 'sys_mac_addr' instead?

Ugh, I mean to say 'ad_sys_mac_addr' since this is 802.3ad-specific it
would be good to have the 'ad' on the front since that is the only mode
that uses it.

> 
> Thanks,
> 
> -andy
> 
> > >         -J
> > >
> > >
> > >>>         -J
> > >>>
> > >>>>Signed-off-by: Mahesh Bandewar <maheshb@google.com>
> > >>>>---
> > >>>> drivers/net/bonding/bond_3ad.c     |  7 ++++++-
> > >>>> drivers/net/bonding/bond_main.c    |  1 +
> > >>>> drivers/net/bonding/bond_options.c | 29 +++++++++++++++++++++++++++++
> > >>>> drivers/net/bonding/bond_procfs.c  |  6 ++++++
> > >>>> drivers/net/bonding/bond_sysfs.c   | 16 ++++++++++++++++
> > >>>> include/net/bond_options.h         |  1 +
> > >>>> include/net/bonding.h              |  1 +
> > >>>> 7 files changed, 60 insertions(+), 1 deletion(-)
> > >>>>
> > >>>>diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
> > >>>>index 1177f96194dd..373d3db3809f 100644
> > >>>>--- a/drivers/net/bonding/bond_3ad.c
> > >>>>+++ b/drivers/net/bonding/bond_3ad.c
> > >>>>@@ -1914,7 +1914,12 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution)
> > >>>>
> > >>>>               BOND_AD_INFO(bond).system.sys_priority =
> > >>>>                       bond->params.ad_actor_sysprio;
> > >>>>-              BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr *)bond->dev->dev_addr);
> > >>>>+              if (is_zero_ether_addr(bond->params.ad_actor_sys_macaddr))
> > >>>>+                      BOND_AD_INFO(bond).system.sys_mac_addr =
> > >>>>+                          *((struct mac_addr *)bond->dev->dev_addr);
> > >>>>+              else
> > >>>>+                      BOND_AD_INFO(bond).system.sys_mac_addr =
> > >>>>+                          *((struct mac_addr *)bond->params.ad_actor_sys_macaddr);
> > >>>>
> > >>>>               /* initialize how many times this module is called in one
> > >>>>                * second (should be about every 100ms)
> > >>>>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> > >>>>index 561b2bde5aeb..1a6735ef2ea7 100644
> > >>>>--- a/drivers/net/bonding/bond_main.c
> > >>>>+++ b/drivers/net/bonding/bond_main.c
> > >>>>@@ -4440,6 +4440,7 @@ static int bond_check_params(struct bond_params *params)
> > >>>>       params->packets_per_slave = packets_per_slave;
> > >>>>       params->tlb_dynamic_lb = 1; /* Default value */
> > >>>>       params->ad_actor_sysprio = ad_actor_sysprio;
> > >>>>+      eth_zero_addr(params->ad_actor_sys_macaddr);
> > >>>>       if (packets_per_slave > 0) {
> > >>>>               params->reciprocal_packets_per_slave =
> > >>>>                       reciprocal_value(packets_per_slave);
> > >>>>diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
> > >>>>index d8f6760143ae..330d48b6a1e6 100644
> > >>>>--- a/drivers/net/bonding/bond_options.c
> > >>>>+++ b/drivers/net/bonding/bond_options.c
> > >>>>@@ -72,6 +72,8 @@ static int bond_option_tlb_dynamic_lb_set(struct bonding *bond,
> > >>>>                                 const struct bond_opt_value *newval);
> > >>>> static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
> > >>>>                                 const struct bond_opt_value *newval);
> > >>>>+static int bond_option_ad_actor_sys_macaddr_set(struct bonding *bond,
> > >>>>+                                const struct bond_opt_value *newval);
> > >>>>
> > >>>>
> > >>>> static const struct bond_opt_value bond_mode_tbl[] = {
> > >>>>@@ -396,6 +398,13 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
> > >>>>               .values = bond_ad_actor_sysprio_tbl,
> > >>>>               .set = bond_option_ad_actor_sysprio_set,
> > >>>>       },
> > >>>>+      [BOND_OPT_AD_ACTOR_SYS_MACADDR] = {
> > >>>>+              .id = BOND_OPT_AD_ACTOR_SYS_MACADDR,
> > >>>>+              .name = "ad_actor_system_mac_address",
> > >>>>+              .unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_8023AD)),
> > >>>>+              .flags = BOND_OPTFLAG_RAWVAL | BOND_OPTFLAG_IFDOWN,
> > >>>>+              .set = bond_option_ad_actor_sys_macaddr_set,
> > >>>>+      },
> > >>>> };
> > >>>>
> > >>>> /* Searches for an option by name */
> > >>>>@@ -1376,3 +1385,23 @@ static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
> > >>>>       bond->params.ad_actor_sysprio = newval->value;
> > >>>>       return 0;
> > >>>> }
> > >>>>+
> > >>>>+static int bond_option_ad_actor_sys_macaddr_set(struct bonding *bond,
> > >>>>+                                          const struct bond_opt_value *newval)
> > >>>>+{
> > >>>>+      u8 macaddr[ETH_ALEN];
> > >>>>+      int i;
> > >>>>+
> > >>>>+      i = sscanf(newval->string, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
> > >>>>+                 &macaddr[0], &macaddr[1], &macaddr[2],
> > >>>>+                 &macaddr[3], &macaddr[4], &macaddr[5]);
> > >>>>+
> > >>>>+      if (i != ETH_ALEN || !is_valid_ether_addr(macaddr)) {
> > >>>>+              netdev_err(bond->dev, "Invalid MAC address.\n");
> > >>>>+              return -EINVAL;
> > >>>>+      }
> > >>>>+
> > >>>>+      ether_addr_copy(bond->params.ad_actor_sys_macaddr, macaddr);
> > >>>>+
> > >>>>+      return 0;
> > >>>>+}
> > >>>>diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
> > >>>>index 9e33c48886ef..81452ced852f 100644
> > >>>>--- a/drivers/net/bonding/bond_procfs.c
> > >>>>+++ b/drivers/net/bonding/bond_procfs.c
> > >>>>@@ -136,6 +136,8 @@ static void bond_info_show_master(struct seq_file *seq)
> > >>>>                          optval->string);
> > >>>>               seq_printf(seq, "System priority: %d\n",
> > >>>>                               BOND_AD_INFO(bond).system.sys_priority);
> > >>>>+              seq_printf(seq, "System MAC address: %pM\n",
> > >>>>+                              &BOND_AD_INFO(bond).system.sys_mac_addr);
> > >>>>
> > >>>>               if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
> > >>>>                       seq_printf(seq, "bond %s has no active aggregator\n",
> > >>>>@@ -198,6 +200,8 @@ static void bond_info_show_slave(struct seq_file *seq,
> > >>>>                       seq_puts(seq, "details actor lacp pdu:\n");
> > >>>>                       seq_printf(seq, "    system priority: %d\n",
> > >>>>                                  port->actor_system_priority);
> > >>>>+                      seq_printf(seq, "    system mac address: %pM\n",
> > >>>>+                                 &port->actor_system);
> > >>>>                       seq_printf(seq, "    port key: %d\n",
> > >>>>                                  port->actor_oper_port_key);
> > >>>>                       seq_printf(seq, "    port priority: %d\n",
> > >>>>@@ -210,6 +214,8 @@ static void bond_info_show_slave(struct seq_file *seq,
> > >>>>                       seq_puts(seq, "details partner lacp pdu:\n");
> > >>>>                       seq_printf(seq, "    system priority: %d\n",
> > >>>>                                  port->partner_oper.system_priority);
> > >>>>+                      seq_printf(seq, "    system mac address: %pM\n",
> > >>>>+                                 &port->partner_oper.system);
> > >>>>                       seq_printf(seq, "    oper key: %d\n",
> > >>>>                                  port->partner_oper.key);
> > >>>>                       seq_printf(seq, "    port priority: %d\n",
> > >>>>diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
> > >>>>index 4350aa06f867..91713d0b6685 100644
> > >>>>--- a/drivers/net/bonding/bond_sysfs.c
> > >>>>+++ b/drivers/net/bonding/bond_sysfs.c
> > >>>>@@ -706,6 +706,21 @@ static ssize_t bonding_show_ad_actor_sysprio(struct device *d,
> > >>>> static DEVICE_ATTR(ad_actor_system_priority, S_IRUGO | S_IWUSR,
> > >>>>                  bonding_show_ad_actor_sysprio, bonding_sysfs_store_option);
> > >>>>
> > >>>>+static ssize_t bonding_show_ad_actor_sys_macaddr(struct device *d,
> > >>>>+                                               struct device_attribute *attr,
> > >>>>+                                               char *buf)
> > >>>>+{
> > >>>>+      struct bonding *bond = to_bond(d);
> > >>>>+
> > >>>>+      if (BOND_MODE(bond) == BOND_MODE_8023AD)
> > >>>>+              return sprintf(buf, "%pM\n", bond->params.ad_actor_sys_macaddr);
> > >>>>+
> > >>>>+      return 0;
> > >>>>+}
> > >>>>+static DEVICE_ATTR(ad_actor_system_mac_address, S_IRUGO | S_IWUSR,
> > >>>>+                 bonding_show_ad_actor_sys_macaddr,
> > >>>>+                 bonding_sysfs_store_option);
> > >>>>+
> > >>>> static struct attribute *per_bond_attrs[] = {
> > >>>>       &dev_attr_slaves.attr,
> > >>>>       &dev_attr_mode.attr,
> > >>>>@@ -740,6 +755,7 @@ static struct attribute *per_bond_attrs[] = {
> > >>>>       &dev_attr_packets_per_slave.attr,
> > >>>>       &dev_attr_tlb_dynamic_lb.attr,
> > >>>>       &dev_attr_ad_actor_system_priority.attr,
> > >>>>+      &dev_attr_ad_actor_system_mac_address.attr,
> > >>>>       NULL,
> > >>>> };
> > >>>>
> > >>>>diff --git a/include/net/bond_options.h b/include/net/bond_options.h
> > >>>>index c2af1db37354..993ef73cd050 100644
> > >>>>--- a/include/net/bond_options.h
> > >>>>+++ b/include/net/bond_options.h
> > >>>>@@ -64,6 +64,7 @@ enum {
> > >>>>       BOND_OPT_SLAVES,
> > >>>>       BOND_OPT_TLB_DYNAMIC_LB,
> > >>>>       BOND_OPT_AD_ACTOR_SYSPRIO,
> > >>>>+      BOND_OPT_AD_ACTOR_SYS_MACADDR,
> > >>>>       BOND_OPT_LAST
> > >>>> };
> > >>>>
> > >>>>diff --git a/include/net/bonding.h b/include/net/bonding.h
> > >>>>index 7a5c79fcf866..cd2092e6bc71 100644
> > >>>>--- a/include/net/bonding.h
> > >>>>+++ b/include/net/bonding.h
> > >>>>@@ -144,6 +144,7 @@ struct bond_params {
> > >>>>       int tlb_dynamic_lb;
> > >>>>       struct reciprocal_value reciprocal_packets_per_slave;
> > >>>>       u16 ad_actor_sysprio;
> > >>>>+      u8 ad_actor_sys_macaddr[ETH_ALEN];
> > >>>> };
> > >>>>
> > >>>> struct bond_parm_tbl {
> > >>>>--
> > >>>>2.2.0.rc0.207.ga3a616c
> > >>>>
> > >
> > > ---
> > >         -Jay Vosburgh, jay.vosburgh@canonical.com
> > --
> > To unsubscribe from this list: send the line "unsubscribe netdev" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH next 5/6] bonding: Allow userspace to set macaddr on bonding-dev
From: Andy Gospodarek @ 2015-02-07  3:22 UTC (permalink / raw)
  To: Mahesh Bandewar
  Cc: Jay Vosburgh, Andy Gospodarek, Veaceslav Falico,
	Nikolay Aleksandrov, David Miller, netdev, Eric Dumazet,
	Maciej Żenczykowski
In-Reply-To: <CAF2d9ji=Z+wVz7AdpSeNmOwys0jqWsx6TYsCML_+Hw=u+QMt_A@mail.gmail.com>

On Fri, Feb 06, 2015 at 06:41:05PM -0800, Mahesh Bandewar wrote:
> On Fri, Feb 6, 2015 at 5:54 PM, Jay Vosburgh <jay.vosburgh@canonical.com> wrote:
> > Mahesh Bandewar <maheshb@google.com> wrote:
> >
> >>On Fri, Feb 6, 2015 at 5:20 PM, Jay Vosburgh <jay.vosburgh@canonical.com> wrote:
> >>> Mahesh Bandewar <maheshb@google.com> wrote:
> >>>
> >>>>This patch allows user-space to set the mac-address on the bonding device.
> >>>>This mac-address can not be NULL or a Multicast. If the mac-address is set
> >>>>from user-space; kernel will honor it and will not overwrite it. In the
> >>>>absense (value from user space); the logic will default to using the
> >>>>masters' mac as the mac address for the bonding device.
> >>>>
> >>>>It can be set using example code below -
> >>>>
> >>>>   # modprobe bonding mode=4
> >>>>   # sys_mac_addr=$(printf '%02x:%02x:%02x:%02x:%02x:%02x' \
> >>>>                    $(( (RANDOM & 0xFE) | 0x02 )) \
> >>>>                    $(( RANDOM & 0xFF )) \
> >>>>                    $(( RANDOM & 0xFF )) \
> >>>>                    $(( RANDOM & 0xFF )) \
> >>>>                    $(( RANDOM & 0xFF )) \
> >>>>                    $(( RANDOM & 0xFF )))
> >>>>   # echo $sys_mac_addr > /sys/class/net/bond0/bonding/ad_actor_system_mac_address
> >>>>   # echo +eth1 > /sys/class/net/bond0/bonding/slaves
> >>>>   ...
> >>>>   # ip link set bond0 up
> >>>
> >>>         How is this patch functionally different from setting the
> >>> bonding master's MAC address to a particular value prior to adding any
> >>> slaves?
> >>>
> >>
> >>Maciej is correct but I think I was bit ambiguous about it in the
> >>commit message which might have made you think this way. I'll reword
> >>the commit message.
> >
> >         Thanks; presumably there is some administrative reason for this.
> >
> The idea is that in an AD system the actor-partner communication is a
> business between them two only and no one in the L2 domain should
> care. These enhancements should obscure that should anyone try to
> sniff it. Probably I assumed too much and should add this idea behind
> the implementation in the commit log.
> 
> >         Also, for patches 4, 5 and 6, I believe current practice is to
> > provide a netlink / iproute2 facility for options.
> >
> OK. I'll add them (netlink enhancements) in a separate set of patch(s).
> 

Mahesh,

Overall this looks good.  My only comment (other than the suggestion
that was already made to also add netlink support), would be a slight
change to the name.

Would you consider renaming 'ad_actor_sys_macaddr' to something a bit
shorter?  That is really long name.  Maybe just 'sys_mac_addr' instead?

Thanks,

-andy

> >         -J
> >
> >
> >>>         -J
> >>>
> >>>>Signed-off-by: Mahesh Bandewar <maheshb@google.com>
> >>>>---
> >>>> drivers/net/bonding/bond_3ad.c     |  7 ++++++-
> >>>> drivers/net/bonding/bond_main.c    |  1 +
> >>>> drivers/net/bonding/bond_options.c | 29 +++++++++++++++++++++++++++++
> >>>> drivers/net/bonding/bond_procfs.c  |  6 ++++++
> >>>> drivers/net/bonding/bond_sysfs.c   | 16 ++++++++++++++++
> >>>> include/net/bond_options.h         |  1 +
> >>>> include/net/bonding.h              |  1 +
> >>>> 7 files changed, 60 insertions(+), 1 deletion(-)
> >>>>
> >>>>diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
> >>>>index 1177f96194dd..373d3db3809f 100644
> >>>>--- a/drivers/net/bonding/bond_3ad.c
> >>>>+++ b/drivers/net/bonding/bond_3ad.c
> >>>>@@ -1914,7 +1914,12 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution)
> >>>>
> >>>>               BOND_AD_INFO(bond).system.sys_priority =
> >>>>                       bond->params.ad_actor_sysprio;
> >>>>-              BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr *)bond->dev->dev_addr);
> >>>>+              if (is_zero_ether_addr(bond->params.ad_actor_sys_macaddr))
> >>>>+                      BOND_AD_INFO(bond).system.sys_mac_addr =
> >>>>+                          *((struct mac_addr *)bond->dev->dev_addr);
> >>>>+              else
> >>>>+                      BOND_AD_INFO(bond).system.sys_mac_addr =
> >>>>+                          *((struct mac_addr *)bond->params.ad_actor_sys_macaddr);
> >>>>
> >>>>               /* initialize how many times this module is called in one
> >>>>                * second (should be about every 100ms)
> >>>>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> >>>>index 561b2bde5aeb..1a6735ef2ea7 100644
> >>>>--- a/drivers/net/bonding/bond_main.c
> >>>>+++ b/drivers/net/bonding/bond_main.c
> >>>>@@ -4440,6 +4440,7 @@ static int bond_check_params(struct bond_params *params)
> >>>>       params->packets_per_slave = packets_per_slave;
> >>>>       params->tlb_dynamic_lb = 1; /* Default value */
> >>>>       params->ad_actor_sysprio = ad_actor_sysprio;
> >>>>+      eth_zero_addr(params->ad_actor_sys_macaddr);
> >>>>       if (packets_per_slave > 0) {
> >>>>               params->reciprocal_packets_per_slave =
> >>>>                       reciprocal_value(packets_per_slave);
> >>>>diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
> >>>>index d8f6760143ae..330d48b6a1e6 100644
> >>>>--- a/drivers/net/bonding/bond_options.c
> >>>>+++ b/drivers/net/bonding/bond_options.c
> >>>>@@ -72,6 +72,8 @@ static int bond_option_tlb_dynamic_lb_set(struct bonding *bond,
> >>>>                                 const struct bond_opt_value *newval);
> >>>> static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
> >>>>                                 const struct bond_opt_value *newval);
> >>>>+static int bond_option_ad_actor_sys_macaddr_set(struct bonding *bond,
> >>>>+                                const struct bond_opt_value *newval);
> >>>>
> >>>>
> >>>> static const struct bond_opt_value bond_mode_tbl[] = {
> >>>>@@ -396,6 +398,13 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
> >>>>               .values = bond_ad_actor_sysprio_tbl,
> >>>>               .set = bond_option_ad_actor_sysprio_set,
> >>>>       },
> >>>>+      [BOND_OPT_AD_ACTOR_SYS_MACADDR] = {
> >>>>+              .id = BOND_OPT_AD_ACTOR_SYS_MACADDR,
> >>>>+              .name = "ad_actor_system_mac_address",
> >>>>+              .unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_8023AD)),
> >>>>+              .flags = BOND_OPTFLAG_RAWVAL | BOND_OPTFLAG_IFDOWN,
> >>>>+              .set = bond_option_ad_actor_sys_macaddr_set,
> >>>>+      },
> >>>> };
> >>>>
> >>>> /* Searches for an option by name */
> >>>>@@ -1376,3 +1385,23 @@ static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
> >>>>       bond->params.ad_actor_sysprio = newval->value;
> >>>>       return 0;
> >>>> }
> >>>>+
> >>>>+static int bond_option_ad_actor_sys_macaddr_set(struct bonding *bond,
> >>>>+                                          const struct bond_opt_value *newval)
> >>>>+{
> >>>>+      u8 macaddr[ETH_ALEN];
> >>>>+      int i;
> >>>>+
> >>>>+      i = sscanf(newval->string, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
> >>>>+                 &macaddr[0], &macaddr[1], &macaddr[2],
> >>>>+                 &macaddr[3], &macaddr[4], &macaddr[5]);
> >>>>+
> >>>>+      if (i != ETH_ALEN || !is_valid_ether_addr(macaddr)) {
> >>>>+              netdev_err(bond->dev, "Invalid MAC address.\n");
> >>>>+              return -EINVAL;
> >>>>+      }
> >>>>+
> >>>>+      ether_addr_copy(bond->params.ad_actor_sys_macaddr, macaddr);
> >>>>+
> >>>>+      return 0;
> >>>>+}
> >>>>diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
> >>>>index 9e33c48886ef..81452ced852f 100644
> >>>>--- a/drivers/net/bonding/bond_procfs.c
> >>>>+++ b/drivers/net/bonding/bond_procfs.c
> >>>>@@ -136,6 +136,8 @@ static void bond_info_show_master(struct seq_file *seq)
> >>>>                          optval->string);
> >>>>               seq_printf(seq, "System priority: %d\n",
> >>>>                               BOND_AD_INFO(bond).system.sys_priority);
> >>>>+              seq_printf(seq, "System MAC address: %pM\n",
> >>>>+                              &BOND_AD_INFO(bond).system.sys_mac_addr);
> >>>>
> >>>>               if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
> >>>>                       seq_printf(seq, "bond %s has no active aggregator\n",
> >>>>@@ -198,6 +200,8 @@ static void bond_info_show_slave(struct seq_file *seq,
> >>>>                       seq_puts(seq, "details actor lacp pdu:\n");
> >>>>                       seq_printf(seq, "    system priority: %d\n",
> >>>>                                  port->actor_system_priority);
> >>>>+                      seq_printf(seq, "    system mac address: %pM\n",
> >>>>+                                 &port->actor_system);
> >>>>                       seq_printf(seq, "    port key: %d\n",
> >>>>                                  port->actor_oper_port_key);
> >>>>                       seq_printf(seq, "    port priority: %d\n",
> >>>>@@ -210,6 +214,8 @@ static void bond_info_show_slave(struct seq_file *seq,
> >>>>                       seq_puts(seq, "details partner lacp pdu:\n");
> >>>>                       seq_printf(seq, "    system priority: %d\n",
> >>>>                                  port->partner_oper.system_priority);
> >>>>+                      seq_printf(seq, "    system mac address: %pM\n",
> >>>>+                                 &port->partner_oper.system);
> >>>>                       seq_printf(seq, "    oper key: %d\n",
> >>>>                                  port->partner_oper.key);
> >>>>                       seq_printf(seq, "    port priority: %d\n",
> >>>>diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
> >>>>index 4350aa06f867..91713d0b6685 100644
> >>>>--- a/drivers/net/bonding/bond_sysfs.c
> >>>>+++ b/drivers/net/bonding/bond_sysfs.c
> >>>>@@ -706,6 +706,21 @@ static ssize_t bonding_show_ad_actor_sysprio(struct device *d,
> >>>> static DEVICE_ATTR(ad_actor_system_priority, S_IRUGO | S_IWUSR,
> >>>>                  bonding_show_ad_actor_sysprio, bonding_sysfs_store_option);
> >>>>
> >>>>+static ssize_t bonding_show_ad_actor_sys_macaddr(struct device *d,
> >>>>+                                               struct device_attribute *attr,
> >>>>+                                               char *buf)
> >>>>+{
> >>>>+      struct bonding *bond = to_bond(d);
> >>>>+
> >>>>+      if (BOND_MODE(bond) == BOND_MODE_8023AD)
> >>>>+              return sprintf(buf, "%pM\n", bond->params.ad_actor_sys_macaddr);
> >>>>+
> >>>>+      return 0;
> >>>>+}
> >>>>+static DEVICE_ATTR(ad_actor_system_mac_address, S_IRUGO | S_IWUSR,
> >>>>+                 bonding_show_ad_actor_sys_macaddr,
> >>>>+                 bonding_sysfs_store_option);
> >>>>+
> >>>> static struct attribute *per_bond_attrs[] = {
> >>>>       &dev_attr_slaves.attr,
> >>>>       &dev_attr_mode.attr,
> >>>>@@ -740,6 +755,7 @@ static struct attribute *per_bond_attrs[] = {
> >>>>       &dev_attr_packets_per_slave.attr,
> >>>>       &dev_attr_tlb_dynamic_lb.attr,
> >>>>       &dev_attr_ad_actor_system_priority.attr,
> >>>>+      &dev_attr_ad_actor_system_mac_address.attr,
> >>>>       NULL,
> >>>> };
> >>>>
> >>>>diff --git a/include/net/bond_options.h b/include/net/bond_options.h
> >>>>index c2af1db37354..993ef73cd050 100644
> >>>>--- a/include/net/bond_options.h
> >>>>+++ b/include/net/bond_options.h
> >>>>@@ -64,6 +64,7 @@ enum {
> >>>>       BOND_OPT_SLAVES,
> >>>>       BOND_OPT_TLB_DYNAMIC_LB,
> >>>>       BOND_OPT_AD_ACTOR_SYSPRIO,
> >>>>+      BOND_OPT_AD_ACTOR_SYS_MACADDR,
> >>>>       BOND_OPT_LAST
> >>>> };
> >>>>
> >>>>diff --git a/include/net/bonding.h b/include/net/bonding.h
> >>>>index 7a5c79fcf866..cd2092e6bc71 100644
> >>>>--- a/include/net/bonding.h
> >>>>+++ b/include/net/bonding.h
> >>>>@@ -144,6 +144,7 @@ struct bond_params {
> >>>>       int tlb_dynamic_lb;
> >>>>       struct reciprocal_value reciprocal_packets_per_slave;
> >>>>       u16 ad_actor_sysprio;
> >>>>+      u8 ad_actor_sys_macaddr[ETH_ALEN];
> >>>> };
> >>>>
> >>>> struct bond_parm_tbl {
> >>>>--
> >>>>2.2.0.rc0.207.ga3a616c
> >>>>
> >
> > ---
> >         -Jay Vosburgh, jay.vosburgh@canonical.com
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH next 5/6] bonding: Allow userspace to set macaddr on bonding-dev
From: Mahesh Bandewar @ 2015-02-07  2:41 UTC (permalink / raw)
  To: Jay Vosburgh
  Cc: Andy Gospodarek, Veaceslav Falico, Nikolay Aleksandrov,
	David Miller, netdev, Eric Dumazet, Maciej Żenczykowski
In-Reply-To: <4653.1423274042@famine>

On Fri, Feb 6, 2015 at 5:54 PM, Jay Vosburgh <jay.vosburgh@canonical.com> wrote:
> Mahesh Bandewar <maheshb@google.com> wrote:
>
>>On Fri, Feb 6, 2015 at 5:20 PM, Jay Vosburgh <jay.vosburgh@canonical.com> wrote:
>>> Mahesh Bandewar <maheshb@google.com> wrote:
>>>
>>>>This patch allows user-space to set the mac-address on the bonding device.
>>>>This mac-address can not be NULL or a Multicast. If the mac-address is set
>>>>from user-space; kernel will honor it and will not overwrite it. In the
>>>>absense (value from user space); the logic will default to using the
>>>>masters' mac as the mac address for the bonding device.
>>>>
>>>>It can be set using example code below -
>>>>
>>>>   # modprobe bonding mode=4
>>>>   # sys_mac_addr=$(printf '%02x:%02x:%02x:%02x:%02x:%02x' \
>>>>                    $(( (RANDOM & 0xFE) | 0x02 )) \
>>>>                    $(( RANDOM & 0xFF )) \
>>>>                    $(( RANDOM & 0xFF )) \
>>>>                    $(( RANDOM & 0xFF )) \
>>>>                    $(( RANDOM & 0xFF )) \
>>>>                    $(( RANDOM & 0xFF )))
>>>>   # echo $sys_mac_addr > /sys/class/net/bond0/bonding/ad_actor_system_mac_address
>>>>   # echo +eth1 > /sys/class/net/bond0/bonding/slaves
>>>>   ...
>>>>   # ip link set bond0 up
>>>
>>>         How is this patch functionally different from setting the
>>> bonding master's MAC address to a particular value prior to adding any
>>> slaves?
>>>
>>
>>Maciej is correct but I think I was bit ambiguous about it in the
>>commit message which might have made you think this way. I'll reword
>>the commit message.
>
>         Thanks; presumably there is some administrative reason for this.
>
The idea is that in an AD system the actor-partner communication is a
business between them two only and no one in the L2 domain should
care. These enhancements should obscure that should anyone try to
sniff it. Probably I assumed too much and should add this idea behind
the implementation in the commit log.

>         Also, for patches 4, 5 and 6, I believe current practice is to
> provide a netlink / iproute2 facility for options.
>
OK. I'll add them (netlink enhancements) in a separate set of patch(s).

>         -J
>
>
>>>         -J
>>>
>>>>Signed-off-by: Mahesh Bandewar <maheshb@google.com>
>>>>---
>>>> drivers/net/bonding/bond_3ad.c     |  7 ++++++-
>>>> drivers/net/bonding/bond_main.c    |  1 +
>>>> drivers/net/bonding/bond_options.c | 29 +++++++++++++++++++++++++++++
>>>> drivers/net/bonding/bond_procfs.c  |  6 ++++++
>>>> drivers/net/bonding/bond_sysfs.c   | 16 ++++++++++++++++
>>>> include/net/bond_options.h         |  1 +
>>>> include/net/bonding.h              |  1 +
>>>> 7 files changed, 60 insertions(+), 1 deletion(-)
>>>>
>>>>diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>>>>index 1177f96194dd..373d3db3809f 100644
>>>>--- a/drivers/net/bonding/bond_3ad.c
>>>>+++ b/drivers/net/bonding/bond_3ad.c
>>>>@@ -1914,7 +1914,12 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution)
>>>>
>>>>               BOND_AD_INFO(bond).system.sys_priority =
>>>>                       bond->params.ad_actor_sysprio;
>>>>-              BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr *)bond->dev->dev_addr);
>>>>+              if (is_zero_ether_addr(bond->params.ad_actor_sys_macaddr))
>>>>+                      BOND_AD_INFO(bond).system.sys_mac_addr =
>>>>+                          *((struct mac_addr *)bond->dev->dev_addr);
>>>>+              else
>>>>+                      BOND_AD_INFO(bond).system.sys_mac_addr =
>>>>+                          *((struct mac_addr *)bond->params.ad_actor_sys_macaddr);
>>>>
>>>>               /* initialize how many times this module is called in one
>>>>                * second (should be about every 100ms)
>>>>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>>>>index 561b2bde5aeb..1a6735ef2ea7 100644
>>>>--- a/drivers/net/bonding/bond_main.c
>>>>+++ b/drivers/net/bonding/bond_main.c
>>>>@@ -4440,6 +4440,7 @@ static int bond_check_params(struct bond_params *params)
>>>>       params->packets_per_slave = packets_per_slave;
>>>>       params->tlb_dynamic_lb = 1; /* Default value */
>>>>       params->ad_actor_sysprio = ad_actor_sysprio;
>>>>+      eth_zero_addr(params->ad_actor_sys_macaddr);
>>>>       if (packets_per_slave > 0) {
>>>>               params->reciprocal_packets_per_slave =
>>>>                       reciprocal_value(packets_per_slave);
>>>>diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
>>>>index d8f6760143ae..330d48b6a1e6 100644
>>>>--- a/drivers/net/bonding/bond_options.c
>>>>+++ b/drivers/net/bonding/bond_options.c
>>>>@@ -72,6 +72,8 @@ static int bond_option_tlb_dynamic_lb_set(struct bonding *bond,
>>>>                                 const struct bond_opt_value *newval);
>>>> static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
>>>>                                 const struct bond_opt_value *newval);
>>>>+static int bond_option_ad_actor_sys_macaddr_set(struct bonding *bond,
>>>>+                                const struct bond_opt_value *newval);
>>>>
>>>>
>>>> static const struct bond_opt_value bond_mode_tbl[] = {
>>>>@@ -396,6 +398,13 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
>>>>               .values = bond_ad_actor_sysprio_tbl,
>>>>               .set = bond_option_ad_actor_sysprio_set,
>>>>       },
>>>>+      [BOND_OPT_AD_ACTOR_SYS_MACADDR] = {
>>>>+              .id = BOND_OPT_AD_ACTOR_SYS_MACADDR,
>>>>+              .name = "ad_actor_system_mac_address",
>>>>+              .unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_8023AD)),
>>>>+              .flags = BOND_OPTFLAG_RAWVAL | BOND_OPTFLAG_IFDOWN,
>>>>+              .set = bond_option_ad_actor_sys_macaddr_set,
>>>>+      },
>>>> };
>>>>
>>>> /* Searches for an option by name */
>>>>@@ -1376,3 +1385,23 @@ static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
>>>>       bond->params.ad_actor_sysprio = newval->value;
>>>>       return 0;
>>>> }
>>>>+
>>>>+static int bond_option_ad_actor_sys_macaddr_set(struct bonding *bond,
>>>>+                                          const struct bond_opt_value *newval)
>>>>+{
>>>>+      u8 macaddr[ETH_ALEN];
>>>>+      int i;
>>>>+
>>>>+      i = sscanf(newval->string, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
>>>>+                 &macaddr[0], &macaddr[1], &macaddr[2],
>>>>+                 &macaddr[3], &macaddr[4], &macaddr[5]);
>>>>+
>>>>+      if (i != ETH_ALEN || !is_valid_ether_addr(macaddr)) {
>>>>+              netdev_err(bond->dev, "Invalid MAC address.\n");
>>>>+              return -EINVAL;
>>>>+      }
>>>>+
>>>>+      ether_addr_copy(bond->params.ad_actor_sys_macaddr, macaddr);
>>>>+
>>>>+      return 0;
>>>>+}
>>>>diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
>>>>index 9e33c48886ef..81452ced852f 100644
>>>>--- a/drivers/net/bonding/bond_procfs.c
>>>>+++ b/drivers/net/bonding/bond_procfs.c
>>>>@@ -136,6 +136,8 @@ static void bond_info_show_master(struct seq_file *seq)
>>>>                          optval->string);
>>>>               seq_printf(seq, "System priority: %d\n",
>>>>                               BOND_AD_INFO(bond).system.sys_priority);
>>>>+              seq_printf(seq, "System MAC address: %pM\n",
>>>>+                              &BOND_AD_INFO(bond).system.sys_mac_addr);
>>>>
>>>>               if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
>>>>                       seq_printf(seq, "bond %s has no active aggregator\n",
>>>>@@ -198,6 +200,8 @@ static void bond_info_show_slave(struct seq_file *seq,
>>>>                       seq_puts(seq, "details actor lacp pdu:\n");
>>>>                       seq_printf(seq, "    system priority: %d\n",
>>>>                                  port->actor_system_priority);
>>>>+                      seq_printf(seq, "    system mac address: %pM\n",
>>>>+                                 &port->actor_system);
>>>>                       seq_printf(seq, "    port key: %d\n",
>>>>                                  port->actor_oper_port_key);
>>>>                       seq_printf(seq, "    port priority: %d\n",
>>>>@@ -210,6 +214,8 @@ static void bond_info_show_slave(struct seq_file *seq,
>>>>                       seq_puts(seq, "details partner lacp pdu:\n");
>>>>                       seq_printf(seq, "    system priority: %d\n",
>>>>                                  port->partner_oper.system_priority);
>>>>+                      seq_printf(seq, "    system mac address: %pM\n",
>>>>+                                 &port->partner_oper.system);
>>>>                       seq_printf(seq, "    oper key: %d\n",
>>>>                                  port->partner_oper.key);
>>>>                       seq_printf(seq, "    port priority: %d\n",
>>>>diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
>>>>index 4350aa06f867..91713d0b6685 100644
>>>>--- a/drivers/net/bonding/bond_sysfs.c
>>>>+++ b/drivers/net/bonding/bond_sysfs.c
>>>>@@ -706,6 +706,21 @@ static ssize_t bonding_show_ad_actor_sysprio(struct device *d,
>>>> static DEVICE_ATTR(ad_actor_system_priority, S_IRUGO | S_IWUSR,
>>>>                  bonding_show_ad_actor_sysprio, bonding_sysfs_store_option);
>>>>
>>>>+static ssize_t bonding_show_ad_actor_sys_macaddr(struct device *d,
>>>>+                                               struct device_attribute *attr,
>>>>+                                               char *buf)
>>>>+{
>>>>+      struct bonding *bond = to_bond(d);
>>>>+
>>>>+      if (BOND_MODE(bond) == BOND_MODE_8023AD)
>>>>+              return sprintf(buf, "%pM\n", bond->params.ad_actor_sys_macaddr);
>>>>+
>>>>+      return 0;
>>>>+}
>>>>+static DEVICE_ATTR(ad_actor_system_mac_address, S_IRUGO | S_IWUSR,
>>>>+                 bonding_show_ad_actor_sys_macaddr,
>>>>+                 bonding_sysfs_store_option);
>>>>+
>>>> static struct attribute *per_bond_attrs[] = {
>>>>       &dev_attr_slaves.attr,
>>>>       &dev_attr_mode.attr,
>>>>@@ -740,6 +755,7 @@ static struct attribute *per_bond_attrs[] = {
>>>>       &dev_attr_packets_per_slave.attr,
>>>>       &dev_attr_tlb_dynamic_lb.attr,
>>>>       &dev_attr_ad_actor_system_priority.attr,
>>>>+      &dev_attr_ad_actor_system_mac_address.attr,
>>>>       NULL,
>>>> };
>>>>
>>>>diff --git a/include/net/bond_options.h b/include/net/bond_options.h
>>>>index c2af1db37354..993ef73cd050 100644
>>>>--- a/include/net/bond_options.h
>>>>+++ b/include/net/bond_options.h
>>>>@@ -64,6 +64,7 @@ enum {
>>>>       BOND_OPT_SLAVES,
>>>>       BOND_OPT_TLB_DYNAMIC_LB,
>>>>       BOND_OPT_AD_ACTOR_SYSPRIO,
>>>>+      BOND_OPT_AD_ACTOR_SYS_MACADDR,
>>>>       BOND_OPT_LAST
>>>> };
>>>>
>>>>diff --git a/include/net/bonding.h b/include/net/bonding.h
>>>>index 7a5c79fcf866..cd2092e6bc71 100644
>>>>--- a/include/net/bonding.h
>>>>+++ b/include/net/bonding.h
>>>>@@ -144,6 +144,7 @@ struct bond_params {
>>>>       int tlb_dynamic_lb;
>>>>       struct reciprocal_value reciprocal_packets_per_slave;
>>>>       u16 ad_actor_sysprio;
>>>>+      u8 ad_actor_sys_macaddr[ETH_ALEN];
>>>> };
>>>>
>>>> struct bond_parm_tbl {
>>>>--
>>>>2.2.0.rc0.207.ga3a616c
>>>>
>
> ---
>         -Jay Vosburgh, jay.vosburgh@canonical.com

^ permalink raw reply

* Re: [PATCH net-next] net: rfs: add hash collision detection
From: Eric Dumazet @ 2015-02-07  2:24 UTC (permalink / raw)
  To: Tom Herbert; +Cc: David Miller, netdev, Ying Cai, Willem de Bruijn
In-Reply-To: <CA+mtBx-N1bQW8vscQf1-h=C0cmtTc2gG3ka+ixs1AMt7cP-Z_Q@mail.gmail.com>

On Fri, 2015-02-06 at 14:21 -0800, Tom Herbert wrote:

> Acked-by: Tom Herbert <therbert@google.com>
> 
> Eric, looks awesome! Can you share any performance numbers?

Right, numbers are awesome.

I flood one target with ~2.3 Mpps UDP packets coming from random IP
addresses.

UDP server uses SO_REUSEPORT with 8 sockets (I have 8 rx queues on the
host)


I force a small RFS table to show that hash collisions no longer
matter :

echo 512 >/proc/sys/net/core/rps_sock_flow_entries


softnettop tool (displaying /proc/net/softnet_stat in realtime)
shows that before starting the TCP flows, only 8 cpus are receiving and
process NIC irqs.

cpu:    recv     drop     time      rps 
26:   586720        0        0        0 
29:   586982        0        0        0 
32:   588582        0        0        0 
35:   589266        0        0        0 
38:   587796        0        0        0 
41:   588146        0        0        0 
44:   588158        0        0        0 
47:   587548        0        0        0 
 *:  4703282        0        0        5 


Then I start 200 netperf -t TCP_RR 

When the 200 TCP_RR flows start, we can see load nicely shifting,
but the UDP packets still not use RFS. TCP fl

cpu:    recv     drop     time      rps 
 0:     4254        0        0     1427 
 1:     4472        0        0     1460 
 2:     3070        0        0     1132 
 3:     4210        0        0     1417 
 4:     4472        0        0     1488 
 5:     2146        0        0      869 
 6:     4163        0        0     1456 
 7:     4354        0        0     1468 
 8:     3254        0        0     1170 
 9:     4468        0        0     1479 
10:     4449        0        0     1521 
11:     2788        0        0     1070 
12:     5902        0        0     1665 
13:     6160        0        0     1692 
14:     2319        0        0      945 
15:     5850        0        0     1686 
16:     5716        0        0     1643 
17:     3388        0        0     1224 
18:     5936        0        0     1724 
19:     6040        0        0     1691 
20:     2962        0        0     1076 
21:     5784        0        0     1696 
22:     6094        0        0     1717 
23:     2748        0        0      999 
24:     1392        0        0      638 
25:     1158        0        0      524 
26:   577970        0        0       77 
27:     1410        0        0      644 
28:     1166        0        0      544 
29:   575270        0        0        5 
30:     1158        0        0      523 
31:      972        0        0      444 
32:   574306        0        0      181 
33:     1248        0        0      575 
34:     1094        0        0      502 
35:   577116        0        0       69 
36:     2142        0        0      893 
37:     1384        0        0      587 
38:   577470        0        0        7 
39:     2029        0        0      856 
40:     1858        0        0      780 
41:   574744        0        0       46 
42:     1946        0        0      806 
43:     1711        0        0      719 
44:   570190        0        0       81 
45:     2210        0        0      872 
46:     1670        0        0      702 
47:   572758        0        0       68 
 *:  4729371        0        0    44858 

cpu:    recv     drop     time      rps 
 0:    48770        0        0    13778 
 1:    49198        0        0    13979 
 2:    24580        0        0     8631 
 3:    48272        0        0    13642 
 4:    48578        0        0    13831 
 5:    23716        0        0     8631 
 6:    48034        0        0    13648 
 7:    49408        0        0    13848 
 8:    26147        0        0     9068 
 9:    48678        0        0    13843 
10:    49515        0        0    13931 
11:    29836        0        0    10079 
12:    45828        0        0    13331 
13:    46654        0        0    13553 
14:    19850        0        0     7452 
15:    44382        0        0    13083 
16:    44667        0        0    13072 
17:    27196        0        0     9429 
18:    44574        0        0    13069 
19:    45076        0        0    13193 
20:    27352        0        0     9329 
21:    45468        0        0    13183 
22:    46264        0        0    13435 
23:    23598        0        0     8485 
24:    14248        0        0     6061 
25:    13624        0        0     5851 
26:   508738        0        0      828 
27:    14516        0        0     6214 
28:    13354        0        0     5700 
29:   512006        0        0      604 
30:    14686        0        0     6249 
31:    13866        0        0     5944 
32:   491190        0        0     1101 
33:    14628        0        0     6237 
34:    14164        0        0     6025 
35:   499178        0        0     1513 
36:    13138        0        0     5687 
37:    11964        0        0     5220 
38:   523120        0        0      413 
39:    13565        0        0     5808 
40:    12742        0        0     5500 
41:   485162        0        0     1343 
42:    13254        0        0     5686 
43:    12096        0        0     5254 
44:   464680        0        0     1615 
45:    13450        0        0     5781 
46:    12400        0        0     5346 
47:   493070        0        0      935 
 *:  5148480        0        0   388438 

cpu:    recv     drop     time      rps 
 0:    46596        0        0    13977 
 1:    48633        0        0    14331 
 2:    24006        0        0     8909 
 3:    47844        0        0    14080 
 4:    47742        0        0    14067 
 5:    26642        0        0     9605 
 6:    47796        0        0    14117 
 7:    48806        0        0    14432 
 8:    27936        0        0     9934 
 9:    48034        0        0    14233 
10:    48892        0        0    14377 
11:    30650        0        0    10512 
12:    45651        0        0    13614 
13:    45439        0        0    13536 
14:    24337        0        0     8877 
15:    45379        0        0    13666 
16:    45695        0        0    13643 
17:    26552        0        0     9452 
18:    45513        0        0    13608 
19:    46588        0        0    13930 
20:    26242        0        0     9273 
21:    45521        0        0    13670 
22:    46255        0        0    13729 
23:    28166        0        0     9842 
24:    13998        0        0     6086 
25:    12518        0        0     5512 
26:   503796        0        0      621 
27:    13732        0        0     6002 
28:    12802        0        0     5611 
29:   507766        0        0      689 
30:    13968        0        0     6044 
31:    13012        0        0     5648 
32:   488760        0        0      938 
33:    13969        0        0     6044 
34:    12666        0        0     5545 
35:   497482        0        0     1497 
36:    13074        0        0     5715 
37:    12187        0        0     5338 
38:   520414        0        0      496 
39:    13752        0        0     5988 
40:    12046        0        0     5297 
41:   480412        0        0      904 
42:    13436        0        0     5845 
43:    11978        0        0     5286 
44:   461146        0        0     1288 
45:    12982        0        0     5655 
46:    12872        0        0     5643 
47:   488788        0        0     1066 
 *:  5122471        0        0   398172 

cpu:    recv     drop     time      rps 
 0:    46970        0        0    13467 
 1:    48129        0        0    13914 
 2:    25876        0        0     9206 
 3:    47672        0        0    13723 
 4:    48566        0        0    13875 
 5:    25575        0        0     9009 
 6:    47342        0        0    13673 
 7:    48636        0        0    13889 
 8:    28038        0        0     9722 
 9:    48298        0        0    13875 
10:    48662        0        0    13911 
11:    28412        0        0     9777 
12:    45025        0        0    13323 
13:    45620        0        0    13422 
14:    20808        0        0     7800 
15:    44481        0        0    13271 
16:    45032        0        0    13324 
17:    25698        0        0     9155 
18:    45125        0        0    13483 
19:    46371        0        0    13627 
20:    27234        0        0     9437 
21:    44899        0        0    13234 
22:    46065        0        0    13530 
23:    24118        0        0     8629 
24:    14416        0        0     6137 
25:    13690        0        0     5863 
26:   508418        0        0      905 
27:    14780        0        0     6295 
28:    13288        0        0     5716 
29:   509010        0        0     1136 
30:    15080        0        0     6443 
31:    13378        0        0     5771 
32:   489950        0        0     1302 
33:    14410        0        0     6157 
34:    13712        0        0     5894 
35:   496760        0        0     1153 
36:    13906        0        0     5978 
37:    12198        0        0     5326 
38:   520846        0        0      444 
39:    13206        0        0     5709 
40:    13020        0        0     5636 
41:   482136        0        0     1029 
42:    13068        0        0     5616 
43:    12982        0        0     5636 
44:   462626        0        0     1378 
45:    13342        0        0     5765 
46:    12784        0        0     5608 
47:   491690        0        0      717 
 *:  5131348        0        0   391890 

cpu:    recv     drop     time      rps 
 0:    45472        0        0    13241 
 1:    46628        0        0    13471 
 2:    25556        0        0     8988 
 3:    46082        0        0    13369 
 4:    45573        0        0    13263 
 5:    28061        0        0     9506 
 6:    45806        0        0    13329 
 7:    46890        0        0    13631 
 8:    28321        0        0     9711 
 9:    45826        0        0    13339 
10:    46522        0        0    13569 
11:    27168        0        0     9467 
12:    47750        0        0    13717 
13:    47630        0        0    13619 
14:    20660        0        0     7846 
15:    47224        0        0    13707 
16:    48439        0        0    13884 
17:    23894        0        0     8646 
18:    47019        0        0    13666 
19:    47532        0        0    13811 
20:    26957        0        0     9465 
21:    47380        0        0    13703 
22:    48520        0        0    14014 
23:    24379        0        0     8775 
24:    13100        0        0     5633 
25:    13210        0        0     5696 
26:   506252        0        0      887 
27:    13564        0        0     5865 
28:    12258        0        0     5294 
29:   510674        0        0     1436 
30:    12892        0        0     5551 
31:    13112        0        0     5668 
32:   492734        0        0     1633 
33:    13480        0        0     5775 
34:    12400        0        0     5367 
35:   497366        0        0     1371 
36:    14236        0        0     6109 
37:    12728        0        0     5552 
38:   519158        0        0      365 
39:    14322        0        0     6096 
40:    13432        0        0     5801 
41:   481236        0        0      832 
42:    14584        0        0     6242 
43:    14200        0        0     6099 
44:   463266        0        0     1242 
45:    14130        0        0     6056 
46:    13574        0        0     5824 
47:   490142        0        0      778 
 *:  5131339        0        0   390909 

cpu:    recv     drop     time      rps 
 0:    46704        0        0    13515 
 1:    46175        0        0    13421 
 2:    22761        0        0     8388 
 3:    47142        0        0    13758 
 4:    46908        0        0    13532 
 5:    27770        0        0     9681 
 6:    47210        0        0    13638 
 7:    47645        0        0    13657 
 8:    28668        0        0     9829 
 9:    47806        0        0    13763 
10:    47638        0        0    13621 
11:    30896        0        0    10260 
12:    47778        0        0    13721 
13:    48396        0        0    13753 
14:    18130        0        0     7339 
15:    46427        0        0    13522 
16:    47578        0        0    13659 
17:    25465        0        0     8996 
18:    47052        0        0    13537 
19:    48184        0        0    13839 
20:    27105        0        0     9526 
21:    48230        0        0    13697 
22:    49176        0        0    13919 
23:    20728        0        0     7863 
24:    13626        0        0     5844 
25:    11770        0        0     5112 
26:   532288        0        0      549 
27:    13960        0        0     6030 
28:    13534        0        0     5863 
29:   537130        0        0     1374 
30:    14702        0        0     6259 
31:    13776        0        0     5923 
32:   520046        0        0     1242 
33:    14292        0        0     6095 
34:    13684        0        0     5868 
35:   524026        0        0     1466 
36:    14931        0        0     6375 
37:    10918        0        0     4738 
38:   545740        0        0      119 
39:    15372        0        0     6580 
40:    13984        0        0     5992 
41:   507908        0        0     1185 
42:    15540        0        0     6595 
43:    14538        0        0     6243 
44:   486684        0        0     1202 
45:    15100        0        0     6417 
46:    13423        0        0     5781 
47:   515604        0        0      333 
 *:  5354148        0        0   393619 

cpu:    recv     drop     time      rps 
 0:    49981        0        0    14007 
 1:    51769        0        0    14362 
 2:    21066        0        0     7982 
 3:    51477        0        0    14326 
 4:    50566        0        0    14090 
 5:    21334        0        0     8299 
 6:    50853        0        0    14238 
 7:    52091        0        0    14379 
 8:    22447        0        0     8502 
 9:    51318        0        0    14373 
10:    52682        0        0    14605 
11:    31434        0        0    10542 
12:    45672        0        0    13385 
13:    46592        0        0    13574 
14:    19514        0        0     7595 
15:    45765        0        0    13409 
16:    45518        0        0    13260 
17:    22627        0        0     8526 
18:    45697        0        0    13382 
19:    46958        0        0    13667 
20:    25211        0        0     9039 
21:    46581        0        0    13685 
22:    46623        0        0    13493 
23:    22625        0        0     8326 
24:    15724        0        0     6612 
25:    13978        0        0     5959 
26:   555430        0        0      296 
27:    16266        0        0     6831 
28:    14319        0        0     6139 
29:   557434        0        0      232 
30:    17372        0        0     7232 
31:    14600        0        0     6244 
32:   541476        0        0      601 
33:    17265        0        0     7225 
34:    15755        0        0     6693 
35:   550066        0        0     1764 
36:    14554        0        0     6240 
37:    12873        0        0     5575 
38:   569992        0        0      323 
39:    14685        0        0     6306 
40:    13202        0        0     5755 
41:   531414        0        0      571 
42:    15002        0        0     6467 
43:    13336        0        0     5746 
44:   512364        0        0     1019 
45:    14469        0        0     6158 
46:    13390        0        0     5813 
47:   541256        0        0      644 
 *:  5562623        0        0   397491 

cpu:    recv     drop     time      rps 
 0:    49230        0        0    13561 
 1:    48356        0        0    13262 
 2:    25240        0        0     8872 
 3:    48772        0        0    13475 
 4:    49256        0        0    13579 
 5:    26330        0        0     9117 
 6:    49474        0        0    13638 
 7:    50230        0        0    13808 
 8:    27763        0        0     9450 
 9:    49538        0        0    13641 
10:    50428        0        0    13888 
11:    26006        0        0     9110 
12:    46391        0        0    13273 
13:    46546        0        0    13354 
14:    18240        0        0     7144 
15:    45833        0        0    13084 
16:    46194        0        0    13148 
17:    26255        0        0     9218 
18:    46387        0        0    13280 
19:    47606        0        0    13546 
20:    22683        0        0     8411 
21:    47091        0        0    13458 
22:    47880        0        0    13577 
23:    22779        0        0     8252 
24:    15551        0        0     6458 
25:    14146        0        0     5986 
26:   558688        0        0      779 
27:    15856        0        0     6559 
28:    13980        0        0     5886 
29:   562008        0        0     1002 
30:    16178        0        0     6766 
31:    14736        0        0     6213 
32:   542428        0        0     1121 
33:    15828        0        0     6541 
34:    14944        0        0     6336 
35:   547546        0        0      829 
36:    13882        0        0     5942 
37:    11804        0        0     5165 
38:   571056        0        0      227 
39:    15422        0        0     6529 
40:    12786        0        0     5514 
41:   532399        0        0     1073 
42:    14810        0        0     6316 
43:    13254        0        0     5721 
44:   509890        0        0      649 
45:    14717        0        0     6280 
46:    12160        0        0     5294 
47:   538686        0        0      547 
 *:  5557263        0        0   388879 

cpu:    recv     drop     time      rps 
 0:    48494        0        0    13610 
 1:    48450        0        0    13667 
 2:    18908        0        0     7389 
 3:    47301        0        0    13496 
 4:    48212        0        0    13626 
 5:    24524        0        0     8817 
 6:    48055        0        0    13477 
 7:    50226        0        0    13908 
 8:    26093        0        0     9198 
 9:    49130        0        0    13734 
10:    50252        0        0    14079 
11:    30880        0        0    10275 
12:    46759        0        0    13098 
13:    48464        0        0    13494 
14:    21192        0        0     7887 
15:    47295        0        0    13352 
16:    48224        0        0    13641 
17:    27363        0        0     9500 
18:    46990        0        0    13353 
19:    48559        0        0    13695 
20:    24237        0        0     8670 
21:    48024        0        0    13583 
22:    49013        0        0    13651 
23:    22739        0        0     8365 
24:    14664        0        0     6240 
25:    10190        0        0     4505 
26:   556422        0        0      301 
27:    14702        0        0     6260 
28:    13725        0        0     5924 
29:   560214        0        0      826 
30:    15144        0        0     6412 
31:    14250        0        0     6075 
32:   540102        0        0      972 
33:    15122        0        0     6408 
34:    14358        0        0     6157 
35:   549364        0        0     1676 
36:    14894        0        0     6302 
37:    13023        0        0     5569 
38:   571308        0        0      496 
39:    15154        0        0     6391 
40:    14430        0        0     6116 
41:   530950        0        0      945 
42:    15478        0        0     6571 
43:    13633        0        0     5849 
44:   511994        0        0     1052 
45:    14892        0        0     6327 
46:    13216        0        0     5686 
47:   541362        0        0      559 
 *:  5557975        0        0   391184 

cpu:    recv     drop     time      rps 
 0:    49414        0        0    13841 
 1:    50425        0        0    14087 
 2:    19888        0        0     7699 
 3:    49729        0        0    14059 
 4:    49847        0        0    13937 
 5:    20906        0        0     7860 
 6:    49566        0        0    13901 
 7:    49948        0        0    13943 
 8:    26602        0        0     9373 
 9:    50721        0        0    14104 
10:    50977        0        0    14123 
11:    31706        0        0    10511 
12:    47948        0        0    13746 
13:    48042        0        0    13843 
14:    17106        0        0     7039 
15:    47788        0        0    13749 
16:    47675        0        0    13651 
17:    22882        0        0     8337 
18:    47063        0        0    13544 
19:    48308        0        0    13791 
20:    23578        0        0     8637 
21:    48128        0        0    13847 
22:    48846        0        0    13843 
23:    20482        0        0     7744 
24:    15436        0        0     6517 
25:    12962        0        0     5592 
26:   555592        0        0      216 
27:    16100        0        0     6811 
28:    13358        0        0     5712 
29:   558520        0        0      572 
30:    15792        0        0     6618 
31:    14698        0        0     6277 
32:   540146        0        0     1166 
33:    15970        0        0     6711 
34:    15034        0        0     6345 
35:   548184        0        0     2099 
36:    15194        0        0     6493 
37:    12204        0        0     5338 
38:   570088        0        0       77 
39:    15828        0        0     6732 
40:    13156        0        0     5694 
41:   528860        0        0      906 
42:    15874        0        0     6783 
43:    13476        0        0     5795 
44:   510034        0        0      973 
45:    15476        0        0     6624 
46:    13382        0        0     5816 
47:   538046        0        0      551 
 *:  5550985        0        0   395627 

cpu:    recv     drop     time      rps 
 0:    42896        0        0    12157 
 1:    43502        0        0    12338 
 2:    24072        0        0     8449 
 3:    42853        0        0    12258 
 4:    43146        0        0    12331 
 5:    21194        0        0     7741 
 6:    42003        0        0    12066 
 7:    43034        0        0    12182 
 8:    22830        0        0     7946 
 9:    43633        0        0    12347 
10:    43731        0        0    12329 
11:    24231        0        0     8449 
12:    43542        0        0    12251 
13:    44341        0        0    12409 
14:    19231        0        0     7209 
15:    43392        0        0    12284 
16:    43544        0        0    12189 
17:    24620        0        0     8463 
18:    42781        0        0    12012 
19:    44263        0        0    12439 
20:    22462        0        0     8016 
21:    43984        0        0    12512 
22:    44554        0        0    12435 
23:    19194        0        0     7287 
24:    13028        0        0     5565 
25:    11452        0        0     4959 
26:   558724        0        0      850 
27:    13408        0        0     5708 
28:    11022        0        0     4745 
29:   559438        0        0      645 
30:    13428        0        0     5695 
31:    12946        0        0     5524 
32:   543112        0        0     1045 
33:    13006        0        0     5520 
34:    12110        0        0     5191 
35:   547556        0        0      838 
36:    13546        0        0     5723 
37:    12582        0        0     5456 
38:   571372        0        0      424 
39:    14040        0        0     5898 
40:    12936        0        0     5525 
41:   536642        0        0      978 
42:    14164        0        0     5957 
43:    13158        0        0     5671 
44:   518283        0        0      975 
45:    13834        0        0     5860 
46:    11914        0        0     5093 
47:   542846        0        0      489 
 *:  5457580        0        0   354433 

TCP_RR workload ends....

cpu:    recv     drop     time      rps 
26:   588684        0        0        0 
29:   589572        0        0        0 
32:   589626        0        0        0 
35:   588128        0        0        0 
38:   589176        0        0        0 
41:   589258        0        0        0 
44:   589546        0        0        0 
47:   587540        0        0        0 
 *:  4711633        0        0       12 

Thanks

^ permalink raw reply

* [PATCH] vxlan: Wrong type passed to %pIS
From: Rasmus Villemoes @ 2015-02-07  2:17 UTC (permalink / raw)
  To: David S. Miller, Pravin B Shelar, Nicolas Dichtel
  Cc: Rasmus Villemoes, netdev, linux-kernel

src_ip is a pointer to a union vxlan_addr, one member of which is a
struct sockaddr. Passing a pointer to src_ip is wrong; one should pass
the value of src_ip itself. Since %pIS formally expects something of
type struct sockaddr*, let's pass a pointer to the appropriate union
member, though this of course doesn't change the generated code.

Fixes: e4c7ed415387 ("vxlan: add ipv6 support")
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/net/vxlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index a8c755dcab14..11defbb24183 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -991,7 +991,7 @@ static bool vxlan_snoop(struct net_device *dev,
 		if (net_ratelimit())
 			netdev_info(dev,
 				    "%pM migrated from %pIS to %pIS\n",
-				    src_mac, &rdst->remote_ip, &src_ip);
+				    src_mac, &rdst->remote_ip.sa, &src_ip->sa);
 
 		rdst->remote_ip = *src_ip;
 		f->updated = jiffies;
-- 
2.1.3

^ permalink raw reply related

* Re: [PATCH next 5/6] bonding: Allow userspace to set macaddr on bonding-dev
From: Jay Vosburgh @ 2015-02-07  1:54 UTC (permalink / raw)
  To: Mahesh Bandewar
  Cc: Andy Gospodarek, Veaceslav Falico, Nikolay Aleksandrov,
	David Miller, netdev, Eric Dumazet, Maciej Żenczykowski
In-Reply-To: <CAF2d9jgV5adAjydN18Ct7BVJJcc=FRc+5icNMS=pRQMRX=83+w@mail.gmail.com>

Mahesh Bandewar <maheshb@google.com> wrote:

>On Fri, Feb 6, 2015 at 5:20 PM, Jay Vosburgh <jay.vosburgh@canonical.com> wrote:
>> Mahesh Bandewar <maheshb@google.com> wrote:
>>
>>>This patch allows user-space to set the mac-address on the bonding device.
>>>This mac-address can not be NULL or a Multicast. If the mac-address is set
>>>from user-space; kernel will honor it and will not overwrite it. In the
>>>absense (value from user space); the logic will default to using the
>>>masters' mac as the mac address for the bonding device.
>>>
>>>It can be set using example code below -
>>>
>>>   # modprobe bonding mode=4
>>>   # sys_mac_addr=$(printf '%02x:%02x:%02x:%02x:%02x:%02x' \
>>>                    $(( (RANDOM & 0xFE) | 0x02 )) \
>>>                    $(( RANDOM & 0xFF )) \
>>>                    $(( RANDOM & 0xFF )) \
>>>                    $(( RANDOM & 0xFF )) \
>>>                    $(( RANDOM & 0xFF )) \
>>>                    $(( RANDOM & 0xFF )))
>>>   # echo $sys_mac_addr > /sys/class/net/bond0/bonding/ad_actor_system_mac_address
>>>   # echo +eth1 > /sys/class/net/bond0/bonding/slaves
>>>   ...
>>>   # ip link set bond0 up
>>
>>         How is this patch functionally different from setting the
>> bonding master's MAC address to a particular value prior to adding any
>> slaves?
>>
>
>Maciej is correct but I think I was bit ambiguous about it in the
>commit message which might have made you think this way. I'll reword
>the commit message.

	Thanks; presumably there is some administrative reason for this.

	Also, for patches 4, 5 and 6, I believe current practice is to
provide a netlink / iproute2 facility for options.

	-J


>>         -J
>>
>>>Signed-off-by: Mahesh Bandewar <maheshb@google.com>
>>>---
>>> drivers/net/bonding/bond_3ad.c     |  7 ++++++-
>>> drivers/net/bonding/bond_main.c    |  1 +
>>> drivers/net/bonding/bond_options.c | 29 +++++++++++++++++++++++++++++
>>> drivers/net/bonding/bond_procfs.c  |  6 ++++++
>>> drivers/net/bonding/bond_sysfs.c   | 16 ++++++++++++++++
>>> include/net/bond_options.h         |  1 +
>>> include/net/bonding.h              |  1 +
>>> 7 files changed, 60 insertions(+), 1 deletion(-)
>>>
>>>diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>>>index 1177f96194dd..373d3db3809f 100644
>>>--- a/drivers/net/bonding/bond_3ad.c
>>>+++ b/drivers/net/bonding/bond_3ad.c
>>>@@ -1914,7 +1914,12 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution)
>>>
>>>               BOND_AD_INFO(bond).system.sys_priority =
>>>                       bond->params.ad_actor_sysprio;
>>>-              BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr *)bond->dev->dev_addr);
>>>+              if (is_zero_ether_addr(bond->params.ad_actor_sys_macaddr))
>>>+                      BOND_AD_INFO(bond).system.sys_mac_addr =
>>>+                          *((struct mac_addr *)bond->dev->dev_addr);
>>>+              else
>>>+                      BOND_AD_INFO(bond).system.sys_mac_addr =
>>>+                          *((struct mac_addr *)bond->params.ad_actor_sys_macaddr);
>>>
>>>               /* initialize how many times this module is called in one
>>>                * second (should be about every 100ms)
>>>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>>>index 561b2bde5aeb..1a6735ef2ea7 100644
>>>--- a/drivers/net/bonding/bond_main.c
>>>+++ b/drivers/net/bonding/bond_main.c
>>>@@ -4440,6 +4440,7 @@ static int bond_check_params(struct bond_params *params)
>>>       params->packets_per_slave = packets_per_slave;
>>>       params->tlb_dynamic_lb = 1; /* Default value */
>>>       params->ad_actor_sysprio = ad_actor_sysprio;
>>>+      eth_zero_addr(params->ad_actor_sys_macaddr);
>>>       if (packets_per_slave > 0) {
>>>               params->reciprocal_packets_per_slave =
>>>                       reciprocal_value(packets_per_slave);
>>>diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
>>>index d8f6760143ae..330d48b6a1e6 100644
>>>--- a/drivers/net/bonding/bond_options.c
>>>+++ b/drivers/net/bonding/bond_options.c
>>>@@ -72,6 +72,8 @@ static int bond_option_tlb_dynamic_lb_set(struct bonding *bond,
>>>                                 const struct bond_opt_value *newval);
>>> static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
>>>                                 const struct bond_opt_value *newval);
>>>+static int bond_option_ad_actor_sys_macaddr_set(struct bonding *bond,
>>>+                                const struct bond_opt_value *newval);
>>>
>>>
>>> static const struct bond_opt_value bond_mode_tbl[] = {
>>>@@ -396,6 +398,13 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
>>>               .values = bond_ad_actor_sysprio_tbl,
>>>               .set = bond_option_ad_actor_sysprio_set,
>>>       },
>>>+      [BOND_OPT_AD_ACTOR_SYS_MACADDR] = {
>>>+              .id = BOND_OPT_AD_ACTOR_SYS_MACADDR,
>>>+              .name = "ad_actor_system_mac_address",
>>>+              .unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_8023AD)),
>>>+              .flags = BOND_OPTFLAG_RAWVAL | BOND_OPTFLAG_IFDOWN,
>>>+              .set = bond_option_ad_actor_sys_macaddr_set,
>>>+      },
>>> };
>>>
>>> /* Searches for an option by name */
>>>@@ -1376,3 +1385,23 @@ static int bond_option_ad_actor_sysprio_set(struct bonding *bond,
>>>       bond->params.ad_actor_sysprio = newval->value;
>>>       return 0;
>>> }
>>>+
>>>+static int bond_option_ad_actor_sys_macaddr_set(struct bonding *bond,
>>>+                                          const struct bond_opt_value *newval)
>>>+{
>>>+      u8 macaddr[ETH_ALEN];
>>>+      int i;
>>>+
>>>+      i = sscanf(newval->string, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
>>>+                 &macaddr[0], &macaddr[1], &macaddr[2],
>>>+                 &macaddr[3], &macaddr[4], &macaddr[5]);
>>>+
>>>+      if (i != ETH_ALEN || !is_valid_ether_addr(macaddr)) {
>>>+              netdev_err(bond->dev, "Invalid MAC address.\n");
>>>+              return -EINVAL;
>>>+      }
>>>+
>>>+      ether_addr_copy(bond->params.ad_actor_sys_macaddr, macaddr);
>>>+
>>>+      return 0;
>>>+}
>>>diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
>>>index 9e33c48886ef..81452ced852f 100644
>>>--- a/drivers/net/bonding/bond_procfs.c
>>>+++ b/drivers/net/bonding/bond_procfs.c
>>>@@ -136,6 +136,8 @@ static void bond_info_show_master(struct seq_file *seq)
>>>                          optval->string);
>>>               seq_printf(seq, "System priority: %d\n",
>>>                               BOND_AD_INFO(bond).system.sys_priority);
>>>+              seq_printf(seq, "System MAC address: %pM\n",
>>>+                              &BOND_AD_INFO(bond).system.sys_mac_addr);
>>>
>>>               if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
>>>                       seq_printf(seq, "bond %s has no active aggregator\n",
>>>@@ -198,6 +200,8 @@ static void bond_info_show_slave(struct seq_file *seq,
>>>                       seq_puts(seq, "details actor lacp pdu:\n");
>>>                       seq_printf(seq, "    system priority: %d\n",
>>>                                  port->actor_system_priority);
>>>+                      seq_printf(seq, "    system mac address: %pM\n",
>>>+                                 &port->actor_system);
>>>                       seq_printf(seq, "    port key: %d\n",
>>>                                  port->actor_oper_port_key);
>>>                       seq_printf(seq, "    port priority: %d\n",
>>>@@ -210,6 +214,8 @@ static void bond_info_show_slave(struct seq_file *seq,
>>>                       seq_puts(seq, "details partner lacp pdu:\n");
>>>                       seq_printf(seq, "    system priority: %d\n",
>>>                                  port->partner_oper.system_priority);
>>>+                      seq_printf(seq, "    system mac address: %pM\n",
>>>+                                 &port->partner_oper.system);
>>>                       seq_printf(seq, "    oper key: %d\n",
>>>                                  port->partner_oper.key);
>>>                       seq_printf(seq, "    port priority: %d\n",
>>>diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
>>>index 4350aa06f867..91713d0b6685 100644
>>>--- a/drivers/net/bonding/bond_sysfs.c
>>>+++ b/drivers/net/bonding/bond_sysfs.c
>>>@@ -706,6 +706,21 @@ static ssize_t bonding_show_ad_actor_sysprio(struct device *d,
>>> static DEVICE_ATTR(ad_actor_system_priority, S_IRUGO | S_IWUSR,
>>>                  bonding_show_ad_actor_sysprio, bonding_sysfs_store_option);
>>>
>>>+static ssize_t bonding_show_ad_actor_sys_macaddr(struct device *d,
>>>+                                               struct device_attribute *attr,
>>>+                                               char *buf)
>>>+{
>>>+      struct bonding *bond = to_bond(d);
>>>+
>>>+      if (BOND_MODE(bond) == BOND_MODE_8023AD)
>>>+              return sprintf(buf, "%pM\n", bond->params.ad_actor_sys_macaddr);
>>>+
>>>+      return 0;
>>>+}
>>>+static DEVICE_ATTR(ad_actor_system_mac_address, S_IRUGO | S_IWUSR,
>>>+                 bonding_show_ad_actor_sys_macaddr,
>>>+                 bonding_sysfs_store_option);
>>>+
>>> static struct attribute *per_bond_attrs[] = {
>>>       &dev_attr_slaves.attr,
>>>       &dev_attr_mode.attr,
>>>@@ -740,6 +755,7 @@ static struct attribute *per_bond_attrs[] = {
>>>       &dev_attr_packets_per_slave.attr,
>>>       &dev_attr_tlb_dynamic_lb.attr,
>>>       &dev_attr_ad_actor_system_priority.attr,
>>>+      &dev_attr_ad_actor_system_mac_address.attr,
>>>       NULL,
>>> };
>>>
>>>diff --git a/include/net/bond_options.h b/include/net/bond_options.h
>>>index c2af1db37354..993ef73cd050 100644
>>>--- a/include/net/bond_options.h
>>>+++ b/include/net/bond_options.h
>>>@@ -64,6 +64,7 @@ enum {
>>>       BOND_OPT_SLAVES,
>>>       BOND_OPT_TLB_DYNAMIC_LB,
>>>       BOND_OPT_AD_ACTOR_SYSPRIO,
>>>+      BOND_OPT_AD_ACTOR_SYS_MACADDR,
>>>       BOND_OPT_LAST
>>> };
>>>
>>>diff --git a/include/net/bonding.h b/include/net/bonding.h
>>>index 7a5c79fcf866..cd2092e6bc71 100644
>>>--- a/include/net/bonding.h
>>>+++ b/include/net/bonding.h
>>>@@ -144,6 +144,7 @@ struct bond_params {
>>>       int tlb_dynamic_lb;
>>>       struct reciprocal_value reciprocal_packets_per_slave;
>>>       u16 ad_actor_sysprio;
>>>+      u8 ad_actor_sys_macaddr[ETH_ALEN];
>>> };
>>>
>>> struct bond_parm_tbl {
>>>--
>>>2.2.0.rc0.207.ga3a616c
>>>

---
	-Jay Vosburgh, jay.vosburgh@canonical.com

^ permalink raw reply


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