Re: [PATCH] bridge: Enable configuration of ageing interval for bridges and switch devices.

2015-08-18 Thread Michal Kubecek
On Tue, Aug 18, 2015 at 09:08:42AM +, Premkumar Jonnala wrote:
  -Original Message-
  From: Rosen, Rami [mailto:rami.ro...@intel.com]
  Sent: Tuesday, August 18, 2015 10:25 AM
  To: Premkumar Jonnala; roopa
  Cc: netdev@vger.kernel.org
  Subject: RE: [PATCH] bridge: Enable configuration of ageing interval for 
  bridges
  and switch devices.
  
  Hi,
  
  First, I agree about the need to propagate the ageing interval to switchdev
  devices, so that hardware based aging can be setup correctly.
  
  Second, in this occasion, I want to mention the need to
  turn off bridge ageing in the kernel as part of using switchdev devices. 
  This is
  mentioned in
  https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-
  next/+/master/Documentation/networking/switchdev.txt:
  
  ...
  XXX: how to turn off ageing in kernel on a per-port basis or
  otherwise prevent the kernel from ageing out the FDB entry?
  ...
  
  One can think of the option of using value 0 of the ageing interval as an
  indication to turn off bridge ageing in the kernel, and any other value 
  bigger
  than MIN_AGEING_INTERVAL_SECS to turn on bridge ageing.
 
 I recall that there was a patch proposed to prevent ageing of fdb entried by 
 bridge in kernel,
 when the fdb entry was added due to notification by switch device.  Please 
 see:
 http://www.spinics.net/lists/netdev/msg314770.html
 
 Somehow the patch is not visible in the net-next pull.

It has been reverted by commit 3fcf90111887 as requested by

  http://www.spinics.net/lists/netdev/msg315236.html

Michal Kubecek

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v3] rocker: add debugfs support to dump internal tables

2015-08-18 Thread Scott Feldman
On Mon, Aug 17, 2015 at 10:55 PM, Jiri Pirko j...@resnulli.us wrote:
 Tue, Aug 18, 2015 at 12:36:17AM CEST, sfel...@gmail.com wrote:
From: Scott Feldman sfel...@gmail.com

 tree /sys/kernel/debug/rocker
/sys/kernel/debug/rocker
└── 525400123501
├── fdb_tbl
├── internal_vlan_tbl
├── neigh_tbl
├── of_dpa_flow_tbl
└── of_dpa_group_tbl

1 directory, 5 files

 cat /sys/kernel/debug/rocker/525400123501/internal_vlan_tbl
ifindex 5 ref_count 1 vlan 3843
ifindex 7 ref_count 2 vlan 3840
ifindex 4 ref_count 1 vlan 3842

 cat /sys/kernel/debug/rocker/525400123501/fdb_tbl
learned 1 pport 1 addr 00:02:00:00:02:00 vlan 3840
learned 1 pport 2 addr 00:02:00:00:03:00 vlan 3840

 cat /sys/kernel/debug/rocker/525400123501/neigh_tbl
11.0.0.9 dev sw1p2 ref_count 3 index 1 dst 00:02:00:00:01:00 ttl_check 1
11.0.0.1 dev sw1p1 ref_count 3 index 0 dst 00:02:00:00:00:00 ttl_check 1

 cat /sys/kernel/debug/rocker/525400123501/of_dpa_flow_tbl
cmd 3 cookie 15 priority 3  tbl aclin_pport 2 
01:80:c2:00:00:00/ff:ff:ff:ff:ff:f0 eth_type 0x vlan_id 3841 ip proto 0/0 
ip tos 0/0 group_id 0x0f01
cmd 3 cookie 2  priority 0  tbl term_mac   in_pport 1 eth_type 0x0800 
52:54:00:12:35:01 vlan_id 3840 goto_tbl ucast_routing copy_to_cpu 0
cmd 3 cookie 1f priority 3  tbl bridge 00:02:00:00:00:00 vlan_id 3840 
tunnel_id 0 goto_tbl acl group_id 0x copy_to_cpu 0
cmd 3 cookie 4  priority 1  tbl vlan   in_pport 2 vlan_id 0 goto_tbl 
term_mac untagged 1 new_vlan_id 3841
cmd 3 cookie 20 priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.1 
goto_tbl acl group_id 0x2000
cmd 3 cookie 21 priority 3  tbl bridge 00:02:00:00:01:00 vlan_id 3841 
tunnel_id 0 goto_tbl acl group_id 0x copy_to_cpu 0
cmd 3 cookie 16 priority 2  tbl aclin_pport 2 eth_type 0x0806 
vlan_id 3841 ip proto 0/0 ip tos 0/0 group_id 0x0f01
cmd 3 cookie 12 priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.0 
goto_tbl acl group_id 0x0f00
cmd 3 cookie 9  priority 3  tbl aclin_pport 1 
01:80:c2:00:00:00/ff:ff:ff:ff:ff:f0 eth_type 0x vlan_id 3840 ip proto 0/0 
ip tos 0/0 group_id 0x0f00
cmd 3 cookie 6  priority 0  tbl term_mac   in_pport 2 eth_type 0x86dd 
52:54:00:12:35:02 vlan_id 3841 goto_tbl ucast_routing copy_to_cpu 0
cmd 4 cookie 0  priority 1  tbl ig_portin_pport 0/0x goto_tbl 
vlan
cmd 4 cookie e  priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.3 
goto_tbl acl group_id 0x0f00
cmd 3 cookie 1  priority 1  tbl vlan   in_pport 1 vlan_id 0 goto_tbl 
term_mac untagged 1 new_vlan_id 3840
cmd 3 cookie 24 priority 20 tbl ucast_routing  eth_type 0x0800 
11.0.0.4/255.255.255.252 goto_tbl acl group_id 0x2000
cmd 4 cookie 14 priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.10 
goto_tbl acl group_id 0x0f01
cmd 3 cookie 2c priority 20 tbl ucast_routing  eth_type 0x0800 12.0.0.4 
goto_tbl acl group_id 0x2001
cmd 3 cookie 17 priority 1  tbl term_mac   in_pport 2 eth_type 0x0800 
01:00:5e:00:00:00/ff:ff:ff:80:00:00 vlan_id 3841 goto_tbl mcast_routing 
copy_to_cpu 1
cmd 3 cookie 26 priority 20 tbl ucast_routing  eth_type 0x0800 12.0.0.3 
goto_tbl acl group_id 0x2000
cmd 3 cookie 2e priority 30 tbl ucast_routing  eth_type 0x0800 12.0.0.2 
goto_tbl acl group_id 0x0f01
cmd 3 cookie 22 priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.9 
goto_tbl acl group_id 0x2001
cmd 3 cookie 1c priority 0  tbl ucast_routing  eth_type 0x0800 
11.0.0.8/255.255.255.252 goto_tbl acl group_id 0x0f01
cmd 3 cookie 18 priority 1  tbl term_mac   in_pport 2 eth_type 0x86dd 
33:33:00:00:00:00/ff:ff:00:00:00:00 vlan_id 3841 goto_tbl mcast_routing 
copy_to_cpu 1
cmd 3 cookie 5  priority 0  tbl term_mac   in_pport 2 eth_type 0x0800 
52:54:00:12:35:02 vlan_id 3841 goto_tbl ucast_routing copy_to_cpu 0
cmd 3 cookie a  priority 2  tbl aclin_pport 1 eth_type 0x0806 
vlan_id 3840 ip proto 0/0 ip tos 0/0 group_id 0x0f00
cmd 4 cookie 1a priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.11 
goto_tbl acl group_id 0x0f01
cmd 3 cookie 1e priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.8 
goto_tbl acl group_id 0x0f01
cmd 3 cookie 3  priority 0  tbl term_mac   in_pport 1 eth_type 0x86dd 
52:54:00:12:35:01 vlan_id 3840 goto_tbl ucast_routing copy_to_cpu 0
cmd 3 cookie b  priority 1  tbl term_mac   in_pport 1 eth_type 0x0800 
01:00:5e:00:00:00/ff:ff:ff:80:00:00 vlan_id 3840 goto_tbl mcast_routing 
copy_to_cpu 1
cmd 4 cookie 8  priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.2 
goto_tbl acl group_id 0x0f00
cmd 3 cookie 10 priority 0  tbl ucast_routing  eth_type 0x0800 
11.0.0.0/255.255.255.252 goto_tbl acl group_id 0x0f00
cmd 3 cookie 28 priority 20 tbl ucast_routing  eth_type 0x0800 
11.0.0.12/255.255.255.252 goto_tbl acl group_id 0x2001
cmd 3 cookie c  priority 1  tbl term_mac   in_pport 1 eth_type 0x86dd 
33:33:00:00:00:00/ff:ff:00:00:00:00 vlan_id 3840 

[PATCH 05/21] net: nlmon: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Daniel Borkmann dbork...@redhat.com
---
 drivers/net/nlmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/nlmon.c b/drivers/net/nlmon.c
index 34924df..7b7c70e 100644
--- a/drivers/net/nlmon.c
+++ b/drivers/net/nlmon.c
@@ -130,7 +130,7 @@ static const struct net_device_ops nlmon_ops = {
 static void nlmon_setup(struct net_device *dev)
 {
dev-type = ARPHRD_NETLINK;
-   dev-tx_queue_len = 0;
+   dev-priv_flags |= IFF_NO_QUEUE;
 
dev-netdev_ops = nlmon_ops;
dev-ethtool_ops = nlmon_ethtool_ops;
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/21] net: Convert drivers to IFF_NO_QUEUE and cleanup afterwards

2015-08-18 Thread Phil Sutter
This series converts in-tree users away from the old and deprecated
'tx_queue_len = 0' idiom, adds a warning to notify out-of-tree driver
maintainers that there is need for action on their behalf and finally drops any
workarounds in scheduling algorithm implementations.

Phil Sutter (21):
  net: veth: enable noqueue operation by default
  net: dummy: convert to using IFF_NO_QUEUE
  net: geneve: convert to using IFF_NO_QUEUE
  net: loopback: convert to using IFF_NO_QUEUE
  net: nlmon: convert to using IFF_NO_QUEUE
  net: team: convert to using IFF_NO_QUEUE
  net: vxlan: convert to using IFF_NO_QUEUE
  net: 8021q: convert to using IFF_NO_QUEUE
  net: bridge: convert to using IFF_NO_QUEUE
  net: 6lowpan: convert to using IFF_NO_QUEUE
  net: bonding: convert to using IFF_NO_QUEUE
  net: ipvlan: convert to using IFF_NO_QUEUE
  net: dsa: convert to using IFF_NO_QUEUE
  net: hostap: convert to using IFF_NO_QUEUE
  net: mac80211_hwsim: convert to using IFF_NO_QUEUE
  net: batman-adv: convert to using IFF_NO_QUEUE
  net: hsr: convert to using IFF_NO_QUEUE
  net: caif: convert to using IFF_NO_QUEUE
  staging: wilc1000: convert to using IFF_NO_QUEUE
  net: warn if drivers set tx_queue_len = 0
  net: sched: drop all special handling of tx_queue_len == 0

 drivers/net/bonding/bond_main.c   | 3 +--
 drivers/net/caif/caif_hsi.c   | 2 +-
 drivers/net/caif/caif_serial.c| 2 +-
 drivers/net/caif/caif_spi.c   | 2 +-
 drivers/net/dummy.c   | 3 +--
 drivers/net/geneve.c  | 3 +--
 drivers/net/ipvlan/ipvlan_main.c  | 3 +--
 drivers/net/loopback.c| 3 +--
 drivers/net/nlmon.c   | 2 +-
 drivers/net/team/team.c   | 2 +-
 drivers/net/veth.c| 1 +
 drivers/net/vxlan.c   | 3 +--
 drivers/net/wan/hdlc_fr.c | 2 +-
 drivers/net/wireless/hostap/hostap_main.c | 4 ++--
 drivers/net/wireless/mac80211_hwsim.c | 2 +-
 drivers/staging/wilc1000/linux_mon.c  | 2 +-
 net/8021q/vlan_dev.c  | 3 +--
 net/batman-adv/soft-interface.c   | 2 +-
 net/bridge/br_device.c| 3 +--
 net/caif/caif_dev.c   | 2 +-
 net/core/dev.c| 3 +++
 net/dsa/slave.c   | 2 +-
 net/hsr/hsr_device.c  | 2 +-
 net/ieee802154/6lowpan/core.c | 2 +-
 net/sched/sch_fifo.c  | 2 +-
 net/sched/sch_gred.c  | 8 +++-
 net/sched/sch_htb.c   | 6 ++
 net/sched/sch_plug.c  | 8 ++--
 net/sched/sch_sfb.c   | 2 +-
 29 files changed, 36 insertions(+), 48 deletions(-)

-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 20/21] net: warn if drivers set tx_queue_len = 0

2015-08-18 Thread Phil Sutter
Due to the introduction of IFF_NO_QUEUE, there is a better way for
drivers to indicate that no qdisc should be attached by default. Though,
the old convention can't be dropped since ignoring that setting would
break drivers still using it. Instead, add a warning so out-of-tree
driver maintainers get a chance to adjust their code before we finally
get rid of any special handling of tx_queue_len == 0.

Signed-off-by: Phil Sutter p...@nwl.cc
---
 net/core/dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 4870c35..b1f3f48 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6997,6 +6997,9 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, 
const char *name,
dev-priv_flags = IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM;
setup(dev);
 
+   if (!dev-tx_queue_len)
+   printk(KERN_WARNING %s uses DEPRECATED zero tx_queue_len - 
convert driver to use IFF_NO_QUEUE instead.\n, name);
+
dev-num_tx_queues = txqs;
dev-real_num_tx_queues = txqs;
if (netif_alloc_netdev_queues(dev))
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/21] net: bridge: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Stephen Hemminger step...@networkplumber.org
---
 net/bridge/br_device.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 0aa8f5c..6ed2feb 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -365,8 +365,7 @@ void br_dev_setup(struct net_device *dev)
dev-destructor = br_dev_free;
dev-ethtool_ops = br_ethtool_ops;
SET_NETDEV_DEVTYPE(dev, br_type);
-   dev-tx_queue_len = 0;
-   dev-priv_flags = IFF_EBRIDGE;
+   dev-priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE;
 
dev-features = COMMON_FEATURES | NETIF_F_LLTX | NETIF_F_NETNS_LOCAL |
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/21] net: ipvlan: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Mahesh Bandewar mahe...@google.com
---
 drivers/net/ipvlan/ipvlan_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 20b58bd..a9268db 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -520,12 +520,11 @@ static void ipvlan_link_setup(struct net_device *dev)
ether_setup(dev);
 
dev-priv_flags = ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
-   dev-priv_flags |= IFF_UNICAST_FLT;
+   dev-priv_flags |= IFF_UNICAST_FLT | IFF_NO_QUEUE;
dev-netdev_ops = ipvlan_netdev_ops;
dev-destructor = free_netdev;
dev-header_ops = ipvlan_header_ops;
dev-ethtool_ops = ipvlan_ethtool_ops;
-   dev-tx_queue_len = 0;
 }
 
 static const struct nla_policy ipvlan_nl_policy[IFLA_IPVLAN_MAX + 1] =
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/21] net: bonding: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Jay Vosburgh j.vosbu...@gmail.com
Cc: Veaceslav Falico vfal...@gmail.com
Cc: Andy Gospodarek go...@cumulusnetworks.com
---
 drivers/net/bonding/bond_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 2d7d72c..0ef2ed3 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4120,9 +4120,8 @@ void bond_setup(struct net_device *bond_dev)
SET_NETDEV_DEVTYPE(bond_dev, bond_type);
 
/* Initialize the device options */
-   bond_dev-tx_queue_len = 0;
bond_dev-flags |= IFF_MASTER|IFF_MULTICAST;
-   bond_dev-priv_flags |= IFF_BONDING | IFF_UNICAST_FLT;
+   bond_dev-priv_flags |= IFF_BONDING | IFF_UNICAST_FLT | IFF_NO_QUEUE;
bond_dev-priv_flags = ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
 
/* don't acquire bond device's netif_tx_lock when transmitting */
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/21] net: hostap: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Jouni Malinen j...@w1.fi
---
 drivers/net/wireless/hostap/hostap_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/hostap/hostap_main.c 
b/drivers/net/wireless/hostap/hostap_main.c
index 01de1a3..80d4228 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -865,7 +865,7 @@ void hostap_setup_dev(struct net_device *dev, local_info_t 
*local,
 
switch(type) {
case HOSTAP_INTERFACE_AP:
-   dev-tx_queue_len = 0;  /* use main radio device queue */
+   dev-priv_flags |= IFF_NO_QUEUE;/* use main radio 
device queue */
dev-netdev_ops = hostap_mgmt_netdev_ops;
dev-type = ARPHRD_IEEE80211;
dev-header_ops = hostap_80211_ops;
@@ -874,7 +874,7 @@ void hostap_setup_dev(struct net_device *dev, local_info_t 
*local,
dev-netdev_ops = hostap_master_ops;
break;
default:
-   dev-tx_queue_len = 0;  /* use main radio device queue */
+   dev-priv_flags |= IFF_NO_QUEUE;/* use main radio 
device queue */
dev-netdev_ops = hostap_netdev_ops;
}
 
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/21] net: team: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Jiri Pirko j...@resnulli.us
---
 drivers/net/team/team.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index daa054b..651d35e 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -2051,9 +2051,9 @@ static void team_setup(struct net_device *dev)
dev-netdev_ops = team_netdev_ops;
dev-ethtool_ops = team_ethtool_ops;
dev-destructor = team_destructor;
-   dev-tx_queue_len = 0;
dev-flags |= IFF_MULTICAST;
dev-priv_flags = ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
+   dev-priv_flags |= IFF_NO_QUEUE;
 
/*
 * Indicate we support unicast address filtering. That way core won't
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/21] net: loopback: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
---
 drivers/net/loopback.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index c76283c..dc7d970 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -165,10 +165,9 @@ static void loopback_setup(struct net_device *dev)
dev-mtu= 64 * 1024;
dev-hard_header_len= ETH_HLEN; /* 14   */
dev-addr_len   = ETH_ALEN; /* 6*/
-   dev-tx_queue_len   = 0;
dev-type   = ARPHRD_LOOPBACK;  /* 0x0001*/
dev-flags  = IFF_LOOPBACK;
-   dev-priv_flags |= IFF_LIVE_ADDR_CHANGE;
+   dev-priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
netif_keep_dst(dev);
dev-hw_features= NETIF_F_ALL_TSO | NETIF_F_UFO;
dev-features   = NETIF_F_SG | NETIF_F_FRAGLIST
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/21] net: mac80211_hwsim: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Johannes Berg johan...@sipsolutions.net
---
 drivers/net/wireless/mac80211_hwsim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c 
b/drivers/net/wireless/mac80211_hwsim.c
index 99e873d..a1dbcb2 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2676,7 +2676,7 @@ static void hwsim_mon_setup(struct net_device *dev)
dev-netdev_ops = hwsim_netdev_ops;
dev-destructor = free_netdev;
ether_setup(dev);
-   dev-tx_queue_len = 0;
+   dev-priv_flags |= IFF_NO_QUEUE;
dev-type = ARPHRD_IEEE80211_RADIOTAP;
eth_zero_addr(dev-dev_addr);
dev-dev_addr[0] = 0x12;
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/21] net: geneve: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: John W. Linville linvi...@tuxdriver.com
---
 drivers/net/geneve.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 78d49d1..897e1a3 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -283,7 +283,6 @@ static void geneve_setup(struct net_device *dev)
 
SET_NETDEV_DEVTYPE(dev, geneve_type);
 
-   dev-tx_queue_len = 0;
dev-features|= NETIF_F_LLTX;
dev-features|= NETIF_F_SG | NETIF_F_HW_CSUM;
dev-features|= NETIF_F_RXCSUM;
@@ -297,7 +296,7 @@ static void geneve_setup(struct net_device *dev)
dev-hw_features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
 
netif_keep_dst(dev);
-   dev-priv_flags |= IFF_LIVE_ADDR_CHANGE;
+   dev-priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
 }
 
 static const struct nla_policy geneve_policy[IFLA_GENEVE_MAX + 1] = {
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] bridge: Enable configuration of ageing interval for bridges and switch devices.

2015-08-18 Thread Premkumar Jonnala


 -Original Message-
 From: Rosen, Rami [mailto:rami.ro...@intel.com]
 Sent: Tuesday, August 18, 2015 10:25 AM
 To: Premkumar Jonnala; roopa
 Cc: netdev@vger.kernel.org
 Subject: RE: [PATCH] bridge: Enable configuration of ageing interval for 
 bridges
 and switch devices.
 
 Hi,
 
 First, I agree about the need to propagate the ageing interval to switchdev
 devices, so that hardware based aging can be setup correctly.
 
 Second, in this occasion, I want to mention the need to
 turn off bridge ageing in the kernel as part of using switchdev devices. This 
 is
 mentioned in
 https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-
 next/+/master/Documentation/networking/switchdev.txt:
 
 ...
 XXX: how to turn off ageing in kernel on a per-port basis or
 otherwise prevent the kernel from ageing out the FDB entry?
 ...
 
 One can think of the option of using value 0 of the ageing interval as an
 indication to turn off bridge ageing in the kernel, and any other value bigger
 than MIN_AGEING_INTERVAL_SECS to turn on bridge ageing.

I recall that there was a patch proposed to prevent ageing of fdb entried by 
bridge in kernel,
when the fdb entry was added due to notification by switch device.  Please see:
http://www.spinics.net/lists/netdev/msg314770.html

Somehow the patch is not visible in the net-next pull.

-Prem

 
 As another option for a *per-port* boolean flag for enabling/disabling ageing,
 one can think of adding an IFLA_BRPORT_AGEING bool flag (and BR_AGEING)
 for IFLA_PROTINFO.
 
 Regards,
 Rami Rosen
 Intel Corporation

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch] cxgb4: memory corruption in debugfs

2015-08-18 Thread Dan Carpenter
You can't use kstrtoul() with an int or it causes memory corruption.
Also j should be unsigned or we have underflow bugs.

I considered changing j to unsigned long but everything fits in a u32.

