[net-next:master 630/633] net/bridge/br_netlink.c:1110:1: warning: the frame size of 2160 bytes is larger than 2048 bytes

2015-10-04 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
master
head:   3e087caa23ef36370bfb925d3bbca78e8302d3ce
commit: 7e4df51eb35deedd3ba8d4db92a6c36fb7eff90a [630/633] bridge: netlink: add 
support for igmp's intervals
config: x86_64-randconfig-s0-10051005 (attached as .config)
reproduce:
git checkout 7e4df51eb35deedd3ba8d4db92a6c36fb7eff90a
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   net/bridge/br_netlink.c: In function 'br_fill_info':
>> net/bridge/br_netlink.c:1110:1: warning: the frame size of 2160 bytes is 
>> larger than 2048 bytes [-Wframe-larger-than=]
}
^

vim +1110 net/bridge/br_netlink.c

7e4df51e Nikolay Aleksandrov 2015-10-04  1094   return -EMSGSIZE;
7e4df51e Nikolay Aleksandrov 2015-10-04  1095   clockval = 
jiffies_to_clock_t(br->multicast_querier_interval);
7e4df51e Nikolay Aleksandrov 2015-10-04  1096   if (nla_put_u64(skb, 
IFLA_BR_MCAST_QUERIER_INTVL, clockval))
7e4df51e Nikolay Aleksandrov 2015-10-04  1097   return -EMSGSIZE;
7e4df51e Nikolay Aleksandrov 2015-10-04  1098   clockval = 
jiffies_to_clock_t(br->multicast_query_interval);
7e4df51e Nikolay Aleksandrov 2015-10-04  1099   if (nla_put_u64(skb, 
IFLA_BR_MCAST_QUERY_INTVL, clockval))
7e4df51e Nikolay Aleksandrov 2015-10-04  1100   return -EMSGSIZE;
7e4df51e Nikolay Aleksandrov 2015-10-04  1101   clockval = 
jiffies_to_clock_t(br->multicast_query_response_interval);
7e4df51e Nikolay Aleksandrov 2015-10-04  1102   if (nla_put_u64(skb, 
IFLA_BR_MCAST_QUERY_RESPONSE_INTVL, clockval))
7e4df51e Nikolay Aleksandrov 2015-10-04  1103   return -EMSGSIZE;
7e4df51e Nikolay Aleksandrov 2015-10-04  1104   clockval = 
jiffies_to_clock_t(br->multicast_startup_query_interval);
7e4df51e Nikolay Aleksandrov 2015-10-04  1105   if (nla_put_u64(skb, 
IFLA_BR_MCAST_STARTUP_QUERY_INTVL, clockval))
7e4df51e Nikolay Aleksandrov 2015-10-04  1106   return -EMSGSIZE;
a9a6bc70 Nikolay Aleksandrov 2015-10-04  1107  #endif
a9a6bc70 Nikolay Aleksandrov 2015-10-04  1108  
e5c3ea5c Jiri Pirko  2014-09-05  1109   return 0;
e5c3ea5c Jiri Pirko  2014-09-05 @1110  }
e5c3ea5c Jiri Pirko  2014-09-05    
fed0a159 Roopa Prabhu2015-02-25  1112  static size_t 
br_get_link_af_size(const struct net_device *dev)
fed0a159 Roopa Prabhu2015-02-25  1113  {
2594e906 Nikolay Aleksandrov 2015-09-25  1114   struct net_bridge_port *p;
2594e906 Nikolay Aleksandrov 2015-09-25  1115   struct net_bridge *br;
2594e906 Nikolay Aleksandrov 2015-09-25  1116   int num_vlans = 0;
fed0a159 Roopa Prabhu2015-02-25  1117  
2594e906 Nikolay Aleksandrov 2015-09-25  1118   if (br_port_exists(dev)) {

:: The code at line 1110 was first introduced by commit
:: e5c3ea5c668033b303e7ac835d7d91da32d97958 bridge: implement 
rtnl_link_ops->get_size and rtnl_link_ops->fill_info

:: TO: Jiri Pirko 
:: CC: David S. Miller 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH net-next 4/5] net: use sk_fullsock() in __netdev_pick_tx()

2015-10-04 Thread Eric Dumazet
SYN_RECV & TIMEWAIT sockets are not full blown, they do not have a
sk_dst_cache pointer.

Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of 
listener")
Signed-off-by: Eric Dumazet 
---
 include/net/request_sock.h | 1 +
 net/core/dev.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index dd423d840852..f83669460d82 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -92,6 +92,7 @@ reqsk_alloc(const struct request_sock_ops *ops, struct sock 
*sk_listener)
req->rsk_listener = sk_listener;
req_to_sk(req)->sk_prot = sk_listener->sk_prot;
sk_node_init(_to_sk(req)->sk_node);
+   sk_tx_queue_clear(req_to_sk(req));
req->saved_syn = NULL;
/* Following is temporary. It is coupled with debugging
 * helpers in reqsk_put() & reqsk_free()
diff --git a/net/core/dev.c b/net/core/dev.c
index 323c04edd779..a229bf0d649d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2974,6 +2974,7 @@ static u16 __netdev_pick_tx(struct net_device *dev, 
struct sk_buff *skb)
new_index = skb_tx_hash(dev, skb);
 
if (queue_index != new_index && sk &&
+   sk_fullsock(sk) &&
rcu_access_pointer(sk->sk_dst_cache))
sk_tx_queue_set(sk, new_index);
 
-- 
2.6.0.rc2.230.g3dd15c0

--
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/5] ipv6: inet6_sk() should use sk_fullsock()

2015-10-04 Thread Eric Dumazet
SYN_RECV & TIMEWAIT sockets are not full blown, they do not have a pinet6
pointer.

Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of 
listener")
Signed-off-by: Eric Dumazet 
---
 include/linux/ipv6.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index f1f32af6d9b9..0ef2a97ccdb5 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -264,9 +264,9 @@ struct tcp6_timewait_sock {
 };
 
 #if IS_ENABLED(CONFIG_IPV6)
-static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
+static inline struct ipv6_pinfo *inet6_sk(const struct sock *__sk)
 {
-   return inet_sk(__sk)->pinet6;
+   return sk_fullsock(__sk) ? inet_sk(__sk)->pinet6 : NULL;
 }
 
 static inline struct raw6_sock *raw6_sk(const struct sock *sk)
-- 
2.6.0.rc2.230.g3dd15c0

--
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 5/5] tcp: avoid two atomic ops for syncookies

2015-10-04 Thread Eric Dumazet
inet_reqsk_alloc() is used to allocate a temporary request
in order to generate a SYNACK with a cookie. Then later,
syncookie validation also uses a temporary request.

These paths already took a reference on listener refcount,
we can avoid a couple of atomic operations.

Signed-off-by: Eric Dumazet 
---
 include/net/inet_sock.h|  3 ++-
 include/net/request_sock.h | 11 ---
 net/dccp/ipv4.c|  2 +-
 net/dccp/ipv6.c|  2 +-
 net/ipv4/syncookies.c  |  2 +-
 net/ipv4/tcp_input.c   |  8 +---
 net/ipv6/syncookies.c  |  2 +-
 7 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 47eb67b08abd..f5bf7310e334 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -245,7 +245,8 @@ static inline unsigned int __inet_ehashfn(const __be32 
laddr,
 }
 
 struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops,
- struct sock *sk_listener);
+ struct sock *sk_listener,
+ bool attach_listener);
 
 static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
 {
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index f83669460d82..95ab5d7aab96 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -80,7 +80,8 @@ static inline struct sock *req_to_sk(struct request_sock *req)
 }
 
 static inline struct request_sock *
-reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener)
+reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener,
+   bool attach_listener)
 {
struct request_sock *req;
 
@@ -88,8 +89,12 @@ reqsk_alloc(const struct request_sock_ops *ops, struct sock 
*sk_listener)
 
if (req) {
req->rsk_ops = ops;
-   sock_hold(sk_listener);
-   req->rsk_listener = sk_listener;
+   if (attach_listener) {
+   sock_hold(sk_listener);
+   req->rsk_listener = sk_listener;
+   } else {
+   req->rsk_listener = NULL;
+   }
req_to_sk(req)->sk_prot = sk_listener->sk_prot;
sk_node_init(_to_sk(req)->sk_node);
sk_tx_queue_clear(req_to_sk(req));
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 8910c9567719..8e99681c8189 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -595,7 +595,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff 
*skb)
if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1)
goto drop;
 
-   req = inet_reqsk_alloc(_request_sock_ops, sk);
+   req = inet_reqsk_alloc(_request_sock_ops, sk, true);
if (req == NULL)
goto drop;
 
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 1361a3f45df7..aed314f8c7c6 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -319,7 +319,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct 
sk_buff *skb)
if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1)
goto drop;
 
-   req = inet_reqsk_alloc(_request_sock_ops, sk);
+   req = inet_reqsk_alloc(_request_sock_ops, sk, true);
if (req == NULL)
goto drop;
 
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 729ceb5f63c6..8113c30ccf96 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -326,7 +326,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct 
sk_buff *skb)
goto out;
 
ret = NULL;
-   req = inet_reqsk_alloc(_request_sock_ops, sk); /* for safety */
+   req = inet_reqsk_alloc(_request_sock_ops, sk, false); /* for safety 
*/
if (!req)
goto out;
 
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a95c8eb04ff7..ddadb318e850 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6042,9 +6042,11 @@ static void tcp_openreq_init(struct request_sock *req,
 }
 
 struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops,
- struct sock *sk_listener)
+ struct sock *sk_listener,
+ bool attach_listener)
 {
-   struct request_sock *req = reqsk_alloc(ops, sk_listener);
+   struct request_sock *req = reqsk_alloc(ops, sk_listener,
+  attach_listener);
 
if (req) {
struct inet_request_sock *ireq = inet_rsk(req);
@@ -6143,7 +6145,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
goto drop;
}
 
-   req = inet_reqsk_alloc(rsk_ops, sk);
+   req = inet_reqsk_alloc(rsk_ops, sk, !want_cookie);
if (!req)
goto drop;
 
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index 

[PATCH net-next 0/5] tcp: lockless listener fixes and improvement

2015-10-04 Thread Eric Dumazet
This fixes issues with TCP FastOpen vs lockless listeners,
and SYNACK being attached to request sockets.

Then, last patch brings performance improvement for
syncookies generation and validation.

Tested under a 4.3 Mpps SYNFLOOD attack, new perf profile looks
like :
12.11%  [kernel]  [k] sha_transform
 5.83%  [kernel]  [k] tcp_conn_request
 4.59%  [kernel]  [k] __inet_lookup_listener
 4.11%  [kernel]  [k] ipt_do_table
 3.91%  [kernel]  [k] tcp_make_synack
 3.05%  [kernel]  [k] fib_table_lookup
 2.74%  [kernel]  [k] sock_wfree
 2.66%  [kernel]  [k] memcpy_erms
 2.12%  [kernel]  [k] tcp_v4_rcv

Eric Dumazet (5):
  tcp: fix fastopen races vs lockless listener
  inet: ip_skb_dst_mtu() should use sk_fullsock()
  ipv6: inet6_sk() should use sk_fullsock()
  net: use sk_fullsock() in __netdev_pick_tx()
  tcp: avoid two atomic ops for syncookies

 include/linux/ipv6.h   |  4 ++--
 include/net/inet_sock.h|  3 ++-
 include/net/ip.h   |  9 ++---
 include/net/request_sock.h | 12 +---
 net/core/dev.c |  1 +
 net/dccp/ipv4.c|  2 +-
 net/dccp/ipv6.c|  2 +-
 net/ipv4/syncookies.c  |  2 +-
 net/ipv4/tcp_fastopen.c| 26 +++---
 net/ipv4/tcp_input.c   | 14 ++
 net/ipv6/syncookies.c  |  2 +-
 11 files changed, 41 insertions(+), 36 deletions(-)

-- 
2.6.0.rc2.230.g3dd15c0

--
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/5] inet: ip_skb_dst_mtu() should use sk_fullsock()

2015-10-04 Thread Eric Dumazet
SYN_RECV & TIMEWAIT sockets are not full blown,
do not even try to call ip_sk_use_pmtu() on them.

Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of 
listener")
Signed-off-by: Eric Dumazet 
---
 include/net/ip.h | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/net/ip.h b/include/net/ip.h
index 91a6b2c88341..aa7811993276 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -323,12 +323,15 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const 
struct dst_entry *dst,
 
 static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
 {
-   if (!skb->sk || ip_sk_use_pmtu(skb->sk)) {
+   struct sock *sk = skb->sk;
+
+   if (!sk || !sk_fullsock(sk) || ip_sk_use_pmtu(sk)) {
bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED;
+
return ip_dst_mtu_maybe_forward(skb_dst(skb), forwarding);
-   } else {
-   return min(skb_dst(skb)->dev->mtu, IP_MAX_MTU);
}
+
+   return min(skb_dst(skb)->dev->mtu, IP_MAX_MTU);
 }
 
 u32 ip_idents_reserve(u32 hash, int segs);
-- 
2.6.0.rc2.230.g3dd15c0

--
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] ppp: don't override sk->sk_state in pppoe_flush_dev()

2015-10-04 Thread Matt Bennett
Hi, I am seeing this panic occur occasionally however I am unsure how to
go about reproducing it. Is it enough to simply keep creating and
tearing down the PPP interface? I can also test and/or investigate this
issue if a suitable reproduction method is available.

On Sun, 2015-10-04 at 19:08 +0300, Denys Fedoryshchenko wrote:
> On 2015-10-02 20:54, Guillaume Nault wrote:

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

[PATCH net-next 1/5] tcp: fix fastopen races vs lockless listener

2015-10-04 Thread Eric Dumazet
There are multiple races that need fixes :

1) skb_get() + queue skb + kfree_skb() is racy

An accept() can be done on another cpu, data consumed immediately.
tcp_recvmsg() uses __kfree_skb() as it is assumed all skb found in
socket receive queue are private.

Then the kfree_skb() in tcp_rcv_state_process() uses an already freed skb

2) tcp_reqsk_record_syn() needs to be done before tcp_try_fastopen()
for the same reasons.

3) We want to send the SYNACK before queueing child into accept queue,
otherwise we might reintroduce the ooo issue fixed in
commit 7c85af881044 ("tcp: avoid reorders for TFO passive connections")

Signed-off-by: Eric Dumazet 
---
 net/ipv4/tcp_fastopen.c | 26 +++---
 net/ipv4/tcp_input.c|  6 +-
 2 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
index 410ac481fda0..93396bf7b475 100644
--- a/net/ipv4/tcp_fastopen.c
+++ b/net/ipv4/tcp_fastopen.c
@@ -168,8 +168,6 @@ static struct sock *tcp_fastopen_create_child(struct sock 
*sk,
  TCP_TIMEOUT_INIT, TCP_RTO_MAX);
 
atomic_set(>rsk_refcnt, 2);
-   /* Add the child socket directly into the accept queue */
-   inet_csk_reqsk_queue_add(sk, req, child);
 
/* Now finish processing the fastopen child socket. */
inet_csk(child)->icsk_af_ops->rebuild_header(child);
@@ -178,12 +176,10 @@ static struct sock *tcp_fastopen_create_child(struct sock 
*sk,
tcp_init_metrics(child);
tcp_init_buffer_space(child);
 
-   /* Queue the data carried in the SYN packet. We need to first
-* bump skb's refcnt because the caller will attempt to free it.
-* Note that IPv6 might also have used skb_get() trick
-* in tcp_v6_conn_request() to keep this SYN around (treq->pktopts)
-* So we need to eventually get a clone of the packet,
-* before inserting it in sk_receive_queue.
+   /* Queue the data carried in the SYN packet.
+* We used to play tricky games with skb_get().
+* With lockless listener, it is a dead end.
+* Do not think about it.
 *
 * XXX (TFO) - we honor a zero-payload TFO request for now,
 * (any reason not to?) but no need to queue the skb since
@@ -191,12 +187,7 @@ static struct sock *tcp_fastopen_create_child(struct sock 
*sk,
 */
end_seq = TCP_SKB_CB(skb)->end_seq;
if (end_seq != TCP_SKB_CB(skb)->seq + 1) {
-   struct sk_buff *skb2;
-
-   if (unlikely(skb_shared(skb)))
-   skb2 = skb_clone(skb, GFP_ATOMIC);
-   else
-   skb2 = skb_get(skb);
+   struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
 
if (likely(skb2)) {
skb_dst_drop(skb2);
@@ -214,12 +205,9 @@ static struct sock *tcp_fastopen_create_child(struct sock 
*sk,
}
}
tcp_rsk(req)->rcv_nxt = tp->rcv_nxt = end_seq;
-   sk->sk_data_ready(sk);
-   bh_unlock_sock(child);
-   /* Note: sock_put(child) will be done by tcp_conn_request()
-* after SYNACK packet is sent.
+   /* tcp_conn_request() is sending the SYNACK,
+* and queues the child into listener accept queue.
 */
-   WARN_ON(!req->sk);
return child;
 }
 
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 27108757c310..a95c8eb04ff7 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6229,12 +6229,16 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
tcp_rsk(req)->txhash = net_tx_rndhash();
tcp_openreq_init_rwin(req, sk, dst);
if (!want_cookie) {
-   fastopen_sk = tcp_try_fastopen(sk, skb, req, , dst);
tcp_reqsk_record_syn(sk, req, skb);
+   fastopen_sk = tcp_try_fastopen(sk, skb, req, , dst);
}
if (fastopen_sk) {
af_ops->send_synack(fastopen_sk, dst, , req,
skb_get_queue_mapping(skb), , false);
+   /* Add the child socket directly into the accept queue */
+   inet_csk_reqsk_queue_add(sk, req, fastopen_sk);
+   sk->sk_data_ready(sk);
+   bh_unlock_sock(fastopen_sk);
sock_put(fastopen_sk);
} else {
tcp_rsk(req)->tfo_listener = false;
-- 
2.6.0.rc2.230.g3dd15c0

--
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] mwifiex: fix a comment typo

2015-10-04 Thread Geliang Tang
Just fix a typo in the code comment.

Signed-off-by: Geliang Tang 
---
 drivers/net/wireless/mwifiex/cfg80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c 
b/drivers/net/wireless/mwifiex/cfg80211.c
index 30cbafb..b7ac45f 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -2374,7 +2374,7 @@ mwifiex_cfg80211_leave_ibss(struct wiphy *wiphy, struct 
net_device *dev)
  * CFG802.11 operation handler for scan request.
  *
  * This function issues a scan request to the firmware based upon
- * the user specified scan configuration. On successfull completion,
+ * the user specified scan configuration. On successful completion,
  * it also informs the results.
  */
 static int
-- 
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-next 06/20] bridge: netlink: export topology_change and topology_change_detected

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_TOPOLOGY_CHANGE and IFLA_BR_TOPOLOGY_CHANGE_DETECTED and
export them via netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h | 2 ++
 net/bridge/br_netlink.c  | 7 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 7d7236d143fb..b00286ca1bfe 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -237,6 +237,8 @@ enum {
IFLA_BR_BRIDGE_ID,
IFLA_BR_ROOT_PORT,
IFLA_BR_ROOT_PATH_COST,
+   IFLA_BR_TOPOLOGY_CHANGE,
+   IFLA_BR_TOPOLOGY_CHANGE_DETECTED,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index cd0488b689d4..8bcaa5171f35 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -858,6 +858,8 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(struct ifla_bridge_id)) +   /* 
IFLA_BR_BRIDGE_ID */
   nla_total_size(sizeof(u16)) +/* IFLA_BR_ROOT_PORT */
   nla_total_size(sizeof(u32)) +/* IFLA_BR_ROOT_PATH_COST */