Fixes: 8e3d04fd7d70 ('cxgb4: Add MPS tracing support')
Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c 
b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 1732e29..0a87a32 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -1289,13 +1289,14 @@ static unsigned int xdigit2int(unsigned char c)
 static ssize_t mps_trc_write(struct file *file, const char __user *buf,
 size_t count, loff_t *pos)
 {
-   int i, j, enable, ret;
+   int i, enable, ret;
u32 *data, *mask;
struct trace_params tp;
const struct inode *ino;
unsigned int trcidx;
char *s, *p, *word, *end;
struct adapter *adap;
+   u32 j;
 
ino = file_inode(file);
trcidx = (uintptr_t)ino-i_private  3;
@@ -1340,7 +1341,7 @@ static ssize_t mps_trc_write(struct file *file, const 
char __user *buf,
 
if (!strncmp(word, qid=, 4)) {
end = (char *)word + 4;
-   ret = kstrtoul(end, 10, (unsigned long *)j);
+   ret = kstrtouint(end, 10, j);
if (ret)
goto out;
if (!adap-trace_rss) {
@@ -1369,7 +1370,7 @@ static ssize_t mps_trc_write(struct file *file, const 
char __user *buf,
}
if (!strncmp(word, snaplen=, 8)) {
end = (char *)word + 8;
-   ret = kstrtoul(end, 10, (unsigned long *)j);
+   ret = kstrtouint(end, 10, j);
if (ret || j  9600) {
 inval: count = -EINVAL;
goto out;
@@ -1379,7 +1380,7 @@ inval:count = -EINVAL;
}
if (!strncmp(word, minlen=, 7)) {
end = (char *)word + 7;
-   ret = kstrtoul(end, 10, (unsigned long *)j);
+   ret = kstrtouint(end, 10, j);
if (ret || j  TFMINPKTSIZE_M)
goto inval;
tp.min_len = j;
@@ -1453,7 +1454,7 @@ inval:count = -EINVAL;
}
if (*word == '@') {
end = (char *)word + 1;
-   ret = kstrtoul(end, 10, (unsigned long *)j);
+   ret = kstrtouint(end, 10, j);
if (*end  *end != '\n')
goto inval;
if (j  7)  /* doesn't start at multiple of 8 */
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Project Funding

2015-08-18 Thread David Anderson
Sir,

Kindly be informed that i am still waiting for your correspondence to
enable us proceed.

Thank you.

David
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] cxgb4: memory corruption in debugfs

2015-08-18 Thread Dan Carpenter
On Tue, Aug 18, 2015 at 07:28:53PM +0900, Tetsuo Handa wrote:
 Dan Carpenter wrote:
  You can't use kstrtoul() with an int or it causes memory corruption.
  Also j should be unsigned or we have underflow bugs.
  
  I considered changing j to unsigned long but everything fits in a u32.
 
 Excuse me, but kstrtouint()'s last argument is not u32 * but unsigned int 
 *.
 Aren't there architectures where sizeof(unsigned int)  sizeof(u32) ?

No.

regards,
dan carpenter

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v3] rocker: add debugfs support to dump internal tables

2015-08-18 Thread Jiri Pirko
Tue, Aug 18, 2015 at 08:14:48AM CEST, sfel...@gmail.com wrote:
On Mon, Aug 17, 2015 at 10:55 PM, Jiri Pirko j...@resnulli.us wrote:
 Tue, Aug 18, 2015 at 12:36:17AM CEST, sfel...@gmail.com wrote:
From: Scott Feldman sfel...@gmail.com

 tree /sys/kernel/debug/rocker
/sys/kernel/debug/rocker
└── 525400123501
├── fdb_tbl
├── internal_vlan_tbl
├── neigh_tbl
├── of_dpa_flow_tbl
└── of_dpa_group_tbl

1 directory, 5 files

 cat /sys/kernel/debug/rocker/525400123501/internal_vlan_tbl
ifindex 5 ref_count 1 vlan 3843
ifindex 7 ref_count 2 vlan 3840
ifindex 4 ref_count 1 vlan 3842

 cat /sys/kernel/debug/rocker/525400123501/fdb_tbl
learned 1 pport 1 addr 00:02:00:00:02:00 vlan 3840
learned 1 pport 2 addr 00:02:00:00:03:00 vlan 3840

 cat /sys/kernel/debug/rocker/525400123501/neigh_tbl
11.0.0.9 dev sw1p2 ref_count 3 index 1 dst 00:02:00:00:01:00 ttl_check 1
11.0.0.1 dev sw1p1 ref_count 3 index 0 dst 00:02:00:00:00:00 ttl_check 1

 cat /sys/kernel/debug/rocker/525400123501/of_dpa_flow_tbl
cmd 3 cookie 15 priority 3  tbl aclin_pport 2 
01:80:c2:00:00:00/ff:ff:ff:ff:ff:f0 eth_type 0x vlan_id 3841 ip proto 
0/0 ip tos 0/0 group_id 0x0f01
cmd 3 cookie 2  priority 0  tbl term_mac   in_pport 1 eth_type 0x0800 
52:54:00:12:35:01 vlan_id 3840 goto_tbl ucast_routing copy_to_cpu 0
cmd 3 cookie 1f priority 3  tbl bridge 00:02:00:00:00:00 vlan_id 
3840 tunnel_id 0 goto_tbl acl group_id 0x copy_to_cpu 0
cmd 3 cookie 4  priority 1  tbl vlan   in_pport 2 vlan_id 0 goto_tbl 
term_mac untagged 1 new_vlan_id 3841
cmd 3 cookie 20 priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.1 
goto_tbl acl group_id 0x2000
cmd 3 cookie 21 priority 3  tbl bridge 00:02:00:00:01:00 vlan_id 
3841 tunnel_id 0 goto_tbl acl group_id 0x copy_to_cpu 0
cmd 3 cookie 16 priority 2  tbl aclin_pport 2 eth_type 0x0806 
vlan_id 3841 ip proto 0/0 ip tos 0/0 group_id 0x0f01
cmd 3 cookie 12 priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.0 
goto_tbl acl group_id 0x0f00
cmd 3 cookie 9  priority 3  tbl aclin_pport 1 
01:80:c2:00:00:00/ff:ff:ff:ff:ff:f0 eth_type 0x vlan_id 3840 ip proto 
0/0 ip tos 0/0 group_id 0x0f00
cmd 3 cookie 6  priority 0  tbl term_mac   in_pport 2 eth_type 0x86dd 
52:54:00:12:35:02 vlan_id 3841 goto_tbl ucast_routing copy_to_cpu 0
cmd 4 cookie 0  priority 1  tbl ig_portin_pport 0/0x 
goto_tbl vlan
cmd 4 cookie e  priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.3 
goto_tbl acl group_id 0x0f00
cmd 3 cookie 1  priority 1  tbl vlan   in_pport 1 vlan_id 0 goto_tbl 
term_mac untagged 1 new_vlan_id 3840
cmd 3 cookie 24 priority 20 tbl ucast_routing  eth_type 0x0800 
11.0.0.4/255.255.255.252 goto_tbl acl group_id 0x2000
cmd 4 cookie 14 priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.10 
goto_tbl acl group_id 0x0f01
cmd 3 cookie 2c priority 20 tbl ucast_routing  eth_type 0x0800 12.0.0.4 
goto_tbl acl group_id 0x2001
cmd 3 cookie 17 priority 1  tbl term_mac   in_pport 2 eth_type 0x0800 
01:00:5e:00:00:00/ff:ff:ff:80:00:00 vlan_id 3841 goto_tbl mcast_routing 
copy_to_cpu 1
cmd 3 cookie 26 priority 20 tbl ucast_routing  eth_type 0x0800 12.0.0.3 
goto_tbl acl group_id 0x2000
cmd 3 cookie 2e priority 30 tbl ucast_routing  eth_type 0x0800 12.0.0.2 
goto_tbl acl group_id 0x0f01
cmd 3 cookie 22 priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.9 
goto_tbl acl group_id 0x2001
cmd 3 cookie 1c priority 0  tbl ucast_routing  eth_type 0x0800 
11.0.0.8/255.255.255.252 goto_tbl acl group_id 0x0f01
cmd 3 cookie 18 priority 1  tbl term_mac   in_pport 2 eth_type 0x86dd 
33:33:00:00:00:00/ff:ff:00:00:00:00 vlan_id 3841 goto_tbl mcast_routing 
copy_to_cpu 1
cmd 3 cookie 5  priority 0  tbl term_mac   in_pport 2 eth_type 0x0800 
52:54:00:12:35:02 vlan_id 3841 goto_tbl ucast_routing copy_to_cpu 0
cmd 3 cookie a  priority 2  tbl aclin_pport 1 eth_type 0x0806 
vlan_id 3840 ip proto 0/0 ip tos 0/0 group_id 0x0f00
cmd 4 cookie 1a priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.11 
goto_tbl acl group_id 0x0f01
cmd 3 cookie 1e priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.8 
goto_tbl acl group_id 0x0f01
cmd 3 cookie 3  priority 0  tbl term_mac   in_pport 1 eth_type 0x86dd 
52:54:00:12:35:01 vlan_id 3840 goto_tbl ucast_routing copy_to_cpu 0
cmd 3 cookie b  priority 1  tbl term_mac   in_pport 1 eth_type 0x0800 
01:00:5e:00:00:00/ff:ff:ff:80:00:00 vlan_id 3840 goto_tbl mcast_routing 
copy_to_cpu 1
cmd 4 cookie 8  priority 0  tbl ucast_routing  eth_type 0x0800 11.0.0.2 
goto_tbl acl group_id 0x0f00
cmd 3 cookie 10 priority 0  tbl ucast_routing  eth_type 0x0800 
11.0.0.0/255.255.255.252 goto_tbl acl group_id 0x0f00
cmd 3 cookie 28 priority 20 tbl ucast_routing  eth_type 0x0800 
11.0.0.12/255.255.255.252 goto_tbl acl group_id 0x2001
cmd 3 cookie c  priority 1  tbl term_mac   in_pport 1 

[PATCH 16/21] net: batman-adv: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Marek Lindner mareklind...@neomailbox.ch
Cc: Simon Wunderlich s...@simonwunderlich.de
Cc: Antonio Quartulli anto...@meshcoding.com
---
 net/batman-adv/soft-interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index a2fc843..c452bc6 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -936,7 +936,7 @@ static void batadv_softif_init_early(struct net_device *dev)
dev-netdev_ops = batadv_netdev_ops;
dev-destructor = batadv_softif_free;
dev-features |= NETIF_F_HW_VLAN_CTAG_FILTER;
-   dev-tx_queue_len = 0;
+   dev-priv_flags |= IFF_NO_QUEUE;
 
/* can't call min_mtu, because the needed variables
 * have not been initialized yet
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/21] net: caif: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Dmitry Tarnyagin dmitry.tarnya...@lockless.no
---
 drivers/net/caif/caif_hsi.c| 2 +-
 drivers/net/caif/caif_serial.c | 2 +-
 drivers/net/caif/caif_spi.c| 2 +-
 drivers/net/wan/hdlc_fr.c  | 2 +-
 net/caif/caif_dev.c| 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c
index b3b922a..615c65d 100644
--- a/drivers/net/caif/caif_hsi.c
+++ b/drivers/net/caif/caif_hsi.c
@@ -1120,7 +1120,7 @@ static void cfhsi_setup(struct net_device *dev)
dev-type = ARPHRD_CAIF;
dev-flags = IFF_POINTOPOINT | IFF_NOARP;
dev-mtu = CFHSI_MAX_CAIF_FRAME_SZ;
-   dev-tx_queue_len = 0;
+   dev-priv_flags |= IFF_NO_QUEUE;
dev-destructor = free_netdev;
dev-netdev_ops = cfhsi_netdevops;
for (i = 0; i  CFHSI_PRIO_LAST; ++i)
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
index 9da0653..c2dea49 100644
--- a/drivers/net/caif/caif_serial.c
+++ b/drivers/net/caif/caif_serial.c
@@ -427,7 +427,7 @@ static void caifdev_setup(struct net_device *dev)
dev-type = ARPHRD_CAIF;
dev-flags = IFF_POINTOPOINT | IFF_NOARP;
dev-mtu = CAIF_MAX_MTU;
-   dev-tx_queue_len = 0;
+   dev-priv_flags |= IFF_NO_QUEUE;
dev-destructor = free_netdev;
skb_queue_head_init(serdev-head);
serdev-common.link_select = CAIF_LINK_LOW_LATENCY;
diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c
index 72ea9ff..de39620 100644
--- a/drivers/net/caif/caif_spi.c
+++ b/drivers/net/caif/caif_spi.c
@@ -710,7 +710,7 @@ static void cfspi_setup(struct net_device *dev)
dev-netdev_ops = cfspi_ops;
dev-type = ARPHRD_CAIF;
dev-flags = IFF_NOARP | IFF_POINTOPOINT;
-   dev-tx_queue_len = 0;
+   dev-priv_flags |= IFF_NO_QUEUE;
dev-mtu = SPI_MAX_PAYLOAD_SIZE;
dev-destructor = free_netdev;
skb_queue_head_init(cfspi-qhead);
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index 3ebed1c..e92aaf6 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -1096,7 +1096,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned 
int dlci, int type)
}
dev-netdev_ops = pvc_ops;
dev-mtu = HDLC_MAX_MTU;
-   dev-tx_queue_len = 0;
+   dev-priv_flags |= IFF_NO_QUEUE;
dev-ml_priv = pvc;
 
if (register_netdevice(dev) != 0) {
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
index edbca46..d730a0f 100644
--- a/net/caif/caif_dev.c
+++ b/net/caif/caif_dev.c
@@ -177,7 +177,7 @@ static int transmit(struct cflayer *layer, struct cfpkt 
*pkt)
skb-protocol = htons(ETH_P_CAIF);
 
/* Check if we need to handle xoff */
-   if (likely(caifd-netdev-tx_queue_len == 0))
+   if (likely(caifd-netdev-priv_flags  IFF_NO_QUEUE))
goto noxoff;
 
if (unlikely(caifd-xoff))
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/21] net: veth: enable noqueue operation by default

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Pavel Emelyanov xe...@openvz.org
---
 drivers/net/veth.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 343592c..0ef4a5a 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -306,6 +306,7 @@ static void veth_setup(struct net_device *dev)
 
dev-priv_flags = ~IFF_TX_SKB_SHARING;
dev-priv_flags |= IFF_LIVE_ADDR_CHANGE;
+   dev-priv_flags |= IFF_NO_QUEUE;
 
dev-netdev_ops = veth_netdev_ops;
dev-ethtool_ops = veth_ethtool_ops;
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] bridge: Enable configuration of ageing interval for bridges and switch devices.

2015-08-18 Thread Scott Feldman



On Fri, 14 Aug 2015, Premkumar Jonnala wrote:


Bridge devices have ageing interval used to age out MAC addresses
from FDB.  This ageing interval was not configuratble.

Enable netlink based configuration of ageing interval for bridges and
switch devices.  The ageing interval changes the timer used to purge
inactive FDB entries in bridges.  The ageing interval config is
propagated to switch devices, so that platform or hardware based
ageing works according to configuration.

Signed-off-by: Premkumar Jonnala pjonn...@broadcom.com


Hi Premkumar,

I agree with Roopa that we should use existing IFLA_BR_AGEING_TIME.

I hope you don't mind if share a patch for setting bridge-level attributes 
down to the switch hardware ports.  It uses the switchdev_port_attr_set() 
call on the bridge interface itself when any IFLA_BR_xxx attribute is set 
via netlink.   switchdev_port_attr_set() will do a recursive walk of all 
lower devs from the bridge, stopping at each to set the attribute.  I 
added one small tweak to switchdev_port_attr_set() to allow skipping over 
ports that return -EOPNOTSUPP.  The advantage to using 
switchdev_port_attr_set() is it automatically knows how to find the leaf 
ports in a stacked driver setup, and it uses the prepare/commit 
transaction model to make sure all ports can support new attr setting 
before committing setting to hardware.


I gave an example using rocker to set IFLA_BR_AGEING_TIME.  It's stubbed 
out, but you get the idea.  Other IFLA_BR_xxx attrs can be added to this 
model.


Does this look like something that would work?  If so, would you mind 
running with this patch and maybe even extending it for other IFLA_BR_xxx 
attrs?


Again, I hope I'm not stepping on toes here by rewriting your patch, but 
it was the best way to communicate the idea of how to use the switchdev 
frame work for these bridge attrs.


-scott




diff --git a/drivers/net/ethernet/rocker/rocker.c 
b/drivers/net/ethernet/rocker/rocker.c
index 0cc9e8f..830f8e6 100644
--- a/drivers/net/ethernet/rocker/rocker.c
+++ b/drivers/net/ethernet/rocker/rocker.c
@@ -4680,6 +4680,24 @@ static int rocker_port_brport_flags_set(struct 
rocker_port *rocker_port,
return err;
 }

+static int rocker_port_bridge_set(struct rocker_port *rocker_port,
+ enum switchdev_trans trans,
+ struct switchdev_attr_bridge *bridge)
+{
+   switch (bridge-attr) {
+   case IFLA_BR_AGEING_TIME:
+   {
+   u32 ageing_time = bridge-val;
+   /* XXX push ageing_time down to device */
+   }
+   break;
+   default:
+   return -EOPNOTSUPP;
+   }
+
+   return 0;
+}
+
 static int rocker_port_attr_set(struct net_device *dev,
struct switchdev_attr *attr)
 {
@@ -4707,6 +4725,10 @@ static int rocker_port_attr_set(struct net_device *dev,
err = rocker_port_brport_flags_set(rocker_port, attr-trans,
   attr-u.brport_flags);
break;
+   case SWITCHDEV_ATTR_BRIDGE:
+   err = rocker_port_bridge_set(rocker_port, attr-trans,
+attr-u.bridge);
+   break;
default:
err = -EOPNOTSUPP;
break;
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 319baab..22a6dbe 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -15,6 +15,7 @@
 #include linux/notifier.h

 #define SWITCHDEV_F_NO_RECURSE BIT(0)
+#define SWITCHDEV_F_SKIP_EOPNOTSUPPBIT(1)

 enum switchdev_trans {
SWITCHDEV_TRANS_NONE,
@@ -28,6 +29,7 @@ enum switchdev_attr_id {
SWITCHDEV_ATTR_PORT_PARENT_ID,
SWITCHDEV_ATTR_PORT_STP_STATE,
SWITCHDEV_ATTR_PORT_BRIDGE_FLAGS,
+   SWITCHDEV_ATTR_BRIDGE,
 };

 struct switchdev_attr {
@@ -38,6 +40,10 @@ struct switchdev_attr {
struct netdev_phys_item_id ppid;/* PORT_PARENT_ID */
u8 stp_state;   /* PORT_STP_STATE */
unsigned long brport_flags; /* PORT_BRIDGE_FLAGS */
+   struct switchdev_attr_bridge {  /* BRIDGE */
+   enum ifla_br attr;
+   u32 val;
+   } bridge;
} u;
 };

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index ff659f0..0630053 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -222,7 +222,7 @@ enum in6_addr_gen_mode {

 /* Bridge section */

-enum {
+enum ifla_br {
IFLA_BR_UNSPEC,
IFLA_BR_FORWARD_DELAY,
IFLA_BR_HELLO_TIME,
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 0f2408f..01401ea 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -759,9 +759,9 @@ static int br_changelink(struct net_device *brdev, 

Re: [PATCH 1/6] net/bonding: enable LRO if one device supports it

2015-08-18 Thread Michal Kubecek
On Mon, Aug 17, 2015 at 05:07:06PM -0400, Jarod Wilson wrote:
 On 2015-08-14 7:41 PM, Jarod Wilson wrote:
 
 Yeah, my thinking was that it should mean there's at least one lro
 capable slave. If we just leave things the way they are though, I think
 its confusing on the user side -- it was one of our QE people who
 reported confusion being able to toggle lro on a bond when none of the
 slaves supported it. And there's also the inconsistency among devices
 that support lro in their vlan_features. So I think *something* should
 still be done here to make things clearer and more consistent, but I'll
 have to ponder that next week, since its beyond quitting time on Friday
 already. :)
 
 Oh, last thought: the comment above #define NETIF_F_ONE_FOR_ALL is
 partly to blame for my not thinking harder and trying inverted ordering
 of slave additions:
 
 /*
   * If one device supports one of these features, then enable them
   * for all in netdev_increment_features.
   */
 
 This clearly seems to fall down in the lro case. :)
 
 Similarly, adding LRO to NETIF_F_ALL_FOR_ALL, even a bond with only
 LRO-capable hardware, I'm seeing the bond wind up without LRO and it
 can't be toggled on.

I still believe the very idea of computing bond's NETIF_F_LRO from its
slaves - or, more generally, upper device from lower devices - is wrong.
This makes very good sense for e.g. TSO where lower device is processing
packets passed to it by the lower devices. Then it makes sense to
propagate the information whether the physical device on the bottom can
process those packets (OK, TSO is perhaps not the best example here as
we can always emulate it in software and still gain some performance).

However, with LRO, the situation is exactly the opposite: packets are
produced at the bottom device in the hierarchy and passed up; and
somewhere on the higher level we may hit a reason why LRO should be
disabled (bridged device, IPv6 forwarding enabled, device in a netns
with IPv4 forwarding enabled). This hierarchy may be quite complicated,
I've seen things like a bond with a vlan on top of it and a macvlan on
top of the vlan which was then moved into a different netns (LXC
container). LRO related issues in setups like this were the reason for
529d04895446 and eventually fbe168ba91f7.

I agree that current state is not perfect but I don't think creating an
artificial value of NETIF_F_LRO composed of slave values for a bond (and
probably also a team, for consistency) is going to help. I would see
more sense in rethinking the current concept of deriving all upper
device's features from its lower devices and completing the two classes
we already have:

  - NETIF_F_ONE_FOR_ALL: propagated up, OR-ed
  - NETIF_F_ALL_FOR_ALL: propagated up, AND-ed

by two new classes:

  - propagated down, OR-ed
  - propagated down, AND-ed

NETIF_F_LRO should IMHO fall into the last class. I don't have an
example of a flag belonging to third class from the top of my head
but there may also be one (GRO, perhaps?). Such change would, of course,
require careful planning and testing to avoid regressions.

 I think the answer here (which to be fair, Nik suggested originally to
 me when I inherited this bug from him) is indeed to simply remove LRO
 from BOND_VLAN_FEATURES. Leave it fixed off for the bond itself, which
 should then turn it off for underlying devices via fbe168ba91f7 by
 default. If the user goes and turns it back on for the underlying
 devices individually, that's their prerogative. They keep both halves
 if it breaks.
 
 Does that sound sane?

If I understand the code correctly, this would mean bond would have
NETIF_F_LRO always disabled in its dev-features so that any slave would
end up with disabled LRO after bond_enslave(). While this would be less
of a problem than LRO enabled when it shouldn't, it would cause a
performance penalty in the cases when there is no reason to disable LRO
(end hosts without any virtualization or other bridging or forwarding).

So the distribution init scripts (or management daemons like wicked or
systemd-networkd) would have to handle the LRO reenabling somehow. And
they would have trouble checking whether to do reenable LRO or not as
bond would stop keeping the state information whether dev_disable_lro()
was called for it or not (we must not reenable LRO if it was).

 Michal Kubecek

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


linux-next: build failure after merge of the net-next tree

2015-08-18 Thread Stephen Rothwell
Hi all,

After merging the net-next tree, today's linux-next build (powerpc
allyesconfig) failed like this:

drivers/net/built-in.o: In function `.vnic_wq_devcmd2_alloc':
(.text+0x49fe40): multiple definition of `.vnic_wq_devcmd2_alloc'
drivers/scsi/built-in.o:(.text+0xb4318): first defined here
drivers/net/built-in.o:(.opd+0x2af00): multiple definition of 
`vnic_wq_devcmd2_alloc'
drivers/scsi/built-in.o:(.opd+0xad70): first defined here
drivers/net/built-in.o: In function `.vnic_wq_init_start':
(.text+0x49f9c0): multiple definition of `.vnic_wq_init_start'
drivers/scsi/built-in.o:(.text+0xb3b58): first defined here
drivers/net/built-in.o:(.opd+0x2ae88): multiple definition of 
`vnic_wq_init_start'
drivers/scsi/built-in.o:(.opd+0xace0): first defined here

Caused by commit

  373fb0873d43 (enic: add devcmd2)

I have reverted that commit for today.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next] bnx2x: Add vxlan RSS support

2015-08-18 Thread Yuval Mintz
From: Rajesh Borundia rajesh.borun...@qlogic.com

Latest FW submission added some vxlan offload capabilities to our device.
This patch adds the ability to connect to the vxlan NDOs and configure
the UDP port associated with it in the HW.

The device would now be capable of performing RSS according to the
inner headers of the vxlan packets.

Signed-off-by: Rajesh Borundia rajesh.borun...@qlogic.com
Signed-off-by: Yuval Mintz yuval.mi...@qlogic.com
---
Hi Dave,

Please consider applying this to 'net-next'.

Thanks,
Yuval
---
 drivers/net/ethernet/broadcom/Kconfig|  10 +++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h  |   2 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h  |   2 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 109 +++
 4 files changed, 123 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/Kconfig 
b/drivers/net/ethernet/broadcom/Kconfig
index 8be9eab..e930aa9 100644
--- a/drivers/net/ethernet/broadcom/Kconfig
+++ b/drivers/net/ethernet/broadcom/Kconfig
@@ -139,6 +139,16 @@ config BNX2X_SRIOV
  Virtualization support in the 578xx and 57712 products. This
  allows for virtual function acceleration in virtual environments.
 
+config BNX2X_VXLAN
+   bool Virtual eXtensible Local Area Network support
+   default n
+   depends on BNX2X  VXLAN  !(BNX2X=y  VXLAN=m)
+   ---help---
+ This enables hardward offload support for VXLAN protocol over the
+ NetXtremeII series adapters.
+ Say Y here if you want to enable hardware offload support for
+ Virtual eXtensible Local Area Network (VXLAN) in the driver.
+
 config BGMAC
tristate BCMA bus GBit core support
depends on BCMA_HOST_SOC  HAS_DMA  (BCM47XX || ARCH_BCM_5301X)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index 5762c48..cbd6e25 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1392,6 +1392,8 @@ enum sp_rtnl_flag {
BNX2X_SP_RTNL_HYPERVISOR_VLAN,
BNX2X_SP_RTNL_TX_STOP,
BNX2X_SP_RTNL_GET_DRV_VERSION,
+   BNX2X_SP_RTNL_ADD_VXLAN_PORT,
+   BNX2X_SP_RTNL_DEL_VXLAN_PORT,
 };
 
 enum bnx2x_iov_flag {
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index e18a0e4..d276de3 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -967,6 +967,8 @@ static inline int bnx2x_func_start(struct bnx2x *bp)
else /* CHIP_IS_E1X */
start_params-network_cos_mode = FW_WRR;
 
+   start_params-vxlan_dst_port = cpu_to_le16(bp-vxlan_dst_port);
+
start_params-inner_rss = 1;
 
if (IS_MF_UFP(bp)  BNX2X_IS_MF_SD_PROTOCOL_FCOE(bp)) {
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index ad73a60..5c00350 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -10075,6 +10075,81 @@ static void bnx2x_parity_recover(struct bnx2x *bp)
}
 }
 
+#ifdef CONFIG_BNX2X_VXLAN
+static int bnx2x_vxlan_port_update(struct bnx2x *bp, u16 port)
+{
+   struct bnx2x_func_switch_update_params *switch_update_params;
+   struct bnx2x_func_state_params func_params = {NULL};
+   int rc;
+
+   switch_update_params = func_params.params.switch_update;
+
+   /* Prepare parameters for function state transitions */
+   __set_bit(RAMROD_COMP_WAIT, func_params.ramrod_flags);
+   __set_bit(RAMROD_RETRY, func_params.ramrod_flags);
+
+   func_params.f_obj = bp-func_obj;
+   func_params.cmd = BNX2X_F_CMD_SWITCH_UPDATE;
+
+   /* Function parameters */
+   __set_bit(BNX2X_F_UPDATE_TUNNEL_CFG_CHNG,
+ switch_update_params-changes);
+   switch_update_params-vxlan_dst_port = port;
+   rc = bnx2x_func_state_change(bp, func_params);
+   if (rc)
+   BNX2X_ERR(failed to change vxlan dst port to %d (rc = 0x%x)\n,
+ port, rc);
+   return rc;
+}
+
+static void __bnx2x_add_vxlan_port(struct bnx2x *bp, u16 port)
+{
+   if (!netif_running(bp-dev))
+   return;
+
+   if (bp-vxlan_dst_port || !IS_PF(bp)) {
+   DP(BNX2X_MSG_SP, Vxlan destination port limit reached\n);
+   return;
+   }
+
+   bp-vxlan_dst_port = port;
+   bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_ADD_VXLAN_PORT, 0);
+}
+
+static void bnx2x_add_vxlan_port(struct net_device *netdev,
+sa_family_t sa_family, __be16 port)
+{
+   struct bnx2x *bp = netdev_priv(netdev);
+   u16 t_port = ntohs(port);
+
+   __bnx2x_add_vxlan_port(bp, t_port);
+}
+
+static void __bnx2x_del_vxlan_port(struct bnx2x *bp, u16 port)
+{
+   if (!bp-vxlan_dst_port || bp-vxlan_dst_port != port || !IS_PF(bp)) {
+ 

[PATCH 02/21] net: dummy: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
---
 drivers/net/dummy.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index 49adbf1..815eb94 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -144,10 +144,9 @@ static void dummy_setup(struct net_device *dev)
dev-destructor = free_netdev;
 
/* Fill in device structure with ethernet-generic values. */
-   dev-tx_queue_len = 0;
dev-flags |= IFF_NOARP;
dev-flags = ~IFF_MULTICAST;
-   dev-priv_flags |= IFF_LIVE_ADDR_CHANGE;
+   dev-priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
dev-features   |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO;
dev-features   |= NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX;
eth_hw_addr_random(dev);
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/21] net: 8021q: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Patrick McHardy ka...@trash.net
---
 net/8021q/vlan_dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 01d7ba8..fded865 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -791,10 +791,9 @@ void vlan_setup(struct net_device *dev)
 {
ether_setup(dev);
 
-   dev-priv_flags |= IFF_802_1Q_VLAN;
+   dev-priv_flags |= IFF_802_1Q_VLAN | IFF_NO_QUEUE;
dev-priv_flags = ~IFF_TX_SKB_SHARING;
netif_keep_dst(dev);
-   dev-tx_queue_len   = 0;
 
dev-netdev_ops = vlan_netdev_ops;
dev-destructor = vlan_dev_free;
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: rt2x00: adjust EEPROM_SIZE for rt2500usb

2015-08-18 Thread Kalle Valo

 rt2500usb_validate_eeprom() read data up to 0x6e (EEPROM_CALIBRATE_OFFSET)
 but only 0x6a bytes has been allocated and read from the eeprom.
 
 This lead to out-of-bound accesses and invalid values for
 EEPROM_BBPTUNE_R17 and EEPROM_CALIBRATE_OFFSET.
 
 Change the EEPROM_SIZE to 0x6e in order to retrieve all the fields.
 
 Tested with a rt2570 device.
 
 Signed-off-by: Adrien Schildknecht adrien+...@schischi.me
 Acked-by: Stanislaw Gruszka sgrus...@redhat.com

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

Kalle Valo
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Should driver set CHECKSUM_COMPLETE for TCP pakcets

2015-08-18 Thread Yuval Mintz
Consider a device that doesn't provide the complete checksum for entire Rx
packets, but does verify the checksums for several protocols.

Now, assuming the HW is capable of verifying TCP checksums - Should the driver
calculate the pseudo TCP checksum for such packets and pass those as
COMPLETE? Or should it stick to UNNECESSRAY?

[Specifically I'm interested for this for the FW gro implementation - it might 
be
possible to mark an entire aggregation as COMPLETE]

Thanks,
Yuval
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v3] rocker: add debugfs support to dump internal tables

2015-08-18 Thread Scott Feldman
On Mon, Aug 17, 2015 at 11:48 PM, Jiri Pirko j...@resnulli.us wrote:
 Tue, Aug 18, 2015 at 08:14:48AM CEST, sfel...@gmail.com wrote:
On Mon, Aug 17, 2015 at 10:55 PM, Jiri Pirko j...@resnulli.us wrote:
 Tue, Aug 18, 2015 at 12:36:17AM CEST, sfel...@gmail.com wrote:
From: Scott Feldman sfel...@gmail.com

 snip

+  rocker-dbg_dir = debugfs_create_dir(dbg_dir_name, rocker_dbg_root);
+  if (!rocker-dbg_dir)

 You still check the retval here and

It's OK.  See include/linux/debugfs.h when CONFIG_DEBUG_FS=n.
debugfs_create_dir() returns ERR_PTR(-ENODEV), which is !NULL.

 Does not make sense to check it for NULL then. It is never NULL...

It can be NULL when CONFIG_DEBUG_FS=y.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 15/21] net: mac80211_hwsim: convert to using IFF_NO_QUEUE

2015-08-18 Thread Johannes Berg
On Tue, 2015-08-18 at 10:30 +0200, Phil Sutter wrote:
 Signed-off-by: Phil Sutter p...@nwl.cc
 Cc: Johannes Berg johan...@sipsolutions.net
 ---
  drivers/net/wireless/mac80211_hwsim.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/net/wireless/mac80211_hwsim.c 
 b/drivers/net/wireless/mac80211_hwsim.c
 index 99e873d..a1dbcb2 100644
 --- a/drivers/net/wireless/mac80211_hwsim.c
 +++ b/drivers/net/wireless/mac80211_hwsim.c
 @@ -2676,7 +2676,7 @@ static void hwsim_mon_setup(struct net_device 
 *dev)
   dev-netdev_ops = hwsim_netdev_ops;
   dev-destructor = free_netdev;
   ether_setup(dev);
 - dev-tx_queue_len = 0;
 + dev-priv_flags |= IFF_NO_QUEUE;
 
Fine with me; Dave, are you going to pick up the entire series
(presumably there was one, I only got this patch)?

Note that there's no TX possible on this particular netdev anyway.

johannes
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Should driver set CHECKSUM_COMPLETE for TCP pakcets

2015-08-18 Thread Yuval Mintz
Consider a device that doesn't provide the complete checksum for
entire Rx packets, but does verify the checksums for several protocols.

Now, assuming the HW is capable of verifying TCP checksums -
Should the driver calculate the pseudo TCP checksum for such packets
and pass those as COMPLETE? Or should it stick to UNNECESSRAY?

[Specifically I'm interested for this for the FW gro implementation -
it might be possible to mark an entire aggregation as COMPLETE]

Thanks,
Yuval
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/21] net: dsa: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Lennert Buytenhek buyt...@wantstofly.org
---
 net/dsa/slave.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 373ff31..cce9738 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1147,7 +1147,7 @@ int dsa_slave_create(struct dsa_switch *ds, struct device 
*parent,
slave_dev-features = master-vlan_features;
slave_dev-ethtool_ops = dsa_slave_ethtool_ops;
eth_hw_addr_inherit(slave_dev, master);
-   slave_dev-tx_queue_len = 0;
+   slave_dev-priv_flags |= IFF_NO_QUEUE;
slave_dev-netdev_ops = dsa_slave_netdev_ops;
slave_dev-switchdev_ops = dsa_slave_switchdev_ops;
 
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/21] staging: wilc1000: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Johnny Kim johnny@atmel.com
Cc: Rachel Kim rachel@atmel.com
Cc: Dean Lee dean@atmel.com
Cc: Chris Park chris.p...@atmel.com
---
 drivers/staging/wilc1000/linux_mon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index f5296f5..a1f66ad 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -493,7 +493,7 @@ static void WILC_WFI_mon_setup(struct net_device *dev)
/* dev-destructor = free_netdev; */
PRINT_INFO(CORECONFIG_DBG, In Ethernet setup function\n);
ether_setup(dev);
-   dev-tx_queue_len = 0;
+   dev-priv_flags |= IFF_NO_QUEUE;
dev-type = ARPHRD_IEEE80211_RADIOTAP;
memset(dev-dev_addr, 0, ETH_ALEN);
 
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 21/21] net: sched: drop all special handling of tx_queue_len == 0

2015-08-18 Thread Phil Sutter
Those were all workarounds for the formerly double meaning of
tx_queue_len, which broke scheduling algorithms if untreated.

Now that all in-tree drivers have been converted away from setting
tx_queue_len = 0, it should be safe to drop these workarounds for
categorically broken setups.

Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Jamal Hadi Salim j...@mojatatu.com
---
 net/sched/sch_fifo.c | 2 +-
 net/sched/sch_gred.c | 8 +++-
 net/sched/sch_htb.c  | 6 ++
 net/sched/sch_plug.c | 8 ++--
 net/sched/sch_sfb.c  | 2 +-
 5 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c
index 2e2398c..2177eac 100644
--- a/net/sched/sch_fifo.c
+++ b/net/sched/sch_fifo.c
@@ -54,7 +54,7 @@ static int fifo_init(struct Qdisc *sch, struct nlattr *opt)
bool is_bfifo = sch-ops == bfifo_qdisc_ops;
 
if (opt == NULL) {
-   u32 limit = qdisc_dev(sch)-tx_queue_len ? : 1;
+   u32 limit = qdisc_dev(sch)-tx_queue_len;
 
if (is_bfifo)
limit *= psched_mtu(qdisc_dev(sch));
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index abb9f2f..8010510 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -512,11 +512,9 @@ static int gred_init(struct Qdisc *sch, struct nlattr *opt)
 
if (tb[TCA_GRED_LIMIT])
sch-limit = nla_get_u32(tb[TCA_GRED_LIMIT]);
-   else {
-   u32 qlen = qdisc_dev(sch)-tx_queue_len ? : 1;
-
-   sch-limit = qlen * psched_mtu(qdisc_dev(sch));
-   }
+   else
+   sch-limit = qdisc_dev(sch)-tx_queue_len
+* psched_mtu(qdisc_dev(sch));
 
return gred_change_table_def(sch, tb[TCA_GRED_DPS]);
 }
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index f1acb0f..cf4b0f8 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1048,11 +1048,9 @@ static int htb_init(struct Qdisc *sch, struct nlattr 
*opt)
 
if (tb[TCA_HTB_DIRECT_QLEN])
q-direct_qlen = nla_get_u32(tb[TCA_HTB_DIRECT_QLEN]);
-   else {
+   else
q-direct_qlen = qdisc_dev(sch)-tx_queue_len;
-   if (q-direct_qlen  2) /* some devices have zero tx_queue_len 
*/
-   q-direct_qlen = 2;
-   }
+
if ((q-rate2quantum = gopt-rate2quantum)  1)
q-rate2quantum = 1;
q-defcls = gopt-defcls;
diff --git a/net/sched/sch_plug.c b/net/sched/sch_plug.c
index ade9445..5abfe44 100644
--- a/net/sched/sch_plug.c
+++ b/net/sched/sch_plug.c
@@ -130,12 +130,8 @@ static int plug_init(struct Qdisc *sch, struct nlattr *opt)
q-unplug_indefinite = false;
 
if (opt == NULL) {
-   /* We will set a default limit of 100 pkts (~150kB)
-* in case tx_queue_len is not available. The
-* default value is completely arbitrary.
-*/
-   u32 pkt_limit = qdisc_dev(sch)-tx_queue_len ? : 100;
-   q-limit = pkt_limit * psched_mtu(qdisc_dev(sch));
+   q-limit = qdisc_dev(sch)-tx_queue_len
+  * psched_mtu(qdisc_dev(sch));
} else {
struct tc_plug_qopt *ctl = nla_data(opt);
 
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c
index 4b81519..dcdff5c 100644
--- a/net/sched/sch_sfb.c
+++ b/net/sched/sch_sfb.c
@@ -502,7 +502,7 @@ static int sfb_change(struct Qdisc *sch, struct nlattr *opt)
 
limit = ctl-limit;
if (limit == 0)
-   limit = max_t(u32, qdisc_dev(sch)-tx_queue_len, 1);
+   limit = qdisc_dev(sch)-tx_queue_len;
 
child = fifo_create_dflt(sch, pfifo_qdisc_ops, limit);
if (IS_ERR(child))
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 17/21] net: hsr: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Arvid Brodin arvid.bro...@alten.se
---
 net/hsr/hsr_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index 44d2746..35a9788 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -392,7 +392,7 @@ void hsr_dev_setup(struct net_device *dev)
dev-header_ops = hsr_header_ops;
dev-netdev_ops = hsr_device_ops;
SET_NETDEV_DEVTYPE(dev, hsr_type);
-   dev-tx_queue_len = 0;
+   dev-priv_flags |= IFF_NO_QUEUE;
 
dev-destructor = hsr_dev_destroy;
 
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/21] net: 6lowpan: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Alexander Aring alex.ar...@gmail.com
---
 net/ieee802154/6lowpan/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ieee802154/6lowpan/core.c b/net/ieee802154/6lowpan/core.c
index f20a387..d7fb995 100644
--- a/net/ieee802154/6lowpan/core.c
+++ b/net/ieee802154/6lowpan/core.c
@@ -91,7 +91,7 @@ static void lowpan_setup(struct net_device *dev)
dev-hard_header_len= 2 + 1 + 20 + 14;
dev-needed_tailroom= 2; /* FCS */
dev-mtu= IPV6_MIN_MTU;
-   dev-tx_queue_len   = 0;
+   dev-priv_flags |= IFF_NO_QUEUE;
dev-flags  = IFF_BROADCAST | IFF_MULTICAST;
dev-watchdog_timeo = 0;
 
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/21] net: vxlan: convert to using IFF_NO_QUEUE

2015-08-18 Thread Phil Sutter
Signed-off-by: Phil Sutter p...@nwl.cc
Cc: Stephen Hemminger step...@networkplumber.org
---
 drivers/net/vxlan.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 06c0731..ad51dac 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2416,7 +2416,6 @@ static void vxlan_setup(struct net_device *dev)
dev-destructor = free_netdev;
SET_NETDEV_DEVTYPE(dev, vxlan_type);
 
-   dev-tx_queue_len = 0;
dev-features   |= NETIF_F_LLTX;
dev-features   |= NETIF_F_SG | NETIF_F_HW_CSUM;
dev-features   |= NETIF_F_RXCSUM;
@@ -2428,7 +2427,7 @@ static void vxlan_setup(struct net_device *dev)
dev-hw_features |= NETIF_F_GSO_SOFTWARE;
dev-hw_features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
netif_keep_dst(dev);
-   dev-priv_flags |= IFF_LIVE_ADDR_CHANGE;
+   dev-priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
 
INIT_LIST_HEAD(vxlan-next);
spin_lock_init(vxlan-hash_lock);
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v3] rocker: add debugfs support to dump internal tables

2015-08-18 Thread Jiri Pirko
Tue, Aug 18, 2015 at 09:21:15AM CEST, sfel...@gmail.com wrote:
On Mon, Aug 17, 2015 at 11:48 PM, Jiri Pirko j...@resnulli.us wrote:
 Tue, Aug 18, 2015 at 08:14:48AM CEST, sfel...@gmail.com wrote:
On Mon, Aug 17, 2015 at 10:55 PM, Jiri Pirko j...@resnulli.us wrote:
 Tue, Aug 18, 2015 at 12:36:17AM CEST, sfel...@gmail.com wrote:
From: Scott Feldman sfel...@gmail.com

 snip

+  rocker-dbg_dir = debugfs_create_dir(dbg_dir_name, rocker_dbg_root);
+  if (!rocker-dbg_dir)

 You still check the retval here and

It's OK.  See include/linux/debugfs.h when CONFIG_DEBUG_FS=n.
debugfs_create_dir() returns ERR_PTR(-ENODEV), which is !NULL.

 Does not make sense to check it for NULL then. It is never NULL...

It can be NULL when CONFIG_DEBUG_FS=y.

You are right, this inconsistency looks odd to me though.

Anyway,

Acked-by: Jiri Pirko j...@resnulli.us

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH net] inet: fix potential deadlock in reqsk_queue_unlink()

2015-08-18 Thread David Laight
From: Eric Dumazet
 Sent: 13 August 2015 23:45
 When replacing del_timer() with del_timer_sync(), I introduced
 a deadlock condition :
 
 reqsk_queue_unlink() is called from inet_csk_reqsk_queue_drop()
 
 inet_csk_reqsk_queue_drop() can be called from many contexts,
 one being the timer handler itself (reqsk_timer_handler()).
 
 In this case, del_timer_sync() loops forever.
 
 Simple fix is to test if timer is pending.

Doesn't that mean you fail to wait for the timer function
to finish if you are calling from a different context?

What you need to know is whether the current context
is that running the timer itself.
In which case you need to mark the timer 'to be deleted'
and actually delete it when the timer function returns.
(so other code can still wait for completion.)

David

N�r��yb�X��ǧv�^�)޺{.n�+���z�^�)w*jg����ݢj/���z�ޖ��2�ޙ�)ߡ�a�����G���h��j:+v���w��٥

Re: [patch] cxgb4: memory corruption in debugfs

2015-08-18 Thread Tetsuo Handa
Dan Carpenter wrote:
 You can't use kstrtoul() with an int or it causes memory corruption.
 Also j should be unsigned or we have underflow bugs.
 
 I considered changing j to unsigned long but everything fits in a u32.

Excuse me, but kstrtouint()'s last argument is not u32 * but unsigned int *.
Aren't there architectures where sizeof(unsigned int)  sizeof(u32) ?

 
 Fixes: 8e3d04fd7d70 ('cxgb4: Add MPS tracing support')
 Signed-off-by: Dan Carpenter dan.carpen...@oracle.com
 
 diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c 
 b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
 index 1732e29..0a87a32 100644
 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
 +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
 @@ -1289,13 +1289,14 @@ static unsigned int xdigit2int(unsigned char c)
  static ssize_t mps_trc_write(struct file *file, const char __user *buf,
size_t count, loff_t *pos)
  {
 - int i, j, enable, ret;
 + int i, enable, ret;
   u32 *data, *mask;
   struct trace_params tp;
   const struct inode *ino;
   unsigned int trcidx;
   char *s, *p, *word, *end;
   struct adapter *adap;
 + u32 j;
  
   ino = file_inode(file);
   trcidx = (uintptr_t)ino-i_private  3;
 @@ -1340,7 +1341,7 @@ static ssize_t mps_trc_write(struct file *file, const 
 char __user *buf,
  
   if (!strncmp(word, qid=, 4)) {
   end = (char *)word + 4;
 - ret = kstrtoul(end, 10, (unsigned long *)j);
 + ret = kstrtouint(end, 10, j);
   if (ret)
   goto out;
   if (!adap-trace_rss) {
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net] batman-adv: Fix memory leak on tt add with invalid vlan

2015-08-18 Thread Sven Eckelmann
The object tt_local is allocated with kmalloc and not initialized when the
function batadv_tt_local_add checks for the vlan. But this function can
only cleanup the object when the (not yet initialized) reference counter of
the object is 1. This is unlikely and thus the object would leak when the
vlan could not be found.

Instead the uninitialized object tt_local has to be freed manually and the
pointer has to set to NULL to avoid calling the function which would try to
decrement the reference counter of the not existing object.

CID: 1316518
Fixes: 354136bcc3c4 (batman-adv: fix kernel crash due to missing NULL checks)
Signed-off-by: Sven Eckelmann s...@narfation.org
---
Hi,

sorry for sending the patch directly to you. But Marek told me that neither
he or Antonio have currently time to prepare/send a patch for this problem.
Instead he told me that it would be ok to send the patch directly to you.

The problematic patch is currently in net.git and was accepted a week ago
by you [1]. I was also told that this patch has also been queued for
different stable trees.

Kind regards,
Sven

[1] http://www.spinics.net/lists/netdev/msg338630.html
---
 net/batman-adv/translation-table.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/batman-adv/translation-table.c 
b/net/batman-adv/translation-table.c
index 75bc678ea116..4228b10c47ea 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -598,8 +598,11 @@ bool batadv_tt_local_add(struct net_device *soft_iface, 
const u8 *addr,
/* increase the refcounter of the related vlan */
vlan = batadv_softif_vlan_get(bat_priv, vid);
if (WARN(!vlan, adding TT local entry %pM to non-existent VLAN %d,
-addr, BATADV_PRINT_VID(vid)))
+addr, BATADV_PRINT_VID(vid))) {
+   kfree(tt_local);
+   tt_local = NULL;
goto out;
+   }
 
batadv_dbg(BATADV_DBG_TT, bat_priv,
   Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n,
-- 
2.5.0

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] net: ipv4: inlining ip_send_check()

2015-08-18 Thread Christophe Leroy
ip_send_check() is a function that does nothing but calling
ip_fast_csum() after having zeroed iph-check

We get (on PPC) a quite long function for just that, as it requires
setting the stack frame, saving volatile regs, restoring them after
the call, etc ...

c02d3e3c ip_send_check:
c02d3e3c:   7c 08 02 a6 mflrr0
c02d3e40:   94 21 ff f0 stwur1,-16(r1)
c02d3e44:   39 20 00 00 li  r9,0
c02d3e48:   93 e1 00 0c stw r31,12(r1)
c02d3e4c:   90 01 00 14 stw r0,20(r1)
c02d3e50:   b1 23 00 0a sth r9,10(r3)
c02d3e54:   88 83 00 00 lbz r4,0(r3)
c02d3e58:   7c 7f 1b 78 mr  r31,r3
c02d3e5c:   54 84 07 3e clrlwi  r4,r4,28
c02d3e60:   4b d3 ab 7d bl  c000e9dc ip_fast_csum
c02d3e64:   b0 7f 00 0a sth r3,10(r31)
c02d3e68:   80 01 00 14 lwz r0,20(r1)
c02d3e6c:   83 e1 00 0c lwz r31,12(r1)
c02d3e70:   7c 08 03 a6 mtlrr0
c02d3e74:   38 21 00 10 addir1,r1,16
c02d3e78:   4e 80 00 20 blr

Signed-off-by: Christophe Leroy christophe.le...@c-s.fr
---
 include/net/ip.h | 9 -
 net/ipv4/ip_output.c | 8 
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/include/net/ip.h b/include/net/ip.h
index c0c26c3..b88d592 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -32,6 +32,7 @@
 #include net/snmp.h
 #include net/flow.h
 #include net/flow_keys.h
+#include net/checksum.h
 
 struct sock;
 
@@ -110,7 +111,13 @@ int ip_output(struct sock *sk, struct sk_buff *skb);
 int ip_mc_output(struct sock *sk, struct sk_buff *skb);
 int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
 int ip_do_nat(struct sk_buff *skb);
-void ip_send_check(struct iphdr *ip);
+/* Generate a checksum for an outgoing IP datagram. */
+static inline void ip_send_check(struct iphdr *iph)
+{
+   iph-check = 0;
+   iph-check = ip_fast_csum((unsigned char *)iph, iph-ihl);
+}
+
 int __ip_local_out(struct sk_buff *skb);
 int ip_local_out_sk(struct sock *sk, struct sk_buff *skb);
 static inline int ip_local_out(struct sk_buff *skb)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 357c2a9..fa054cf 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -83,14 +83,6 @@
 int sysctl_ip_default_ttl __read_mostly = IPDEFTTL;
 EXPORT_SYMBOL(sysctl_ip_default_ttl);
 
-/* Generate a checksum for an outgoing IP datagram. */
-void ip_send_check(struct iphdr *iph)
-{
-   iph-check = 0;
-   iph-check = ip_fast_csum((unsigned char *)iph, iph-ihl);
-}
-EXPORT_SYMBOL(ip_send_check);
-
 int __ip_local_out(struct sk_buff *skb)
 {
struct iphdr *iph = ip_hdr(skb);
-- 
2.1.0
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] bridge: Enable configuration of ageing interval for bridges and switch devices.

2015-08-18 Thread Rosen, Rami
Hi, Prem, 

I recall that there was a patch proposed to prevent ageing of fdb entried by 
bridge in kernel, when the fdb entry was added due to notification by switch 
device.  Please see:
http://www.spinics.net/lists/netdev/msg314770.html

Somehow the patch is not visible in the net-next pull.

It seems that this patch was reverted:
http://lists.openwall.net/netdev/2015/02/05/129
https://lkml.org/lkml/2015/2/11/12

Regards,
Rami Rosen
Intel Corporation

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/21] net: Convert drivers to IFF_NO_QUEUE and cleanup afterwards

2015-08-18 Thread David Miller
From: Phil Sutter p...@nwl.cc
Date: Tue, 18 Aug 2015 10:30:28 +0200

 This series converts in-tree users away from the old and deprecated
 'tx_queue_len = 0' idiom, adds a warning to notify out-of-tree driver
 maintainers that there is need for action on their behalf and finally drops 
 any
 workarounds in scheduling algorithm implementations.

I've applied this series, but please address the removal of trivial qdiscs issue
that Eric Dumazet brought up.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [net-next]: unable to add routes to tables

2015-08-18 Thread David Ahern

On 8/18/15 10:57 AM, Andreas Schultz wrote:

Hi,

It seems that the policy for adding routes to tables has changed between
Linux 4.2-rc6 and net-next.

In Linux main line (tested up to 4.2-rc6), with this main routing table:
# ip route show table main
...
172.28.0.0/24 dev vnf-xe1p0  proto kernel  scope link  src 172.28.0.16

and an empty table 100, this works:

# ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0

With net-next at commit d52736e24fe2e927c26817256f8d1a3c8b5d51a0, the
same command leads to an:

# ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0
RTNETLINK answers: Resource temporarily unavailable

Is this expected behavior?


That's going to be due to 3bfd847203c6d89532f836ad3f5b4ff4ced26dd9.

I'll fix.

David

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH, net-next] r8169:Correct value on RxMaxSize register