+  nla_total_size(sizeof(u8)) +/* IFLA_BR_TOPOLOGY_CHANGE */
+  nla_total_size(sizeof(u8)) +/* 
IFLA_BR_TOPOLOGY_CHANGE_DETECTED */
   0;
 }
 
@@ -892,7 +894,10 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
nla_put(skb, IFLA_BR_ROOT_ID, sizeof(root_id), _id) ||
nla_put(skb, IFLA_BR_BRIDGE_ID, sizeof(bridge_id), _id) ||
nla_put_u16(skb, IFLA_BR_ROOT_PORT, br->root_port) ||
-   nla_put_u32(skb, IFLA_BR_ROOT_PATH_COST, br->root_path_cost))
+   nla_put_u32(skb, IFLA_BR_ROOT_PATH_COST, br->root_path_cost) ||
+   nla_put_u8(skb, IFLA_BR_TOPOLOGY_CHANGE, br->topology_change) ||
+   nla_put_u8(skb, IFLA_BR_TOPOLOGY_CHANGE_DETECTED,
+  br->topology_change_detected))
return -EMSGSIZE;
 
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
-- 
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 14/20] bridge: netlink: add support for igmp's hash_elasticity

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_MCAST_HASH_ELASTICITY to allow setting/getting
br->hash_elasticity via netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  1 +
 net/bridge/br_netlink.c  | 12 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index fe5fac5c2a7f..ca7ca766d8af 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -249,6 +249,7 @@ enum {
IFLA_BR_MCAST_SNOOPING,
IFLA_BR_MCAST_QUERY_USE_IFADDR,
IFLA_BR_MCAST_QUERIER,
+   IFLA_BR_MCAST_HASH_ELASTICITY,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index e21296dacf42..b210a639e8d1 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -771,6 +771,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = 
{
[IFLA_BR_MCAST_SNOOPING] = { .type = NLA_U8 },
[IFLA_BR_MCAST_QUERY_USE_IFADDR] = { .type = NLA_U8 },
[IFLA_BR_MCAST_QUERIER] = { .type = NLA_U8 },
+   [IFLA_BR_MCAST_HASH_ELASTICITY] = { .type = NLA_U32 },
 };
 
 static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -897,6 +898,12 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
if (err)
return err;
}
+
+   if (data[IFLA_BR_MCAST_HASH_ELASTICITY]) {
+   u32 val = nla_get_u32(data[IFLA_BR_MCAST_HASH_ELASTICITY]);
+
+   br->hash_elasticity = val;
+   }
 #endif
 
return 0;
@@ -931,6 +938,7 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_SNOOPING */
   nla_total_size(sizeof(u8)) + /* 
IFLA_BR_MCAST_QUERY_USE_IFADDR */
   nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_QUERIER */
+  nla_total_size(sizeof(u32)) + /* 
IFLA_BR_MCAST_HASH_ELASTICITY */
 #endif
   0;
 }
@@ -993,7 +1001,9 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
nla_put_u8(skb, IFLA_BR_MCAST_SNOOPING, !br->multicast_disabled) ||
nla_put_u8(skb, IFLA_BR_MCAST_QUERY_USE_IFADDR,
   br->multicast_query_use_ifaddr) ||
-   nla_put_u8(skb, IFLA_BR_MCAST_QUERIER, br->multicast_querier))
+   nla_put_u8(skb, IFLA_BR_MCAST_QUERIER, br->multicast_querier) ||
+   nla_put_u32(skb, IFLA_BR_MCAST_HASH_ELASTICITY,
+   br->hash_elasticity))
return -EMSGSIZE;
 #endif
 
-- 
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 20/20] bridge: netlink: add support for default_pvid

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_VLAN_DEFAULT_PVID to allow setting/getting bridge's
default_pvid via netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  1 +
 net/bridge/br_netlink.c  | 13 -
 net/bridge/br_private.h  |  1 +
 net/bridge/br_vlan.c | 14 +++---
 4 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 0200bed6e5d6..c5b15bfeabe2 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -262,6 +262,7 @@ enum {
IFLA_BR_NF_CALL_IPTABLES,
IFLA_BR_NF_CALL_IP6TABLES,
IFLA_BR_NF_CALL_ARPTABLES,
+   IFLA_BR_VLAN_DEFAULT_PVID,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index fd37caf02b51..70efe2edde2b 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -784,6 +784,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = 
{
[IFLA_BR_NF_CALL_IPTABLES] = { .type = NLA_U8 },
[IFLA_BR_NF_CALL_IP6TABLES] = { .type = NLA_U8 },
[IFLA_BR_NF_CALL_ARPTABLES] = { .type = NLA_U8 },
+   [IFLA_BR_VLAN_DEFAULT_PVID] = { .type = NLA_U16 },
 };
 
 static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -847,6 +848,14 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
if (err)
return err;
}
+
+   if (data[IFLA_BR_VLAN_DEFAULT_PVID]) {
+   __u16 defpvid = nla_get_u16(data[IFLA_BR_VLAN_DEFAULT_PVID]);
+
+   err = __br_vlan_set_default_pvid(br, defpvid);
+   if (err)
+   return err;
+   }
 #endif
 
if (data[IFLA_BR_GROUP_FWD_MASK]) {
@@ -1007,6 +1016,7 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(u8)) + /* IFLA_BR_VLAN_FILTERING */
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
   nla_total_size(sizeof(__be16)) + /* IFLA_BR_VLAN_PROTOCOL */
+  nla_total_size(sizeof(u16)) +/* IFLA_BR_VLAN_DEFAULT_PVID */
 #endif
   nla_total_size(sizeof(u16)) +/* IFLA_BR_GROUP_FWD_MASK */
   nla_total_size(sizeof(struct ifla_bridge_id)) +   /* 
IFLA_BR_ROOT_ID */
@@ -1094,7 +1104,8 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
return -EMSGSIZE;
 
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
-   if (nla_put_be16(skb, IFLA_BR_VLAN_PROTOCOL, br->vlan_proto))
+   if (nla_put_be16(skb, IFLA_BR_VLAN_PROTOCOL, br->vlan_proto) ||
+   nla_put_u16(skb, IFLA_BR_VLAN_DEFAULT_PVID, br->default_pvid))
return -EMSGSIZE;
 #endif
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 1ff6a0faef3f..09d3ecbcb4f0 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -690,6 +690,7 @@ int __br_vlan_set_proto(struct net_bridge *br, __be16 
proto);
 int br_vlan_set_proto(struct net_bridge *br, unsigned long val);
 int br_vlan_init(struct net_bridge *br);
 int br_vlan_set_default_pvid(struct net_bridge *br, unsigned long val);
+int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid);
 int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags);
 int nbp_vlan_delete(struct net_bridge_port *port, u16 vid);
 void nbp_vlan_flush(struct net_bridge_port *port);
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index b879111582f0..eae07ee9bfe0 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -727,7 +727,7 @@ static void br_vlan_disable_default_pvid(struct net_bridge 
*br)
br->default_pvid = 0;
 }
 
-static int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid)
+int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid)
 {
const struct net_bridge_vlan *pvent;
struct net_bridge_port *p;
@@ -735,6 +735,11 @@ static int __br_vlan_set_default_pvid(struct net_bridge 
*br, u16 pvid)
int err = 0;
unsigned long *changed;
 
+   if (!pvid) {
+   br_vlan_disable_default_pvid(br);
+   return 0;
+   }
+
changed = kcalloc(BITS_TO_LONGS(BR_MAX_PORTS), sizeof(unsigned long),
  GFP_KERNEL);
if (!changed)
@@ -825,12 +830,7 @@ int br_vlan_set_default_pvid(struct net_bridge *br, 
unsigned long val)
err = -EPERM;
goto unlock;
}
-
-   if (!pvid)
-   br_vlan_disable_default_pvid(br);
-   else
-   err = __br_vlan_set_default_pvid(br, pvid);
-
+   err = __br_vlan_set_default_pvid(br, pvid);
 unlock:
rtnl_unlock();
return err;
-- 
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  

[PATCH net-next 07/20] bridge: netlink: export all timers

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Export the following bridge timers (also exported via sysfs):
IFLA_BR_HELLO_TIMER, IFLA_BR_TCN_TIMER, IFLA_BR_TOPOLOGY_CHANGE_TIMER,
IFLA_BR_GC_TIMER via netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  4 
 net/bridge/br_netlink.c  | 16 +++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index b00286ca1bfe..a1e33282ab9d 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -239,6 +239,10 @@ enum {
IFLA_BR_ROOT_PATH_COST,
IFLA_BR_TOPOLOGY_CHANGE,
IFLA_BR_TOPOLOGY_CHANGE_DETECTED,
+   IFLA_BR_HELLO_TIMER,
+   IFLA_BR_TCN_TIMER,
+   IFLA_BR_TOPOLOGY_CHANGE_TIMER,
+   IFLA_BR_GC_TIMER,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 8bcaa5171f35..755bfe0ab404 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -860,12 +860,17 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(u32)) +/* IFLA_BR_ROOT_PATH_COST */
   nla_total_size(sizeof(u8)) +/* IFLA_BR_TOPOLOGY_CHANGE */
   nla_total_size(sizeof(u8)) +/* 
IFLA_BR_TOPOLOGY_CHANGE_DETECTED */
+  nla_total_size(sizeof(u64)) +/* IFLA_BR_HELLO_TIMER */
+  nla_total_size(sizeof(u64)) +/* IFLA_BR_TCN_TIMER */
+  nla_total_size(sizeof(u64)) +/* 
IFLA_BR_TOPOLOGY_CHANGE_TIMER */
+  nla_total_size(sizeof(u64)) +/* IFLA_BR_GC_TIMER */
   0;
 }
 
 static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)
 {
struct net_bridge *br = netdev_priv(brdev);
+   u64 hello_timer, tcn_timer, topology_change_timer, gc_timer;
u32 forward_delay = jiffies_to_clock_t(br->forward_delay);
u32 hello_time = jiffies_to_clock_t(br->hello_time);
u32 age_time = jiffies_to_clock_t(br->max_age);
@@ -882,6 +887,10 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
memcpy(root_id.addr, br->designated_root.addr, sizeof(root_id.addr));
memcpy(bridge_id.prio, br->bridge_id.prio, sizeof(bridge_id.prio));
memcpy(bridge_id.addr, br->bridge_id.addr, sizeof(bridge_id.addr));
+   hello_timer = br_timer_value(>hello_timer);
+   tcn_timer = br_timer_value(>tcn_timer);
+   topology_change_timer = br_timer_value(>topology_change_timer);
+   gc_timer = br_timer_value(>gc_timer);
 
if (nla_put_u32(skb, IFLA_BR_FORWARD_DELAY, forward_delay) ||
nla_put_u32(skb, IFLA_BR_HELLO_TIME, hello_time) ||
@@ -897,7 +906,12 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
nla_put_u32(skb, IFLA_BR_ROOT_PATH_COST, br->root_path_cost) ||
nla_put_u8(skb, IFLA_BR_TOPOLOGY_CHANGE, br->topology_change) ||
nla_put_u8(skb, IFLA_BR_TOPOLOGY_CHANGE_DETECTED,
-  br->topology_change_detected))
+  br->topology_change_detected) ||
+   nla_put_u64(skb, IFLA_BR_HELLO_TIMER, hello_timer) ||
+   nla_put_u64(skb, IFLA_BR_TCN_TIMER, tcn_timer) ||
+   nla_put_u64(skb, IFLA_BR_TOPOLOGY_CHANGE_TIMER,
+   topology_change_timer) ||
+   nla_put_u64(skb, IFLA_BR_GC_TIMER, gc_timer))
return -EMSGSIZE;
 
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
-- 
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 00/20] bridge: complete netlink support

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Hi,
This set completes the bridge device's netlink support and makes it
possible to view and configure everything that can be configured via
sysfs. I have tested all of these (setting and getting). There're a few
longer line warnings about the br_get_size() ifla comments but I think we
should have them to know what has been accounted for. I have used the sysfs
interface as a guide of what and how to set. As usual I'll send the
corresponding iproute2 patches later.
The bridge port's netlink interface will be completed after this set gets
applied in some form.

This patch-set is on top of my last vlan cleanups set:
http://www.spinics.net/lists/netdev/msg346005.html

Cheers,
 Nik

Nikolay Aleksandrov (20):
  bridge: netlink: add group_fwd_mask support
  bridge: netlink: export root id
  bridge: netlink: export bridge id
  bridge: netlink: export root port
  bridge: netlink: export root path cost
  bridge: netlink: export topology_change and topology_change_detected
  bridge: netlink: export all timers
  bridge: netlink: add group_addr support
  bridge: netlink: add fdb flush
  bridge: netlink: add support for multicast_router
  bridge: netlink: add support for multicast_snooping
  bridge: netlink: add support for multicast_query_use_ifaddr
  bridge: netlink: add support for multicast_querier
  bridge: netlink: add support for igmp's hash_elasticity
  bridge: netlink: add support for igmp's hash_max
  bridge: netlink: add support for multicast_last_member_count
  bridge: netlink: add support for multicast_startup_query_count
  bridge: netlink: add support for igmp's intervals
  bridge: netlink: add support for netfilter tables config
  bridge: netlink: add support for default_pvid

 include/uapi/linux/if_link.h |  36 ++
 net/bridge/br_netlink.c  | 284 ++-
 net/bridge/br_private.h  |   1 +
 net/bridge/br_vlan.c |  14 +--
 4 files changed, 326 insertions(+), 9 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 01/20] bridge: netlink: add group_fwd_mask support

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_GROUP_FWD_MASK attribute to allow setting and retrieving the
group_fwd_mask via netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  1 +
 net/bridge/br_netlink.c  | 14 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 3a5f263cfc2f..f7f480613555 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -232,6 +232,7 @@ enum {
IFLA_BR_PRIORITY,
IFLA_BR_VLAN_FILTERING,
IFLA_BR_VLAN_PROTOCOL,
+   IFLA_BR_GROUP_FWD_MASK,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index c3186198d46d..39b201a2bc12 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -764,6 +764,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = 
{
[IFLA_BR_PRIORITY] = { .type = NLA_U16 },
[IFLA_BR_VLAN_FILTERING] = { .type = NLA_U8 },
[IFLA_BR_VLAN_PROTOCOL] = { .type = NLA_U16 },
+   [IFLA_BR_GROUP_FWD_MASK] = { .type = NLA_U16 },
 };
 
 static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -829,6 +830,14 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
}
 #endif
 
+   if (data[IFLA_BR_GROUP_FWD_MASK]) {
+   u16 fwd_mask = nla_get_u16(data[IFLA_BR_GROUP_FWD_MASK]);
+
+   if (fwd_mask & BR_GROUPFWD_RESTRICTED)
+   return -EINVAL;
+   br->group_fwd_mask = fwd_mask;
+   }
+
return 0;
 }
 
@@ -844,6 +853,7 @@ static size_t br_get_size(const struct net_device *brdev)
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
   nla_total_size(sizeof(__be16)) + /* IFLA_BR_VLAN_PROTOCOL */
 #endif
+  nla_total_size(sizeof(u16)) +/* IFLA_BR_GROUP_FWD_MASK */
   0;
 }
 
@@ -856,6 +866,7 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
u32 ageing_time = jiffies_to_clock_t(br->ageing_time);
u32 stp_enabled = br->stp_enabled;
u16 priority = (br->bridge_id.prio[0] << 8) | br->bridge_id.prio[1];
+   u16 group_fwd_mask = br->group_fwd_mask;
u8 vlan_enabled = br_vlan_enabled(br);
 
if (nla_put_u32(skb, IFLA_BR_FORWARD_DELAY, forward_delay) ||
@@ -864,7 +875,8 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
nla_put_u32(skb, IFLA_BR_AGEING_TIME, ageing_time) ||
nla_put_u32(skb, IFLA_BR_STP_STATE, stp_enabled) ||
nla_put_u16(skb, IFLA_BR_PRIORITY, priority) ||
-   nla_put_u8(skb, IFLA_BR_VLAN_FILTERING, vlan_enabled))
+   nla_put_u8(skb, IFLA_BR_VLAN_FILTERING, vlan_enabled) ||
+   nla_put_u16(skb, IFLA_BR_GROUP_FWD_MASK, group_fwd_mask))
return -EMSGSIZE;
 
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
-- 
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 17/20] bridge: netlink: add support for multicast_startup_query_count

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_MCAST_STARTUP_QUERY_CNT to allow setting/getting
br->multicast_startup_query_count via netlink. Also align the ifla
comments.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  1 +
 net/bridge/br_netlink.c  | 22 --
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 5409a461e47e..fd841b5269c1 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -252,6 +252,7 @@ enum {
IFLA_BR_MCAST_HASH_ELASTICITY,
IFLA_BR_MCAST_HASH_MAX,
IFLA_BR_MCAST_LAST_MEMBER_CNT,
+   IFLA_BR_MCAST_STARTUP_QUERY_CNT,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index cf6ccaea8180..6744e30120af 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -774,6 +774,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = 
{
[IFLA_BR_MCAST_HASH_ELASTICITY] = { .type = NLA_U32 },
[IFLA_BR_MCAST_HASH_MAX] = { .type = NLA_U32 },
[IFLA_BR_MCAST_LAST_MEMBER_CNT] = { .type = NLA_U32 },
+   [IFLA_BR_MCAST_STARTUP_QUERY_CNT] = { .type = NLA_U32 },
 };
 
 static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -920,6 +921,12 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
 
br->multicast_last_member_count = val;
}
+
+   if (data[IFLA_BR_MCAST_STARTUP_QUERY_CNT]) {
+   u32 val = nla_get_u32(data[IFLA_BR_MCAST_STARTUP_QUERY_CNT]);
+
+   br->multicast_startup_query_count = val;
+   }
 #endif
 
return 0;
@@ -942,8 +949,8 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(struct ifla_bridge_id)) +   /* 
IFLA_BR_BRIDGE_ID */
   nla_total_size(sizeof(u16)) +/* IFLA_BR_ROOT_PORT */
   nla_total_size(sizeof(u32)) +/* IFLA_BR_ROOT_PATH_COST */
-  nla_total_size(sizeof(u8)) +/* IFLA_BR_TOPOLOGY_CHANGE */
-  nla_total_size(sizeof(u8)) +/* 
IFLA_BR_TOPOLOGY_CHANGE_DETECTED */
+  nla_total_size(sizeof(u8)) + /* IFLA_BR_TOPOLOGY_CHANGE */
+  nla_total_size(sizeof(u8)) + /* 
IFLA_BR_TOPOLOGY_CHANGE_DETECTED */
   nla_total_size(sizeof(u64)) +/* IFLA_BR_HELLO_TIMER */
   nla_total_size(sizeof(u64)) +/* IFLA_BR_TCN_TIMER */
   nla_total_size(sizeof(u64)) +/* 
IFLA_BR_TOPOLOGY_CHANGE_TIMER */
@@ -954,9 +961,10 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_SNOOPING */
   nla_total_size(sizeof(u8)) + /* 
IFLA_BR_MCAST_QUERY_USE_IFADDR */
   nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_QUERIER */