2015-08-18 Thread Corcodel Marian
On here want to be original value, period.


Signed-off-by: Corcodel Marian corcodel.mar...@gmail.com

diff --git a/drivers/net/ethernet/realtek/r8169.c 
b/drivers/net/ethernet/realtek/r8169.c
index aff5437..6d16de3 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5219,8 +5219,8 @@ static u16 rtl_rw_cpluscmd(void __iomem *ioaddr)
 
 static void rtl_set_rx_max_size(void __iomem *ioaddr, unsigned int rx_buf_sz)
 {
-   /* Low hurts. Let's disable the filtering. */
-   RTL_W16(RxMaxSize, rx_buf_sz + 1);
+   
+   RTL_W16(RxMaxSize, rx_buf_sz);
 }
 
 static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version)
-- 
2.1.4

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v3] rocker: add debugfs support to dump internal tables

2015-08-18 Thread Scott Feldman
On Tue, Aug 18, 2015 at 7:01 AM, Andrew Lunn and...@lunn.ch wrote:
 On Mon, Aug 17, 2015 at 03:36:17PM -0700, sfel...@gmail.com wrote:
 From: Scott Feldman sfel...@gmail.com

  tree /sys/kernel/debug/rocker
 /sys/kernel/debug/rocker
 ? 525400123501
 ? fdb_tbl
 ? internal_vlan_tbl
 ? neigh_tbl
 ? of_dpa_flow_tbl
 ? of_dpa_group_tbl

 1 directory, 5 files

  cat /sys/kernel/debug/rocker/525400123501/internal_vlan_tbl
 ifindex 5 ref_count 1 vlan 3843
 ifindex 7 ref_count 2 vlan 3840
 ifindex 4 ref_count 1 vlan 3842

  cat /sys/kernel/debug/rocker/525400123501/fdb_tbl
 learned 1 pport 1 addr 00:02:00:00:02:00 vlan 3840
 learned 1 pport 2 addr 00:02:00:00:03:00 vlan 3840

  cat /sys/kernel/debug/rocker/525400123501/neigh_tbl
 11.0.0.9 dev sw1p2 ref_count 3 index 1 dst 00:02:00:00:01:00 ttl_check 1
 11.0.0.1 dev sw1p1 ref_count 3 index 0 dst 00:02:00:00:00:00 ttl_check 1

 Hi Scott

 David is not so keen no debugfs stuff. He already NACKed adding more
 than what is currently in DSA:

 https://lkml.org/lkml/2015/7/11/8

That patch added writable debugfs files, which I can see might be used
as a back-door to program hardware.  That does seem bad.

 I think the key thing from David's message is:

 Fetching information should be done by well typed, generic,
 interfaces that apply to any similar device or object.

 So rather than splattering rocker stuff in debugfs, we should really
 be thinking about an interface which works well for both Rocker and
 DSA, i.e. generic, and keeps David happy by being typed.

 No idea what that actually is, not thought about it yet.

Rocker debugfs files are read-only and dump internal tables that are
very specific to the (rocker) device.  I don't see how these could be
generic as each device/driver will have it's own unique data
structures.

I'm OK with not including debugfs in rocker even for these read-only
files, but I find them very useful during development/debugging, and I
could see their value in troubleshooting issues with others using
rocker.

Writable debugfs files is another story.

-scott
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v3] rocker: add debugfs support to dump internal tables

2015-08-18 Thread Andrew Lunn
On Tue, Aug 18, 2015 at 10:18:51AM -0700, Scott Feldman wrote:
 On Tue, Aug 18, 2015 at 7:01 AM, Andrew Lunn and...@lunn.ch wrote:
  On Mon, Aug 17, 2015 at 03:36:17PM -0700, sfel...@gmail.com wrote:
  From: Scott Feldman sfel...@gmail.com
 
   tree /sys/kernel/debug/rocker
  /sys/kernel/debug/rocker
  ? 525400123501
  ? fdb_tbl
  ? internal_vlan_tbl
  ? neigh_tbl
  ? of_dpa_flow_tbl
  ? of_dpa_group_tbl
 
  1 directory, 5 files
 
   cat /sys/kernel/debug/rocker/525400123501/internal_vlan_tbl
  ifindex 5 ref_count 1 vlan 3843
  ifindex 7 ref_count 2 vlan 3840
  ifindex 4 ref_count 1 vlan 3842
 
   cat /sys/kernel/debug/rocker/525400123501/fdb_tbl
  learned 1 pport 1 addr 00:02:00:00:02:00 vlan 3840
  learned 1 pport 2 addr 00:02:00:00:03:00 vlan 3840
 
   cat /sys/kernel/debug/rocker/525400123501/neigh_tbl
  11.0.0.9 dev sw1p2 ref_count 3 index 1 dst 00:02:00:00:01:00 ttl_check 1
  11.0.0.1 dev sw1p1 ref_count 3 index 0 dst 00:02:00:00:00:00 ttl_check 1
 
  Hi Scott
 
  David is not so keen no debugfs stuff. He already NACKed adding more
  than what is currently in DSA:
 
  https://lkml.org/lkml/2015/7/11/8
 
 That patch added writable debugfs files, which I can see might be used
 as a back-door to program hardware.  That does seem bad.

I fully agreed with respect to write. But if you read the whole
message, David is also not happy with read only.

I think before you spend too much more time on this, you need some
indication from David if he is going to merge it or not.

   Andrew
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v3] rocker: add debugfs support to dump internal tables

2015-08-18 Thread David Miller
From: Jiri Pirko j...@resnulli.us
Date: Tue, 18 Aug 2015 07:55:55 +0200

 Tue, Aug 18, 2015 at 12:36:17AM CEST, sfel...@gmail.com wrote:
+static int rocker_probe_debugfs_init(struct rocker *rocker)
+{
+ char dbg_dir_name[sizeof(rocker-hw.id) * 2 + 1];
+
+ sprintf(dbg_dir_name, %*phN, (int)sizeof(rocker-hw.id),
+ rocker-hw.id);
 
 You can use PCI address here. Might be better.

This absolutely will not be unique in a multi-domain PCI configuration.

It is arguable whether that matters or not under qemu, but it's a bad
precedence to say that PCI addresses will be unique, they absolutely
are not unique between devices even of the same exact type.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 15/21] net: mac80211_hwsim: convert to using IFF_NO_QUEUE

2015-08-18 Thread David Miller
From: Johannes Berg johan...@sipsolutions.net
Date: Tue, 18 Aug 2015 10:43:55 +0200

 On Tue, 2015-08-18 at 10:30 +0200, Phil Sutter wrote:
 Signed-off-by: Phil Sutter p...@nwl.cc
 Cc: Johannes Berg johan...@sipsolutions.net
 ---
  drivers/net/wireless/mac80211_hwsim.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/net/wireless/mac80211_hwsim.c 
 b/drivers/net/wireless/mac80211_hwsim.c
 index 99e873d..a1dbcb2 100644
 --- a/drivers/net/wireless/mac80211_hwsim.c
 +++ b/drivers/net/wireless/mac80211_hwsim.c
 @@ -2676,7 +2676,7 @@ static void hwsim_mon_setup(struct net_device 
 *dev)
  dev-netdev_ops = hwsim_netdev_ops;
  dev-destructor = free_netdev;
  ether_setup(dev);
 -dev-tx_queue_len = 0;
 +dev-priv_flags |= IFF_NO_QUEUE;
 
 Fine with me; Dave, are you going to pick up the entire series
 (presumably there was one, I only got this patch)?
 
 Note that there's no TX possible on this particular netdev anyway.

Yes, I'm going to take the full series.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [net-next RFC] net: ipv4: Send IGMP messages from highest scoped address

2015-08-18 Thread David Miller
From: Andrew Lunn and...@lunn.ch
Date: Tue, 18 Aug 2015 15:36:41 +0200

 We currently take the first address from the interface which is scope
 link or higher.
 
 Historically, the global scope address would of been used, but my
 previous fix, which stopped it taking a global scope address from a
 different interface altogether under some conditions, changed this
 behaviour.
 
 The first address from the interface, then broke one of my use
 case. The querier is only in one of the subnets on this interface, and
 using an address from the global scope address range. It then drops
 the membership reports when they are sent from the first address on
 the interface. This is why i want to restore the previous behaviour,
 take the global scope address from this interface.
 
 The patch works for me and is restoring previous behaviour, but is
 that sufficient to make it correct?

Preferring link-scope addresses make so much more sense for me.

The querier is on the local network, and he can do things like the
validity check on the subnet of the source address to try and avoid
forged IGMP responses.

So if anything I'd be advising you to change the code to prefer
link local addresses on the interface and keep avoiding global
addresses, as it is the only correct source address selection
scheme I can think of for IGMPs.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[net-next]: unable to add routes to tables

2015-08-18 Thread Andreas Schultz
Hi,

It seems that the policy for adding routes to tables has changed between
Linux 4.2-rc6 and net-next.

In Linux main line (tested up to 4.2-rc6), with this main routing table:
# ip route show table main
...
172.28.0.0/24 dev vnf-xe1p0  proto kernel  scope link  src 172.28.0.16 

and an empty table 100, this works:

# ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0

With net-next at commit d52736e24fe2e927c26817256f8d1a3c8b5d51a0, the
same command leads to an:

# ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0
RTNETLINK answers: Resource temporarily unavailable

Is this expected behavior?

Andreas
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 0/4] vrf: a few simplifications and cleanups

2015-08-18 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov niko...@cumulusnetworks.com

Hi,
These patches remove some unnecessary checks (patches 3, 4), unnecessary
num_slaves member and refcnt manipulations which are already done by the
upper functions.

Cheers,
 Nik

Nikolay Aleksandrov (4):
  vrf: drop unnecessary dev refcnt changes
  vrf: drop unused num_slaves member
  vrf: don't check for dstats and rth in uninit path
  vrf: simplify the netdev notifier function

 drivers/net/vrf.c | 15 ---
 include/net/vrf.h |  1 -
 2 files changed, 4 insertions(+), 12 deletions(-)

-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 1/4] vrf: drop unnecessary dev refcnt changes

2015-08-18 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov niko...@cumulusnetworks.com

netdev_master_upper_dev_link/unlink already do a dev_hold/put on the
devices being linked, so no need to take another reference.

Signed-off-by: Nikolay Aleksandrov niko...@cumulusnetworks.com
---
 drivers/net/vrf.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 95097cb79354..cd4bc77f2e04 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -334,14 +334,12 @@ static struct slave *__vrf_find_slave_dev(struct 
slave_queue *queue,
 /* inverse of __vrf_insert_slave */
 static void __vrf_remove_slave(struct slave_queue *queue, struct slave *slave)
 {
-   dev_put(slave-dev);
list_del(slave-list);
queue-num_slaves--;
 }
 
 static void __vrf_insert_slave(struct slave_queue *queue, struct slave *slave)
 {
-   dev_hold(slave-dev);
list_add(slave-list, queue-all_slaves);
queue-num_slaves++;
 }
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 3/4] vrf: don't check for dstats and rth in uninit path

2015-08-18 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov niko...@cumulusnetworks.com

dstats and rth are always present because we fail the device registration
if they can't be allocated in vrf_init() (ndo_init) so drop the unnecessary
checks.

Signed-off-by: Nikolay Aleksandrov niko...@cumulusnetworks.com
---
 drivers/net/vrf.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 3d7da0c6f827..97605eab14ae 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -265,8 +265,7 @@ static void vrf_rtable_destroy(struct net_vrf *vrf)
 {
struct dst_entry *dst = (struct dst_entry *)vrf-rth;
 
-   if (dst)
-   dst_destroy(dst);
+   dst_destroy(dst);
vrf-rth = NULL;
 }
 
@@ -455,8 +454,7 @@ static void vrf_dev_uninit(struct net_device *dev)
list_for_each_entry_safe(slave, next, head, list)
vrf_del_slave(dev, slave-dev);
 
-   if (dev-dstats)
-   free_percpu(dev-dstats);
+   free_percpu(dev-dstats);
dev-dstats = NULL;
 }
 
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 2/4] vrf: drop unused num_slaves member

2015-08-18 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov niko...@cumulusnetworks.com

slave_queue has a num_slaves member which is unused, drop it.