-  nla_total_size(sizeof(u32)) + /* 
IFLA_BR_MCAST_HASH_ELASTICITY */
-  nla_total_size(sizeof(u32)) + /* IFLA_BR_MCAST_HASH_MAX */
-  nla_total_size(sizeof(u32)) + /* 
IFLA_BR_MCAST_LAST_MEMBER_CNT */
+  nla_total_size(sizeof(u32)) +/* 
IFLA_BR_MCAST_HASH_ELASTICITY */
+  nla_total_size(sizeof(u32)) +/* IFLA_BR_MCAST_HASH_MAX */
+  nla_total_size(sizeof(u32)) +/* 
IFLA_BR_MCAST_LAST_MEMBER_CNT */
+  nla_total_size(sizeof(u32)) +/* 
IFLA_BR_MCAST_STARTUP_QUERY_CNT */
 #endif
   0;
 }
@@ -1024,7 +1032,9 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
br->hash_elasticity) ||
nla_put_u32(skb, IFLA_BR_MCAST_HASH_MAX, br->hash_max) ||
nla_put_u32(skb, IFLA_BR_MCAST_LAST_MEMBER_CNT,
-   br->multicast_last_member_count))
+   br->multicast_last_member_count) ||
+   nla_put_u32(skb, IFLA_BR_MCAST_STARTUP_QUERY_CNT,
+   br->multicast_startup_query_count))
return -EMSGSIZE;
 #endif
 
-- 
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 16/20] bridge: netlink: add support for multicast_last_member_count

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_MCAST_LAST_MEMBER_CNT to allow setting/getting
br->multicast_last_member_count via netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  1 +
 net/bridge/br_netlink.c  | 12 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 10a44a735512..5409a461e47e 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -251,6 +251,7 @@ enum {
IFLA_BR_MCAST_QUERIER,
IFLA_BR_MCAST_HASH_ELASTICITY,
IFLA_BR_MCAST_HASH_MAX,
+   IFLA_BR_MCAST_LAST_MEMBER_CNT,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index d6b61b0eeada..cf6ccaea8180 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -773,6 +773,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = 
{
[IFLA_BR_MCAST_QUERIER] = { .type = NLA_U8 },
[IFLA_BR_MCAST_HASH_ELASTICITY] = { .type = NLA_U32 },
[IFLA_BR_MCAST_HASH_MAX] = { .type = NLA_U32 },
+   [IFLA_BR_MCAST_LAST_MEMBER_CNT] = { .type = NLA_U32 },
 };
 
 static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -913,6 +914,12 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
if (err)
return err;
}
+
+   if (data[IFLA_BR_MCAST_LAST_MEMBER_CNT]) {
+   u32 val = nla_get_u32(data[IFLA_BR_MCAST_LAST_MEMBER_CNT]);
+
+   br->multicast_last_member_count = val;
+   }
 #endif
 
return 0;
@@ -949,6 +956,7 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_QUERIER */
   nla_total_size(sizeof(u32)) + /* 
IFLA_BR_MCAST_HASH_ELASTICITY */
   nla_total_size(sizeof(u32)) + /* IFLA_BR_MCAST_HASH_MAX */
+  nla_total_size(sizeof(u32)) + /* 
IFLA_BR_MCAST_LAST_MEMBER_CNT */
 #endif
   0;
 }
@@ -1014,7 +1022,9 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
nla_put_u8(skb, IFLA_BR_MCAST_QUERIER, br->multicast_querier) ||
nla_put_u32(skb, IFLA_BR_MCAST_HASH_ELASTICITY,
br->hash_elasticity) ||
-   nla_put_u32(skb, IFLA_BR_MCAST_HASH_MAX, br->hash_max))
+   nla_put_u32(skb, IFLA_BR_MCAST_HASH_MAX, br->hash_max) ||
+   nla_put_u32(skb, IFLA_BR_MCAST_LAST_MEMBER_CNT,
+   br->multicast_last_member_count))
return -EMSGSIZE;
 #endif
 
-- 
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 18/20] bridge: netlink: add support for igmp's intervals

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add support to set/get all of the igmp's configurable intervals via
netlink. These currently are:
IFLA_BR_MCAST_LAST_MEMBER_INTVL
IFLA_BR_MCAST_MEMBERSHIP_INTVL
IFLA_BR_MCAST_QUERIER_INTVL
IFLA_BR_MCAST_QUERY_INTVL
IFLA_BR_MCAST_QUERY_RESPONSE_INTVL
IFLA_BR_MCAST_STARTUP_QUERY_INTVL

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  6 
 net/bridge/br_netlink.c  | 70 +++-
 2 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index fd841b5269c1..b8c88aa19fef 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -253,6 +253,12 @@ enum {
IFLA_BR_MCAST_HASH_MAX,
IFLA_BR_MCAST_LAST_MEMBER_CNT,
IFLA_BR_MCAST_STARTUP_QUERY_CNT,
+   IFLA_BR_MCAST_LAST_MEMBER_INTVL,
+   IFLA_BR_MCAST_MEMBERSHIP_INTVL,
+   IFLA_BR_MCAST_QUERIER_INTVL,
+   IFLA_BR_MCAST_QUERY_INTVL,
+   IFLA_BR_MCAST_QUERY_RESPONSE_INTVL,
+   IFLA_BR_MCAST_STARTUP_QUERY_INTVL,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 6744e30120af..30def4fb5901 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -775,6 +775,12 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] 
= {
[IFLA_BR_MCAST_HASH_MAX] = { .type = NLA_U32 },
[IFLA_BR_MCAST_LAST_MEMBER_CNT] = { .type = NLA_U32 },
[IFLA_BR_MCAST_STARTUP_QUERY_CNT] = { .type = NLA_U32 },
+   [IFLA_BR_MCAST_LAST_MEMBER_INTVL] = { .type = NLA_U64 },
+   [IFLA_BR_MCAST_MEMBERSHIP_INTVL] = { .type = NLA_U64 },
+   [IFLA_BR_MCAST_QUERIER_INTVL] = { .type = NLA_U64 },
+   [IFLA_BR_MCAST_QUERY_INTVL] = { .type = NLA_U64 },
+   [IFLA_BR_MCAST_QUERY_RESPONSE_INTVL] = { .type = NLA_U64 },
+   [IFLA_BR_MCAST_STARTUP_QUERY_INTVL] = { .type = NLA_U64 },
 };
 
 static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -927,6 +933,42 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
 
br->multicast_startup_query_count = val;
}
+
+   if (data[IFLA_BR_MCAST_LAST_MEMBER_INTVL]) {
+   u64 val = nla_get_u64(data[IFLA_BR_MCAST_LAST_MEMBER_INTVL]);
+
+   br->multicast_last_member_interval = clock_t_to_jiffies(val);
+   }
+
+   if (data[IFLA_BR_MCAST_MEMBERSHIP_INTVL]) {
+   u64 val = nla_get_u64(data[IFLA_BR_MCAST_MEMBERSHIP_INTVL]);
+
+   br->multicast_membership_interval = clock_t_to_jiffies(val);
+   }
+
+   if (data[IFLA_BR_MCAST_QUERIER_INTVL]) {
+   u64 val = nla_get_u64(data[IFLA_BR_MCAST_QUERIER_INTVL]);
+
+   br->multicast_querier_interval = clock_t_to_jiffies(val);
+   }
+
+   if (data[IFLA_BR_MCAST_QUERY_INTVL]) {
+   u64 val = nla_get_u64(data[IFLA_BR_MCAST_QUERY_INTVL]);
+
+   br->multicast_query_interval = clock_t_to_jiffies(val);
+   }
+
+   if (data[IFLA_BR_MCAST_QUERY_RESPONSE_INTVL]) {
+   u64 val = nla_get_u64(data[IFLA_BR_MCAST_QUERY_RESPONSE_INTVL]);
+
+   br->multicast_query_response_interval = clock_t_to_jiffies(val);
+   }
+
+   if (data[IFLA_BR_MCAST_STARTUP_QUERY_INTVL]) {
+   u64 val = nla_get_u64(data[IFLA_BR_MCAST_STARTUP_QUERY_INTVL]);
+
+   br->multicast_startup_query_interval = clock_t_to_jiffies(val);
+   }
 #endif
 
return 0;
@@ -965,6 +1007,12 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(u32)) +/* IFLA_BR_MCAST_HASH_MAX */
   nla_total_size(sizeof(u32)) +/* 
IFLA_BR_MCAST_LAST_MEMBER_CNT */
   nla_total_size(sizeof(u32)) +/* 
IFLA_BR_MCAST_STARTUP_QUERY_CNT */
+  nla_total_size(sizeof(u64)) +/* 
IFLA_BR_MCAST_LAST_MEMBER_INTVL */
+  nla_total_size(sizeof(u64)) +/* 
IFLA_BR_MCAST_MEMBERSHIP_INTVL */
+  nla_total_size(sizeof(u64)) +/* IFLA_BR_MCAST_QUERIER_INTVL 
*/
+  nla_total_size(sizeof(u64)) +/* IFLA_BR_MCAST_QUERY_INTVL */
+  nla_total_size(sizeof(u64)) +/* 
IFLA_BR_MCAST_QUERY_RESPONSE_INTVL */
+  nla_total_size(sizeof(u64)) +/* 
IFLA_BR_MCAST_STARTUP_QUERY_INTVL */
 #endif
   0;
 }
@@ -972,7 +1020,7 @@ static size_t br_get_size(const struct net_device *brdev)
 static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)
 {
struct net_bridge *br = netdev_priv(brdev);
-   u64 hello_timer, tcn_timer, topology_change_timer, gc_timer;
+   u64 hello_timer, tcn_timer, topology_change_timer, gc_timer, clockval;
u32 forward_delay = jiffies_to_clock_t(br->forward_delay);
u32 hello_time = jiffies_to_clock_t(br->hello_time);
u32 age_time = jiffies_to_clock_t(br->max_age);
@@ 

[PATCH net-next 15/20] bridge: netlink: add support for igmp's hash_max

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_MCAST_HASH_MAX to allow setting/getting br->hash_max via
netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  1 +
 net/bridge/br_netlink.c  | 13 -
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index ca7ca766d8af..10a44a735512 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -250,6 +250,7 @@ enum {
IFLA_BR_MCAST_QUERY_USE_IFADDR,
IFLA_BR_MCAST_QUERIER,
IFLA_BR_MCAST_HASH_ELASTICITY,
+   IFLA_BR_MCAST_HASH_MAX,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index b210a639e8d1..d6b61b0eeada 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -772,6 +772,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = 
{
[IFLA_BR_MCAST_QUERY_USE_IFADDR] = { .type = NLA_U8 },
[IFLA_BR_MCAST_QUERIER] = { .type = NLA_U8 },
[IFLA_BR_MCAST_HASH_ELASTICITY] = { .type = NLA_U32 },
+   [IFLA_BR_MCAST_HASH_MAX] = { .type = NLA_U32 },
 };
 
 static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -904,6 +905,14 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
 
br->hash_elasticity = val;
}
+
+   if (data[IFLA_BR_MCAST_HASH_MAX]) {
+   u32 hash_max = nla_get_u32(data[IFLA_BR_MCAST_HASH_MAX]);
+
+   err = br_multicast_set_hash_max(br, hash_max);
+   if (err)
+   return err;
+   }
 #endif
 
return 0;
@@ -939,6 +948,7 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(u8)) + /* 
IFLA_BR_MCAST_QUERY_USE_IFADDR */
   nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_QUERIER */
   nla_total_size(sizeof(u32)) + /* 
IFLA_BR_MCAST_HASH_ELASTICITY */
+  nla_total_size(sizeof(u32)) + /* IFLA_BR_MCAST_HASH_MAX */
 #endif
   0;
 }
@@ -1003,7 +1013,8 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
   br->multicast_query_use_ifaddr) ||
nla_put_u8(skb, IFLA_BR_MCAST_QUERIER, br->multicast_querier) ||
nla_put_u32(skb, IFLA_BR_MCAST_HASH_ELASTICITY,
-   br->hash_elasticity))
+   br->hash_elasticity) ||
+   nla_put_u32(skb, IFLA_BR_MCAST_HASH_MAX, br->hash_max))
return -EMSGSIZE;
 #endif
 
-- 
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 19/20] bridge: netlink: add support for netfilter tables config

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add support to allow getting/setting netfilter tables settings.
Currently these are IFLA_BR_NF_CALL_IPTABLES, IFLA_BR_NF_CALL_IP6TABLES
and IFLA_BR_NF_CALL_ARPTABLES.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  3 +++
 net/bridge/br_netlink.c  | 37 -
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index b8c88aa19fef..0200bed6e5d6 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -259,6 +259,9 @@ enum {
IFLA_BR_MCAST_QUERY_INTVL,
IFLA_BR_MCAST_QUERY_RESPONSE_INTVL,
IFLA_BR_MCAST_STARTUP_QUERY_INTVL,
+   IFLA_BR_NF_CALL_IPTABLES,
+   IFLA_BR_NF_CALL_IP6TABLES,
+   IFLA_BR_NF_CALL_ARPTABLES,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 30def4fb5901..fd37caf02b51 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -781,6 +781,9 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = 
{
[IFLA_BR_MCAST_QUERY_INTVL] = { .type = NLA_U64 },
[IFLA_BR_MCAST_QUERY_RESPONSE_INTVL] = { .type = NLA_U64 },
[IFLA_BR_MCAST_STARTUP_QUERY_INTVL] = { .type = NLA_U64 },
+   [IFLA_BR_NF_CALL_IPTABLES] = { .type = NLA_U8 },
+   [IFLA_BR_NF_CALL_IP6TABLES] = { .type = NLA_U8 },
+   [IFLA_BR_NF_CALL_ARPTABLES] = { .type = NLA_U8 },
 };
 
 static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -970,6 +973,25 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
br->multicast_startup_query_interval = clock_t_to_jiffies(val);
}
 #endif
+#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
+   if (data[IFLA_BR_NF_CALL_IPTABLES]) {
+   u8 val = nla_get_u8(data[IFLA_BR_NF_CALL_IPTABLES]);
+
+   br->nf_call_iptables = val ? true : false;
+   }
+
+   if (data[IFLA_BR_NF_CALL_IP6TABLES]) {
+   u8 val = nla_get_u8(data[IFLA_BR_NF_CALL_IP6TABLES]);
+
+   br->nf_call_ip6tables = val ? true : false;
+   }
+
+   if (data[IFLA_BR_NF_CALL_ARPTABLES]) {
+   u8 val = nla_get_u8(data[IFLA_BR_NF_CALL_ARPTABLES]);
+
+   br->nf_call_arptables = val ? true : false;
+   }
+#endif
 
return 0;
 }
@@ -1014,6 +1036,11 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(u64)) +/* 
IFLA_BR_MCAST_QUERY_RESPONSE_INTVL */
   nla_total_size(sizeof(u64)) +/* 
IFLA_BR_MCAST_STARTUP_QUERY_INTVL */
 #endif
+#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
+  nla_total_size(sizeof(u8)) + /* IFLA_BR_NF_CALL_IPTABLES */
+  nla_total_size(sizeof(u8)) + /* IFLA_BR_NF_CALL_IP6TABLES */
+  nla_total_size(sizeof(u8)) + /* IFLA_BR_NF_CALL_ARPTABLES */
+#endif
   0;
 }
 
@@ -1070,7 +1097,6 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
if (nla_put_be16(skb, IFLA_BR_VLAN_PROTOCOL, br->vlan_proto))
return -EMSGSIZE;
 #endif
-
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
if (nla_put_u8(skb, IFLA_BR_MCAST_ROUTER, br->multicast_router) ||
nla_put_u8(skb, IFLA_BR_MCAST_SNOOPING, !br->multicast_disabled) ||
@@ -1105,6 +1131,15 @@ static int br_fill_info(struct sk_buff *skb, const 
struct net_device *brdev)
if (nla_put_u64(skb, IFLA_BR_MCAST_STARTUP_QUERY_INTVL, clockval))
return -EMSGSIZE;
 #endif
+#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
+   if (nla_put_u8(skb, IFLA_BR_NF_CALL_IPTABLES,
+  br->nf_call_iptables ? 1 : 0) ||
+   nla_put_u8(skb, IFLA_BR_NF_CALL_IP6TABLES,
+  br->nf_call_ip6tables ? 1 : 0) ||
+   nla_put_u8(skb, IFLA_BR_NF_CALL_ARPTABLES,
+  br->nf_call_arptables ? 1 : 0))
+   return -EMSGSIZE;
+#endif
 
return 0;
 }
-- 
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] net/mlx4_core: Test interrupts fail if not all comp vectors called request_irq

2015-10-04 Thread Or Gerlitz

On 9/29/2015 9:38 PM, cls...@linux.vnet.ibm.com wrote:

From: Carol L Soto 

Test interrupts fails if not all completion vectors called
request_irq. This case can happen if only mlx4_en loads and
we have more completion vectors than rx rings.


good catch! is this a bug since the driver 0-day or was introduced by
some recent commit? in the latercase, please add a Fixes: tag before 
your S.O.B note.


Signed-off-by: Carol L Soto 
---
  drivers/net/ethernet/mellanox/mlx4/eq.c | 4 
  1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c 
b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 8e81e53..c344884 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -1364,6 +1364,10 @@ int mlx4_test_interrupts(struct mlx4_dev *dev)
 * and performing a NOP command
 */
for(i = 0; !err && (i < dev->caps.num_comp_vectors); ++i) {
+   /* Make sure request_irq was called */
+   if (!priv->eq_table.eq[i].have_irq)
+   continue;
+
/* Temporary use polling for command completions */
mlx4_cmd_use_polling(dev);
  


--
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 04/20] bridge: netlink: export root port

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_ROOT_PORT and export it via netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h | 1 +
 net/bridge/br_netlink.c  | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 748495438a8b..172268a5767d 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -235,6 +235,7 @@ enum {
IFLA_BR_GROUP_FWD_MASK,
IFLA_BR_ROOT_ID,
IFLA_BR_BRIDGE_ID,
+   IFLA_BR_ROOT_PORT,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index a63f944a7f12..652db1ca0acc 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -856,6 +856,7 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(u16)) +/* IFLA_BR_GROUP_FWD_MASK */
   nla_total_size(sizeof(struct ifla_bridge_id)) +   /* 
IFLA_BR_ROOT_ID */
   nla_total_size(sizeof(struct ifla_bridge_id)) +   /* 
IFLA_BR_BRIDGE_ID */
+  nla_total_size(sizeof(u16)) +/* IFLA_BR_ROOT_PORT */
   0;
 }
 
@@ -888,7 +889,8 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
nla_put_u8(skb, IFLA_BR_VLAN_FILTERING, vlan_enabled) ||
nla_put_u16(skb, IFLA_BR_GROUP_FWD_MASK, group_fwd_mask) ||
nla_put(skb, IFLA_BR_ROOT_ID, sizeof(root_id), _id) ||
-   nla_put(skb, IFLA_BR_BRIDGE_ID, sizeof(bridge_id), _id))
+   nla_put(skb, IFLA_BR_BRIDGE_ID, sizeof(bridge_id), _id) ||
+   nla_put_u16(skb, IFLA_BR_ROOT_PORT, br->root_port))
return -EMSGSIZE;
 
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
-- 
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 02/20] bridge: netlink: export root id

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_ROOT_ID and export br->designated_root via netlink. For this
purpose add struct ifla_bridge_id that would represent struct bridge_id.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h | 6 ++
 net/bridge/br_netlink.c  | 9 -
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index f7f480613555..03814371df44 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -233,11 +233,17 @@ enum {
IFLA_BR_VLAN_FILTERING,
IFLA_BR_VLAN_PROTOCOL,
IFLA_BR_GROUP_FWD_MASK,
+   IFLA_BR_ROOT_ID,
__IFLA_BR_MAX,
 };
 
 #define IFLA_BR_MAX(__IFLA_BR_MAX - 1)
 