Signed-off-by: Nikolay Aleksandrov niko...@cumulusnetworks.com
---
 drivers/net/vrf.c | 2 --
 include/net/vrf.h | 1 -
 2 files changed, 3 deletions(-)

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index cd4bc77f2e04..3d7da0c6f827 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -335,13 +335,11 @@ static struct slave *__vrf_find_slave_dev(struct 
slave_queue *queue,
 static void __vrf_remove_slave(struct slave_queue *queue, struct slave *slave)
 {
list_del(slave-list);
-   queue-num_slaves--;
 }
 
 static void __vrf_insert_slave(struct slave_queue *queue, struct slave *slave)
 {
list_add(slave-list, queue-all_slaves);
-   queue-num_slaves++;
 }
 
 static int do_vrf_add_slave(struct net_device *dev, struct net_device 
*port_dev)
diff --git a/include/net/vrf.h b/include/net/vrf.h
index 40e3793c7a05..3bb4af462ed6 100644
--- a/include/net/vrf.h
+++ b/include/net/vrf.h
@@ -24,7 +24,6 @@ struct slave {
 
 struct slave_queue {
struct list_headall_slaves;
-   int num_slaves;
 };
 
 struct net_vrf {
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 4/4] vrf: simplify the netdev notifier function

2015-08-18 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov niko...@cumulusnetworks.com

We can drop the check because if vrf_ptr is present then we must have
the vrf device as a master and since we're running with rtnl it can't go
away.

Signed-off-by: Nikolay Aleksandrov niko...@cumulusnetworks.com
---
 drivers/net/vrf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 97605eab14ae..ed208317cbb5 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -624,9 +624,8 @@ static int vrf_device_event(struct notifier_block *unused,
if (!vrf_ptr || netif_is_vrf(dev))
goto out;
 
-   vrf_dev = __dev_get_by_index(dev_net(dev), vrf_ptr-ifindex);
-   if (vrf_dev)
-   vrf_del_slave(vrf_dev, dev);
+   vrf_dev = netdev_master_upper_dev_get(dev);
+   vrf_del_slave(vrf_dev, dev);
}
 out:
return NOTIFY_DONE;
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [net-next]: unable to add routes to tables

2015-08-18 Thread David Ahern

On 8/18/15 10:57 AM, Andreas Schultz wrote:

Hi,

It seems that the policy for adding routes to tables has changed between
Linux 4.2-rc6 and net-next.

In Linux main line (tested up to 4.2-rc6), with this main routing table:
# ip route show table main
...
172.28.0.0/24 dev vnf-xe1p0  proto kernel  scope link  src 172.28.0.16

and an empty table 100, this works:

# ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0

With net-next at commit d52736e24fe2e927c26817256f8d1a3c8b5d51a0, the
same command leads to an:

# ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0
RTNETLINK answers: Resource temporarily unavailable

Is this expected behavior?



The attached works for me and so does my original problem. Can you 
confirm it resolves your problem? If so I'll send a formal patch.


David


diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index c8025851dac7..01a237278dd2 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -710,9 +710,16 @@ static int fib_check_nh(struct fib_config *cfg, struct 
fib_info *fi,
err = fib_table_lookup(tbl, fl4, res,
   
FIB_LOOKUP_IGNORE_LINKSTATE |
   FIB_LOOKUP_NOREF);
-   else
+
+   /* on error or if no table given do full lookup. This is
+* needed for example when nexthops are in the local 
table
+* rather than the given table
+*/
+   if (!tbl || err) {
err = fib_lookup(net, fl4, res,
 FIB_LOOKUP_IGNORE_LINKSTATE);
+   }
+
if (err) {
rcu_read_unlock();
return err;


Re: [PATCH] bluetooth:Fix variable assignment for switch case in the function a2mp_chan_recv_cb

2015-08-18 Thread Marcel Holtmann
Hi Nicholas,

 This fixes the issue with not assigning the variable err to the return
 value of the call to the function a2mp_command_rej for the switch case
 A2MP_COMMAND_REJ as this function call can fail and thus callers of
 a2mp_chan_recv_cb should be signaled when this internal function call
 fails in order for them to handle this failure when calling the function
 a2mp_chan_recv_cb.
 
 Signed-off-by: Nicholas Krause xerofo...@gmail.com
 ---
 net/bluetooth/a2mp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next] r8169:Set RxConfig on same func. with TxConfig

2015-08-18 Thread Corcodel Marian
 Add set DMA burst size and  Rx FIFO threshold on RxConfig  
  register to function rtl_set_rx_tx_config_register.


Signed-off-by: Corcodel Marian corcodel.mar...@gmail.com

diff --git a/drivers/net/ethernet/realtek/r8169.c 
b/drivers/net/ethernet/realtek/r8169.c
index 6d16de3..c3c908c 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5183,6 +5183,7 @@ static void rtl_set_rx_tx_config_registers(struct 
rtl8169_private *tp)
/* Set DMA burst size and Interframe Gap Time */
RTL_W32(TxConfig, (TX_DMA_BURST  TxDMAShift) |
 (InterFrameGap  TxInterFrameGapShift) | InterFrameGap2);
+   RTL_W32(RxConfig, RX_FIFO_THRESHOLD | RX_DMA_BURST);
 }
 
 static void rtl_hw_start(struct net_device *dev)
-- 
2.1.4

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next] vrf: vrf_master_ifindex_rcu is not always called with rcu read lock

2015-08-18 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov niko...@cumulusnetworks.com

While running net-next I hit this:
[  634.073119] ===
[  634.073150] [ INFO: suspicious RCU usage. ]
[  634.073182] 4.2.0-rc6+ #45 Not tainted
[  634.073213] ---
[  634.073244] include/net/vrf.h:38 suspicious rcu_dereference_check()
usage!
[  634.073274]
   other info that might help us debug this:

[  634.073307]
   rcu_scheduler_active = 1, debug_locks = 1
[  634.073338] 2 locks held by swapper/0/0:
[  634.073369]  #0:  (((n-timer))){+.-...}, at: [8112bc35]
call_timer_fn+0x5/0x480
[  634.073412]  #1:  (slock-AF_INET){+.-...}, at: [8174f0f5]
icmp_send+0x155/0x5f0
[  634.073450]
   stack backtrace:
[  634.073483] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.2.0-rc6+ #45
[  634.073514] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS
VirtualBox 12/01/2006
[  634.073545]   0593ba8242d9ace4 88002fc03b48
81803f1b
[  634.073612]   81e12500 88002fc03b78
811003c5
[  634.073642]   88002ec4e600 81f00f80
88002fc03cf0
[  634.073669] Call Trace:
[  634.073694]  IRQ  [81803f1b] dump_stack+0x4c/0x65
[  634.073728]  [811003c5] lockdep_rcu_suspicious+0xc5/0x100
[  634.073763]  [8174eb56] icmp_route_lookup+0x176/0x5c0
[  634.073793]  [8174f2fb] ? icmp_send+0x35b/0x5f0
[  634.073818]  [8174f274] ? icmp_send+0x2d4/0x5f0
[  634.073844]  [8174f3ce] icmp_send+0x42e/0x5f0
[  634.073873]  [8170b662] ipv4_link_failure+0x22/0xa0
[  634.073899]  [8174bdda] arp_error_report+0x3a/0x80
[  634.073926]  [816d6100] ? neigh_lookup+0x2c0/0x2c0
[  634.073952]  [816d396e] neigh_invalidate+0x8e/0x110
[  634.073984]  [816d62ae] neigh_timer_handler+0x1ae/0x290
[  634.074013]  [816d6100] ? neigh_lookup+0x2c0/0x2c0
[  634.074013]  [8112bce3] call_timer_fn+0xb3/0x480
[  634.074013]  [8112bc35] ? call_timer_fn+0x5/0x480
[  634.074013]  [816d6100] ? neigh_lookup+0x2c0/0x2c0
[  634.074013]  [8112c2bc] run_timer_softirq+0x20c/0x430
[  634.074013]  [810af50e] __do_softirq+0xde/0x630
[  634.074013]  [810afc97] irq_exit+0x117/0x120
[  634.074013]  [81810976] smp_apic_timer_interrupt+0x46/0x60
[  634.074013]  [8180e950] apic_timer_interrupt+0x70/0x80
[  634.074013]  EOI  [8106b9d6] ? native_safe_halt+0x6/0x10
[  634.074013]  [81101d8d] ? trace_hardirqs_on+0xd/0x10
[  634.074013]  [81027d43] default_idle+0x23/0x200
[  634.074013]  [8102852f] arch_cpu_idle+0xf/0x20
[  634.074013]  [810f89ba] default_idle_call+0x2a/0x40
[  634.074013]  [810f8dcc] cpu_startup_entry+0x39c/0x4c0
[  634.074013]  [817f9cad] rest_init+0x13d/0x150
[  634.074013]  [81f69038] start_kernel+0x4a8/0x4c9
[  634.074013]  [81f68120] ?
early_idt_handler_array+0x120/0x120
[  634.074013]  [81f68339] x86_64_start_reservations+0x2a/0x2c
[  634.074013]  [81f68485] x86_64_start_kernel+0x14a/0x16d

It would seem vrf_master_ifindex_rcu() can be called without RCU held in
other contexts as well so to be sure acquire rcu before dereferencing the
vrf ptr.
Also add curly braces around both the if and else parts as per the
style guide.

Signed-off-by: Nikolay Aleksandrov niko...@cumulusnetworks.com
---
 include/net/vrf.h | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/net/vrf.h b/include/net/vrf.h
index 40e3793c7a05..22dfe2195092 100644
--- a/include/net/vrf.h
+++ b/include/net/vrf.h
@@ -35,7 +35,6 @@ struct net_vrf {
 
 
 #if IS_ENABLED(CONFIG_NET_VRF)
-/* called with rcu_read_lock() */
 static inline int vrf_master_ifindex_rcu(const struct net_device *dev)
 {
struct net_vrf_dev *vrf_ptr;
@@ -44,12 +43,14 @@ static inline int vrf_master_ifindex_rcu(const struct 
net_device *dev)
if (!dev)
return 0;
 
-   if (netif_is_vrf(dev))
+   if (netif_is_vrf(dev)) {
ifindex = dev-ifindex;
-   else {
+   } else {
+   rcu_read_lock();
vrf_ptr = rcu_dereference(dev-vrf_ptr);
if (vrf_ptr)
ifindex = vrf_ptr-ifindex;
+   rcu_read_unlock();
}
 
return ifindex;
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next] lwtunnel: fix memory leak

2015-08-18 Thread roopa

On 8/18/15, 9:41 AM, Jiri Benc wrote:

The built lwtunnel_state struct has to be freed after comparison.

Fixes: 571e722676fe3 (ipv4: support for fib route lwtunnel encap attributes)
Signed-off-by: Jiri Benc jb...@redhat.com
---


Acked-by: Roopa Prabhu ro...@cumulusnetworks.com

looks like this was introduced in my last version when i decided to drop 
the get/put of lwtstate here. Thanks!

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next] r8169:Set RxConfig on same func. with TxConfig

2015-08-18 Thread David Miller
From: Corcodel Marian corcodel.mar...@gmail.com
Date: Tue, 18 Aug 2015 22:10:21 +0300

  Add set DMA burst size and  Rx FIFO threshold on RxConfig  
   register to function rtl_set_rx_tx_config_register.
 
 
 Signed-off-by: Corcodel Marian corcodel.mar...@gmail.com

I would like to politely ask you to stop submitting these r8169 patches
right now.

Your method of handling your patch submissions is not acceptable and
is scarily wasting developer resources every single day.

When people give you feedback about why your patch is not correct, or
ask you questions, you often do not respond.  Or, if you do respond,
you give a very small response that do not actually answer the
question given to you.

When people give feedback to your patch, you _MUST_ engage in a
coherent full conversation with the person giving you feedback.

It is not acceptable to just ignore what that person tells you,
or to be quiet.  You cannot just keep throwing patches blindly
to this mailing list.

It is especially not acceptable to ignore feedback, and then keep
submitting more and more patches.  This is the worst thing in the
world that you can do.

You are creating a situation where the people trying to help you by
reviewing your work feel like they are wasting their time.

Furthermore, you haven't answered the most basic question we have
asked you.  Where are all of these r1869 patches coming from?  What is
the reason why you are looking into all of the r8169 issues all of a
sudden?  It looks very random and strange to all of us.

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v2] vrf: vrf_master_ifindex_rcu is not always called with rcu read lock

2015-08-18 Thread Nikolay Aleksandrov

 On Aug 18, 2015, at 11:10 PM, David Ahern d...@cumulusnetworks.com wrote:
 
 On 8/18/15 12:15 PM, Nikolay Aleksandrov wrote:
 diff --git a/include/net/vrf.h b/include/net/vrf.h
 index 3bb4af462ed6..b039850a94a3 100644
 --- a/include/net/vrf.h
 +++ b/include/net/vrf.h
 @@ -34,7 +34,6 @@ struct net_vrf {
 
 
  #if IS_ENABLED(CONFIG_NET_VRF)
 -/* called with rcu_read_lock() */
  static inline int vrf_master_ifindex_rcu(const struct net_device *dev)
  {
  struct net_vrf_dev *vrf_ptr;
 
 That comment is true for this version.
 
 David
 

It is, but as we established the name implies the same. Anyway I’ll post a v3 
and
keep it.


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v3] rocker: add debugfs support to dump internal tables

2015-08-18 Thread Scott Feldman
On Tue, Aug 18, 2015 at 11:19 AM, Andrew Lunn and...@lunn.ch wrote:
 On Tue, Aug 18, 2015 at 10:18:51AM -0700, Scott Feldman wrote:
 On Tue, Aug 18, 2015 at 7:01 AM, Andrew Lunn and...@lunn.ch wrote:
  On Mon, Aug 17, 2015 at 03:36:17PM -0700, sfel...@gmail.com wrote:
  From: Scott Feldman sfel...@gmail.com
 
   tree /sys/kernel/debug/rocker
  /sys/kernel/debug/rocker
  ? 525400123501
  ? fdb_tbl
  ? internal_vlan_tbl
  ? neigh_tbl
  ? of_dpa_flow_tbl
  ? of_dpa_group_tbl
 
  1 directory, 5 files
 
   cat /sys/kernel/debug/rocker/525400123501/internal_vlan_tbl
  ifindex 5 ref_count 1 vlan 3843
  ifindex 7 ref_count 2 vlan 3840
  ifindex 4 ref_count 1 vlan 3842
 
   cat /sys/kernel/debug/rocker/525400123501/fdb_tbl
  learned 1 pport 1 addr 00:02:00:00:02:00 vlan 3840
  learned 1 pport 2 addr 00:02:00:00:03:00 vlan 3840
 
   cat /sys/kernel/debug/rocker/525400123501/neigh_tbl
  11.0.0.9 dev sw1p2 ref_count 3 index 1 dst 00:02:00:00:01:00 ttl_check 1
  11.0.0.1 dev sw1p1 ref_count 3 index 0 dst 00:02:00:00:00:00 ttl_check 1
 
  Hi Scott
 
  David is not so keen no debugfs stuff. He already NACKed adding more
  than what is currently in DSA:
 
  https://lkml.org/lkml/2015/7/11/8

 That patch added writable debugfs files, which I can see might be used
 as a back-door to program hardware.  That does seem bad.

 I fully agreed with respect to write. But if you read the whole
 message, David is also not happy with read only.

 I think before you spend too much more time on this, you need some
 indication from David if he is going to merge it or not.

David, please give us guidance on debugfs in drivers/net.  Is there
some criteria we can define to know when it's OK to use debugfs?

-scott
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [net-next RFC] net: ipv4: Send IGMP messages from highest scoped address

2015-08-18 Thread Andrew Lunn
On Tue, Aug 18, 2015 at 12:01:10PM -0700, David Miller wrote:
 From: Andrew Lunn and...@lunn.ch
 Date: Tue, 18 Aug 2015 15:36:41 +0200
 
  We currently take the first address from the interface which is scope
  link or higher.
  
  Historically, the global scope address would of been used, but my
  previous fix, which stopped it taking a global scope address from a
  different interface altogether under some conditions, changed this
  behaviour.
  
  The first address from the interface, then broke one of my use
  case. The querier is only in one of the subnets on this interface, and
  using an address from the global scope address range. It then drops
  the membership reports when they are sent from the first address on
  the interface. This is why i want to restore the previous behaviour,
  take the global scope address from this interface.
  
  The patch works for me and is restoring previous behaviour, but is
  that sufficient to make it correct?
 
 Preferring link-scope addresses make so much more sense for me.
 
 The querier is on the local network, and he can do things like the
 validity check on the subnet of the source address to try and avoid
 forged IGMP responses.
 
 So if anything I'd be advising you to change the code to prefer
 link local addresses on the interface and keep avoiding global
 addresses, as it is the only correct source address selection
 scheme I can think of for IGMPs.

Hi David

O.K, thanks for the discussion, and this patch can be ignored.

 Andrew
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[net-next 06/15] igb: Teardown SR-IOV before unregister_netdev()

2015-08-18 Thread Jeff Kirsher
From: Alex Williamson alex.william...@redhat.com

When the .remove() callback for a PF is called, SR-IOV support for the
device is disabled, which requires unbinding and removing the VFs.
The VFs may be in-use either by the host kernel or userspace, such as
assigned to a VM through vfio-pci.  In this latter case, the VFs may
be removed either by shutting down the VM or hot-unplugging the
devices from the VM.  Unfortunately in the case of a Windows 2012 R2
guest, hot-unplug is broken due to the ordering of the PF driver
teardown.  Disabling SR-IOV prior to unregister_netdev() avoids this
issue.

Signed-off-by: Alex Williamson alex.william...@redhat.com
Acked-by: Mitch Williams mitch.a.willi...@intel.com
Tested-by: Aaron Brown aaron.f.br...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/igb/igb_main.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index 67ac0ea..8d22298 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2809,14 +2809,14 @@ static void igb_remove(struct pci_dev *pdev)
 */
igb_release_hw_control(adapter);
 
-   unregister_netdev(netdev);
-
-   igb_clear_interrupt_scheme(adapter);
-
 #ifdef CONFIG_PCI_IOV
igb_disable_sriov(pdev);
 #endif
 
+   unregister_netdev(netdev);
+
+   igb_clear_interrupt_scheme(adapter);
+
pci_iounmap(pdev, hw-hw_addr);
if (hw-flash_address)
iounmap(hw-flash_address);
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[net-next 09/15] igb: Fix a deadlock in igb_sriov_reinit

2015-08-18 Thread Jeff Kirsher
From: Jia-Ju Bai baijiaju1...@163.com

When igb_init_interrupt_scheme in igb_sriov_reinit is failed, the lock
acquired by rtnl_lock() is not released, which causes a deadlock.
This patch adds rtnl_unlock() in error handling to fix it.

Signed-off-by: Jia-Ju Bai baijiaju1...@163.com
Tested-by: Aaron Brown aaron.f.br...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/igb/igb_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index 8d22298..17c1c84 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -7413,6 +7413,7 @@ static int igb_resume(struct device *dev)
 
if (igb_init_interrupt_scheme(adapter, true)) {
dev_err(pdev-dev, Unable to allocate memory for queues\n);
+   rtnl_unlock();
return -ENOMEM;
}
 
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[net-next 03/15] igb: do not re-init SR-IOV during probe

2015-08-18 Thread Jeff Kirsher
From: Stefan Assmann sassm...@kpanic.de

During driver probing the following code path is triggered.
igb_probe
-igb_sw_init
  -igb_probe_vfs
-igb_pci_enable_sriov
  -igb_sriov_reinit

Doing the SR-IOV re-init is not necessary during probing since we're
starting from scratch. Here we can call igb_enable_sriov() right away.

Running igb_sriov_reinit() during igb_probe() also seems to cause
occasional packet loss on some onboard 82576 NICs. Reproduced on
Dell and HP servers with onboard 82576 NICs.
Example:
Intel Corporation 82576 Gigabit Network Connection [8086:10c9] (rev 01)
Subsystem: Dell Device [1028:0481]

Signed-off-by: Stefan Assmann sassm...@kpanic.de
Tested-by: Aaron Brown aaron.f.br...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index 0069c32..67ac0ea 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2851,7 +2851,7 @@ static void igb_probe_vfs(struct igb_adapter *adapter)
return;
 
pci_sriov_set_totalvfs(pdev, 7);
-   igb_pci_enable_sriov(pdev, max_vfs);
+   igb_enable_sriov(pdev, max_vfs);
 
 #endif /* CONFIG_PCI_IOV */
 }
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[net-next 11/15] igb: Fix a memory leak in igb_probe

2015-08-18 Thread Jeff Kirsher
From: Jia-Ju Bai baijiaju1...@163.com

In error handling code of igb_probe, the memory adapter-shadow_vfta
allocated by kcalloc in igb_sw_init is not freed. So when register_netdev
or igb_init_i2c is failed, a memory leak will occur.
This patch adds kfree to fix it.

Signed-off-by: Jia-Ju Bai baijiaju1...@163.com
Tested-by: Aaron Brown aaron.f.br...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/igb/igb_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index 17c1c84..1ebdb46 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2649,6 +2649,7 @@ err_eeprom:
if (hw-flash_address)
iounmap(hw-flash_address);
 err_sw_init:
+   kfree(adapter-shadow_vfta);
igb_clear_interrupt_scheme(adapter);
pci_iounmap(pdev, hw-hw_addr);
 err_ioremap:
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[net-next 15/15] ixgbe: TRIVIAL fix up double 'the' and comment style

2015-08-18 Thread Jeff Kirsher
From: Jacob Keller jacob.e.kel...@intel.com

Signed-off-by: Jacob Keller jacob.e.kel...@intel.com
Tested-by: Phil Schmitt phillip.j.schm...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 3e6a931..7906234 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -248,8 +248,7 @@ static void ixgbe_check_minimum_link(struct ixgbe_adapter 
*adapter,
enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN;
struct pci_dev *pdev;
 
-   /* determine whether to use the the parent device
-*/
+   /* determine whether to use the parent device */
if (ixgbe_pcie_from_parent(adapter-hw))
pdev = adapter-pdev-bus-parent-self;
else
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[net-next 13/15] igb: make sure SR-IOV init uses the right number of queues

2015-08-18 Thread Jeff Kirsher
From: Todd Fujinaka todd.fujin...@intel.com

Recent changes to igb_probe_vfs() could lead to the PF holding onto all
of the queues. Reorder igb_probe_vfs() to be before
gb_init_queue_configuration() and add some more error checking.

Signed-off-by: Todd Fujinaka todd.fujin...@intel.com
Tested-by: Aaron Brown aaron.f.br...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/igb/igb_main.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index 1ebdb46..1902ef8 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -179,6 +179,8 @@ static void igb_check_vf_rate_limit(struct igb_adapter *);
 #ifdef CONFIG_PCI_IOV
 static int igb_vf_configure(struct igb_adapter *adapter, int vf);
 static int igb_pci_enable_sriov(struct pci_dev *dev, int num_vfs);
+static int igb_disable_sriov(struct pci_dev *dev);
+static int igb_pci_disable_sriov(struct pci_dev *dev);
 #endif
 
 #ifdef CONFIG_PM
@@ -2651,6 +2653,9 @@ err_eeprom:
 err_sw_init:
kfree(adapter-shadow_vfta);
igb_clear_interrupt_scheme(adapter);
+#ifdef CONFIG_PCI_IOV
+   igb_disable_sriov(pdev);
+#endif
pci_iounmap(pdev, hw-hw_addr);
 err_ioremap:
free_netdev(netdev);
@@ -2981,6 +2986,8 @@ static int igb_sw_init(struct igb_adapter *adapter)
}
 #endif /* CONFIG_PCI_IOV */
 
+   igb_probe_vfs(adapter);
+
igb_init_queue_configuration(adapter);
 
/* Setup and initialize a copy of the hw vlan table array */
@@ -2993,8 +3000,6 @@ static int igb_sw_init(struct igb_adapter *adapter)
return -ENOMEM;
}
 
-   igb_probe_vfs(adapter);
-
/* Explicitly disable IRQ since the NIC can be in any state. */
igb_irq_disable(adapter);
 
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[net-next 14/15] ixgbe: Simplify port-specific macros

2015-08-18 Thread Jeff Kirsher
From: Mark Rustad mark.d.rus...@intel.com

Simplify port-specific macros by eliminating explicit comparison
with 0. More importantly, enclose formal parameter in parens to
eliminate the risk of an operator precedence surprise.

Signed-off-by: Mark Rustad mark.d.rus...@intel.com
Tested-by: Phil Schmitt phillip.j.schm...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
index b6f424f..4615a94 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
@@ -1,7 +1,7 @@
 
/***
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2014 Intel Corporation.
+  Copyright(c) 1999 - 2015 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -3462,14 +3462,14 @@ struct ixgbe_info {
 #define IXGBE_ERR_HOST_INTERFACE_COMMAND-33
 #define IXGBE_NOT_IMPLEMENTED   0x7FFF
 
-#define IXGBE_KRM_PORT_CAR_GEN_CTRL(P) ((P == 0) ? (0x4010) : (0x8010))
-#define IXGBE_KRM_LINK_CTRL_1(P)   ((P == 0) ? (0x420C) : (0x820C))
-#define IXGBE_KRM_DSP_TXFFE_STATE_4(P) ((P == 0) ? (0x4634) : (0x8634))
-#define IXGBE_KRM_DSP_TXFFE_STATE_5(P) ((P == 0) ? (0x4638) : (0x8638))
-#define IXGBE_KRM_RX_TRN_LINKUP_CTRL(P)((P == 0) ? (0x4B00) : (0x8B00))
-#define IXGBE_KRM_PMD_DFX_BURNIN(P)((P == 0) ? (0x4E00) : (0x8E00))
-#define IXGBE_KRM_TX_COEFF_CTRL_1(P)   ((P == 0) ? (0x5520) : (0x9520))
-#define IXGBE_KRM_RX_ANA_CTL(P)((P == 0) ? (0x5A00) : (0x9A00))
+#define IXGBE_KRM_PORT_CAR_GEN_CTRL(P) ((P) ? 0x8010 : 0x4010)
+#define IXGBE_KRM_LINK_CTRL_1(P)   ((P) ? 0x820C : 0x420C)
+#define IXGBE_KRM_DSP_TXFFE_STATE_4(P) ((P) ? 0x8634 : 0x4634)
+#define IXGBE_KRM_DSP_TXFFE_STATE_5(P) ((P) ? 0x8638 : 0x4638)
+#define IXGBE_KRM_RX_TRN_LINKUP_CTRL(P)((P) ? 0x8B00 : 0x4B00)
+#define IXGBE_KRM_PMD_DFX_BURNIN(P)((P) ? 0x8E00 : 0x4E00)
+#define IXGBE_KRM_TX_COEFF_CTRL_1(P)   ((P) ? 0x9520 : 0x5520)
+#define IXGBE_KRM_RX_ANA_CTL(P)((P) ? 0x9A00 : 0x5A00)
 
 #define IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_32B   (1  9)
 #define IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_KRPCS (1  11)
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 09/13] vxlan: provide access function for vxlan socket address family

2015-08-18 Thread Jiri Benc
Signed-off-by: Jiri Benc jb...@redhat.com
---
 drivers/net/vxlan.c | 8 
 include/net/vxlan.h | 5 +
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index e4b8ab63d0fa..d5ca1d7e0b81 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -236,7 +236,7 @@ static struct vxlan_sock *vxlan_find_sock(struct net *net, 
sa_family_t family,
 
hlist_for_each_entry_rcu(vs, vs_head(net, port), hlist) {
if (inet_sk(vs-sock-sk)-inet_sport == port 
-   inet_sk(vs-sock-sk)-sk.sk_family == family 
+   vxlan_get_sk_family(vs) == family 
vs-flags == flags)
return vs;
}
@@ -625,7 +625,7 @@ static void vxlan_notify_add_rx_port(struct vxlan_sock *vs)
struct net_device *dev;
struct sock *sk = vs-sock-sk;
struct net *net = sock_net(sk);
-   sa_family_t sa_family = sk-sk_family;
+   sa_family_t sa_family = vxlan_get_sk_family(vs);
__be16 port = inet_sk(sk)-inet_sport;
int err;
 
@@ -650,7 +650,7 @@ static void vxlan_notify_del_rx_port(struct vxlan_sock *vs)
struct net_device *dev;
struct sock *sk = vs-sock-sk;
struct net *net = sock_net(sk);
-   sa_family_t sa_family = sk-sk_family;
+   sa_family_t sa_family = vxlan_get_sk_family(vs);
__be16 port = inet_sk(sk)-inet_sport;
 
rcu_read_lock();
@@ -2390,7 +2390,7 @@ void vxlan_get_rx_port(struct net_device *dev)
for (i = 0; i  PORT_HASH_SIZE; ++i) {
hlist_for_each_entry_rcu(vs, vn-sock_list[i], hlist) {
port = inet_sk(vs-sock-sk)-inet_sport;
-   sa_family = vs-sock-sk-sk_family;
+   sa_family = vxlan_get_sk_family(vs);
dev-netdev_ops-ndo_add_vxlan_port(dev, sa_family,
port);
}
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index e4534f1b2d8c..43677e6b9c43 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -241,3 +241,8 @@ static inline void vxlan_get_rx_port(struct net_device 
*netdev)
 }
 #endif
 #endif
+
+static inline unsigned short vxlan_get_sk_family(struct vxlan_sock *vs)
+{
+   return vs-sock-sk-sk_family;
+}
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 01/13] ip_tunnels: remove custom alignment and packing

2015-08-18 Thread Jiri Benc
The custom alignment of struct ip_tunnel_key is unnecessary. In struct
sw_flow_key, it starts at offset 256, in struct ip_tunnel_info it's the
first field.

The structure is also packed even without the __packed keyword.

Signed-off-by: Jiri Benc jb...@redhat.com
---
 include/net/ip_tunnels.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 984dbfa15e13..81cf11c931e4 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -36,7 +36,7 @@ struct ip_tunnel_key {
__u8ipv4_ttl;
__be16  tp_src;
__be16  tp_dst;
-} __packed __aligned(4); /* Minimize padding. */
+};
 
 /* Indicates whether the tunnel info structure represents receive
  * or transmit tunnel parameters.
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 11/13] vxlan: metadata based tunneling for IPv6

2015-08-18 Thread Jiri Benc
Support metadata based (formerly flow based) tunneling also for IPv6.
This complements commit ee122c79d422 (vxlan: Flow based tunneling).

Signed-off-by: Jiri Benc jb...@redhat.com
---
 drivers/net/vxlan.c | 69 +++--
 1 file changed, 40 insertions(+), 29 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d0caac63231c..671f06781bb1 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1269,17 +1269,27 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct 
sk_buff *skb)
}
 
if (vxlan_collect_metadata(vs)) {
-   const struct iphdr *iph = ip_hdr(skb);
-
tun_dst = metadata_dst_alloc(sizeof(*md), GFP_ATOMIC);
if (!tun_dst)
goto drop;
 
info = tun_dst-u.tun_info;
-   info-key.u.ipv4.src = iph-saddr;
-   info-key.u.ipv4.dst = iph-daddr;
-   info-key.tos = iph-tos;
-   info-key.ttl = iph-ttl;
+   if (vxlan_get_sk_family(vs) == AF_INET) {
+   const struct iphdr *iph = ip_hdr(skb);
+
+   info-key.u.ipv4.src = iph-saddr;
+   info-key.u.ipv4.dst = iph-daddr;
+   info-key.tos = iph-tos;
+   info-key.ttl = iph-ttl;
+   } else {
+   const struct ipv6hdr *ip6h = ipv6_hdr(skb);
+
+   info-key.u.ipv6.src = ip6h-saddr;
+   info-key.u.ipv6.dst = ip6h-daddr;
+   info-key.tos = ipv6_get_dsfield(ip6h);
+   info-key.ttl = ip6h-hop_limit;
+   }
+
info-key.tp_src = udp_hdr(skb)-source;
info-key.tp_dst = udp_hdr(skb)-dest;
 
@@ -1894,6 +1904,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct 
net_device *dev,
struct ip_tunnel_info *info;
struct vxlan_dev *vxlan = netdev_priv(dev);
struct sock *sk = vxlan-vn_sock-sock-sk;
+   unsigned short family = vxlan_get_sk_family(vxlan-vn_sock);
struct rtable *rt = NULL;
const struct iphdr *old_iph;
struct flowi4 fl4;
@@ -1908,7 +1919,6 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct 
net_device *dev,
int err;
u32 flags = vxlan-flags;
 
-   /* FIXME: Support IPv6 */
info = skb_tunnel_info(skb);
 
if (rdst) {
@@ -1924,8 +1934,11 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct 
net_device *dev,
 
dst_port = info-key.tp_dst ? : vxlan-cfg.dst_port;
vni = be64_to_cpu(info-key.tun_id);
-   remote_ip.sin.sin_family = AF_INET;
-   remote_ip.sin.sin_addr.s_addr = info-key.u.ipv4.dst;
+   remote_ip.sa.sa_family = family;
+   if (family == AF_INET)
+   remote_ip.sin.sin_addr.s_addr = info-key.u.ipv4.dst;
+   else
+   remote_ip.sin6.sin6_addr = info-key.u.ipv6.dst;
dst = remote_ip;
}
 
@@ -1951,23 +1964,24 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct 
net_device *dev,
src_port = udp_flow_src_port(dev_net(dev), skb, vxlan-cfg.port_min,
 vxlan-cfg.port_max, true);
 
+   if (info) {
+   if (info-key.tun_flags  TUNNEL_CSUM)
+   flags |= VXLAN_F_UDP_CSUM;
+   else
+   flags = ~VXLAN_F_UDP_CSUM;
+
+   ttl = info-key.ttl;
+   tos = info-key.tos;
+
+   if (info-options_len)
+   md = ip_tunnel_info_opts(info, sizeof(*md));
+   } else {
+   md-gbp = skb-mark;
+   }
+
if (dst-sa.sa_family == AF_INET) {
-   if (info) {
-   if (info-key.tun_flags  TUNNEL_DONT_FRAGMENT)
-   df = htons(IP_DF);
-   if (info-key.tun_flags  TUNNEL_CSUM)
-   flags |= VXLAN_F_UDP_CSUM;
-   else
-   flags = ~VXLAN_F_UDP_CSUM;
-
-   ttl = info-key.ttl;
-   tos = info-key.tos;
-
-   if (info-options_len)
-   md = ip_tunnel_info_opts(info, sizeof(*md));
-   } else {
-   md-gbp = skb-mark;
-   }
+   if (info  (info-key.tun_flags  TUNNEL_DONT_FRAGMENT))
+   df = htons(IP_DF);
 
memset(fl4, 0, sizeof(fl4));
fl4.flowi4_oif = rdst ? rdst-remote_ifindex : 0;
@@ -2066,12 +2080,10 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct 
net_device *dev,
}
 