+struct ifla_bridge_id {
+   __u8prio[2];
+   __u8addr[6]; /* ETH_ALEN */
+};
+
 enum {
BRIDGE_MODE_UNSPEC,
BRIDGE_MODE_HAIRPIN,
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 39b201a2bc12..7a3692469db6 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -854,6 +854,7 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(__be16)) + /* IFLA_BR_VLAN_PROTOCOL */
 #endif
   nla_total_size(sizeof(u16)) +/* IFLA_BR_GROUP_FWD_MASK */
+  nla_total_size(sizeof(struct ifla_bridge_id)) +   /* 
IFLA_BR_ROOT_ID */
   0;
 }
 
@@ -868,6 +869,11 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
u16 priority = (br->bridge_id.prio[0] << 8) | br->bridge_id.prio[1];
u16 group_fwd_mask = br->group_fwd_mask;
u8 vlan_enabled = br_vlan_enabled(br);
+   struct ifla_bridge_id root_id;
+
+   memset(_id, 0, sizeof(root_id));
+   memcpy(root_id.prio, br->designated_root.prio, sizeof(root_id.prio));
+   memcpy(root_id.addr, br->designated_root.addr, sizeof(root_id.addr));
 
if (nla_put_u32(skb, IFLA_BR_FORWARD_DELAY, forward_delay) ||
nla_put_u32(skb, IFLA_BR_HELLO_TIME, hello_time) ||
@@ -876,7 +882,8 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
nla_put_u32(skb, IFLA_BR_STP_STATE, stp_enabled) ||
nla_put_u16(skb, IFLA_BR_PRIORITY, priority) ||
nla_put_u8(skb, IFLA_BR_VLAN_FILTERING, vlan_enabled) ||
-   nla_put_u16(skb, IFLA_BR_GROUP_FWD_MASK, group_fwd_mask))
+   nla_put_u16(skb, IFLA_BR_GROUP_FWD_MASK, group_fwd_mask) ||
+   nla_put(skb, IFLA_BR_ROOT_ID, sizeof(root_id), _id))
return -EMSGSIZE;
 
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
-- 
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 05/20] bridge: netlink: export root path cost

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_ROOT_PATH_COST and export it via netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h | 1 +
 net/bridge/br_netlink.c  | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 172268a5767d..7d7236d143fb 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -236,6 +236,7 @@ enum {
IFLA_BR_ROOT_ID,
IFLA_BR_BRIDGE_ID,
IFLA_BR_ROOT_PORT,
+   IFLA_BR_ROOT_PATH_COST,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 652db1ca0acc..cd0488b689d4 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -857,6 +857,7 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(struct ifla_bridge_id)) +   /* 
IFLA_BR_ROOT_ID */
   nla_total_size(sizeof(struct ifla_bridge_id)) +   /* 
IFLA_BR_BRIDGE_ID */
   nla_total_size(sizeof(u16)) +/* IFLA_BR_ROOT_PORT */
+  nla_total_size(sizeof(u32)) +/* IFLA_BR_ROOT_PATH_COST */
   0;
 }
 
@@ -890,7 +891,8 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
nla_put_u16(skb, IFLA_BR_GROUP_FWD_MASK, group_fwd_mask) ||
nla_put(skb, IFLA_BR_ROOT_ID, sizeof(root_id), _id) ||
nla_put(skb, IFLA_BR_BRIDGE_ID, sizeof(bridge_id), _id) ||
-   nla_put_u16(skb, IFLA_BR_ROOT_PORT, br->root_port))
+   nla_put_u16(skb, IFLA_BR_ROOT_PORT, br->root_port) ||
+   nla_put_u32(skb, IFLA_BR_ROOT_PATH_COST, br->root_path_cost))
return -EMSGSIZE;
 
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
-- 
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 10/20] bridge: netlink: add support for multicast_router

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_MCAST_ROUTER to allow setting and retrieving
br->multicast_router when igmp snooping is enabled.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  1 +
 net/bridge/br_netlink.c  | 19 +++
 2 files changed, 20 insertions(+)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 9ca9bf8bfe04..5d2c92973afe 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -245,6 +245,7 @@ enum {
IFLA_BR_GC_TIMER,
IFLA_BR_GROUP_ADDR,
IFLA_BR_FDB_FLUSH,
+   IFLA_BR_MCAST_ROUTER,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 5853c5737006..f4df609c1ad9 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -767,6 +767,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = 
{
[IFLA_BR_GROUP_FWD_MASK] = { .type = NLA_U16 },
[IFLA_BR_GROUP_ADDR] = { .type = NLA_BINARY,
 .len  = ETH_ALEN },
+   [IFLA_BR_MCAST_ROUTER] = { .type = NLA_U8 },
 };
 
 static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -862,6 +863,16 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
if (data[IFLA_BR_FDB_FLUSH])
br_fdb_flush(br);
 
+#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
+   if (data[IFLA_BR_MCAST_ROUTER]) {
+   u8 multicast_router = nla_get_u8(data[IFLA_BR_MCAST_ROUTER]);
+
+   err = br_multicast_set_router(br, multicast_router);
+   if (err)
+   return err;
+   }
+#endif
+
return 0;
 }
 
@@ -889,6 +900,9 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(u64)) +/* 
IFLA_BR_TOPOLOGY_CHANGE_TIMER */
   nla_total_size(sizeof(u64)) +/* IFLA_BR_GC_TIMER */
   nla_total_size(ETH_ALEN) +   /* IFLA_BR_GROUP_ADDR */
+#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
+  nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_ROUTER */
+#endif
   0;
 }
 
@@ -945,6 +959,11 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
return -EMSGSIZE;
 #endif
 
+#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
+   if (nla_put_u8(skb, IFLA_BR_MCAST_ROUTER, br->multicast_router))
+   return -EMSGSIZE;
+#endif
+
return 0;
 }
 
-- 
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 12/20] bridge: netlink: add support for multicast_query_use_ifaddr

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_MCAST_QUERY_USE_IFADDR to allow setting/getting
br->multicast_query_use_ifaddr via netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  1 +
 net/bridge/br_netlink.c  | 13 -
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 22cb395a713d..7090b3977eac 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -247,6 +247,7 @@ enum {
IFLA_BR_FDB_FLUSH,
IFLA_BR_MCAST_ROUTER,
IFLA_BR_MCAST_SNOOPING,
+   IFLA_BR_MCAST_QUERY_USE_IFADDR,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 25e1c66d70f1..12ef844273a7 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -769,6 +769,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = 
{
 .len  = ETH_ALEN },
[IFLA_BR_MCAST_ROUTER] = { .type = NLA_U8 },
[IFLA_BR_MCAST_SNOOPING] = { .type = NLA_U8 },
+   [IFLA_BR_MCAST_QUERY_USE_IFADDR] = { .type = NLA_U8 },
 };
 
 static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -880,6 +881,13 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
if (err)
return err;
}
+
+   if (data[IFLA_BR_MCAST_QUERY_USE_IFADDR]) {
+   u8 val;
+
+   val = nla_get_u8(data[IFLA_BR_MCAST_QUERY_USE_IFADDR]);
+   br->multicast_query_use_ifaddr = !!val;
+   }
 #endif
 
return 0;
@@ -912,6 +920,7 @@ static size_t br_get_size(const struct net_device *brdev)
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
   nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_ROUTER */
   nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_SNOOPING */
+  nla_total_size(sizeof(u8)) + /* 
IFLA_BR_MCAST_QUERY_USE_IFADDR */
 #endif
   0;
 }
@@ -971,7 +980,9 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
 
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
if (nla_put_u8(skb, IFLA_BR_MCAST_ROUTER, br->multicast_router) ||
-   nla_put_u8(skb, IFLA_BR_MCAST_SNOOPING, !br->multicast_disabled))
+   nla_put_u8(skb, IFLA_BR_MCAST_SNOOPING, !br->multicast_disabled) ||
+   nla_put_u8(skb, IFLA_BR_MCAST_QUERY_USE_IFADDR,
+  br->multicast_query_use_ifaddr))
return -EMSGSIZE;
 #endif
 
-- 
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 11/20] bridge: netlink: add support for multicast_snooping

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_MCAST_SNOOPING to allow enabling/disabling multicast
snooping via netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  1 +
 net/bridge/br_netlink.c  | 13 -
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 5d2c92973afe..22cb395a713d 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -246,6 +246,7 @@ enum {
IFLA_BR_GROUP_ADDR,
IFLA_BR_FDB_FLUSH,
IFLA_BR_MCAST_ROUTER,
+   IFLA_BR_MCAST_SNOOPING,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index f4df609c1ad9..25e1c66d70f1 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -768,6 +768,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = 
{
[IFLA_BR_GROUP_ADDR] = { .type = NLA_BINARY,
 .len  = ETH_ALEN },
[IFLA_BR_MCAST_ROUTER] = { .type = NLA_U8 },
+   [IFLA_BR_MCAST_SNOOPING] = { .type = NLA_U8 },
 };
 
 static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -871,6 +872,14 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
if (err)
return err;
}
+
+   if (data[IFLA_BR_MCAST_SNOOPING]) {
+   u8 mcast_snooping = nla_get_u8(data[IFLA_BR_MCAST_SNOOPING]);
+
+   err = br_multicast_toggle(br, mcast_snooping);
+   if (err)
+   return err;
+   }
 #endif
 
return 0;
@@ -902,6 +911,7 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(ETH_ALEN) +   /* IFLA_BR_GROUP_ADDR */
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
   nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_ROUTER */
+  nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_SNOOPING */
 #endif
   0;
 }
@@ -960,7 +970,8 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
 #endif
 
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
-   if (nla_put_u8(skb, IFLA_BR_MCAST_ROUTER, br->multicast_router))
+   if (nla_put_u8(skb, IFLA_BR_MCAST_ROUTER, br->multicast_router) ||
+   nla_put_u8(skb, IFLA_BR_MCAST_SNOOPING, !br->multicast_disabled))
return -EMSGSIZE;
 #endif
 
-- 
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 03/20] bridge: netlink: export bridge id

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_BRIDGE_ID and export br->bridge_id via netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h | 1 +
 net/bridge/br_netlink.c  | 9 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 03814371df44..748495438a8b 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -234,6 +234,7 @@ enum {
IFLA_BR_VLAN_PROTOCOL,
IFLA_BR_GROUP_FWD_MASK,
IFLA_BR_ROOT_ID,
+   IFLA_BR_BRIDGE_ID,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 7a3692469db6..a63f944a7f12 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -855,6 +855,7 @@ static size_t br_get_size(const struct net_device *brdev)
 #endif
   nla_total_size(sizeof(u16)) +/* IFLA_BR_GROUP_FWD_MASK */
   nla_total_size(sizeof(struct ifla_bridge_id)) +   /* 
IFLA_BR_ROOT_ID */
+  nla_total_size(sizeof(struct ifla_bridge_id)) +   /* 
IFLA_BR_BRIDGE_ID */
   0;
 }
 
@@ -869,11 +870,14 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
u16 priority = (br->bridge_id.prio[0] << 8) | br->bridge_id.prio[1];
u16 group_fwd_mask = br->group_fwd_mask;
u8 vlan_enabled = br_vlan_enabled(br);
-   struct ifla_bridge_id root_id;
+   struct ifla_bridge_id root_id, bridge_id;
 
+   memset(_id, 0, sizeof(bridge_id));
memset(_id, 0, sizeof(root_id));
memcpy(root_id.prio, br->designated_root.prio, sizeof(root_id.prio));
memcpy(root_id.addr, br->designated_root.addr, sizeof(root_id.addr));
+   memcpy(bridge_id.prio, br->bridge_id.prio, sizeof(bridge_id.prio));
+   memcpy(bridge_id.addr, br->bridge_id.addr, sizeof(bridge_id.addr));
 
if (nla_put_u32(skb, IFLA_BR_FORWARD_DELAY, forward_delay) ||
nla_put_u32(skb, IFLA_BR_HELLO_TIME, hello_time) ||
@@ -883,7 +887,8 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
nla_put_u16(skb, IFLA_BR_PRIORITY, priority) ||
nla_put_u8(skb, IFLA_BR_VLAN_FILTERING, vlan_enabled) ||
nla_put_u16(skb, IFLA_BR_GROUP_FWD_MASK, group_fwd_mask) ||
-   nla_put(skb, IFLA_BR_ROOT_ID, sizeof(root_id), _id))
+   nla_put(skb, IFLA_BR_ROOT_ID, sizeof(root_id), _id) ||
+   nla_put(skb, IFLA_BR_BRIDGE_ID, sizeof(bridge_id), _id))
return -EMSGSIZE;
 
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
-- 
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 08/20] bridge: netlink: add group_addr support

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_GROUP_ADDR attribute to allow setting and retrieving the
group_addr via netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  1 +
 net/bridge/br_netlink.c  | 25 -
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index a1e33282ab9d..eaeaac17dfdd 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -243,6 +243,7 @@ enum {
IFLA_BR_TCN_TIMER,
IFLA_BR_TOPOLOGY_CHANGE_TIMER,
IFLA_BR_GC_TIMER,
+   IFLA_BR_GROUP_ADDR,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 755bfe0ab404..a05a4306d42d 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -765,6 +765,8 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = 
{
[IFLA_BR_VLAN_FILTERING] = { .type = NLA_U8 },
[IFLA_BR_VLAN_PROTOCOL] = { .type = NLA_U16 },
[IFLA_BR_GROUP_FWD_MASK] = { .type = NLA_U16 },
+   [IFLA_BR_GROUP_ADDR] = { .type = NLA_BINARY,
+.len  = ETH_ALEN },
 };
 
 static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -838,6 +840,25 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
br->group_fwd_mask = fwd_mask;
}
 
+   if (data[IFLA_BR_GROUP_ADDR]) {
+   u8 new_addr[ETH_ALEN];
+
+   if (nla_len(data[IFLA_BR_GROUP_ADDR]) != ETH_ALEN)
+   return -EINVAL;
+   memcpy(new_addr, nla_data(data[IFLA_BR_GROUP_ADDR]), ETH_ALEN);
+   if (!is_link_local_ether_addr(new_addr))
+   return -EINVAL;
+   if (new_addr[5] == 1 || /* 802.3x Pause address */
+   new_addr[5] == 2 || /* 802.3ad Slow protocols */
+   new_addr[5] == 3)   /* 802.1X PAE address */
+   return -EINVAL;
+   spin_lock_bh(>lock);
+   memcpy(br->group_addr, new_addr, sizeof(br->group_addr));
+   spin_unlock_bh(>lock);
+   br->group_addr_set = true;
+   br_recalculate_fwd_mask(br);
+   }
+
return 0;
 }
 
@@ -864,6 +885,7 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(u64)) +/* IFLA_BR_TCN_TIMER */
   nla_total_size(sizeof(u64)) +/* 
IFLA_BR_TOPOLOGY_CHANGE_TIMER */
   nla_total_size(sizeof(u64)) +/* IFLA_BR_GC_TIMER */
+  nla_total_size(ETH_ALEN) +   /* IFLA_BR_GROUP_ADDR */
   0;
 }
 
@@ -911,7 +933,8 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
nla_put_u64(skb, IFLA_BR_TCN_TIMER, tcn_timer) ||
nla_put_u64(skb, IFLA_BR_TOPOLOGY_CHANGE_TIMER,
topology_change_timer) ||
-   nla_put_u64(skb, IFLA_BR_GC_TIMER, gc_timer))
+   nla_put_u64(skb, IFLA_BR_GC_TIMER, gc_timer) ||
+   nla_put(skb, IFLA_BR_GROUP_ADDR, ETH_ALEN, br->group_addr))
return -EMSGSIZE;
 
 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
-- 
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/20] bridge: netlink: add fdb flush

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Simple attribute that flushes the bridge's fdb.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h | 1 +
 net/bridge/br_netlink.c  | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index eaeaac17dfdd..9ca9bf8bfe04 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -244,6 +244,7 @@ enum {
IFLA_BR_TOPOLOGY_CHANGE_TIMER,
IFLA_BR_GC_TIMER,
IFLA_BR_GROUP_ADDR,
+   IFLA_BR_FDB_FLUSH,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index a05a4306d42d..5853c5737006 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -859,6 +859,9 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
br_recalculate_fwd_mask(br);
}
 
+   if (data[IFLA_BR_FDB_FLUSH])
+   br_fdb_flush(br);
+
return 0;
 }
 
-- 
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 13/20] bridge: netlink: add support for multicast_querier

2015-10-04 Thread Nikolay Aleksandrov
From: Nikolay Aleksandrov 

Add IFLA_BR_MCAST_QUERIER to allow setting/getting br->multicast_querier
via netlink.

Signed-off-by: Nikolay Aleksandrov 
---
 include/uapi/linux/if_link.h |  1 +
 net/bridge/br_netlink.c  | 13 -
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 7090b3977eac..fe5fac5c2a7f 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -248,6 +248,7 @@ enum {
IFLA_BR_MCAST_ROUTER,
IFLA_BR_MCAST_SNOOPING,
IFLA_BR_MCAST_QUERY_USE_IFADDR,
+   IFLA_BR_MCAST_QUERIER,
__IFLA_BR_MAX,
 };
 
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 12ef844273a7..e21296dacf42 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -770,6 +770,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = 
{
[IFLA_BR_MCAST_ROUTER] = { .type = NLA_U8 },
[IFLA_BR_MCAST_SNOOPING] = { .type = NLA_U8 },
[IFLA_BR_MCAST_QUERY_USE_IFADDR] = { .type = NLA_U8 },
+   [IFLA_BR_MCAST_QUERIER] = { .type = NLA_U8 },
 };
 
 static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -888,6 +889,14 @@ static int br_changelink(struct net_device *brdev, struct 
nlattr *tb[],
val = nla_get_u8(data[IFLA_BR_MCAST_QUERY_USE_IFADDR]);
br->multicast_query_use_ifaddr = !!val;
}
+
+   if (data[IFLA_BR_MCAST_QUERIER]) {
+   u8 mcast_querier = nla_get_u8(data[IFLA_BR_MCAST_QUERIER]);
+
+   err = br_multicast_set_querier(br, mcast_querier);
+   if (err)
+   return err;
+   }
 #endif
 
return 0;
@@ -921,6 +930,7 @@ static size_t br_get_size(const struct net_device *brdev)
   nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_ROUTER */
   nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_SNOOPING */
   nla_total_size(sizeof(u8)) + /* 
IFLA_BR_MCAST_QUERY_USE_IFADDR */
+  nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_QUERIER */
 #endif
   0;
 }
@@ -982,7 +992,8 @@ static int br_fill_info(struct sk_buff *skb, const struct 
net_device *brdev)
if (nla_put_u8(skb, IFLA_BR_MCAST_ROUTER, br->multicast_router) ||
nla_put_u8(skb, IFLA_BR_MCAST_SNOOPING, !br->multicast_disabled) ||
nla_put_u8(skb, IFLA_BR_MCAST_QUERY_USE_IFADDR,
-  br->multicast_query_use_ifaddr))
+  br->multicast_query_use_ifaddr) ||
+   nla_put_u8(skb, IFLA_BR_MCAST_QUERIER, br->multicast_querier))
return -EMSGSIZE;
 #endif
 
-- 
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 V5 1/2] ACPI / EC: Fix broken 64bit big-endian users of 'global_lock'

2015-10-04 Thread Greg Kroah-Hartman
On Sun, Sep 27, 2015 at 03:48:24PM +0200, Rafael J. Wysocki wrote:
> On Sun, Sep 27, 2015 at 12:04 AM, Viresh Kumar  
> wrote:
> > global_lock is defined as an unsigned long and accessing only its lower
> > 32 bits from sysfs is incorrect, as we need to consider other 32 bits
> > for big endian 64-bit systems. There are no such platforms yet, but the
> > code needs to be robust for such a case.
> >
> > Fix that by changing type of 'global_lock' to u32.
> >
> > Signed-off-by: Viresh Kumar 
> 
> Acked-by: Rafael J. Wysocki 
> 
> Greg, please take this one along with the [2/2] if that one looks good to you.

Thanks, will do.

greg k-h
--
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/15] dma: remove external references to dma_supported

2015-10-04 Thread Greg KH
On Sat, Oct 03, 2015 at 05:19:39PM +0200, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig 
> ---
>  Documentation/DMA-API.txt   | 13 -
>  drivers/usb/host/ehci-hcd.c |  2 +-
>  drivers/usb/host/fotg210-hcd.c  |  2 +-
>  drivers/usb/host/fusbh200-hcd.c |  2 +-
>  drivers/usb/host/oxu210hp-hcd.c |  2 +-
>  5 files changed, 4 insertions(+), 17 deletions(-)


Acked-by: Greg Kroah-Hartman 
--
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/unix: fix logic about sk_peek_offset

2015-10-04 Thread Aaron Conole
Andrey Vagin  writes:

> From: Andrey Vagin 
>
> Now send with MSG_PEEK can return data from multiple SKBs.
>
> Unfortunately we take into account the peek offset for each skb,
> that is wrong. We need to apply the peek offset only once.
>
> In addition, the peek offset should be used only if MSG_PEEK is set.
>
> Cc: "David S. Miller"  (maintainer:NETWORKING
> Cc: Eric Dumazet  (commit_signer:1/14=7%)
> Cc: Aaron Conole 
> Fixes: 9f389e35674f ("af_unix: return data from multiple SKBs on recv() with 
> MSG_PEEK flag")
> Signed-off-by: Andrey Vagin 
> ---
Tested-by: Aaron Conole 

Thanks again!
--
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 - Nicholas's tree] netconsole: Missing unlock on error path

2015-10-04 Thread Christoph Hellwig
On Sat, Oct 03, 2015 at 10:05:24PM +0300, Dan Carpenter wrote:
> We added new locking to this function but we missed one error path which
> needs an unlock.
> 
> Fixes: cdacad4993f4 ('netconsole: use per-attribute show and store methods')
> Signed-off-by: Dan Carpenter 
> ---
> This is going through Nicholas Bellinger's tree not net-next.

Hi Dan,

this was fixed a while ago, I'm actually surpised it was still in the patches
Nic merged.  My repost from earlier yesterday should have fixed 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


[PATCH] cfg80211: drop unlikely behind WARN_ON()

2015-10-04 Thread Geliang Tang
WARN_ON() already contain an unlikely compiler flag. Drop it.

Signed-off-by: Geliang Tang 
---
 drivers/net/wireless/ath/ath6kl/cfg80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c 
b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index a511ef3..fe38fc4 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -2217,7 +2217,7 @@ static int ath6kl_wow_suspend(struct ath6kl *ar, struct 
cfg80211_wowlan *wow)
 
/* enter / leave wow suspend on first vif always */
first_vif = ath6kl_vif_first(ar);
-   if (WARN_ON(unlikely(!first_vif)) ||
+   if (WARN_ON(!first_vif) ||
!ath6kl_cfg80211_ready(first_vif))
return -EIO;
 
@@ -2297,7 +2297,7 @@ static int ath6kl_wow_resume(struct ath6kl *ar)
int ret;
 
vif = ath6kl_vif_first(ar);
-   if (WARN_ON(unlikely(!vif)) ||
+   if (WARN_ON(!vif) ||
!ath6kl_cfg80211_ready(vif))
return -EIO;
 
-- 
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] netfilter: remove the nh_scope test in rpfilter_lookup_reverse of ipt_rpfilter

2015-10-04 Thread Xin Long
--accept-local  option works for res.type == RTN_LOCAL, which should be from
the local table, but there, the fib_info's nh->nh_scope = RT_SCOPE_NOWHERE
( > RT_SCOPE_HOST). in fib_create_info().

if (cfg->fc_scope == RT_SCOPE_HOST) {
struct fib_nh *nh = fi->fib_nh;

/* Local address is added. */
if (nhs != 1 || nh->nh_gw)
goto err_inval;
nh->nh_scope = RT_SCOPE_NOWHERE;   <===
nh->nh_dev = dev_get_by_index(net, fi->fib_nh->nh_oif);
err = -ENODEV;
if (!nh->nh_dev)
goto failure;

but in our rpfilter_lookup_reverse():

if (dev_match || flags & XT_RPFILTER_LOOSE)
return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;

if nh->nh_scope > RT_SCOPE_HOST, it will fail. --accept-local option will never
be passed.

it seems the test is bogus and can be removed to fix this issue.

if (dev_match || flags & XT_RPFILTER_LOOSE)
return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;

ipv6 does not have this issue.

Signed-off-by: Xin Long 
---
 net/ipv4/netfilter/ipt_rpfilter.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/ipv4/netfilter/ipt_rpfilter.c 
b/net/ipv4/netfilter/ipt_rpfilter.c
index 8618fd1..11c5662 100644
--- a/net/ipv4/netfilter/ipt_rpfilter.c
+++ b/net/ipv4/netfilter/ipt_rpfilter.c
@@ -61,8 +61,6 @@ static bool rpfilter_lookup_reverse(struct flowi4 *fl4,
if (FIB_RES_DEV(res) == dev)
dev_match = true;
 #endif
-   if (dev_match || flags & XT_RPFILTER_LOOSE)
-   return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;
return dev_match;
 }
 
-- 
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 net-next v2] net: Add support for filtering neigh dump by device index

2015-10-04 Thread Nikolay Aleksandrov
On 10/03/2015 08:43 PM, David Ahern wrote:
> Add support for filtering neighbor dumps by device by adding the
> NDA_IFINDEX attribute to the dump request.
> 
> Signed-off-by: David Ahern 
> ---
> v2
> - fix or on the index as noticed by Eagle-Eye Nikolay
> 
>  net/core/neighbour.c | 17 +++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
LGTM,

Reviewed-by: Nikolay Aleksandrov 


--
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


[RFC PATCH] net: mvneta: add ethtool statistics

2015-10-04 Thread Russell King
Add support for the ethtool statistic interface, returning the full set
of statistics which both the Armada 370 and Armada XP can support.

Signed-off-by: Russell King 
---
Is there any standard terminology for the ethtool statistics?  Are the
names given here satisfactory?

This patch is against net-next.git.

 drivers/net/ethernet/marvell/mvneta.c | 100 ++
 1 file changed, 100 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvneta.c 
b/drivers/net/ethernet/marvell/mvneta.c
index 514df76fc70f..2019fa6b52e0 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -278,6 +278,51 @@ struct mvneta_pcpu_stats {
 
 #define MVNETA_RX_BUF_SIZE(pkt_size)   ((pkt_size) + NET_SKB_PAD)
 
+struct mvneta_statistic {
+   unsigned short offset;
+   unsigned short type;
+   const char name[ETH_GSTRING_LEN];
+};
+
+#define T_REG_32   32
+#define T_REG_64   64
+#define T_SW   1
+
+static const struct mvneta_statistic mvneta_statistics[] = {
+   { 0x3000, T_REG_64, "rx_good_bytes", },
+   { 0x3010, T_REG_32, "rx_good_packets", },
+   { 0x3008, T_REG_32, "rx_bad_bytes", },
+   { 0x3014, T_REG_32, "rx_bad_packets", },
+   { 0x3018, T_REG_32, "rx_broadcast_packets", },
+   { 0x301c, T_REG_32, "rx_multicast_packets", },
+   { 0x3050, T_REG_32, "rx_unrecog_mac_ctl", },
+   { 0x3054, T_REG_32, "rx_good_fc_packets", },
+   { 0x3058, T_REG_32, "rx_bad_fc_packets", },
+   { 0x305c, T_REG_32, "rx_undersize_packets", },
+   { 0x3064, T_REG_32, "rx_fragments", },
+   { 0x3068, T_REG_32, "rx_oversize_packets", },
+   { 0x306c, T_REG_32, "rx_jabber_packets", },
+   { 0x3070, T_REG_32, "rx_mac_errors", },
+   { 0x3074, T_REG_32, "rx_bad_crc", },
+   { 0x3078, T_REG_32, "rx_collision_events", },
+   { 0x307c, T_REG_32, "rx_late_collision_events", },
+   { 0x2484, T_REG_32, "rx_discard_packets", },
+   { 0x2488, T_REG_32, "rx_overrun_packets", },
+   { 0x3020, T_REG_32, "packets_64bytes", },
+   { 0x3024, T_REG_32, "packets_65to127bytes", },
+   { 0x3028, T_REG_32, "packets_128to255bytes", },
+   { 0x302c, T_REG_32, "packets_256to511bytes", },
+   { 0x3030, T_REG_32, "packets_512to1023bytes", },
+   { 0x3034, T_REG_32, "packets_1024tomaxbytes", },
+   { 0x3038, T_REG_64, "tx_good_bytes", },
+   { 0x3040, T_REG_32, "tx_good_packets", },
+   { 0x3044, T_REG_32, "tx_excessive_collision", },
+   { 0x3048, T_REG_32, "tx_multicast_packets", },
+   { 0x304c, T_REG_32, "tx_broadcast_packets", },
+   { 0x3060, T_REG_32, "tx_fc", },
+   { 0x300c, T_REG_32, "tx_mac_error", },
+};
+
 struct mvneta_pcpu_stats {
struct  u64_stats_sync syncp;
u64 rx_packets;
@@ -324,6 +369,8 @@ struct mvneta_port {
unsigned int speed;
unsigned int tx_csum_limit;
int use_inband_status:1;
+
+   u64 ethtool_stats[ARRAY_SIZE(mvneta_statistics)];
 };
 
 /* The mvneta_tx_desc and mvneta_rx_desc structures describe the
@@ -2982,6 +3029,56 @@ static int mvneta_ethtool_set_ringparam(struct 
net_device *dev,
return 0;
 }
 
+static void mvneta_ethtool_get_strings(struct net_device *netdev, u32 sset,
+  u8 *data)
+{
+   if (sset == ETH_SS_STATS) {
+   int i;
+
+   for (i = 0; i < ARRAY_SIZE(mvneta_statistics); i++)
+   memcpy(data + i * ETH_GSTRING_LEN,
+  mvneta_statistics[i].name, ETH_GSTRING_LEN);
+   }
+}
+
+static void mvneta_ethtool_get_stats(struct net_device *dev,
+struct ethtool_stats *stats, u64 *data)
+{
+   struct mvneta_port *pp = netdev_priv(dev);
+   const struct mvneta_statistic *s;
+   void __iomem *base = pp->base;
+   u32 high, low, val;
+   int i;
+
+   for (i = 0, s = mvneta_statistics;
+s < mvneta_statistics + ARRAY_SIZE(mvneta_statistics);
+s++, i++) {
+   val = 0;
+
+   switch (s->type) {
+   case T_REG_32:
+   val = readl_relaxed(base + s->offset);
+   break;
+   case T_REG_64:
+   /* Docs say to read low 32-bit then high */
+   low = readl_relaxed(base + s->offset);
+   high = readl_relaxed(base + s->offset + 4);
+   val = (u64)high << 32 | low;
+   break;
+   }
+
+   pp->ethtool_stats[i] += val;
+   *data++ = pp->ethtool_stats[i];
+   }
+}
+
+static int mvneta_ethtool_get_sset_count(struct net_device *dev, int sset)
+{
+   if (sset == ETH_SS_STATS)
+   return ARRAY_SIZE(mvneta_statistics);
+   return -EOPNOTSUPP;
+}
+
 static const struct net_device_ops mvneta_netdev_ops = {
.ndo_open  

Re: [PATCH v2 1/3] unix: fix use-after-free in unix_dgram_poll()

2015-10-04 Thread Rainer Weikusat
Rainer Weikusat  writes:

> Mathias Krause  writes:
>> On 2 October 2015 at 22:43, Jason Baron  wrote:
>>> The unix_dgram_poll() routine calls sock_poll_wait() not only for the wait
>>> queue associated with the socket s that we are poll'ing against, but also 
>>> calls
>
> [useless full-quote removed]
>
>> My reproducer runs on this patch for more than 3 days now without
>> triggering anything anymore.
>
> Since the behaviour of your program is random, using it to "test"
> anything doesn't really provide any insight: It could have been
> executing the same codepath which doesn't happen to trigger any problems
> for all of these three days. Nobody can tell.

Since this "strangely" seems to have been lost in the thread: Here's the
test program showing that the reconnect while in epoll actually causes a
problem (at least I think so):


#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

static int sk, tg0, tg1;

static void *epoller(void *unused)
{
struct epoll_event epev;
int epfd;

epfd = epoll_create(1);
if (epfd == -1) exit(0);

epev.events = EPOLLOUT;
epoll_ctl(epfd, EPOLL_CTL_ADD, sk, );
epoll_wait(epfd, , 1, 5000);

close(sk);

execl("./a.out", "./a.out", (void *)0);

return NULL;
}

int main(void)
{
struct sockaddr_un sun;
pthread_t tid;
int rc;

sun.sun_family = AF_UNIX;

tg0 = socket(AF_UNIX, SOCK_DGRAM, 0);
strncpy(sun.sun_path, "/tmp/tg0", sizeof(sun.sun_path));
unlink(sun.sun_path);
bind(tg0, (struct sockaddr *), sizeof(sun));

tg1 = socket(AF_UNIX, SOCK_DGRAM, 0);
strncpy(sun.sun_path, "/tmp/tg1", sizeof(sun.sun_path));
unlink(sun.sun_path);
bind(tg1, (struct sockaddr *), sizeof(sun));

sk = socket(AF_UNIX, SOCK_DGRAM, 0);
connect(sk, (struct sockaddr *), sizeof(sun));

fcntl(sk, F_SETFL, fcntl(sk, F_GETFL) | O_NONBLOCK);

while ((rc = write(sk, "bla", 3)) != -1);

pthread_create(, NULL, epoller, NULL);

usleep(5);

strncpy(sun.sun_path, "/tmp/tg0", sizeof(sun.sun_path));
connect(sk, (struct sockaddr *), sizeof(sun));
close(tg1);

pause();

return 0;
}
--

And here the other demonstrating the poller not being woken up despite
it could write something:

--
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

int main(void)
{
struct sockaddr_un sun;
struct pollfd pfd;
int tg, sk0, sk1, rc;
char buf[16];

sun.sun_family = AF_UNIX;

tg = socket(AF_UNIX, SOCK_DGRAM, 0);
strncpy(sun.sun_path, "/tmp/tg", sizeof(sun.sun_path));
unlink(sun.sun_path);
bind(tg, (struct sockaddr *), sizeof(sun));

sk0 = socket(AF_UNIX, SOCK_DGRAM, 0);
connect(sk0, (struct sockaddr *), sizeof(sun));

sk1 = socket(AF_UNIX, SOCK_DGRAM, 0);
connect(sk1, (struct sockaddr *), sizeof(sun));

fcntl(sk0, F_SETFL, fcntl(sk0, F_GETFL) | O_NONBLOCK);
fcntl(sk1, F_SETFL, fcntl(sk1, F_GETFL) | O_NONBLOCK);

while (write(sk0, "bla", 3) != -1);

if (fork() == 0) {
pfd.fd = sk1;
pfd.events = POLLOUT;
rc = poll(, 1, -1);

_exit(0);
}

sleep(3);
read(tg, buf, sizeof(buf));
wait();

return 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 net] ppp: don't override sk->sk_state in pppoe_flush_dev()

2015-10-04 Thread Denys Fedoryshchenko

On 2015-10-02 20:54, Guillaume Nault wrote:

On Fri, Oct 02, 2015 at 11:01:45AM +0300, Denys Fedoryshchenko wrote:
Here is similar panic after patch applied (it might be different bug), 
got

over netconsole:

 [126348.617115] CPU: 0 PID: 5254 Comm: accel-pppd Not tainted
4.2.2-build-0087 #2
 [126348.617632] Hardware name: Intel Corporation S2600GZ/S2600GZ, 
BIOS

SE5C600.86B.02.03.0003.041920141333 04/19/2014
 [126348.618193] task: 8817cfbe ti: 8817c635 task.ti:
8817c635
 [126348.618696] RIP: 0010:[]
 [] pppoe_release+0x56/0x142 [pppoe]
 [126348.619306] RSP: 0018:8817c6353e28  EFLAGS: 00010202
 [126348.619601] RAX:  RBX: 8817a92b0400 RCX:

 [126348.620152] RDX: 0001 RSI: fe01 RDI:
8180c18a
 [126348.620715] RBP: 8817c6353e68 R08:  R09:

 [126348.621254] R10: 88173c02b210 R11: 0293 R12:
8817b3c18000
 [126348.621784] R13: 8817b3c18030 R14: 8817967f1140 R15:
8817d226c920
 [126348.622330] FS:  7f9444db9700() GS:8817dee0()
knlGS:
 [126348.622876] CS:  0010 DS:  ES:  CR0: 80050033
 [126348.623202] CR2: 0428 CR3: 0017c70b2000 CR4:
001406f0
 [126348.623760] Stack:
 [126348.624056]  000100200018
 
 0001
 8817b3c18000

 [126348.624925]  a00ec280
 8817b3c18030
 8817967f1140
 8817d226c920

 [126348.625736]  8817c6353e88
 8180820a
 88173c02b200
 0008

 [126348.626533] Call Trace:
 [126348.626873]  [] sock_release+0x1a/0x70
 [126348.627183]  [] sock_close+0xd/0x11
 [126348.627512]  [] __fput+0xdf/0x193
 [126348.627845]  [] fput+0x9/0xb
 [126348.628169]  [] task_work_run+0x78/0x8f
 [126348.628517]  [] do_notify_resume+0x40/0x4e
 [126348.628837]  [] int_signal+0x12/0x17


Ok, so there's another possibility for pppoe_release() to be called 
while
sk->sk_state is PPPOX_{CONNECTED,BOUND,ZOMBIE} but po->pppoe_dev is 
NULL.


I'll check the code to see if I can find any race wrt. po->pppoe_dev
and sk->sk_state settings.

In a previous message, you said you'd try reverting 287f3a943fef
("pppoe: Use workqueue to die properly when a PADT is received") and
related patches. I guess "related patches" means 665a6cd809f4 ("pppoe:
drop pppoe device in pppoe_unbind_sock_work"), right?.
Did these reverts give any successful result?

BTW, please don't top-post.
I am doing just "dirty" patch like this, i cannot certainly remember if 
i was doing git reversal, because
it was a while when i spotted this bug. After that pppoe server is not 
rebooting.


diff -Naur linux-4.2.2-vanilla/drivers/net/ppp/pppoe.c 
linux-4.2.2-changed/drivers/net/ppp/pppoe.c
--- linux-4.2.2-vanilla/drivers/net/ppp/pppoe.c 2015-09-29 
20:38:27.0 +0300
+++ linux-4.2.2-changed/drivers/net/ppp/pppoe.c 2015-10-04 
19:05:55.697732991 +0300

@@ -519,7 +519,7 @@
}

bh_unlock_sock(sk);
-   if (!schedule_work(>proto.pppoe.padt_work))
+// if (!schedule_work(>proto.pppoe.padt_work))
sock_put(sk);
}

@@ -633,7 +633,7 @@

lock_sock(sk);

-   INIT_WORK(>proto.pppoe.padt_work, pppoe_unbind_sock_work);
+// INIT_WORK(>proto.pppoe.padt_work, pppoe_unbind_sock_work);

error = -EINVAL;
if (sp->sa_protocol != PX_PROTO_OE)




--
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: Slow ramp-up for single-stream TCP throughput on 4.2 kernel.

2015-10-04 Thread Ben Greear



On 10/03/2015 06:20 PM, Neal Cardwell wrote:

On Sat, Oct 3, 2015 at 6:46 PM, Ben Greear  wrote:



On 10/03/2015 09:29 AM, Neal Cardwell wrote:


On Fri, Oct 2, 2015 at 8:21 PM, Ben Greear 
wrote:


Gah, seems 'cubic' related.  That is the default tcp cong ctrl
I was using (same in 3.17, for that matter).



There have been recent changes to CUBIC that may account for this. If
you could repeat your test with more instrumentation, eg "nstat", that
would be very helpful.

nstat > /dev/null
# run one test
nstat

Also, if you could take a sender-side tcpdump trace of the test, that
would be very useful (default capture length, grabbing just headers,
is fine).



Here is nstat output:

[root@ben-ota-1 ~]# nstat
#kernel
IpInReceives14507  0.0
IpInDelivers14507  0.0
IpOutRequests   49531  0.0
TcpActiveOpens  3  0.0
TcpPassiveOpens 2  0.0
TcpInSegs   14498  0.0
TcpOutSegs  50269  0.0
UdpInDatagrams  9  0.0
UdpOutDatagrams 1  0.0
TcpExtDelayedACKs   43 0.0
TcpExtDelayedACKLost5  0.0
TcpExtTCPHPHits 4830.0
TcpExtTCPPureAcks   9180.0
TcpExtTCPHPAcks 12758  0.0
TcpExtTCPDSACKOldSent   5  0.0
TcpExtTCPRcvCoalesce49 0.0
TcpExtTCPAutoCorking3  0.0
TcpExtTCPOrigDataSent   49776  0.0
TcpExtTCPHystartTrainDetect 1  0.0
TcpExtTCPHystartTrainCwnd   16 0.0
IpExtInBcastPkts8  0.0
IpExtInOctets   29342740.0
IpExtOutOctets  74817312   0.0
IpExtInBcastOctets  6400.0
IpExtInNoECTPkts14911  0.0
[root@ben-ota-1 ~]#


And, you can find the pcap here:

http://www.candelatech.com/downloads/cubic.pcap.bz2

Let me know if you need anything else.


Thanks! This is very useful. It looks like the sender is sending 3
(and later 4) packets every ~1.5ms for the entirety of the trace. 3
packets per burst is usually a hint that this may be related to TSQ.

This slow-and-steady behavior triggers CUBIC's Hystart Train Detection
to enter congestion avoidance at a cwnd of 16, which probably in turn
leads to slow cwnd growth, since the sending is not cwnd-limited, but
probably TSQ-limited, so cwnd does not grow in congestion avoidance
mode. Probably most of the other congestion control modules do better
because they stay in slow-start, which has a more aggressive criterion
for growing cwnd.

So this is probably at root due to the known issue with an interaction
between the ath10k driver and the following change in 3.19:

   605ad7f tcp: refine TSO autosizing

There has been a lot of discussion about how to address the
TSQ-related issues with this driver. For example, you might consider:

   https://patchwork.ozlabs.org/patch/438322/

But I am not sure of the latest status of that effort. Perhaps someone
on the ath10k list will know.


If the guys in that thread cannot get a patch upstream, then there is
little chance I'd be able to make a difference.

I guess I'll just stop using Cubic.  Any suggestions for another
congestion algorithm to use?  I'd prefer something that worked well
in pretty much any network condition, of course, and it has to work with
ath10k.

We can also run some tests with 1G, 10G, ath10k, ath9k, and in conjunction
with network emulators and various congestion control algorithms.

Thanks,
Ben

--
Ben Greear 
Candela Technologies Inc  http://www.candelatech.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


Re: Slow ramp-up for single-stream TCP throughput on 4.2 kernel.

2015-10-04 Thread Eric Dumazet
On Sun, 2015-10-04 at 10:05 -0700, Ben Greear wrote:

> I guess I'll just stop using Cubic.  Any suggestions for another
> congestion algorithm to use?  I'd prefer something that worked well
> in pretty much any network condition, of course, and it has to work with
> ath10k.
> 
> We can also run some tests with 1G, 10G, ath10k, ath9k, and in conjunction
> with network emulators and various congestion control algorithms.

You could use cubic , but disable or tune HyStart, which is known to be
problematic anyway.

echo  0 >/sys/module/tcp_cubic/parameters/hystart_detect

Or try

echo 40 >/sys/module/tcp_cubic/parameters/hystart_low_window


--
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: Slow ramp-up for single-stream TCP throughput on 4.2 kernel.

2015-10-04 Thread Yuchung Cheng
On Sun, Oct 4, 2015 at 10:28 AM, Eric Dumazet  wrote:
> On Sun, 2015-10-04 at 10:05 -0700, Ben Greear wrote:
>
>> I guess I'll just stop using Cubic.  Any suggestions for another
>> congestion algorithm to use?  I'd prefer something that worked well
>> in pretty much any network condition, of course, and it has to work with
>> ath10k.
>>
>> We can also run some tests with 1G, 10G, ath10k, ath9k, and in conjunction
>> with network emulators and various congestion control algorithms.
>
> You could use cubic , but disable or tune HyStart, which is known to be
> problematic anyway.
>
> echo  0 >/sys/module/tcp_cubic/parameters/hystart_detect
>
> Or try
>
> echo 40 >/sys/module/tcp_cubic/parameters/hystart_low_window
Or if you truly don't want to use cubic, Reno would be my choice b/c
1) Cubic in mid-low BDP behaves like Reno (tcp friendly mode)
2) Reno has several recent stretched-ack fixes which may be useful in wireless