ttl = ttl ? : ip6_dst_hoplimit(ndst);
-   md-gbp = skb-mark;
-
err = vxlan6_xmit_skb(ndst, sk, skb, dev, fl6.saddr, 
fl6.daddr,
 

[PATCH net-next 13/13] ipv6: route: per route IP tunnel metadata via lightweight tunnel

2015-08-18 Thread Jiri Benc
Allow specification of per route IP tunnel instructions also for IPv6.
This complements commit 3093fbe7ff4b (route: Per route IP tunnel metadata
via lightweight tunnel).

Signed-off-by: Jiri Benc jb...@redhat.com
---
 include/uapi/linux/lwtunnel.h |  16 +++
 net/ipv4/ip_tunnel_core.c | 102 ++
 2 files changed, 118 insertions(+)

diff --git a/include/uapi/linux/lwtunnel.h b/include/uapi/linux/lwtunnel.h
index aa84ca396bcb..32a149571417 100644
--- a/include/uapi/linux/lwtunnel.h
+++ b/include/uapi/linux/lwtunnel.h
@@ -7,6 +7,7 @@ enum lwtunnel_encap_types {
LWTUNNEL_ENCAP_NONE,
LWTUNNEL_ENCAP_MPLS,
LWTUNNEL_ENCAP_IP,
+   LWTUNNEL_ENCAP_IP6,
LWTUNNEL_ENCAP_ILA,
__LWTUNNEL_ENCAP_MAX,
 };
@@ -28,4 +29,19 @@ enum lwtunnel_ip_t {
 
 #define LWTUNNEL_IP_MAX (__LWTUNNEL_IP_MAX - 1)
 
+enum lwtunnel_ip6_t {
+   LWTUNNEL_IP6_UNSPEC,
+   LWTUNNEL_IP6_ID,
+   LWTUNNEL_IP6_DST,
+   LWTUNNEL_IP6_SRC,
+   LWTUNNEL_IP6_HOPLIMIT,
+   LWTUNNEL_IP6_TC,
+   LWTUNNEL_IP6_SPORT,
+   LWTUNNEL_IP6_DPORT,
+   LWTUNNEL_IP6_FLAGS,
+   __LWTUNNEL_IP6_MAX,
+};
+
+#define LWTUNNEL_IP6_MAX (__LWTUNNEL_IP6_MAX - 1)
+
 #endif /* _UAPI_LWTUNNEL_H_ */
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index f0514e39e57c..289b6c26ce37 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -299,9 +299,111 @@ static const struct lwtunnel_encap_ops ip_tun_lwt_ops = {
.cmp_encap = ip_tun_cmp_encap,
 };
 
+static const struct nla_policy ip6_tun_policy[LWTUNNEL_IP6_MAX + 1] = {
+   [LWTUNNEL_IP6_ID]   = { .type = NLA_U64 },
+   [LWTUNNEL_IP6_DST]  = { .len = sizeof(struct in6_addr) },
+   [LWTUNNEL_IP6_SRC]  = { .len = sizeof(struct in6_addr) },
+   [LWTUNNEL_IP6_HOPLIMIT] = { .type = NLA_U8 },
+   [LWTUNNEL_IP6_TC]   = { .type = NLA_U8 },
+   [LWTUNNEL_IP6_SPORT]= { .type = NLA_U16 },
+   [LWTUNNEL_IP6_DPORT]= { .type = NLA_U16 },
+   [LWTUNNEL_IP6_FLAGS]= { .type = NLA_U16 },
+};
+
+static int ip6_tun_build_state(struct net_device *dev, struct nlattr *attr,
+  struct lwtunnel_state **ts)
+{
+   struct ip_tunnel_info *tun_info;
+   struct lwtunnel_state *new_state;
+   struct nlattr *tb[LWTUNNEL_IP6_MAX + 1];
+   int err;
+
+   err = nla_parse_nested(tb, LWTUNNEL_IP6_MAX, attr, ip6_tun_policy);
+   if (err  0)
+   return err;
+
+   new_state = lwtunnel_state_alloc(sizeof(*tun_info));
+   if (!new_state)
+   return -ENOMEM;
+
+   new_state-type = LWTUNNEL_ENCAP_IP6;
+
+   tun_info = lwt_tun_info(new_state);
+
+   if (tb[LWTUNNEL_IP6_ID])
+   tun_info-key.tun_id = nla_get_u64(tb[LWTUNNEL_IP6_ID]);
+
+   if (tb[LWTUNNEL_IP6_DST])
+   tun_info-key.u.ipv6.dst = 
nla_get_in6_addr(tb[LWTUNNEL_IP6_DST]);
+
+   if (tb[LWTUNNEL_IP6_SRC])
+   tun_info-key.u.ipv6.src = 
nla_get_in6_addr(tb[LWTUNNEL_IP6_SRC]);
+
+   if (tb[LWTUNNEL_IP6_HOPLIMIT])
+   tun_info-key.ttl = nla_get_u8(tb[LWTUNNEL_IP6_HOPLIMIT]);
+
+   if (tb[LWTUNNEL_IP6_TC])
+   tun_info-key.tos = nla_get_u8(tb[LWTUNNEL_IP6_TC]);
+
+   if (tb[LWTUNNEL_IP6_SPORT])
+   tun_info-key.tp_src = nla_get_be16(tb[LWTUNNEL_IP6_SPORT]);
+
+   if (tb[LWTUNNEL_IP6_DPORT])
+   tun_info-key.tp_dst = nla_get_be16(tb[LWTUNNEL_IP6_DPORT]);
+
+   if (tb[LWTUNNEL_IP6_FLAGS])
+   tun_info-key.tun_flags = nla_get_u16(tb[LWTUNNEL_IP6_FLAGS]);
+
+   tun_info-mode = IP_TUNNEL_INFO_TX;
+   tun_info-options = NULL;
+   tun_info-options_len = 0;
+
+   *ts = new_state;
+
+   return 0;
+}
+
+static int ip6_tun_fill_encap_info(struct sk_buff *skb,
+  struct lwtunnel_state *lwtstate)
+{
+   struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate);
+
+   if (nla_put_u64(skb, LWTUNNEL_IP6_ID, tun_info-key.tun_id) ||
+   nla_put_in6_addr(skb, LWTUNNEL_IP6_DST, tun_info-key.u.ipv6.dst) 
||
+   nla_put_in6_addr(skb, LWTUNNEL_IP6_SRC, tun_info-key.u.ipv6.src) 
||
+   nla_put_u8(skb, LWTUNNEL_IP6_HOPLIMIT, tun_info-key.tos) ||
+   nla_put_u8(skb, LWTUNNEL_IP6_TC, tun_info-key.ttl) ||
+   nla_put_u16(skb, LWTUNNEL_IP6_SPORT, tun_info-key.tp_src) ||
+   nla_put_u16(skb, LWTUNNEL_IP6_DPORT, tun_info-key.tp_dst) ||
+   nla_put_u16(skb, LWTUNNEL_IP6_FLAGS, tun_info-key.tun_flags))
+   return -ENOMEM;
+
+   return 0;
+}
+
+static int ip6_tun_encap_nlsize(struct lwtunnel_state *lwtstate)
+{
+   return nla_total_size(8)/* LWTUNNEL_IP6_ID */
+   + nla_total_size(16)/* LWTUNNEL_IP6_DST */
+   + nla_total_size(16)/* LWTUNNEL_IP6_SRC */
+   + 

[PATCH net-next 05/13] ip_tunnels: use tos and ttl fields also for IPv6

2015-08-18 Thread Jiri Benc
Rename the ipv4_tos and ipv4_ttl fields to just 'tos' and 'ttl', as they'll
be used with IPv6 tunnels, too.

Signed-off-by: Jiri Benc jb...@redhat.com
---
 drivers/net/vxlan.c|  8 
 include/net/ip_tunnels.h   |  8 
 net/ipv4/ip_gre.c  |  8 
 net/ipv4/ip_tunnel_core.c  |  8 
 net/openvswitch/flow_netlink.c | 10 +-
 net/openvswitch/vport-geneve.c |  4 ++--
 net/openvswitch/vport.c|  4 ++--
 net/openvswitch/vport.h|  2 +-
 8 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 1c0733540756..41e9549e1d5e 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1278,8 +1278,8 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct 
sk_buff *skb)
info = tun_dst-u.tun_info;
info-key.u.ipv4.src = iph-saddr;
info-key.u.ipv4.dst = iph-daddr;
-   info-key.ipv4_tos = iph-tos;
-   info-key.ipv4_ttl = iph-ttl;
+   info-key.tos = iph-tos;
+   info-key.ttl = iph-ttl;
info-key.tp_src = udp_hdr(skb)-source;
info-key.tp_dst = udp_hdr(skb)-dest;
 
@@ -1960,8 +1960,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct 
net_device *dev,
else
flags = ~VXLAN_F_UDP_CSUM;
 
-   ttl = info-key.ipv4_ttl;
-   tos = info-key.ipv4_tos;
+   ttl = info-key.ttl;
+   tos = info-key.tos;
 
if (info-options_len)
md = ip_tunnel_info_opts(info, sizeof(*md));
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 96b0a37af42c..f0faf8a3186b 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -43,8 +43,8 @@ struct ip_tunnel_key {
} ipv6;
} u;
__be16  tun_flags;
-   u8  ipv4_tos;
-   u8  ipv4_ttl;
+   u8  tos;/* TOS for IPv4, TC for IPv6 */
+   u8  ttl;/* TTL for IPv4, HL for IPv6 */
__be16  tp_src;
__be16  tp_dst;
 };
@@ -194,8 +194,8 @@ static inline void __ip_tunnel_info_init(struct 
ip_tunnel_info *tun_info,
tun_info-key.u.ipv4.dst = daddr;
memset((unsigned char *)tun_info-key + IP_TUNNEL_KEY_IPV4_PAD,
   0, IP_TUNNEL_KEY_IPV4_PAD_LEN);
-   tun_info-key.ipv4_tos = tos;
-   tun_info-key.ipv4_ttl = ttl;
+   tun_info-key.tos = tos;
+   tun_info-key.ttl = ttl;
tun_info-key.tun_flags = tun_flags;
 
/* For the tunnel types on the top of IPsec, the tp_src and tp_dst of
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index b7bb7d6aa7a8..5193618b2600 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -409,8 +409,8 @@ static int ipgre_rcv(struct sk_buff *skb, const struct 
tnl_ptk_info *tpi)
info = tun_dst-u.tun_info;
info-key.u.ipv4.src = iph-saddr;
info-key.u.ipv4.dst = iph-daddr;
-   info-key.ipv4_tos = iph-tos;
-   info-key.ipv4_ttl = iph-ttl;
+   info-key.tos = iph-tos;
+   info-key.ttl = iph-ttl;
 
info-mode = IP_TUNNEL_INFO_RX;
info-key.tun_flags = tpi-flags 
@@ -529,7 +529,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct 
net_device *dev)
memset(fl, 0, sizeof(fl));
fl.daddr = key-u.ipv4.dst;
fl.saddr = key-u.ipv4.src;
-   fl.flowi4_tos = RT_TOS(key-ipv4_tos);
+   fl.flowi4_tos = RT_TOS(key-tos);
fl.flowi4_mark = skb-mark;
fl.flowi4_proto = IPPROTO_GRE;
 
@@ -565,7 +565,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct 
net_device *dev)
df = key-tun_flags  TUNNEL_DONT_FRAGMENT ?  htons(IP_DF) : 0;
err = iptunnel_xmit(skb-sk, rt, skb, fl.saddr,
key-u.ipv4.dst, IPPROTO_GRE,
-   key-ipv4_tos, key-ipv4_ttl, df, false);
+   key-tos, key-ttl, df, false);
iptunnel_xmit_stats(err, dev-stats, dev-tstats);
return;
 
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 93907d71cda6..f0514e39e57c 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -233,10 +233,10 @@ static int ip_tun_build_state(struct net_device *dev, 
struct nlattr *attr,
tun_info-key.u.ipv4.src = nla_get_be32(tb[LWTUNNEL_IP_SRC]);
 
if (tb[LWTUNNEL_IP_TTL])
-   tun_info-key.ipv4_ttl = nla_get_u8(tb[LWTUNNEL_IP_TTL]);
+   tun_info-key.ttl = nla_get_u8(tb[LWTUNNEL_IP_TTL]);
 
if (tb[LWTUNNEL_IP_TOS])
-   tun_info-key.ipv4_tos = 

[PATCH net-next 02/13] ip_tunnels: use u8/u16/u32

2015-08-18 Thread Jiri Benc
The ip_tunnels.h include file uses mixture of __u16 and u16 (etc.) types.
Unify it to the non-underscore variants.

Signed-off-by: Jiri Benc jb...@redhat.com
---
 include/net/ip_tunnels.h | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 81cf11c931e4..ca173f22f07f 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -32,8 +32,8 @@ struct ip_tunnel_key {
__be32  ipv4_src;
__be32  ipv4_dst;
__be16  tun_flags;
-   __u8ipv4_tos;
-   __u8ipv4_ttl;
+   u8  ipv4_tos;
+   u8  ipv4_ttl;
__be16  tp_src;
__be16  tp_dst;
 };
@@ -64,8 +64,8 @@ struct ip_tunnel_6rd_parm {
 #endif
 
 struct ip_tunnel_encap {
-   __u16   type;
-   __u16   flags;
+   u16 type;
+   u16 flags;
__be16  sport;
__be16  dport;
 };
@@ -95,8 +95,8 @@ struct ip_tunnel {
 * arrived */
 
/* These four fields used only by GRE */
-   __u32   i_seqno;/* The last seen seqno  */
-   __u32   o_seqno;/* The last output seqno */
+   u32 i_seqno;/* The last seen seqno  */
+   u32 o_seqno;/* The last output seqno */
int tun_hlen;   /* Precalculated header length */
int mlink;
 
@@ -273,8 +273,8 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct 
iphdr *iph,
 
 int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
 int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
- __be32 src, __be32 dst, __u8 proto,
- __u8 tos, __u8 ttl, __be16 df, bool xnet);
+ __be32 src, __be32 dst, u8 proto,
+ u8 tos, u8 ttl, __be16 df, bool xnet);
 
 struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, bool gre_csum,
 int gso_type_mask);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[net-next 04/15] igb: implement high frequency periodic output signals

2015-08-18 Thread Jeff Kirsher
From: Richard Cochran richardcoch...@gmail.com

In addition to interrupt driven target time output events, the i210
also has two programmable clock outputs.  These clocks support periods
between 16 nanoseconds and 140 milliseconds.  This patch implements
the periodic output function using the clock outputs when possible,
falling back to the target time for longer periods.

Signed-off-by: Richard Cochran richardcoch...@gmail.com
Tested-by: Aaron Brown aaron.f.br...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/igb/e1000_regs.h |  2 +
 drivers/net/ethernet/intel/igb/igb_ptp.c| 72 +
 2 files changed, 54 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/e1000_regs.h 
b/drivers/net/ethernet/intel/igb/e1000_regs.h
index 6f0490d..4af2870 100644
--- a/drivers/net/ethernet/intel/igb/e1000_regs.h
+++ b/drivers/net/ethernet/intel/igb/e1000_regs.h
@@ -104,6 +104,8 @@
 #define E1000_TRGTTIMH0  0x0B648 /* Target Time Register 0 High - RW */
 #define E1000_TRGTTIML1  0x0B64C /* Target Time Register 1 Low  - RW */
 #define E1000_TRGTTIMH1  0x0B650 /* Target Time Register 1 High - RW */
+#define E1000_FREQOUT0   0x0B654 /* Frequency Out 0 Control Register - RW */
+#define E1000_FREQOUT1   0x0B658 /* Frequency Out 1 Control Register - RW */
 #define E1000_AUXSTMPL0  0x0B65C /* Auxiliary Time Stamp 0 Register Low  - RO 
*/
 #define E1000_AUXSTMPH0  0x0B660 /* Auxiliary Time Stamp 0 Register High - RO 
*/
 #define E1000_AUXSTMPL1  0x0B664 /* Auxiliary Time Stamp 1 Register Low  - RO 
*/
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c 
b/drivers/net/ethernet/intel/igb/igb_ptp.c
index c3a9392c..5982f28 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -405,7 +405,7 @@ static void igb_pin_extts(struct igb_adapter *igb, int 
chan, int pin)
wr32(E1000_CTRL_EXT, ctrl_ext);
 }
 