>
>
> --
> 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
--
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 05/14] rocker: implement set settings mode command

2015-10-04 Thread Jiri Pirko
From: Jiri Pirko 

Introduce a helper to ask HW for change of the port mode (world).

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/rocker/rocker_main.c | 32 +++
 1 file changed, 32 insertions(+)

diff --git a/drivers/net/ethernet/rocker/rocker_main.c 
b/drivers/net/ethernet/rocker/rocker_main.c
index c698653..54d2f46 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -1641,6 +1641,30 @@ rocker_cmd_set_port_learning_prep(const struct 
rocker_port *rocker_port,
return 0;
 }
 
+static int
+rocker_cmd_set_port_settings_mode_prep(const struct rocker_port *rocker_port,
+  struct rocker_desc_info *desc_info,
+  void *priv)
+{
+   int mode = *(int *)priv;
+   struct rocker_tlv *cmd_info;
+
+   if (rocker_tlv_put_u16(desc_info, ROCKER_TLV_CMD_TYPE,
+  ROCKER_TLV_CMD_TYPE_SET_PORT_SETTINGS))
+   return -EMSGSIZE;
+   cmd_info = rocker_tlv_nest_start(desc_info, ROCKER_TLV_CMD_INFO);
+   if (!cmd_info)
+   return -EMSGSIZE;
+   if (rocker_tlv_put_u32(desc_info, ROCKER_TLV_CMD_PORT_SETTINGS_PPORT,
+  rocker_port->pport))
+   return -EMSGSIZE;
+   if (rocker_tlv_put_u16(desc_info, ROCKER_TLV_CMD_PORT_SETTINGS_MODE,
+  mode))
+   return -EMSGSIZE;
+   rocker_tlv_nest_end(desc_info, cmd_info);
+   return 0;
+}
+
 static int rocker_cmd_get_port_settings_ethtool(struct rocker_port 
*rocker_port,
struct ethtool_cmd *ecmd)
 {
@@ -1691,6 +1715,14 @@ static int rocker_port_set_learning(struct rocker_port 
*rocker_port,
   NULL, NULL, NULL);
 }
 
+static int rocker_cmd_set_port_settings_mode(struct rocker_port *rocker_port,
+u8 mode)
+{
+   return rocker_cmd_exec(rocker_port, NULL, 0,
+  rocker_cmd_set_port_settings_mode_prep,
+  , NULL, NULL);
+}
+
 static int
 rocker_cmd_flow_tbl_add_ig_port(struct rocker_desc_info *desc_info,
const struct rocker_flow_tbl_entry *entry)
-- 
1.9.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 06/14] rocker: introduce worlds infrastructure

2015-10-04 Thread Jiri Pirko
From: Jiri Pirko 

This is another step on the way to per-world clean cut. Introduce world
ops hooks which each world can implement in world-specific way.
Also introduce world infrastructure including function for port worlds
change.

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/rocker/rocker.h  |  56 
 drivers/net/ethernet/rocker/rocker_main.c | 508 +-
 2 files changed, 563 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/rocker/rocker.h 
b/drivers/net/ethernet/rocker/rocker.h
index 650caa0..d49bc5d 100644
--- a/drivers/net/ethernet/rocker/rocker.h
+++ b/drivers/net/ethernet/rocker/rocker.h
@@ -12,7 +12,11 @@
 #ifndef _ROCKER_H
 #define _ROCKER_H
 
+#include 
 #include 
+#include 
+#include 
+#include 
 
 #include "rocker_hw.h"
 
@@ -24,4 +28,56 @@ struct rocker_desc_info {
dma_addr_t mapaddr;
 };
 
+struct rocker;
+struct rocker_port;
+
+struct rocker_world_ops {
+   const char *kind;
+   size_t priv_size;
+   size_t port_priv_size;
+   u8 mode;
+   int (*init)(struct rocker *rocker, void *priv);
+   void (*fini)(void *priv);
+   int (*port_init)(struct rocker_port *rocker_port, void *priv,
+void *port_priv);
+   void (*port_fini)(void *port_priv);
+   int (*port_open)(void *port_priv);
+   void (*port_stop)(void *port_priv);
+   int (*port_attr_stp_state_set)(void *port_priv, u8 state,
+  struct switchdev_trans *trans);
+   int (*port_attr_bridge_flags_set)(void *port_priv,
+ unsigned long brport_flags,
+ struct switchdev_trans *trans);
+   int (*port_attr_bridge_flags_get)(void *port_priv,
+ unsigned long *p_brport_flags);
+   int (*port_obj_vlan_add)(void *port_priv,
+const struct switchdev_obj_port_vlan *vlan,
+struct switchdev_trans *trans);
+   int (*port_obj_vlan_del)(void *port_priv,
+const struct switchdev_obj_port_vlan *vlan);
+   int (*port_obj_vlan_dump)(void *port_priv,
+ struct switchdev_obj_port_vlan *vlan,
+ switchdev_obj_dump_cb_t *cb);
+   int (*port_obj_fib4_add)(void *port_priv,
+const struct switchdev_obj_ipv4_fib *fib4,
+struct switchdev_trans *trans);
+   int (*port_obj_fib4_del)(void *port_priv,
+const struct switchdev_obj_ipv4_fib *fib4);
+   int (*port_obj_fdb_add)(void *port_priv,
+   const struct switchdev_obj_port_fdb *fdb,
+   struct switchdev_trans *trans);
+   int (*port_obj_fdb_del)(void *port_priv,
+   const struct switchdev_obj_port_fdb *fdb);
+   int (*port_obj_fdb_dump)(void *port_priv,
+struct switchdev_obj_port_fdb *fdb,
+switchdev_obj_dump_cb_t *cb);
+   int (*port_master_linked)(void *port_priv, struct net_device *master);
+   int (*port_master_unlinked)(void *port_priv, struct net_device *master);
+   int (*port_neigh_update)(void *port_priv, struct neighbour *n);
+   int (*port_neigh_destroy)(void *port_priv, struct neighbour *n);
+   int (*port_ev_mac_vlan_seen)(void *port_priv,
+const unsigned char *addr,
+__be16 vlan_id);
+};
+
 #endif
diff --git a/drivers/net/ethernet/rocker/rocker_main.c 
b/drivers/net/ethernet/rocker/rocker_main.c
index 54d2f46..b9b3c9d 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -210,6 +210,8 @@ struct rocker_port {
struct net_device *dev;
struct net_device *bridge_dev;
struct rocker *rocker;
+   struct rocker_world *world;
+   void *world_port_priv;
unsigned int port_number;
u32 pport;
__be16 internal_vlan_id;
@@ -236,6 +238,7 @@ struct rocker {
spinlock_t cmd_ring_lock;   /* for cmd ring accesses */
struct rocker_dma_ring_info cmd_ring;
struct rocker_dma_ring_info event_ring;
+   struct list_head worlds;
DECLARE_HASHTABLE(flow_tbl, 16);
spinlock_t flow_tbl_lock;   /* for flow tbl accesses */
u64 flow_tbl_next_cookie;
@@ -1236,6 +1239,9 @@ static int rocker_port_fdb(struct rocker_port 
*rocker_port,
   struct switchdev_trans *trans,
   const unsigned char *addr,
   __be16 vlan_id, int flags);
+static int rocker_world_port_ev_mac_vlan_seen(struct rocker_port *rocker_port,
+ const 

[patch net-next 09/14] rocker: add rtnl ops for port mode [gs]etting

2015-10-04 Thread Jiri Pirko
From: Jiri Pirko 

Introduce a stub for allowing user to change rocker port world/mode.
This is implemented using rtnl changelink op.

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/rocker/rocker_main.c | 56 +++
 include/uapi/linux/if_link.h  | 11 ++
 2 files changed, 67 insertions(+)

diff --git a/drivers/net/ethernet/rocker/rocker_main.c 
b/drivers/net/ethernet/rocker/rocker_main.c
index 2dda7f9..fb7e8c2 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -5263,6 +5263,61 @@ static void rocker_port_dev_addr_init(struct rocker_port 
*rocker_port)
}
 }
 
+static const struct nla_policy rocker_policy[IFLA_ROCKER_MAX + 1] = {
+   [IFLA_ROCKER_MODE] = { .type = NLA_STRING,
+  .len = ROCKER_MODE_MAX - 1 },
+};
+
+static int rocker_changelink(struct net_device *dev,
+struct nlattr *tb[], struct nlattr *data[])
+{
+   struct rocker_port *rocker_port = netdev_priv(dev);
+   int err;
+
+   if (!data)
+   return 0;
+
+   if (data[IFLA_ROCKER_MODE]) {
+   char mode[ROCKER_MODE_MAX];
+
+   nla_strlcpy(mode, tb[IFLA_ROCKER_MODE], ROCKER_MODE_MAX);
+   err = rocker_port_change_world(rocker_port, mode);
+   if (err)
+   return err;
+   }
+   return 0;
+}
+
+static size_t rocker_get_size(const struct net_device *dev)
+{
+   return nla_total_size(sizeof(u8)) + /* IFLA_ROCKER_MODE */
+  0;
+}
+
+static int rocker_fill_info(struct sk_buff *skb,
+   const struct net_device *dev)
+{
+   struct rocker_port *rocker_port = netdev_priv(dev);
+   const char *mode = rocker_port->world->ops->kind;
+
+   if (nla_put_string(skb, IFLA_ROCKER_MODE, mode))
+   goto nla_put_failure;
+
+   return 0;
+
+nla_put_failure:
+   return -EMSGSIZE;
+}
+
+static struct rtnl_link_ops rocker_link_ops __read_mostly = {
+   .kind   = "rocker",
+   .maxtype= IFLA_ROCKER_MAX,
+   .policy = rocker_policy,
+   .changelink = rocker_changelink,
+   .get_size   = rocker_get_size,
+   .fill_info  = rocker_fill_info,
+};
+
 static int rocker_probe_port(struct rocker *rocker, unsigned int port_number)
 {
const struct pci_dev *pdev = rocker->pdev;
@@ -5285,6 +5340,7 @@ static int rocker_probe_port(struct rocker *rocker, 
unsigned int port_number)
rocker_port_dev_addr_init(rocker_port);
dev->netdev_ops = _port_netdev_ops;
dev->ethtool_ops = _port_ethtool_ops;
+   dev->rtnl_link_ops = _link_ops;
dev->switchdev_ops = _port_switchdev_ops;
netif_napi_add(dev, _port->napi_tx, rocker_port_poll_tx,
   NAPI_POLL_WEIGHT);
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 3a5f263..7da768e 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -416,6 +416,17 @@ enum {
 };
 #define IFLA_GENEVE_MAX(__IFLA_GENEVE_MAX - 1)
 
+/* Rocker section */
+enum {
+   IFLA_ROCKER_UNSPEC,
+   IFLA_ROCKER_MODE,
+   __IFLA_ROCKER_MAX,
+};
+
+#define IFLA_ROCKER_MAX(__IFLA_ROCKER_MAX - 1)
+
+#define ROCKER_MODE_MAX 16
+
 /* Bonding section */
 
 enum {
-- 
1.9.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 10/14] rocker: pass "learning" value as a parameter to rocker_port_set_learning

2015-10-04 Thread Jiri Pirko
From: Jiri Pirko 

Be consistent with the rest of the setting functions, and pass
"learning" as a bool function parameter.

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/rocker/rocker_main.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/rocker/rocker_main.c 
b/drivers/net/ethernet/rocker/rocker_main.c
index fb7e8c2..d9329a7 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -1634,6 +1634,7 @@ rocker_cmd_set_port_learning_prep(const struct 
rocker_port *rocker_port,
  struct rocker_desc_info *desc_info,
  void *priv)
 {
+   bool learning = *(int *)priv;
struct rocker_tlv *cmd_info;
 
if (rocker_tlv_put_u16(desc_info, ROCKER_TLV_CMD_TYPE,
@@ -1646,7 +1647,7 @@ rocker_cmd_set_port_learning_prep(const struct 
rocker_port *rocker_port,
   rocker_port->pport))
return -EMSGSIZE;
if (rocker_tlv_put_u8(desc_info, ROCKER_TLV_CMD_PORT_SETTINGS_LEARNING,
- !!(rocker_port->brport_flags & BR_LEARNING)))
+ learning))
return -EMSGSIZE;
rocker_tlv_nest_end(desc_info, cmd_info);
return 0;
@@ -1719,11 +1720,12 @@ static int rocker_cmd_set_port_settings_mtu(struct 
rocker_port *rocker_port,
 }
 
 static int rocker_port_set_learning(struct rocker_port *rocker_port,
-   struct switchdev_trans *trans)
+   struct switchdev_trans *trans,
+   bool learning)
 {
return rocker_cmd_exec(rocker_port, trans, 0,
   rocker_cmd_set_port_learning_prep,
-  NULL, NULL, NULL);
+  , NULL, NULL);
 }
 
 static int rocker_cmd_set_port_settings_mode(struct rocker_port *rocker_port,
@@ -4608,7 +4610,8 @@ static int rocker_port_brport_flags_set(struct 
rocker_port *rocker_port,
orig_flags = rocker_port->brport_flags;
rocker_port->brport_flags = brport_flags;
if ((orig_flags ^ rocker_port->brport_flags) & BR_LEARNING)
-   err = rocker_port_set_learning(rocker_port, trans);
+   err = rocker_port_set_learning(rocker_port, trans,
+  !!(rocker_port->brport_flags & 
BR_LEARNING));
 
if (switchdev_trans_ph_prepare(trans))
rocker_port->brport_flags = orig_flags;
@@ -5365,7 +5368,8 @@ static int rocker_probe_port(struct rocker *rocker, 
unsigned int port_number)
 
switchdev_port_fwd_mark_set(rocker_port->dev, NULL, false);
 
-   rocker_port_set_learning(rocker_port, NULL);
+   rocker_port_set_learning(rocker_port, NULL,
+!!(rocker_port->brport_flags & BR_LEARNING));
 
err = rocker_port_ig_tbl(rocker_port, NULL, 0);
if (err) {
-- 
1.9.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 13/14] rocker: call rocker_cmd_exec function with "nowait" boolean instead of flags

2015-10-04 Thread Jiri Pirko
From: Jiri Pirko 

No need to push down rocker flags just to check if this is nowait or
not. Let the caller handle that.

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/rocker/rocker_main.c | 38 +++
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/rocker/rocker_main.c 
b/drivers/net/ethernet/rocker/rocker_main.c
index af950ad..3311f5b 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -338,6 +338,11 @@ static bool rocker_port_is_ovsed(const struct rocker_port 
*rocker_port)
 #define ROCKER_OP_FLAG_LEARNED BIT(2)
 #define ROCKER_OP_FLAG_REFRESH BIT(3)
 
+static bool rocker_flags_nowait(int flags)
+{
+   return flags & ROCKER_OP_FLAG_NOWAIT;
+}
+
 static void *__rocker_mem_alloc(struct switchdev_trans *trans, int flags,
size_t size)
 {
@@ -1412,14 +1417,13 @@ typedef int (*rocker_cmd_proc_cb_t)(const struct 
rocker_port *rocker_port,
const struct rocker_desc_info *desc_info,
void *priv);
 
-static int rocker_cmd_exec(struct rocker_port *rocker_port, int flags,
+static int rocker_cmd_exec(struct rocker_port *rocker_port, bool nowait,
   rocker_cmd_prep_cb_t prepare, void *prepare_priv,
   rocker_cmd_proc_cb_t process, void *process_priv)
 {
struct rocker *rocker = rocker_port->rocker;
struct rocker_desc_info *desc_info;
struct rocker_wait *wait;
-   bool nowait = !!(flags & ROCKER_OP_FLAG_NOWAIT);
unsigned long lock_flags;
int err;
 
@@ -1722,7 +1726,7 @@ rocker_cmd_set_port_settings_mode_prep(const struct 
rocker_port *rocker_port,
 static int rocker_cmd_get_port_settings_ethtool(struct rocker_port 
*rocker_port,
struct ethtool_cmd *ecmd)
 {
-   return rocker_cmd_exec(rocker_port, 0,
+   return rocker_cmd_exec(rocker_port, false,
   rocker_cmd_get_port_settings_prep, NULL,
   rocker_cmd_get_port_settings_ethtool_proc,
   ecmd);
@@ -1731,7 +1735,7 @@ static int rocker_cmd_get_port_settings_ethtool(struct 
rocker_port *rocker_port,
 static int rocker_cmd_get_port_settings_macaddr(struct rocker_port 
*rocker_port,
unsigned char *macaddr)
 {
-   return rocker_cmd_exec(rocker_port, 0,
+   return rocker_cmd_exec(rocker_port, false,
   rocker_cmd_get_port_settings_prep, NULL,
   rocker_cmd_get_port_settings_macaddr_proc,
   macaddr);
@@ -1740,7 +1744,7 @@ static int rocker_cmd_get_port_settings_macaddr(struct 
rocker_port *rocker_port,
 static int rocker_cmd_set_port_settings_ethtool(struct rocker_port 
*rocker_port,
struct ethtool_cmd *ecmd)
 {
-   return rocker_cmd_exec(rocker_port, 0,
+   return rocker_cmd_exec(rocker_port, false,
   rocker_cmd_set_port_settings_ethtool_prep,
   ecmd, NULL, NULL);
 }
@@ -1748,7 +1752,7 @@ static int rocker_cmd_set_port_settings_ethtool(struct 
rocker_port *rocker_port,
 static int rocker_cmd_set_port_settings_macaddr(struct rocker_port 
*rocker_port,
unsigned char *macaddr)
 {
-   return rocker_cmd_exec(rocker_port, 0,
+   return rocker_cmd_exec(rocker_port, false,
   rocker_cmd_set_port_settings_macaddr_prep,
   macaddr, NULL, NULL);
 }
@@ -1756,7 +1760,7 @@ static int rocker_cmd_set_port_settings_macaddr(struct 
rocker_port *rocker_port,
 static int rocker_cmd_set_port_settings_mtu(struct rocker_port *rocker_port,
int mtu)
 {
-   return rocker_cmd_exec(rocker_port, 0,
+   return rocker_cmd_exec(rocker_port, false,
   rocker_cmd_set_port_settings_mtu_prep,
   , NULL, NULL);
 }
@@ -1764,7 +1768,7 @@ static int rocker_cmd_set_port_settings_mtu(struct 
rocker_port *rocker_port,
 static int rocker_port_set_learning(struct rocker_port *rocker_port,
bool learning)
 {
-   return rocker_cmd_exec(rocker_port, 0,
+   return rocker_cmd_exec(rocker_port, false,
   rocker_cmd_set_port_learning_prep,
   , NULL, NULL);
 }
@@ -1772,7 +1776,7 @@ static int rocker_port_set_learning(struct rocker_port 
*rocker_port,
 static int rocker_cmd_set_port_settings_mode(struct rocker_port *rocker_port,
 u8 mode)
 {
-   return rocker_cmd_exec(rocker_port, 0,
+   return 

[patch net-next 08/14] rocker: set default world on port probe and clean world on remove

2015-10-04 Thread Jiri Pirko
From: Jiri Pirko 

Currently, there is only OF-DPA world supported in HW. So make this
would the default one for newly created rocker ports.

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/rocker/rocker_main.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/rocker/rocker_main.c 
b/drivers/net/ethernet/rocker/rocker_main.c
index e00c831..2dda7f9 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -2175,6 +2175,7 @@ static struct rocker_world_ops *rocker_world_ops[] = {
 };
 
 #define ROCKER_WORLD_OPS_LEN ARRAY_SIZE(rocker_world_ops)
+#define ROCKER_DEFAULT_WORLD_OPS rocker_world_ops[0]
 
 static const struct rocker_world_ops *__rocker_world_ops_find(const char *kind)
 {
@@ -5242,6 +5243,7 @@ static void rocker_remove_ports(const struct rocker 
*rocker)
continue;
rocker_port_ig_tbl(rocker_port, NULL, ROCKER_OP_FLAG_REMOVE);
unregister_netdev(rocker_port->dev);
+   __rocker_port_change_world(rocker_port, NULL);
free_netdev(rocker_port->dev);
}
kfree(rocker->ports);
@@ -5292,6 +5294,12 @@ static int rocker_probe_port(struct rocker *rocker, 
unsigned int port_number)
 
dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_SG;
 
+   err = __rocker_port_change_world(rocker_port, ROCKER_DEFAULT_WORLD_OPS);
+   if (err) {
+   dev_err(>dev, "failed to set default world\n");
+   goto err_port_change_world;
+   }
+
err = register_netdev(dev);
if (err) {
dev_err(>dev, "register_netdev failed\n");
@@ -5326,6 +5334,8 @@ err_port_ig_tbl:
rocker->ports[port_number] = NULL;
unregister_netdev(dev);
 err_register_netdev:
+   __rocker_port_change_world(rocker_port, NULL);
+err_port_change_world:
free_netdev(dev);
return err;
 }
-- 
1.9.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 04/14] rocker: push tlv processing into separate files

2015-10-04 Thread Jiri Pirko
From: Jiri Pirko 

Carve out TLV processing helpers into separate files.

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/rocker/Makefile  |   2 +-
 drivers/net/ethernet/rocker/rocker.h  |  27 
 drivers/net/ethernet/rocker/rocker_main.c | 222 +-
 drivers/net/ethernet/rocker/rocker_tlv.c  |  54 
 drivers/net/ethernet/rocker/rocker_tlv.h  | 202 +++
 5 files changed, 286 insertions(+), 221 deletions(-)
 create mode 100644 drivers/net/ethernet/rocker/rocker.h
 create mode 100644 drivers/net/ethernet/rocker/rocker_tlv.c
 create mode 100644 drivers/net/ethernet/rocker/rocker_tlv.h

diff --git a/drivers/net/ethernet/rocker/Makefile 
b/drivers/net/ethernet/rocker/Makefile
index 2bed423..47f3492 100644
--- a/drivers/net/ethernet/rocker/Makefile
+++ b/drivers/net/ethernet/rocker/Makefile
@@ -3,4 +3,4 @@
 #
 
 obj-$(CONFIG_ROCKER) += rocker.o
-rocker-y := rocker_main.o
+rocker-y := rocker_main.o rocker_tlv.o
diff --git a/drivers/net/ethernet/rocker/rocker.h 
b/drivers/net/ethernet/rocker/rocker.h
new file mode 100644
index 000..650caa0
--- /dev/null
+++ b/drivers/net/ethernet/rocker/rocker.h
@@ -0,0 +1,27 @@
+/*
+ * drivers/net/ethernet/rocker/rocker.h - Rocker switch device driver
+ * Copyright (c) 2014-2015 Jiri Pirko 
+ * Copyright (c) 2014 Scott Feldman 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _ROCKER_H
+#define _ROCKER_H
+
+#include 
+
+#include "rocker_hw.h"
+
+struct rocker_desc_info {
+   char *data; /* mapped */
+   size_t data_size;
+   size_t tlv_size;
+   struct rocker_desc *desc;
+   dma_addr_t mapaddr;
+};
+
+#endif
diff --git a/drivers/net/ethernet/rocker/rocker_main.c 
b/drivers/net/ethernet/rocker/rocker_main.c
index b555926..c698653 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -40,6 +40,8 @@
 #include 
 
 #include "rocker_hw.h"
+#include "rocker.h"
+#include "rocker_tlv.h"
 
 static const char rocker_driver_name[] = "rocker";
 
@@ -177,14 +179,6 @@ struct rocker_neigh_tbl_entry {
bool ttl_check;
 };
 
-struct rocker_desc_info {
-   char *data; /* mapped */
-   size_t data_size;
-   size_t tlv_size;
-   struct rocker_desc *desc;
-   dma_addr_t mapaddr;
-};
-
 struct rocker_dma_ring_info {
size_t size;
u32 head;
@@ -661,218 +655,6 @@ free_irq:
return err;
 }
 
-/**
- * TLV
- **/
-
-#define ROCKER_TLV_ALIGNTO 8U
-#define ROCKER_TLV_ALIGN(len) \
-   (((len) + ROCKER_TLV_ALIGNTO - 1) & ~(ROCKER_TLV_ALIGNTO - 1))
-#define ROCKER_TLV_HDRLEN ROCKER_TLV_ALIGN(sizeof(struct rocker_tlv))
-
-/*  <--- ROCKER_TLV_HDRLEN ---> <--- ROCKER_TLV_ALIGN(payload) --->
- * +-+- - -+- - - - - - - - - - - - - - -+- - -+
- * | Header  | Pad |   Payload   | Pad |
- * |  (struct rocker_tlv)| ing | | ing |
- * +-+- - -+- - - - - - - - - - - - - - -+- - -+
- *  <--- tlv->len -->
- */
-
-static struct rocker_tlv *rocker_tlv_next(const struct rocker_tlv *tlv,
- int *remaining)
-{
-   int totlen = ROCKER_TLV_ALIGN(tlv->len);
-
-   *remaining -= totlen;
-   return (struct rocker_tlv *) ((char *) tlv + totlen);
-}
-
-static int rocker_tlv_ok(const struct rocker_tlv *tlv, int remaining)
-{
-   return remaining >= (int) ROCKER_TLV_HDRLEN &&
-  tlv->len >= ROCKER_TLV_HDRLEN &&
-  tlv->len <= remaining;
-}
-
-#define rocker_tlv_for_each(pos, head, len, rem)   \
-   for (pos = head, rem = len; \
-rocker_tlv_ok(pos, rem);   \
-pos = rocker_tlv_next(pos, &(rem)))
-
-#define rocker_tlv_for_each_nested(pos, tlv, rem)  \
-   rocker_tlv_for_each(pos, rocker_tlv_data(tlv),  \
-   rocker_tlv_len(tlv), rem)
-
-static int rocker_tlv_attr_size(int payload)
-{
-   return ROCKER_TLV_HDRLEN + payload;
-}
-
-static int rocker_tlv_total_size(int payload)
-{
-   return ROCKER_TLV_ALIGN(rocker_tlv_attr_size(payload));
-}
-
-static int rocker_tlv_padlen(int payload)
-{
-   return rocker_tlv_total_size(payload) - rocker_tlv_attr_size(payload);
-}
-
-static int rocker_tlv_type(const struct rocker_tlv *tlv)
-{
-   return tlv->type;
-}
-
-static void *rocker_tlv_data(const struct rocker_tlv *tlv)
-{
-   return (char *) tlv + ROCKER_TLV_HDRLEN;
-}
-
-static int rocker_tlv_len(const struct rocker_tlv *tlv)
-{
-   return tlv->len - ROCKER_TLV_HDRLEN;
-}
-

[patch net-next 00/14] rocker: add support for multiple worlds

2015-10-04 Thread Jiri Pirko
From: Jiri Pirko 

This patchset allows new rocker worlds to be easily added in future (like eBPF
based one I have been working on). The main part of the patchset is the OF-DPA
carve-out. It resuts in OF-DPA specific file. Clean cut.
The user is able to change rocker port world/mode using rtnl.

Jiri Pirko (14):
  rocker: remove unused rocker_port param from alloc funcs and shorten
their names
  rocker: rename rocker.h to rocker_hw.h
  rocker: rename rocker.c to rocker_main.c
  rocker: push tlv processing into separate files
  rocker: implement set settings mode command
  rocker: introduce worlds infrastructure
  rocker: introduce OF-DPA world skeleton
  rocker: set default world on port probe and clean world on remove
  rocker: add rtnl ops for port mode [gs]etting
  rocker: pass "learning" value as a parameter to
rocker_port_set_learning
  rocker: pre-allocate wait structures during cmd ring init
  rocker: remove trans parameter to rocker_cmd_exec function
  rocker: call rocker_cmd_exec function with "nowait" boolean instead of
flags
  rocker: move OF-DPA stuff into separate file

 drivers/net/ethernet/rocker/Makefile   |1 +
 drivers/net/ethernet/rocker/rocker.c   | 5478 
 drivers/net/ethernet/rocker/rocker.h   |  543 +--
 drivers/net/ethernet/rocker/rocker_hw.h|  467 +++
 drivers/net/ethernet/rocker/rocker_main.c  | 3093 
 drivers/net/ethernet/rocker/rocker_ofdpa.c | 2927 +++
 drivers/net/ethernet/rocker/rocker_tlv.c   |   54 +
 drivers/net/ethernet/rocker/rocker_tlv.h   |  202 +
 include/uapi/linux/if_link.h   |   11 +
 9 files changed, 6847 insertions(+), 5929 deletions(-)
 delete mode 100644 drivers/net/ethernet/rocker/rocker.c
 create mode 100644 drivers/net/ethernet/rocker/rocker_hw.h
 create mode 100644 drivers/net/ethernet/rocker/rocker_main.c
 create mode 100644 drivers/net/ethernet/rocker/rocker_ofdpa.c
 create mode 100644 drivers/net/ethernet/rocker/rocker_tlv.c
 create mode 100644 drivers/net/ethernet/rocker/rocker_tlv.h

-- 
1.9.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 01/14] rocker: remove unused rocker_port param from alloc funcs and shorten their names

2015-10-04 Thread Jiri Pirko
From: Jiri Pirko 

No need to pass rocker_port around to alloc/free rocker functions,
since they now use switchdev_trans for memory management storage.
With the param removal, shorten the name of the functions since they now
has nothing to do with rocker port.

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/rocker/rocker.c | 87 +---
 1 file changed, 42 insertions(+), 45 deletions(-)

diff --git a/drivers/net/ethernet/rocker/rocker.c 
b/drivers/net/ethernet/rocker/rocker.c
index cf91ffc..23c8d1e 100644
--- a/drivers/net/ethernet/rocker/rocker.c
+++ b/drivers/net/ethernet/rocker/rocker.c
@@ -341,9 +341,8 @@ static bool rocker_port_is_ovsed(const struct rocker_port 
*rocker_port)
 #define ROCKER_OP_FLAG_LEARNED BIT(2)
 #define ROCKER_OP_FLAG_REFRESH BIT(3)
 
-static void *__rocker_port_mem_alloc(struct rocker_port *rocker_port,
-struct switchdev_trans *trans, int flags,
-size_t size)
+static void *__rocker_mem_alloc(struct switchdev_trans *trans, int flags,
+   size_t size)
 {
struct switchdev_trans_item *elem = NULL;
gfp_t gfp_flags = (flags & ROCKER_OP_FLAG_NOWAIT) ?
@@ -372,21 +371,19 @@ static void *__rocker_port_mem_alloc(struct rocker_port 
*rocker_port,
return elem ? elem + 1 : NULL;
 }
 
-static void *rocker_port_kzalloc(struct rocker_port *rocker_port,
-struct switchdev_trans *trans, int flags,
-size_t size)
+static void *rocker_kzalloc(struct switchdev_trans *trans, int flags,
+   size_t size)
 {
-   return __rocker_port_mem_alloc(rocker_port, trans, flags, size);
+   return __rocker_mem_alloc(trans, flags, size);
 }
 
-static void *rocker_port_kcalloc(struct rocker_port *rocker_port,
-struct switchdev_trans *trans, int flags,
-size_t n, size_t size)
+static void *rocker_kcalloc(struct switchdev_trans *trans, int flags,
+   size_t n, size_t size)
 {
-   return __rocker_port_mem_alloc(rocker_port, trans, flags, n * size);
+   return __rocker_mem_alloc(trans, flags, n * size);
 }
 
-static void rocker_port_kfree(struct switchdev_trans *trans, const void *mem)
+static void rocker_kfree(struct switchdev_trans *trans, const void *mem)
 {
struct switchdev_trans_item *elem;
 
@@ -426,7 +423,7 @@ static struct rocker_wait *rocker_wait_create(struct 
rocker_port *rocker_port,
 {
struct rocker_wait *wait;
 
-   wait = rocker_port_kzalloc(rocker_port, trans, flags, sizeof(*wait));
+   wait = rocker_kzalloc(trans, flags, sizeof(*wait));
if (!wait)
return NULL;
rocker_wait_init(wait);
@@ -436,7 +433,7 @@ static struct rocker_wait *rocker_wait_create(struct 
rocker_port *rocker_port,
 static void rocker_wait_destroy(struct switchdev_trans *trans,
struct rocker_wait *wait)
 {
-   rocker_port_kfree(trans, wait);
+   rocker_kfree(trans, wait);
 }
 
 static bool rocker_wait_event_timeout(struct rocker_wait *wait,
@@ -2441,7 +2438,7 @@ static int rocker_flow_tbl_add(struct rocker_port 
*rocker_port,
match->cookie = found->cookie;
if (!switchdev_trans_ph_prepare(trans))
hash_del(>entry);
-   rocker_port_kfree(trans, found);
+   rocker_kfree(trans, found);
found = match;
found->cmd = ROCKER_TLV_CMD_TYPE_OF_DPA_FLOW_MOD;
} else {
@@ -2483,13 +2480,13 @@ static int rocker_flow_tbl_del(struct rocker_port 
*rocker_port,
 
spin_unlock_irqrestore(>flow_tbl_lock, lock_flags);
 
-   rocker_port_kfree(trans, match);
+   rocker_kfree(trans, match);
 
if (found) {
err = rocker_cmd_exec(rocker_port, trans, flags,
  rocker_cmd_flow_tbl_del,
  found, NULL, NULL);
-   rocker_port_kfree(trans, found);
+   rocker_kfree(trans, found);
}
 
return err;
@@ -2512,7 +2509,7 @@ static int rocker_flow_tbl_ig_port(struct rocker_port 
*rocker_port,
 {
struct rocker_flow_tbl_entry *entry;
 
-   entry = rocker_port_kzalloc(rocker_port, trans, flags, sizeof(*entry));
+   entry = rocker_kzalloc(trans, flags, sizeof(*entry));
if (!entry)
return -ENOMEM;
 
@@ -2534,7 +2531,7 @@ static int rocker_flow_tbl_vlan(struct rocker_port 
*rocker_port,
 {
struct rocker_flow_tbl_entry *entry;
 
-   entry = rocker_port_kzalloc(rocker_port, trans, flags, sizeof(*entry));
+   entry = rocker_kzalloc(trans, flags, sizeof(*entry));
if (!entry)
return -ENOMEM;
 
@@ -2561,7 +2558,7 @@ static int rocker_flow_tbl_term_mac(struct 

[patch net-next 12/14] rocker: remove trans parameter to rocker_cmd_exec function

2015-10-04 Thread Jiri Pirko
From: Jiri Pirko 

The only purpose of passing this parameter is to check for
prepare phase. The only reason for a failure in that state is if
TLVs don't fit into descriptor. That is highly unlikely and if that
happens, it is a driver bug. So remove this parameter from
rocker_cmd_exec, and check for prepare phase in caller.

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/rocker/rocker_main.c | 65 +--
 1 file changed, 35 insertions(+), 30 deletions(-)

diff --git a/drivers/net/ethernet/rocker/rocker_main.c 
b/drivers/net/ethernet/rocker/rocker_main.c
index 9dd15d7..af950ad 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -1412,8 +1412,7 @@ typedef int (*rocker_cmd_proc_cb_t)(const struct 
rocker_port *rocker_port,
const struct rocker_desc_info *desc_info,
void *priv);
 
-static int rocker_cmd_exec(struct rocker_port *rocker_port,
-  struct switchdev_trans *trans, int flags,
+static int rocker_cmd_exec(struct rocker_port *rocker_port, int flags,
   rocker_cmd_prep_cb_t prepare, void *prepare_priv,
   rocker_cmd_proc_cb_t process, void *process_priv)
 {
@@ -1442,17 +1441,15 @@ static int rocker_cmd_exec(struct rocker_port 
*rocker_port,
return err;
}
 
-   if (!switchdev_trans_ph_prepare(trans))
-   rocker_desc_head_set(rocker, >cmd_ring, desc_info);
+   rocker_desc_head_set(rocker, >cmd_ring, desc_info);
 
spin_unlock_irqrestore(>cmd_ring_lock, lock_flags);
 
if (nowait)
return 0;
 
-   if (!switchdev_trans_ph_prepare(trans))
-   if (!rocker_wait_event_timeout(wait, HZ / 10))
-   return -EIO;
+   if (!rocker_wait_event_timeout(wait, HZ / 10))
+   return -EIO;
 
err = rocker_desc_err(desc_info);
if (err)
@@ -1725,7 +1722,7 @@ rocker_cmd_set_port_settings_mode_prep(const struct 
rocker_port *rocker_port,
 static int rocker_cmd_get_port_settings_ethtool(struct rocker_port 
*rocker_port,
struct ethtool_cmd *ecmd)
 {
-   return rocker_cmd_exec(rocker_port, NULL, 0,
+   return rocker_cmd_exec(rocker_port, 0,
   rocker_cmd_get_port_settings_prep, NULL,
   rocker_cmd_get_port_settings_ethtool_proc,
   ecmd);
@@ -1734,7 +1731,7 @@ static int rocker_cmd_get_port_settings_ethtool(struct 
rocker_port *rocker_port,
 static int rocker_cmd_get_port_settings_macaddr(struct rocker_port 
*rocker_port,
unsigned char *macaddr)
 {
-   return rocker_cmd_exec(rocker_port, NULL, 0,
+   return rocker_cmd_exec(rocker_port, 0,
   rocker_cmd_get_port_settings_prep, NULL,
   rocker_cmd_get_port_settings_macaddr_proc,
   macaddr);
@@ -1743,7 +1740,7 @@ static int rocker_cmd_get_port_settings_macaddr(struct 
rocker_port *rocker_port,
 static int rocker_cmd_set_port_settings_ethtool(struct rocker_port 
*rocker_port,
struct ethtool_cmd *ecmd)
 {
-   return rocker_cmd_exec(rocker_port, NULL, 0,
+   return rocker_cmd_exec(rocker_port, 0,
   rocker_cmd_set_port_settings_ethtool_prep,
   ecmd, NULL, NULL);
 }
@@ -1751,7 +1748,7 @@ static int rocker_cmd_set_port_settings_ethtool(struct 
rocker_port *rocker_port,
 static int rocker_cmd_set_port_settings_macaddr(struct rocker_port 
*rocker_port,
unsigned char *macaddr)
 {
-   return rocker_cmd_exec(rocker_port, NULL, 0,
+   return rocker_cmd_exec(rocker_port, 0,
   rocker_cmd_set_port_settings_macaddr_prep,
   macaddr, NULL, NULL);
 }
@@ -1759,16 +1756,15 @@ static int rocker_cmd_set_port_settings_macaddr(struct 
rocker_port *rocker_port,
 static int rocker_cmd_set_port_settings_mtu(struct rocker_port *rocker_port,
int mtu)
 {
-   return rocker_cmd_exec(rocker_port, NULL, 0,
+   return rocker_cmd_exec(rocker_port, 0,
   rocker_cmd_set_port_settings_mtu_prep,
   , NULL, NULL);
 }
 
 static int rocker_port_set_learning(struct rocker_port *rocker_port,
-   struct switchdev_trans *trans,
bool learning)
 {
-   return rocker_cmd_exec(rocker_port, trans, 0,
+   return rocker_cmd_exec(rocker_port, 0,
   rocker_cmd_set_port_learning_prep,
   , NULL, NULL);
 }
@@ 

[patch net-next 02/14] rocker: rename rocker.h to rocker_hw.h

2015-10-04 Thread Jiri Pirko
From: Jiri Pirko 

Since "rocker.h" file is going to be used for different purpose,
rename the hardware-specific header to "rocker_hw.h".

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/rocker/rocker.c|   2 +-
 drivers/net/ethernet/rocker/rocker.h| 467 
 drivers/net/ethernet/rocker/rocker_hw.h | 467 
 3 files changed, 468 insertions(+), 468 deletions(-)
 delete mode 100644 drivers/net/ethernet/rocker/rocker.h
 create mode 100644 drivers/net/ethernet/rocker/rocker_hw.h

diff --git a/drivers/net/ethernet/rocker/rocker.c 
b/drivers/net/ethernet/rocker/rocker.c
index 23c8d1e..af70084 100644
--- a/drivers/net/ethernet/rocker/rocker.c
+++ b/drivers/net/ethernet/rocker/rocker.c
@@ -39,7 +39,7 @@
 #include 
 #include 
 
-#include "rocker.h"
+#include "rocker_hw.h"
 
 static const char rocker_driver_name[] = "rocker";
 
diff --git a/drivers/net/ethernet/rocker/rocker.h 
b/drivers/net/ethernet/rocker/rocker.h
deleted file mode 100644
index 12490b2..000
--- a/drivers/net/ethernet/rocker/rocker.h
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * drivers/net/ethernet/rocker/rocker.h - Rocker switch device driver
- * Copyright (c) 2014 Jiri Pirko 
- * Copyright (c) 2014 Scott Feldman 
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _ROCKER_H
-#define _ROCKER_H
-
-#include 
-
-/* Return codes */
-enum {
-   ROCKER_OK = 0,
-   ROCKER_ENOENT = 2,
-   ROCKER_ENXIO = 6,
-   ROCKER_ENOMEM = 12,
-   ROCKER_EEXIST = 17,
-   ROCKER_EINVAL = 22,
-   ROCKER_EMSGSIZE = 90,
-   ROCKER_ENOTSUP = 95,
-   ROCKER_ENOBUFS = 105,
-};
-
-#define ROCKER_FP_PORTS_MAX 62
-
-#define PCI_VENDOR_ID_REDHAT   0x1b36
-#define PCI_DEVICE_ID_REDHAT_ROCKER0x0006
-
-#define ROCKER_PCI_BAR0_SIZE   0x2000
-
-/* MSI-X vectors */
-enum {
-   ROCKER_MSIX_VEC_CMD,
-   ROCKER_MSIX_VEC_EVENT,
-   ROCKER_MSIX_VEC_TEST,
-   ROCKER_MSIX_VEC_RESERVED0,
-   __ROCKER_MSIX_VEC_TX,
-   __ROCKER_MSIX_VEC_RX,
-#define ROCKER_MSIX_VEC_TX(port) \
-   (__ROCKER_MSIX_VEC_TX + ((port) * 2))
-#define ROCKER_MSIX_VEC_RX(port) \
-   (__ROCKER_MSIX_VEC_RX + ((port) * 2))
-#define ROCKER_MSIX_VEC_COUNT(portcnt) \
-   (ROCKER_MSIX_VEC_RX((portcnt - 1)) + 1)
-};
-
-/* Rocker bogus registers */
-#define ROCKER_BOGUS_REG0  0x
-#define ROCKER_BOGUS_REG1  0x0004
-#define ROCKER_BOGUS_REG2  0x0008
-#define ROCKER_BOGUS_REG3  0x000c
-
-/* Rocker test registers */
-#define ROCKER_TEST_REG0x0010
-#define ROCKER_TEST_REG64  0x0018  /* 8-byte */
-#define ROCKER_TEST_IRQ0x0020
-#define ROCKER_TEST_DMA_ADDR   0x0028  /* 8-byte */
-#define ROCKER_TEST_DMA_SIZE   0x0030
-#define ROCKER_TEST_DMA_CTRL   0x0034
-
-/* Rocker test register ctrl */
-#define ROCKER_TEST_DMA_CTRL_CLEAR BIT(0)
-#define ROCKER_TEST_DMA_CTRL_FILL  BIT(1)
-#define ROCKER_TEST_DMA_CTRL_INVERTBIT(2)
-
-/* Rocker DMA ring register offsets */
-#define ROCKER_DMA_DESC_ADDR(x)(0x1000 + (x) * 32)  /* 8-byte 
*/
-#define ROCKER_DMA_DESC_SIZE(x)(0x1008 + (x) * 32)
-#define ROCKER_DMA_DESC_HEAD(x)(0x100c + (x) * 32)
-#define ROCKER_DMA_DESC_TAIL(x)(0x1010 + (x) * 32)
-#define ROCKER_DMA_DESC_CTRL(x)(0x1014 + (x) * 32)
-#define ROCKER_DMA_DESC_CREDITS(x) (0x1018 + (x) * 32)
-#define ROCKER_DMA_DESC_RES1(x)(0x101c + (x) * 32)
-
-/* Rocker dma ctrl register bits */
-#define ROCKER_DMA_DESC_CTRL_RESET BIT(0)
-
-/* Rocker DMA ring types */
-enum rocker_dma_type {
-   ROCKER_DMA_CMD,
-   ROCKER_DMA_EVENT,
-   __ROCKER_DMA_TX,
-   __ROCKER_DMA_RX,
-#define ROCKER_DMA_TX(port) (__ROCKER_DMA_TX + (port) * 2)
-#define ROCKER_DMA_RX(port) (__ROCKER_DMA_RX + (port) * 2)
-};
-
-/* Rocker DMA ring size limits and default sizes */
-#define ROCKER_DMA_SIZE_MIN2ul
-#define ROCKER_DMA_SIZE_MAX65536ul
-#define ROCKER_DMA_CMD_DEFAULT_SIZE32ul
-#define ROCKER_DMA_EVENT_DEFAULT_SIZE  32ul
-#define ROCKER_DMA_TX_DEFAULT_SIZE 64ul
-#define ROCKER_DMA_TX_DESC_SIZE256
-#define ROCKER_DMA_RX_DEFAULT_SIZE 64ul
-#define ROCKER_DMA_RX_DESC_SIZE256
-
-/* Rocker DMA descriptor struct */
-struct rocker_desc {
-   u64 buf_addr;
-   u64 cookie;
-   u16 buf_size;
-   u16 tlv_size;
-   u16 resv[5];
-   u16 comp_err;
-};
-
-#define ROCKER_DMA_DESC_COMP_ERR_GEN   BIT(15)
-
-/* Rocker DMA TLV struct */
-struct rocker_tlv {
-   u32 type;
-   u16 len;
-};

[patch net-next 07/14] rocker: introduce OF-DPA world skeleton

2015-10-04 Thread Jiri Pirko
From: Jiri Pirko 

Introduce basis for OF-DPA world file. This is the place where all
OF-DPA related code is going to be moved.

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/rocker/Makefile   |  2 +-
 drivers/net/ethernet/rocker/rocker.h   |  2 ++
 drivers/net/ethernet/rocker/rocker_main.c  |  1 +
 drivers/net/ethernet/rocker/rocker_ofdpa.c | 27 +++
 4 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ethernet/rocker/rocker_ofdpa.c

diff --git a/drivers/net/ethernet/rocker/Makefile 
b/drivers/net/ethernet/rocker/Makefile
index 47f3492..faa36ac 100644
--- a/drivers/net/ethernet/rocker/Makefile
+++ b/drivers/net/ethernet/rocker/Makefile
@@ -3,4 +3,4 @@
 #
 
 obj-$(CONFIG_ROCKER) += rocker.o
-rocker-y := rocker_main.o rocker_tlv.o
+rocker-y := rocker_main.o rocker_tlv.o rocker_ofdpa.o
diff --git a/drivers/net/ethernet/rocker/rocker.h 
b/drivers/net/ethernet/rocker/rocker.h
index d49bc5d..496fe8f 100644
--- a/drivers/net/ethernet/rocker/rocker.h
+++ b/drivers/net/ethernet/rocker/rocker.h
@@ -80,4 +80,6 @@ struct rocker_world_ops {
 __be16 vlan_id);
 };
 
+extern struct rocker_world_ops rocker_ofdpa_ops;
+
 #endif
diff --git a/drivers/net/ethernet/rocker/rocker_main.c 
b/drivers/net/ethernet/rocker/rocker_main.c
index b9b3c9d..e00c831 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -2171,6 +2171,7 @@ static int rocker_cmd_group_tbl_del(const struct 
rocker_port *rocker_port,
  **/
 
 static struct rocker_world_ops *rocker_world_ops[] = {
+   _ofdpa_ops,
 };
 
 #define ROCKER_WORLD_OPS_LEN ARRAY_SIZE(rocker_world_ops)
diff --git a/drivers/net/ethernet/rocker/rocker_ofdpa.c 
b/drivers/net/ethernet/rocker/rocker_ofdpa.c
new file mode 100644
index 000..e048b8b
--- /dev/null
+++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c
@@ -0,0 +1,27 @@
+/*
+ * drivers/net/ethernet/rocker/rocker_ofdpa.c - Rocker switch OF-DPA-like
+ * implementation
+ * Copyright (c) 2014 Scott Feldman 
+ * Copyright (c) 2014-2015 Jiri Pirko 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include "rocker.h"
+
+struct ofdpa {
+};
+
+struct ofdpa_port {
+};
+
+struct rocker_world_ops rocker_ofdpa_ops = {
+   .kind = "ofdpa",
+   .priv_size = sizeof(struct ofdpa),
+   .port_priv_size = sizeof(struct ofdpa_port),
+   .mode = ROCKER_PORT_MODE_OF_DPA,
+};
-- 
1.9.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] brcm80211:Fix locking region in the function brcmf_sdio_sendfromq

2015-10-04 Thread Arend van Spriel

On 10/03/2015 06:19 PM, Nicholas Krause wrote:

This fixes the locking region in the function brcmf_sdio_sendfromq
to properly lock around the call to the function brcmrf_sdio_txpkt
in order to avoid concurrent access issues when calling this
function as stated in the function's comments about the caller
being required to lock around the call to this particular function.

Signed-off-by: Nicholas Krause 
---
  drivers/net/wireless/brcm80211/brcmfmac/sdio.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c 
b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
index f990e3d..da59683 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
@@ -2388,11 +2388,11 @@ static uint brcmf_sdio_sendfromq(struct brcmf_sdio 
*bus, uint maxframes)
break;
__skb_queue_tail(, pkt);
}
-   spin_unlock_bh(>txq_lock);
if (i == 0)
break;


So what if we break here. Seems you need to do unlock if i == 0 here.

Regards,
Arend



ret = brcmf_sdio_txpkt(bus, , SDPCM_DATA_CHANNEL);
+   spin_unlock_bh(>txq_lock);

cnt += i;




--
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] netfilter: remove the nh_scope test in rpfilter_lookup_reverse of ipt_rpfilter

2015-10-04 Thread Florian Westphal
Xin Long  wrote:
> it seems the test is bogus and can be removed to fix this issue.
> 
>   if (dev_match || flags & XT_RPFILTER_LOOSE)
>   return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;
> 
> ipv6 does not have this issue.

netfilter patches should be sent to netfilter-de...@vger.kernel.org

>  #endif
> - if (dev_match || flags & XT_RPFILTER_LOOSE)
> - return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;
>   return dev_match;
>  }

This breaks --loose option, no?

Thats why I earlier suggested to change this to

> - if (dev_match || flags & XT_RPFILTER_LOOSE)
> - return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;
+   return dev_match || flags & XT_RPFILTER_LOOSE;

--
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] bridge: vlan: cleanups & fixes (part 2)

2015-10-04 Thread David Miller
From: Nikolay Aleksandrov 
Date: Fri,  2 Oct 2015 15:05:09 +0200

> This is the second follow-up set with one fix (patch 01) and more cleanups
> (patches 02,03 and 04). These are minor compared to the previous ones and
> should be the last before taking on the optimization changes on the
> fast-path.

Series applied, 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 00/20] bridge: complete netlink support

2015-10-04 Thread David Miller
From: Nikolay Aleksandrov 
Date: Sun,  4 Oct 2015 14:23:27 +0200

> This set completes the bridge device's netlink support and makes it
> possible to view and configure everything that can be configured via
> sysfs. I have tested all of these (setting and getting). There're a few
> longer line warnings about the br_get_size() ifla comments but I think we
> should have them to know what has been accounted for. I have used the sysfs
> interface as a guide of what and how to set. As usual I'll send the
> corresponding iproute2 patches later.
> The bridge port's netlink interface will be completed after this set gets
> applied in some form.
> 
> This patch-set is on top of my last vlan cleanups set:
> http://www.spinics.net/lists/netdev/msg346005.html

Series applied, 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