-static void igb_pin_perout(struct igb_adapter *igb, int chan, int pin)
+static void igb_pin_perout(struct igb_adapter *igb, int chan, int pin, int 
freq)
 {
static const u32 aux0_sel_sdp[IGB_N_SDP] = {
AUX0_SEL_SDP0, AUX0_SEL_SDP1, AUX0_SEL_SDP2, AUX0_SEL_SDP3,
@@ -424,6 +424,14 @@ static void igb_pin_perout(struct igb_adapter *igb, int 
chan, int pin)
TS_SDP0_SEL_TT1, TS_SDP1_SEL_TT1,
TS_SDP2_SEL_TT1, TS_SDP3_SEL_TT1,
};
+   static const u32 ts_sdp_sel_fc0[IGB_N_SDP] = {
+   TS_SDP0_SEL_FC0, TS_SDP1_SEL_FC0,
+   TS_SDP2_SEL_FC0, TS_SDP3_SEL_FC0,
+   };
+   static const u32 ts_sdp_sel_fc1[IGB_N_SDP] = {
+   TS_SDP0_SEL_FC1, TS_SDP1_SEL_FC1,
+   TS_SDP2_SEL_FC1, TS_SDP3_SEL_FC1,
+   };
static const u32 ts_sdp_sel_clr[IGB_N_SDP] = {
TS_SDP0_SEL_FC1, TS_SDP1_SEL_FC1,
TS_SDP2_SEL_FC1, TS_SDP3_SEL_FC1,
@@ -445,11 +453,17 @@ static void igb_pin_perout(struct igb_adapter *igb, int 
chan, int pin)
tssdp = ~AUX1_TS_SDP_EN;
 
tssdp = ~ts_sdp_sel_clr[pin];
-   if (chan == 1)
-   tssdp |= ts_sdp_sel_tt1[pin];
-   else
-   tssdp |= ts_sdp_sel_tt0[pin];
-
+   if (freq) {
+   if (chan == 1)
+   tssdp |= ts_sdp_sel_fc1[pin];
+   else
+   tssdp |= ts_sdp_sel_fc0[pin];
+   } else {
+   if (chan == 1)
+   tssdp |= ts_sdp_sel_tt1[pin];
+   else
+   tssdp |= ts_sdp_sel_tt0[pin];
+   }
tssdp |= ts_sdp_en[pin];
 
wr32(E1000_TSSDP, tssdp);
@@ -463,10 +477,10 @@ static int igb_ptp_feature_enable_i210(struct 
ptp_clock_info *ptp,
struct igb_adapter *igb =
container_of(ptp, struct igb_adapter, ptp_caps);
struct e1000_hw *hw = igb-hw;
-   u32 tsauxc, tsim, tsauxc_mask, tsim_mask, trgttiml, trgttimh;
+   u32 tsauxc, tsim, tsauxc_mask, tsim_mask, trgttiml, trgttimh, freqout;
unsigned long flags;
struct timespec ts;
-   int pin = -1;
+   int use_freq = 0, pin = -1;
s64 ns;
 
switch (rq-type) {
@@ -511,40 +525,58 @@ static int igb_ptp_feature_enable_i210(struct 
ptp_clock_info *ptp,
ts.tv_nsec = rq-perout.period.nsec;
ns = timespec_to_ns(ts);
ns = ns  1;
-   if (on  ns  50LL) {
-   /* 2k interrupts per second is an awful lot. */
-   return -EINVAL;
+   if (on  ns = 7000LL) {
+   if (ns  8LL)
+   return -EINVAL;
+   use_freq = 1;
}
ts = ns_to_timespec(ns);
if (rq-perout.index == 1) {
-   tsauxc_mask = TSAUXC_EN_TT1;
-   tsim_mask = TSINTR_TT1;
+   if (use_freq) {
+ 

[net-next 02/15] igb: missing rtnl_unlock in igb_sriov_reinit()

2015-08-18 Thread Jeff Kirsher
From: Vasily Averin v...@virtuozzo.com

Signed-off-by: Vasily Averin v...@virtuozzo.com
Tested-by: Aaron Brown aaron.f.br...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/igb/igb_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index 7b97e847..0069c32 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -7506,6 +7506,7 @@ static int igb_sriov_reinit(struct pci_dev *dev)
igb_init_queue_configuration(adapter);
 
if (igb_init_interrupt_scheme(adapter, true)) {
+   rtnl_unlock();
dev_err(pdev-dev, Unable to allocate memory for queues\n);
return -ENOMEM;
}
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-08-18

2015-08-18 Thread Jeff Kirsher
This series contains updates to igb, e100, e1000e and ixgbe.

Shota Suzuki provides a fix for a possible overflow in
igb_set_interrupt_capability() which leads to an oops.  When changing the
number of queues by ethtool -L, set IGB_FLAG_QUEUE_PAIRS in the same
manner as when initializing the igb driver.

Vasily Averin provides a fix for a missing rtnl_unlock() for when we
error out due to not being able to allocate memory for our queues.

Stefan Assman provides a couple of fixes for igb/igbvf.  First changes
the igb driver in probe to simply call igb_enable_sriov() instead of
igb_sriov_reinit() since we are starting from scratch.  Then in igbvf,
fix the driver where it does not clear the buffer_info-dma in all
cases after calling dma_unmap_single(), which was found by changing the
MTU twice.

Richard Cochran implements the periodic output function using the
programmable clock outputs available in i210 when possible, falling
back to the target time for longer periods.

Todd adds support for the Marvell PHY 1512 which is required for i354
devices.  Then updates igb to make sure SR-IOV init uses the correct
number of queues, since recent changes could result in the PF holding
onto all of the queues.

Alex Williamson provides a fix in the case where a guest OS does not
support hot-unplug, so disable SR-IOV prior to unregister_netdev() to
avoid the problem.

Jia-Ju Bai provides several patches, first knocks some collecting dust
off an old e100 driver to add a check to avoid a null pointer
dereference.  Then cleans up a possible resource leak by releasing the
skb buffer allocated when the e100_xmit_prepare() runs into an issue
in the DMA mapping.  In igb, add a missing rtnl_unlock() for when we
error out due to igb_sriov_reinit() in the igb_init_interrupt_scheme().
Provides a e1000e fix, based on suggestions from Alex Duyck to move
head/tail register writing to e1000_configure_tx/rx() to avoid a
possible null pointer dereference (similar to igb driver).  Lastly,
fix a possible memory leak in igb_probe(), where the memory shadow_vfta
allocated by kcalloc in igb_sw_init() is not freed.

Mark simplifies port-specific macros for ixgbe by eliminating explicit
comparisons with 0 and enclose formal parameters in parens to eliminate
the risk of an operator precedence issue.

The following are changes since commit 61ed713bbb043f333ca9576c79a3d33d2ad17438:
  Merge branch 'drivers_iff_no_queue'
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue master

Alex Williamson (1):
  igb: Teardown SR-IOV before unregister_netdev()

Jacob Keller (1):
  ixgbe: TRIVIAL fix up double 'the' and comment style

Jia-Ju Bai (5):
  e100: Add a check after pci_pool_create to avoid null pointer
dereference
  e100: Release skb when DMA mapping is failed in e100_xmit_prepare
  igb: Fix a deadlock in igb_sriov_reinit
  e1000e: Modify Tx/Rx configurations to avoid null pointer dereferences
in e1000_open
  igb: Fix a memory leak in igb_probe

Mark Rustad (1):
  ixgbe: Simplify port-specific macros

Richard Cochran (1):
  igb: implement high frequency periodic output signals

Shota Suzuki (1):
  igb: Fix oops caused by missing queue pairing

Stefan Assmann (2):
  igb: do not re-init SR-IOV during probe
  igbvf: clear buffer_info-dma after dma_unmap_single()

Todd Fujinaka (2):
  igb: add support for 1512 PHY
  igb: make sure SR-IOV init uses the right number of queues

Vasily Averin (1):
  igb: missing rtnl_unlock in igb_sriov_reinit()

 drivers/net/ethernet/intel/e100.c  | 12 +++-
 drivers/net/ethernet/intel/e1000e/netdev.c | 24 +++
 drivers/net/ethernet/intel/igb/e1000_82575.c   | 20 +-
 drivers/net/ethernet/intel/igb/e1000_defines.h |  5 ++
 drivers/net/ethernet/intel/igb/e1000_phy.c | 93 +-
 drivers/net/ethernet/intel/igb/e1000_phy.h |  1 +
 drivers/net/ethernet/intel/igb/e1000_regs.h|  2 +
 drivers/net/ethernet/intel/igb/igb.h   |  1 +
 drivers/net/ethernet/intel/igb/igb_ethtool.c   |  5 +-
 drivers/net/ethernet/intel/igb/igb_main.c  | 38 ---
 drivers/net/ethernet/intel/igb/igb_ptp.c   | 72 ++--
 drivers/net/ethernet/intel/igbvf/netdev.c  |  1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c  |  3 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h  | 18 ++---
 14 files changed, 236 insertions(+), 59 deletions(-)

-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[net-next 10/15] e1000e: Modify Tx/Rx configurations to avoid null pointer dereferences in e1000_open

2015-08-18 Thread Jeff Kirsher
From: Jia-Ju Bai baijiaju1...@163.com

When e1000e_setup_rx_resources is failed in e1000_open,
e1000e_free_tx_resources in err_setup_rx segment is executed.
writel(0, tx_ring-head) statement in e1000_clean_tx_ring
in e1000e_free_tx_resources will cause a null poonter dereference(crash),
because tx_ring-head is only assigned in e1000_configure_tx
in e1000_configure, but it is after e1000e_setup_rx_resources.

This patch moves head/tail register writing to e1000_configure_tx/rx,
which can fix this problem. It is inspired by igb_configure_tx_ring
in the igb driver.

Specially, thank Alexander Duyck for his valuable suggestion.

Signed-off-by: Jia-Ju Bai baijiaju1...@163.com
Tested-by: Aaron Brown aaron.f.br...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/e1000e/netdev.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c 
b/drivers/net/ethernet/intel/e1000e/netdev.c
index 546b5da..faf4b3f 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -1737,12 +1737,6 @@ static void e1000_clean_rx_ring(struct e1000_ring 
*rx_ring)
rx_ring-next_to_clean = 0;
rx_ring-next_to_use = 0;
adapter-flags2 = ~FLAG2_IS_DISCARDING;
-
-   writel(0, rx_ring-head);
-   if (adapter-flags2  FLAG2_PCIM2PCI_ARBITER_WA)
-   e1000e_update_rdt_wa(rx_ring, 0);
-   else
-   writel(0, rx_ring-tail);
 }
 
 static void e1000e_downshift_workaround(struct work_struct *work)
@@ -2447,12 +2441,6 @@ static void e1000_clean_tx_ring(struct e1000_ring 
*tx_ring)
 
tx_ring-next_to_use = 0;
tx_ring-next_to_clean = 0;
-
-   writel(0, tx_ring-head);
-   if (adapter-flags2  FLAG2_PCIM2PCI_ARBITER_WA)
-   e1000e_update_tdt_wa(tx_ring, 0);
-   else
-   writel(0, tx_ring-tail);
 }
 
 /**
@@ -2954,6 +2942,12 @@ static void e1000_configure_tx(struct e1000_adapter 
*adapter)
tx_ring-head = adapter-hw.hw_addr + E1000_TDH(0);
tx_ring-tail = adapter-hw.hw_addr + E1000_TDT(0);
 
+   writel(0, tx_ring-head);
+   if (adapter-flags2  FLAG2_PCIM2PCI_ARBITER_WA)
+   e1000e_update_tdt_wa(tx_ring, 0);
+   else
+   writel(0, tx_ring-tail);
+
/* Set the Tx Interrupt Delay register */
ew32(TIDV, adapter-tx_int_delay);
/* Tx irq moderation */
@@ -3275,6 +3269,12 @@ static void e1000_configure_rx(struct e1000_adapter 
*adapter)
rx_ring-head = adapter-hw.hw_addr + E1000_RDH(0);
rx_ring-tail = adapter-hw.hw_addr + E1000_RDT(0);
 
+   writel(0, rx_ring-head);
+   if (adapter-flags2  FLAG2_PCIM2PCI_ARBITER_WA)
+   e1000e_update_rdt_wa(rx_ring, 0);
+   else
+   writel(0, rx_ring-tail);
+
/* Enable Receive Checksum Offload for TCP and UDP */
rxcsum = er32(RXCSUM);
if (adapter-netdev-features  NETIF_F_RXCSUM)
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[net-next 05/15] igb: add support for 1512 PHY

2015-08-18 Thread Jeff Kirsher
From: Todd Fujinaka todd.fujin...@intel.com

This patch adds support for Marvell PHY 1512 (required for I354).

Submitted by: Maciej Szwed maciej.sz...@intel.com
Signed-off-by: Todd Fujinaka todd.fujin...@intel.com
Tested-by: Aaron Brown aaron.f.br...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/igb/e1000_82575.c   | 20 +-
 drivers/net/ethernet/intel/igb/e1000_defines.h |  5 ++
 drivers/net/ethernet/intel/igb/e1000_phy.c | 93 +-
 drivers/net/ethernet/intel/igb/e1000_phy.h |  1 +
 4 files changed, 114 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c 
b/drivers/net/ethernet/intel/igb/e1000_82575.c
index d192569..7a73510 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -231,6 +231,7 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
/* Verify phy id and set remaining function pointers */
switch (phy-id) {
case M88E1543_E_PHY_ID:
+   case M88E1512_E_PHY_ID:
case I347AT4_E_PHY_ID:
case M88E1112_E_PHY_ID:
case M88E_I_PHY_ID:
@@ -243,7 +244,7 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
else
phy-ops.get_cable_length = igb_get_cable_length_m88;
phy-ops.force_speed_duplex = igb_phy_force_speed_duplex_m88;
-   /* Check if this PHY is confgured for media swap. */
+   /* Check if this PHY is configured for media swap. */
if (phy-id == M88E1112_E_PHY_ID) {
u16 data;
 
@@ -266,6 +267,11 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
hw-mac.ops.check_for_link =
igb_check_for_link_media_swap;
}
+   if (phy-id == M88E1512_E_PHY_ID) {
+   ret_val = igb_initialize_M88E1512_phy(hw);
+   if (ret_val)
+   goto out;
+   }
break;
case IGP03E1000_E_PHY_ID:
phy-type = e1000_phy_igp_3;
@@ -897,6 +903,7 @@ out:
  **/
 static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *hw)
 {
+   struct e1000_phy_info *phy = hw-phy;
s32 ret_val;
 
/* This isn't a true hard reset, but is the only reset
@@ -913,7 +920,11 @@ static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw 
*hw)
goto out;
 
ret_val = igb_phy_sw_reset(hw);
+   if (ret_val)
+   goto out;
 
+   if (phy-id == M88E1512_E_PHY_ID)
+   ret_val = igb_initialize_M88E1512_phy(hw);
 out:
return ret_val;
 }
@@ -1587,6 +1598,7 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw 
*hw)
case I347AT4_E_PHY_ID:
case M88E1112_E_PHY_ID:
case M88E1543_E_PHY_ID:
+   case M88E1512_E_PHY_ID:
case I210_I_PHY_ID:
ret_val = igb_copper_link_setup_m88_gen2(hw);
break;
@@ -2629,7 +2641,8 @@ s32 igb_set_eee_i354(struct e1000_hw *hw, bool adv1G, 
bool adv100M)
u16 phy_data;
 
if ((hw-phy.media_type != e1000_media_type_copper) ||
-   (phy-id != M88E1543_E_PHY_ID))
+   ((phy-id != M88E1543_E_PHY_ID) 
+(phy-id != M88E1512_E_PHY_ID)))
goto out;
 
if (!hw-dev_spec._82575.eee_disable) {
@@ -2709,7 +2722,8 @@ s32 igb_get_eee_status_i354(struct e1000_hw *hw, bool 
*status)
 
/* Check if EEE is supported on this device. */
if ((hw-phy.media_type != e1000_media_type_copper) ||
-   (phy-id != M88E1543_E_PHY_ID))
+   ((phy-id != M88E1543_E_PHY_ID) 
+(phy-id != M88E1512_E_PHY_ID)))
goto out;
 
ret_val = igb_read_xmdio_reg(hw, E1000_PCS_STATUS_ADDR_I354,
diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h 
b/drivers/net/ethernet/intel/igb/e1000_defines.h
index f8684aa..b191504 100644
--- a/drivers/net/ethernet/intel/igb/e1000_defines.h
+++ b/drivers/net/ethernet/intel/igb/e1000_defines.h
@@ -604,6 +604,10 @@
 #define E1000_M88E1112_MAC_CTRL_1_MODE_SHIFT   7
 #define E1000_M88E1112_PAGE_ADDR   0x16
 #define E1000_M88E1112_STATUS  0x01
+#define E1000_M88E1512_CFG_REG_1   0x0010
+#define E1000_M88E1512_CFG_REG_2   0x0011
+#define E1000_M88E1512_CFG_REG_3   0x0007
+#define E1000_M88E1512_MODE0x0014
 
 /* PCI Express Control */
 #define E1000_GCR_CMPL_TMOUT_MASK   0xF000
@@ -861,6 +865,7 @@
 #define M88_VENDOR   0x0141
 #define I210_I_PHY_ID0x01410C00
 #define M88E1543_E_PHY_ID0x01410EA0
+#define M88E1512_E_PHY_ID0x01410DD0
 
 /* M88E1000 Specific Registers */
 #define M88E1000_PHY_SPEC_CTRL 0x10  /* PHY Specific Control Register */

[net-next 01/15] igb: Fix oops caused by missing queue pairing

2015-08-18 Thread Jeff Kirsher
From: Shota Suzuki suzuki_shota...@lab.ntt.co.jp

When initializing igb driver (e.g. 82576, I350), IGB_FLAG_QUEUE_PAIRS is
set if adapter-rss_queues exceeds half of max_rss_queues in
igb_init_queue_configuration().
On the other hand, IGB_FLAG_QUEUE_PAIRS is not set even if the number of
queues exceeds half of max_combined in igb_set_channels() when changing
the number of queues by ethtool -L.
In this case, if numvecs is larger than MAX_MSIX_ENTRIES (10), the size
of adapter-msix_entries[], an overflow can occur in
igb_set_interrupt_capability(), which in turn leads to an oops.

Fix this problem as follows:
 - When changing the number of queues by ethtool -L, set
   IGB_FLAG_QUEUE_PAIRS in the same way as initializing igb driver.
 - When increasing the size of q_vector, reallocate it appropriately.
   (With IGB_FLAG_QUEUE_PAIRS set, the size of q_vector gets larger.)

Another possible way to fix this problem is to cap the queues at its
initial number, which is the number of the initial online cpus. But this
is not the optimal way because we cannot increase queues when another
cpu becomes online.

Note that before commit cd14ef54d25b (igb: Change to use statically
allocated array for MSIx entries), this problem did not cause oops
but just made the number of queues become 1 because of entering msi_only
mode in igb_set_interrupt_capability().

Fixes: 907b7835799f (igb: Add ethtool support to configure number of channels)
CC: stable sta...@vger.kernel.org
Signed-off-by: Shota Suzuki suzuki_shota...@lab.ntt.co.jp
Tested-by: Aaron Brown aaron.f.br...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/igb/igb.h |  1 +
 drivers/net/ethernet/intel/igb/igb_ethtool.c |  5 -
 drivers/net/ethernet/intel/igb/igb_main.c| 16 ++--
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb.h 
b/drivers/net/ethernet/intel/igb/igb.h
index c2bd4f9..212d668 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -540,6 +540,7 @@ void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, 
unsigned char *va,
 struct sk_buff *skb);
 int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
 int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr);
+void igb_set_flag_queue_pairs(struct igb_adapter *, const u32);
 #ifdef CONFIG_IGB_HWMON
 void igb_sysfs_exit(struct igb_adapter *adapter);
 int igb_sysfs_init(struct igb_adapter *adapter);
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c 
b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index b7b9c67..7426276 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -3008,6 +3008,7 @@ static int igb_set_channels(struct net_device *netdev,
 {
struct igb_adapter *adapter = netdev_priv(netdev);
unsigned int count = ch-combined_count;
+   unsigned int max_combined = 0;
 
/* Verify they are not requesting separate vectors */
if (!count || ch-rx_count || ch-tx_count)
@@ -3018,11 +3019,13 @@ static int igb_set_channels(struct net_device *netdev,
return -EINVAL;
 
/* Verify the number of channels doesn't exceed hw limits */
-   if (count  igb_max_channels(adapter))
+   max_combined = igb_max_channels(adapter);
+   if (count  max_combined)
return -EINVAL;
 
if (count != adapter-rss_queues) {
adapter-rss_queues = count;
+   igb_set_flag_queue_pairs(adapter, max_combined);
 
/* Hardware has to reinitialize queues and interrupts to
 * match the new configuration.
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index 41e2740..7b97e847 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1205,10 +1205,14 @@ static int igb_alloc_q_vector(struct igb_adapter 
*adapter,
 
/* allocate q_vector and rings */
q_vector = adapter-q_vector[v_idx];
-   if (!q_vector)
+   if (!q_vector) {
q_vector = kzalloc(size, GFP_KERNEL);
-   else
+   } else if (size  ksize(q_vector)) {
+   kfree_rcu(q_vector, rcu);
+   q_vector = kzalloc(size, GFP_KERNEL);
+   } else {
memset(q_vector, 0, size);
+   }
if (!q_vector)
return -ENOMEM;
 
@@ -2888,6 +2892,14 @@ static void igb_init_queue_configuration(struct 
igb_adapter *adapter)
 
adapter-rss_queues = min_t(u32, max_rss_queues, num_online_cpus());
 
+   igb_set_flag_queue_pairs(adapter, max_rss_queues);
+}
+
+void igb_set_flag_queue_pairs(struct igb_adapter *adapter,
+ const u32 max_rss_queues)
+{
+   struct e1000_hw *hw = adapter-hw;
+
/* Determine if we need to pair queues. */

[net-next 12/15] igbvf: clear buffer_info-dma after dma_unmap_single()

2015-08-18 Thread Jeff Kirsher
From: Stefan Assmann sassm...@kpanic.de

The driver doesn't clear buffer_info-dma after calling
dma_unmap_single() in all cases. This has been discovered by changing
the mtu twice, which caused the following backtrace.

[   68.569280] WARNING: CPU: 2 PID: 1860 at drivers/iommu/intel-iommu.c:3517 
intel_unmap+0x20c/0x220()
[   68.579392] Driver unmaps unmatched page at PFN fffc2a40
[   68.585322] Modules linked in: igbvf ipt_MASQUERADE nf_nat_masquerade_ipv4 
iptable_nat nf_nat_ipv4 nf_nat kvm_intel kvm igb megs
[   68.599163] CPU: 2 PID: 1860 Comm: ifconfig Not tainted 4.2.0-rc4+ #147
[   68.606543] Hardware name: IBM  -[546025Z]-/00Y7630, BIOS -[VVE134TUS-1.51]- 
10/17/2013
[   68.615473]  0dbd 88046441bb08 81a5ad0b 
81e2f9ea
[   68.623775]  88046441bb58 88046441bb48 81056b55 
88047fc583c0
[   68.632075]   880469a8e600 fffc2a40 
880465b32098
[   68.640375] Call Trace:
[   68.643109]  [81a5ad0b] dump_stack+0x48/0x5d
[   68.648844]  [81056b55] warn_slowpath_common+0x95/0xe0
[   68.655549]  [81056c56] warn_slowpath_fmt+0x46/0x70
[   68.661960]  [8158a614] ? find_iova+0x54/0x90
[   68.667791]  [815988dc] intel_unmap+0x20c/0x220
[   68.673815]  [8159891e] intel_unmap_page+0xe/0x10
[   68.680038]  [a0067536] igbvf_clean_rx_ring+0x96/0x370 [igbvf]
[   68.687516]  [a0067915] igbvf_down+0x105/0x110 [igbvf]
[   68.694219]  [a0067beb] igbvf_change_mtu+0x16b/0x180 [igbvf]
[...]

Signed-off-by: Stefan Assmann sassm...@kpanic.de
Acked-by: Jesse Brandeburg jesse.brandeb...@intel.com
Tested-by: Aaron Brown aaron.f.br...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/igbvf/netdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c 
b/drivers/net/ethernet/intel/igbvf/netdev.c
index 95af14e..686fa71 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -319,6 +319,7 @@ static bool igbvf_clean_rx_irq(struct igbvf_adapter 
*adapter,
dma_unmap_single(pdev-dev, buffer_info-dma,
 adapter-rx_ps_hdr_size,
 DMA_FROM_DEVICE);
+   buffer_info-dma = 0;
skb_put(skb, hlen);
}
 
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 0/4] vrf: a few simplifications and cleanups

2015-08-18 Thread David Ahern

On 8/18/15 11:28 AM, Nikolay Aleksandrov wrote:

From: Nikolay Aleksandrov niko...@cumulusnetworks.com

Hi,
These patches remove some unnecessary checks (patches 3, 4), unnecessary
num_slaves member and refcnt manipulations which are already done by the
upper functions.

Cheers,
  Nik

Nikolay Aleksandrov (4):
   vrf: drop unnecessary dev refcnt changes
   vrf: drop unused num_slaves member
   vrf: don't check for dstats and rth in uninit path
   vrf: simplify the netdev notifier function

  drivers/net/vrf.c | 15 ---
  include/net/vrf.h |  1 -
  2 files changed, 4 insertions(+), 12 deletions(-)



Looks good to me. Thanks, Nikolay.

Acked-by: David Ahern d...@cumulusnetworks.com
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2] vrf: vrf_master_ifindex_rcu is not always called with rcu read lock

2015-08-18 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov niko...@cumulusnetworks.com

While running net-next I hit this:
[  634.073119] ===
[  634.073150] [ INFO: suspicious RCU usage. ]
[  634.073182] 4.2.0-rc6+ #45 Not tainted
[  634.073213] ---
[  634.073244] include/net/vrf.h:38 suspicious rcu_dereference_check()
usage!
[  634.073274]
   other info that might help us debug this:

[  634.073307]
   rcu_scheduler_active = 1, debug_locks = 1
[  634.073338] 2 locks held by swapper/0/0:
[  634.073369]  #0:  (((n-timer))){+.-...}, at: [8112bc35]
call_timer_fn+0x5/0x480
[  634.073412]  #1:  (slock-AF_INET){+.-...}, at: [8174f0f5]
icmp_send+0x155/0x5f0
[  634.073450]
   stack backtrace:
[  634.073483] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.2.0-rc6+ #45
[  634.073514] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS
VirtualBox 12/01/2006
[  634.073545]   0593ba8242d9ace4 88002fc03b48
81803f1b
[  634.073612]   81e12500 88002fc03b78
811003c5
[  634.073642]   88002ec4e600 81f00f80
88002fc03cf0
[  634.073669] Call Trace:
[  634.073694]  IRQ  [81803f1b] dump_stack+0x4c/0x65
[  634.073728]  [811003c5] lockdep_rcu_suspicious+0xc5/0x100
[  634.073763]  [8174eb56] icmp_route_lookup+0x176/0x5c0
[  634.073793]  [8174f2fb] ? icmp_send+0x35b/0x5f0
[  634.073818]  [8174f274] ? icmp_send+0x2d4/0x5f0
[  634.073844]  [8174f3ce] icmp_send+0x42e/0x5f0
[  634.073873]  [8170b662] ipv4_link_failure+0x22/0xa0
[  634.073899]  [8174bdda] arp_error_report+0x3a/0x80
[  634.073926]  [816d6100] ? neigh_lookup+0x2c0/0x2c0
[  634.073952]  [816d396e] neigh_invalidate+0x8e/0x110
[  634.073984]  [816d62ae] neigh_timer_handler+0x1ae/0x290
[  634.074013]  [816d6100] ? neigh_lookup+0x2c0/0x2c0
[  634.074013]  [8112bce3] call_timer_fn+0xb3/0x480
[  634.074013]  [8112bc35] ? call_timer_fn+0x5/0x480
[  634.074013]  [816d6100] ? neigh_lookup+0x2c0/0x2c0
[  634.074013]  [8112c2bc] run_timer_softirq+0x20c/0x430
[  634.074013]  [810af50e] __do_softirq+0xde/0x630
[  634.074013]  [810afc97] irq_exit+0x117/0x120
[  634.074013]  [81810976] smp_apic_timer_interrupt+0x46/0x60
[  634.074013]  [8180e950] apic_timer_interrupt+0x70/0x80
[  634.074013]  EOI  [8106b9d6] ? native_safe_halt+0x6/0x10
[  634.074013]  [81101d8d] ? trace_hardirqs_on+0xd/0x10
[  634.074013]  [81027d43] default_idle+0x23/0x200
[  634.074013]  [8102852f] arch_cpu_idle+0xf/0x20
[  634.074013]  [810f89ba] default_idle_call+0x2a/0x40
[  634.074013]  [810f8dcc] cpu_startup_entry+0x39c/0x4c0
[  634.074013]  [817f9cad] rest_init+0x13d/0x150
[  634.074013]  [81f69038] start_kernel+0x4a8/0x4c9
[  634.074013]  [81f68120] ?
early_idt_handler_array+0x120/0x120
[  634.074013]  [81f68339] x86_64_start_reservations+0x2a/0x2c
[  634.074013]  [81f68485] x86_64_start_kernel+0x14a/0x16d

It would seem vrf_master_ifindex_rcu() can be called without RCU held in
other contexts as well so introduce a new helper which acquires rcu and
returns the ifindex.
Also add curly braces around both the if and else parts as per the
style guide.

Signed-off-by: Nikolay Aleksandrov niko...@cumulusnetworks.com
---
v2: use a new helper that acquires and releases rcu instead

 include/net/vrf.h | 21 ++---
 net/ipv4/icmp.c   |  4 ++--
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/include/net/vrf.h b/include/net/vrf.h
index 3bb4af462ed6..b039850a94a3 100644
--- a/include/net/vrf.h
+++ b/include/net/vrf.h
@@ -34,7 +34,6 @@ struct net_vrf {
 
 
 #if IS_ENABLED(CONFIG_NET_VRF)
-/* called with rcu_read_lock() */
 static inline int vrf_master_ifindex_rcu(const struct net_device *dev)
 {
struct net_vrf_dev *vrf_ptr;
@@ -43,9 +42,9 @@ static inline int vrf_master_ifindex_rcu(const struct 
net_device *dev)
if (!dev)
return 0;
 
-   if (netif_is_vrf(dev))
+   if (netif_is_vrf(dev)) {
ifindex = dev-ifindex;
-   else {
+   } else {
vrf_ptr = rcu_dereference(dev-vrf_ptr);
if (vrf_ptr)
ifindex = vrf_ptr-ifindex;
@@ -54,6 +53,17 @@ static inline int vrf_master_ifindex_rcu(const struct 
net_device *dev)
return ifindex;
 }
 
+static inline int vrf_master_ifindex(const struct net_device *dev)
+{
+   int ifindex;
+
+   rcu_read_lock();
+   ifindex = vrf_master_ifindex_rcu(dev);
+   rcu_read_unlock();
+
+   return ifindex;
+}
+
 /* called with rcu_read_lock */
 static inline int vrf_dev_table_rcu(const struct net_device *dev)
 {
@@ -133,6 +143,11 @@ static inline int vrf_master_ifindex_rcu(const struct 
net_device *dev)
return 0;
 }
 

[PATCH net-next 04/13] ip_tunnels: add IPv6 addresses to ip_tunnel_key

2015-08-18 Thread Jiri Benc
Signed-off-by: Jiri Benc jb...@redhat.com
---
 drivers/net/vxlan.c|  6 +++---
 include/net/ip_tunnels.h   | 23 +++
 net/core/filter.c  |  4 ++--
 net/ipv4/ip_gre.c  | 10 +-
 net/ipv4/ip_tunnel_core.c  |  8 
 net/openvswitch/flow_netlink.c | 18 +-
 net/openvswitch/flow_table.c   |  2 +-
 net/openvswitch/vport-geneve.c |  2 +-
 net/openvswitch/vport.c|  2 +-
 net/openvswitch/vport.h|  4 ++--
 10 files changed, 47 insertions(+), 32 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 06c0731ae619..1c0733540756 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1276,8 +1276,8 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct 
sk_buff *skb)
goto drop;
 
info = tun_dst-u.tun_info;
-   info-key.ipv4_src = iph-saddr;
-   info-key.ipv4_dst = iph-daddr;
+   info-key.u.ipv4.src = iph-saddr;
+   info-key.u.ipv4.dst = iph-daddr;
info-key.ipv4_tos = iph-tos;
info-key.ipv4_ttl = iph-ttl;
info-key.tp_src = udp_hdr(skb)-source;
@@ -1925,7 +1925,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct 
net_device *dev,
dst_port = info-key.tp_dst ? : vxlan-cfg.dst_port;
vni = be64_to_cpu(info-key.tun_id);
remote_ip.sin.sin_family = AF_INET;
-   remote_ip.sin.sin_addr.s_addr = info-key.ipv4_dst;
+   remote_ip.sin.sin_addr.s_addr = info-key.u.ipv4.dst;
dst = remote_ip;
}
 
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index cc3b39e9010b..96b0a37af42c 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -25,10 +25,23 @@
 /* Used to memset ip_tunnel padding. */
 #define IP_TUNNEL_KEY_SIZE offsetofend(struct ip_tunnel_key, tp_dst)
 
+/* Used to memset ipv4 address padding. */
+#define IP_TUNNEL_KEY_IPV4_PAD offsetofend(struct ip_tunnel_key, u.ipv4.dst)
+#define IP_TUNNEL_KEY_IPV4_PAD_LEN \
+   (FIELD_SIZEOF(struct ip_tunnel_key, u) - IP_TUNNEL_KEY_IPV4_PAD)
+
 struct ip_tunnel_key {
__be64  tun_id;
-   __be32  ipv4_src;
-   __be32  ipv4_dst;
+   union {
+   struct {
+   __be32  src;
+   __be32  dst;
+   } ipv4;
+   struct {
+   struct in6_addr src;
+   struct in6_addr dst;
+   } ipv6;
+   } u;
__be16  tun_flags;
u8  ipv4_tos;
u8  ipv4_ttl;
@@ -177,8 +190,10 @@ static inline void __ip_tunnel_info_init(struct 
ip_tunnel_info *tun_info,
 const void *opts, u8 opts_len)
 {
tun_info-key.tun_id = tun_id;
-   tun_info-key.ipv4_src = saddr;
-   tun_info-key.ipv4_dst = daddr;
+   tun_info-key.u.ipv4.src = saddr;
+   tun_info-key.u.ipv4.dst = daddr;
+   memset((unsigned char *)tun_info-key + IP_TUNNEL_KEY_IPV4_PAD,
+  0, IP_TUNNEL_KEY_IPV4_PAD_LEN);
tun_info-key.ipv4_tos = tos;
tun_info-key.ipv4_ttl = ttl;
tun_info-key.tun_flags = tun_flags;
diff --git a/net/core/filter.c b/net/core/filter.c
index 83f08cefeab7..379568562ffb 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -1495,7 +1495,7 @@ static u64 bpf_skb_get_tunnel_key(u64 r1, u64 r2, u64 
size, u64 flags, u64 r5)
return -EINVAL;
 
to-tunnel_id = be64_to_cpu(info-key.tun_id);
-   to-remote_ipv4 = be32_to_cpu(info-key.ipv4_src);
+   to-remote_ipv4 = be32_to_cpu(info-key.u.ipv4.src);
 
return 0;
 }
@@ -1529,7 +1529,7 @@ static u64 bpf_skb_set_tunnel_key(u64 r1, u64 r2, u64 
size, u64 flags, u64 r5)
info = md-u.tun_info;
info-mode = IP_TUNNEL_INFO_TX;
info-key.tun_id = cpu_to_be64(from-tunnel_id);
-   info-key.ipv4_dst = cpu_to_be32(from-remote_ipv4);
+   info-key.u.ipv4.dst = cpu_to_be32(from-remote_ipv4);
 
return 0;
 }
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index fb44d693796e..b7bb7d6aa7a8 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -407,8 +407,8 @@ static int ipgre_rcv(struct sk_buff *skb, const struct 
tnl_ptk_info *tpi)
return PACKET_REJECT;
 
info = tun_dst-u.tun_info;
-   info-key.ipv4_src = iph-saddr;
-   info-key.ipv4_dst = iph-daddr;
+   info-key.u.ipv4.src = iph-saddr;
+   info-key.u.ipv4.dst = iph-daddr;
info-key.ipv4_tos = iph-tos;
info-key.ipv4_ttl = iph-ttl;
 
@@ -527,8 +527,8 @@ static void gre_fb_xmit(struct sk_buff *skb, struct 
net_device 

[PATCH net-next 07/13] ipv6: drop metadata dst in ip6_route_input

2015-08-18 Thread Jiri Benc
The fix in commit 48fb6b554501 is incomplete, as now ip6_route_input can be
called with non-NULL dst if it's a metadata dst and the reference is leaked.
Drop the reference.

Fixes: 48fb6b554501 (ipv6: fix crash over flow-based vxlan device)
Fixes: ee122c79d422 (vxlan: Flow based tunneling)
CC: Wei-Chun Chao weich...@plumgrid.com
CC: Thomas Graf tg...@suug.ch
Signed-off-by: Jiri Benc jb...@redhat.com
---
 net/ipv6/route.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index e6bbcdee7707..0947ad0b3de8 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1140,6 +1140,7 @@ void ip6_route_input(struct sk_buff *skb)
.flowi6_proto = iph-nexthdr,
};
 
+   skb_dst_drop(skb);
skb_dst_set(skb, ip6_route_input_lookup(net, skb-dev, fl6, flags));
 }
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 08/13] ipv6: ndisc: inherit metadata dst when creating ndisc requests

2015-08-18 Thread Jiri Benc
If output device wants to see the dst, inherit the dst of the original skb
in the ndisc request.

This is an IPv6 counterpart of commit 0accfc268f4d (arp: Inherit metadata
dst when creating ARP requests).

Signed-off-by: Jiri Benc jb...@redhat.com
---
 include/net/ndisc.h |  3 ++-
 net/ipv6/addrconf.c |  2 +-
 net/ipv6/ndisc.c| 10 +++---
 net/ipv6/route.c|  2 +-
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index b3a7751251b4..aba5695fadb0 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -182,7 +182,8 @@ int ndisc_rcv(struct sk_buff *skb);
 
 void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
   const struct in6_addr *solicit,
-  const struct in6_addr *daddr, const struct in6_addr *saddr);
+  const struct in6_addr *daddr, const struct in6_addr *saddr,
+  struct sk_buff *oskb);
 
 void ndisc_send_rs(struct net_device *dev,
   const struct in6_addr *saddr, const struct in6_addr *daddr);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 59242399b0b5..0f08d3b9e238 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3656,7 +3656,7 @@ static void addrconf_dad_work(struct work_struct *w)
 
/* send a neighbour solicitation for our addr */
addrconf_addr_solict_mult(ifp-addr, mcaddr);
-   ndisc_send_ns(ifp-idev-dev, NULL, ifp-addr, mcaddr, in6addr_any);
+   ndisc_send_ns(ifp-idev-dev, NULL, ifp-addr, mcaddr, in6addr_any, 
NULL);
 out:
in6_ifa_put(ifp);
rtnl_unlock();
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index b3054611f88a..13d3c2beb93e 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -553,7 +553,8 @@ static void ndisc_send_unsol_na(struct net_device *dev)
 
 void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
   const struct in6_addr *solicit,
-  const struct in6_addr *daddr, const struct in6_addr *saddr)
+  const struct in6_addr *daddr, const struct in6_addr *saddr,
+  struct sk_buff *oskb)
 {
struct sk_buff *skb;
struct in6_addr addr_buf;
@@ -589,6 +590,9 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour 
*neigh,
ndisc_fill_addr_option(skb, ND_OPT_SOURCE_LL_ADDR,
   dev-dev_addr);
 
+   if (!(dev-priv_flags  IFF_XMIT_DST_RELEASE)  oskb)
+   skb_dst_copy(skb, oskb);
+
ndisc_send_skb(skb, daddr, saddr);
 }
 
@@ -675,12 +679,12 @@ static void ndisc_solicit(struct neighbour *neigh, struct 
sk_buff *skb)
  %s: trying to ucast probe in NUD_INVALID: 
%pI6\n,
  __func__, target);
}
-   ndisc_send_ns(dev, neigh, target, target, saddr);
+   ndisc_send_ns(dev, neigh, target, target, saddr, skb);
} else if ((probes -= NEIGH_VAR(neigh-parms, APP_PROBES))  0) {
neigh_app_ns(neigh);
} else {
addrconf_addr_solict_mult(target, mcaddr);
-   ndisc_send_ns(dev, NULL, target, mcaddr, saddr);
+   ndisc_send_ns(dev, NULL, target, mcaddr, saddr, skb);
}
 }
 
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 0947ad0b3de8..c4f3b9fcca9d 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -538,7 +538,7 @@ static void rt6_probe_deferred(struct work_struct *w)
container_of(w, struct __rt6_probe_work, work);
 
addrconf_addr_solict_mult(work-target, mcaddr);
-   ndisc_send_ns(work-dev, NULL, work-target, mcaddr, NULL);
+   ndisc_send_ns(work-dev, NULL, work-target, mcaddr, NULL, NULL);
dev_put(work-dev);
kfree(work);
 }
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 03/13] ip_tunnels: use offsetofend

2015-08-18 Thread Jiri Benc
Signed-off-by: Jiri Benc jb...@redhat.com
---
 include/net/ip_tunnels.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index ca173f22f07f..cc3b39e9010b 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -23,9 +23,7 @@
 #define IPTUNNEL_ERR_TIMEO (30*HZ)
 
 /* Used to memset ip_tunnel padding. */
-#define IP_TUNNEL_KEY_SIZE \
-   (offsetof(struct ip_tunnel_key, tp_dst) +   \
-FIELD_SIZEOF(struct ip_tunnel_key, tp_dst))
+#define IP_TUNNEL_KEY_SIZE offsetofend(struct ip_tunnel_key, tp_dst)
 
 struct ip_tunnel_key {
__be64  tun_id;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 12/13] ipv6: route: extend flow representation with tunnel key

2015-08-18 Thread Jiri Benc
Use flowi_tunnel in flowi6 similarly to what is done with IPv4.
This complements commit 1b7179d3adff (route: Extend flow representation
with tunnel key).

Signed-off-by: Jiri Benc jb...@redhat.com
---
 include/net/flow.h | 1 +
 net/ipv6/route.c   | 6 ++
 2 files changed, 7 insertions(+)

diff --git a/include/net/flow.h b/include/net/flow.h
index f305588fc162..9e0297c4c11d 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -130,6 +130,7 @@ struct flowi6 {
 #define flowi6_proto   __fl_common.flowic_proto
 #define flowi6_flags   __fl_common.flowic_flags
 #define flowi6_secid   __fl_common.flowic_secid
+#define flowi6_tun_key __fl_common.flowic_tun_key
struct in6_addr daddr;
struct in6_addr saddr;
__be32  flowlabel;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c4f3b9fcca9d..6c0fe4c7ce8d 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -54,11 +54,13 @@
 #include net/tcp.h
 #include linux/rtnetlink.h
 #include net/dst.h
+#include net/dst_metadata.h
 #include net/xfrm.h
 #include net/netevent.h
 #include net/netlink.h
 #include net/nexthop.h
 #include net/lwtunnel.h
+#include net/ip_tunnels.h
 
 #include asm/uaccess.h
 
@@ -1131,6 +1133,7 @@ void ip6_route_input(struct sk_buff *skb)
const struct ipv6hdr *iph = ipv6_hdr(skb);
struct net *net = dev_net(skb-dev);
int flags = RT6_LOOKUP_F_HAS_SADDR;
+   struct ip_tunnel_info *tun_info;
struct flowi6 fl6 = {
.flowi6_iif = skb-dev-ifindex,
.daddr = iph-daddr,
@@ -1140,6 +1143,9 @@ void ip6_route_input(struct sk_buff *skb)
.flowi6_proto = iph-nexthdr,
};
 
+   tun_info = skb_tunnel_info(skb);
+   if (tun_info  tun_info-mode == IP_TUNNEL_INFO_RX)
+   fl6.flowi6_tun_key.tun_id = tun_info-key.tun_id;
skb_dst_drop(skb);
skb_dst_set(skb, ip6_route_input_lookup(net, skb-dev, fl6, flags));
 }
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v3] rocker: add debugfs support to dump internal tables

2015-08-18 Thread David Miller
From: Scott Feldman sfel...@gmail.com
Date: Tue, 18 Aug 2015 13:37:56 -0700

 On Tue, Aug 18, 2015 at 11:19 AM, Andrew Lunn and...@lunn.ch wrote:
 On Tue, Aug 18, 2015 at 10:18:51AM -0700, Scott Feldman wrote:
 On Tue, Aug 18, 2015 at 7:01 AM, Andrew Lunn and...@lunn.ch wrote:
  On Mon, Aug 17, 2015 at 03:36:17PM -0700, sfel...@gmail.com wrote:
  From: Scott Feldman sfel...@gmail.com
 
   tree /sys/kernel/debug/rocker
  /sys/kernel/debug/rocker
  ? 525400123501
  ? fdb_tbl
  ? internal_vlan_tbl
  ? neigh_tbl
  ? of_dpa_flow_tbl
  ? of_dpa_group_tbl
 
  1 directory, 5 files
 
   cat /sys/kernel/debug/rocker/525400123501/internal_vlan_tbl
  ifindex 5 ref_count 1 vlan 3843
  ifindex 7 ref_count 2 vlan 3840
  ifindex 4 ref_count 1 vlan 3842
 
   cat /sys/kernel/debug/rocker/525400123501/fdb_tbl
  learned 1 pport 1 addr 00:02:00:00:02:00 vlan 3840
  learned 1 pport 2 addr 00:02:00:00:03:00 vlan 3840
 
   cat /sys/kernel/debug/rocker/525400123501/neigh_tbl
  11.0.0.9 dev sw1p2 ref_count 3 index 1 dst 00:02:00:00:01:00 ttl_check 1
  11.0.0.1 dev sw1p1 ref_count 3 index 0 dst 00:02:00:00:00:00 ttl_check 1
 
  Hi Scott
 
  David is not so keen no debugfs stuff. He already NACKed adding more
  than what is currently in DSA:
 
  https://lkml.org/lkml/2015/7/11/8

 That patch added writable debugfs files, which I can see might be used
 as a back-door to program hardware.  That does seem bad.

 I fully agreed with respect to write. But if you read the whole
 message, David is also not happy with read only.

 I think before you spend too much more time on this, you need some
 indication from David if he is going to merge it or not.
 
 David, please give us guidance on debugfs in drivers/net.  Is there
 some criteria we can define to know when it's OK to use debugfs?

The less you use it the better, seriously.

I see some drivers where the foo_debugfs.c file is larger than the rest
of the driver.  Once people start using it, it's like crack, and they
dump every single debugging widget they found useful at some point into
there.

This is not what we want.  Most things I see in debugfs support was
probably useful for debugging one particular bug but then it was never
really useful again in the future.  Those kinds of things can be done
locally in someone's tree.

I often see various kinds of statistics ending up in these things,
or register dumps, both of which are 'ethtool' or similar material.

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next] r8169:Set RxConfig on same func. with TxConfig

2015-08-18 Thread Eric Dumazet
On Tue, 2015-08-18 at 22:10 +0300, Corcodel Marian wrote:
  Add set DMA burst size and  Rx FIFO threshold on RxConfig  
   register to function rtl_set_rx_tx_config_register.
 
 
 Signed-off-by: Corcodel Marian corcodel.mar...@gmail.com
 
 diff --git a/drivers/net/ethernet/realtek/r8169.c 
 b/drivers/net/ethernet/realtek/r8169.c
 index 6d16de3..c3c908c 100644
 --- a/drivers/net/ethernet/realtek/r8169.c
 +++ b/drivers/net/ethernet/realtek/r8169.c
 @@ -5183,6 +5183,7 @@ static void rtl_set_rx_tx_config_registers(struct 
 rtl8169_private *tp)
   /* Set DMA burst size and Interframe Gap Time */
   RTL_W32(TxConfig, (TX_DMA_BURST  TxDMAShift) |
  (InterFrameGap  TxInterFrameGapShift) | InterFrameGap2);
 + RTL_W32(RxConfig, RX_FIFO_THRESHOLD | RX_DMA_BURST);
  }
  
  static void rtl_hw_start(struct net_device *dev)

This does not even compile. This is insane.



  CC [M]  drivers/net/ethernet/realtek/r8169.o
drivers/net/ethernet/realtek/r8169.c: In function
‘rtl_set_rx_tx_config_registers’:
drivers/net/ethernet/realtek/r8169.c:5186:20: error: ‘RX_FIFO_THRESHOLD’
undeclared (first use in this function)
  RTL_W32(RxConfig, RX_FIFO_THRESHOLD | RX_DMA_BURST);
^
drivers/net/ethernet/realtek/r8169.c:104:38: note: in definition of
macro ‘RTL_W32’
 #define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg))
  ^
drivers/net/ethernet/realtek/r8169.c:5186:20: note: each undeclared
identifier is reported only once for each function it appears in
  RTL_W32(RxConfig, RX_FIFO_THRESHOLD | RX_DMA_BURST);
^
drivers/net/ethernet/realtek/r8169.c:104:38: note: in definition of
macro ‘RTL_W32’
 #define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg))
  ^
make[1]: *** [drivers/net/ethernet/realtek/r8169.o] Error 1
make: *** [drivers/net/ethernet/realtek/r8169.o] Error 2


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 06/13] route: move lwtunnel state to dst_entry

2015-08-18 Thread Jiri Benc
Currently, the lwtunnel state resides in per-protocol data. This is
a problem if we encapsulate ipv6 traffic in an ipv4 tunnel (or vice versa).
The xmit function of the tunnel does not know whether the packet has been
routed to it by ipv4 or ipv6, yet it needs the lwtstate data. Moving the
lwtstate data to dst_entry makes such inter-protocol tunneling possible.

As a bonus, this brings a nice diffstat.

Signed-off-by: Jiri Benc jb...@redhat.com
---
 drivers/net/vrf.c  |  1 -
 drivers/net/vxlan.c|  4 +--
 include/net/dst.h  |  3 +-
 include/net/dst_metadata.h | 15 +++--
 include/net/ip6_fib.h  |  1 -
 include/net/lwtunnel.h | 12 
 include/net/route.h|  1 -
 net/core/dst.c |  3 ++
 net/core/filter.c  |  2 +-
 net/core/lwtunnel.c| 70 ++
 net/ipv4/ip_gre.c  |  2 +-
 net/ipv4/route.c   | 20 +---
 net/ipv6/ila.c | 14 +++--
 net/ipv6/ip6_fib.c |  1 -
 net/ipv6/route.c   | 20 ++--
 net/mpls/mpls_iptunnel.c   |  7 ++---
 net/openvswitch/vport-netdev.c |  2 +-
 17 files changed, 48 insertions(+), 130 deletions(-)

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 95097cb79354..6bc8662aa179 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -289,7 +289,6 @@ static struct rtable *vrf_rtable_create(struct net_device 
*dev)
rth-rt_uses_gateway = 0;
INIT_LIST_HEAD(rth-rt_uncached);
rth-rt_uncached_list = NULL;
-   rth-rt_lwtstate = NULL;
}
 
return rth;
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 41e9549e1d5e..e4b8ab63d0fa 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1909,7 +1909,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct 
net_device *dev,
u32 flags = vxlan-flags;
 
/* FIXME: Support IPv6 */
-   info = skb_tunnel_info(skb, AF_INET);
+   info = skb_tunnel_info(skb);
 
if (rdst) {
dst_port = rdst-remote_port ? rdst-remote_port : 
vxlan-cfg.dst_port;
@@ -2105,7 +2105,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct 
net_device *dev)
struct vxlan_fdb *f;
 
/* FIXME: Support IPv6 */
-   info = skb_tunnel_info(skb, AF_INET);
+   info = skb_tunnel_info(skb);
 
skb_reset_mac_header(skb);
eth = eth_hdr(skb);
diff --git a/include/net/dst.h b/include/net/dst.h
index 2578811cef51..0a9a723f6c19 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -44,6 +44,7 @@ struct dst_entry {
 #else
void*__pad1;
 #endif
+   struct lwtunnel_state   *lwtstate;
int (*input)(struct sk_buff *);
int (*output)(struct sock *sk, struct sk_buff *skb);
 
@@ -89,7 +90,7 @@ struct dst_entry {
 * (L1_CACHE_SIZE would be too much)
 */
 #ifdef CONFIG_64BIT
-   long__pad_to_align_refcnt[2];
+   long__pad_to_align_refcnt[1];
 #endif
/*
 * __refcnt wants to be on a different cache line from
diff --git a/include/net/dst_metadata.h b/include/net/dst_metadata.h
index 075f523ff23f..2cb52d562272 100644
--- a/include/net/dst_metadata.h
+++ b/include/net/dst_metadata.h
@@ -23,22 +23,17 @@ static inline struct metadata_dst *skb_metadata_dst(struct 
sk_buff *skb)
return NULL;
 }
 
-static inline struct ip_tunnel_info *skb_tunnel_info(struct sk_buff *skb,
-int family)
+static inline struct ip_tunnel_info *skb_tunnel_info(struct sk_buff *skb)
 {
struct metadata_dst *md_dst = skb_metadata_dst(skb);
-   struct rtable *rt;
+   struct dst_entry *dst;
 
if (md_dst)
return md_dst-u.tun_info;
 
-   switch (family) {
-   case AF_INET:
-   rt = (struct rtable *)skb_dst(skb);
-   if (rt  rt-rt_lwtstate)
-   return lwt_tun_info(rt-rt_lwtstate);
-   break;
-   }
+   dst = skb_dst(skb);
+   if (dst  dst-lwtstate)
+   return lwt_tun_info(dst-lwtstate);
 
return NULL;
 }
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 276328e3daa6..063d30474cf6 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -133,7 +133,6 @@ struct rt6_info {
/* more non-fragment space at head required */
unsigned short  rt6i_nfheader_len;
u8  rt6i_protocol;
-   struct lwtunnel_state   *rt6i_lwtstate;
 };
 
 static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
diff --git a/include/net/lwtunnel.h b/include/net/lwtunnel.h
index 34fd8f70c2ca..3a5fbabf97da 100644
--- a/include/net/lwtunnel.h
+++ b/include/net/lwtunnel.h
@@ -87,9 +87,7 @@ int 

[PATCH net-next 10/13] vxlan: do not shadow flags variable

2015-08-18 Thread Jiri Benc
The 'flags' variable is already defined in the outer scope.

Signed-off-by: Jiri Benc jb...@redhat.com
---
 drivers/net/vxlan.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d5ca1d7e0b81..d0caac63231c 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2025,7 +2025,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct 
net_device *dev,
} else {
struct dst_entry *ndst;
struct flowi6 fl6;
-   u32 flags;
+   u32 rt6i_flags;
 
memset(fl6, 0, sizeof(fl6));
fl6.flowi6_oif = rdst ? rdst-remote_ifindex : 0;
@@ -2050,9 +2050,9 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct 
net_device *dev,
}
 
/* Bypass encapsulation if the destination is local */
-   flags = ((struct rt6_info *)ndst)-rt6i_flags;
-   if (flags  RTF_LOCAL 
-   !(flags  (RTCF_BROADCAST | RTCF_MULTICAST))) {
+   rt6i_flags = ((struct rt6_info *)ndst)-rt6i_flags;
+   if (rt6i_flags  RTF_LOCAL 
+   !(rt6i_flags  (RTCF_BROADCAST | RTCF_MULTICAST))) {
struct vxlan_dev *dst_vxlan;
 
dst_release(ndst);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 00/13] lwtunnel: per route ipv6 support for vxlan

2015-08-18 Thread Jiri Benc
This series enables IPv6 tunnels based on lwtunnel infrastructure. Only
vxlan is supported for now.

Tested in all combinations of IPv4 over IPv6, IPv6 over IPv4 and IPv6 over
IPv6. Applies on top of the two generic/IPv4 fixes I posted earlier today.

Jiri Benc (13):
  ip_tunnels: remove custom alignment and packing
  ip_tunnels: use u8/u16/u32
  ip_tunnels: use offsetofend
  ip_tunnels: add IPv6 addresses to ip_tunnel_key
  ip_tunnels: use tos and ttl fields also for IPv6
  route: move lwtunnel state to dst_entry
  ipv6: drop metadata dst in ip6_route_input
  ipv6: ndisc: inherit metadata dst when creating ndisc requests
  vxlan: provide access function for vxlan socket address family
  vxlan: do not shadow flags variable
  vxlan: metadata based tunneling for IPv6
  ipv6: route: extend flow representation with tunnel key
  ipv6: route: per route IP tunnel metadata via lightweight tunnel

 drivers/net/vrf.c  |   1 -
 drivers/net/vxlan.c|  89 +--
 include/net/dst.h  |   3 +-
 include/net/dst_metadata.h |  15 ++
 include/net/flow.h |   1 +
 include/net/ip6_fib.h  |   1 -
 include/net/ip_tunnels.h   |  49 ++---
 include/net/lwtunnel.h |  12 -
 include/net/ndisc.h|   3 +-
 include/net/route.h|   1 -
 include/net/vxlan.h|   5 ++
 include/uapi/linux/lwtunnel.h  |  16 ++
 net/core/dst.c |   3 ++
 net/core/filter.c  |   6 +--
 net/core/lwtunnel.c|  70 
 net/ipv4/ip_gre.c  |  20 +++
 net/ipv4/ip_tunnel_core.c  | 118 ++---
 net/ipv4/route.c   |  20 +++
 net/ipv6/addrconf.c|   2 +-
 net/ipv6/ila.c |  14 ++---
 net/ipv6/ip6_fib.c |   1 -
 net/ipv6/ndisc.c   |  10 ++--
 net/ipv6/route.c   |  29 ++
 net/mpls/mpls_iptunnel.c   |   7 +--
 net/openvswitch/flow_netlink.c |  28 +-
 net/openvswitch/flow_table.c   |   2 +-
 net/openvswitch/vport-geneve.c |   4 +-
 net/openvswitch/vport-netdev.c |   2 +-
 net/openvswitch/vport.c|   6 +--
 net/openvswitch/vport.h|   6 +--
 30 files changed, 311 insertions(+), 233 deletions(-)

-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[net-next 08/15] e100: Release skb when DMA mapping is failed in e100_xmit_prepare

2015-08-18 Thread Jeff Kirsher
From: Jia-Ju Bai baijiaju1...@163.com

When pci_dma_mapping_error in e100_xmit_prepare is failed, the skb buffer
allocated by netdev_alloc_skb_ip_align in e100_rx_alloc_skb is not
released, which causes a possible resource leak.
This patch adds error handling code to fix it.

Signed-off-by: Jia-Ju Bai baijiaju1...@163.com
Tested-by: Aaron Brown aaron.f.br...@intel.com
Signed-off-by: Jeff Kirsher jeffrey.t.kirs...@intel.com
---
 drivers/net/ethernet/intel/e100.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/e100.c 
b/drivers/net/ethernet/intel/e100.c
index 767c161..068789e 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -1770,8 +1770,11 @@ static int e100_xmit_prepare(struct nic *nic, struct cb 
*cb,
dma_addr = pci_map_single(nic-pdev,
  skb-data, skb-len, PCI_DMA_TODEVICE);
/* If we can't map the skb, have the upper layer try later */
-   if (pci_dma_mapping_error(nic-pdev, dma_addr))
+   if (pci_dma_mapping_error(nic-pdev, dma_addr)) {
+   dev_kfree_skb_any(skb);
+   skb = NULL;
return -ENOMEM;
+   }
 
/*
 * Use the last 4 bytes of the SKB payload packet as the CRC, used for
-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   >