* Re: [PATCH net-next v4 4/4] ipv6: report sin6_scope_id if sockopt RECVORIGDSTADDR is set
From: YOSHIFUJI Hideaki @ 2013-03-08 16:30 UTC (permalink / raw)
To: netdev, David Miller, YOSHIFUJI Hideaki
In-Reply-To: <20130308120726.GA5174@order.stressinduktion.org>
Hannes Frederic Sowa wrote:
> v4:
> a) unchanged
>
> Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> ---
> net/ipv6/datagram.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
> index b55e70a..4b56cbb 100644
> --- a/net/ipv6/datagram.c
> +++ b/net/ipv6/datagram.c
> @@ -594,7 +594,9 @@ int ip6_datagram_recv_ctl(struct sock *sk, struct msghdr *msg,
> sin6.sin6_addr = ipv6_hdr(skb)->daddr;
> sin6.sin6_port = ports[1];
> sin6.sin6_flowinfo = 0;
> - sin6.sin6_scope_id = 0;
> + sin6.sin6_scope_id =
> + ipv6_iface_scope_id(&ipv6_hdr(skb)->daddr,
> + opt->iif);
>
> put_cmsg(msg, SOL_IPV6, IPV6_ORIGDSTADDR, sizeof(sin6), &sin6);
> }
>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
^ permalink raw reply
* Re: [PATCH net-next v4 3/4] ipv6: stop multicast forwarding to process interface scoped addresses
From: YOSHIFUJI Hideaki @ 2013-03-08 16:30 UTC (permalink / raw)
To: netdev, David Miller, YOSHIFUJI Hideaki
In-Reply-To: <20130308120723.GA5120@order.stressinduktion.org>
Hannes Frederic Sowa wrote:
> v2:
> a) used struct ipv6_addr_props
>
> v3:
> a) reverted changes for ipv6_addr_props
>
> v4:
> a) do not use __ipv6_addr_needs_scope_id
>
> Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> ---
> net/ipv6/ip6_input.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
> index b1876e5..e33fe0a 100644
> --- a/net/ipv6/ip6_input.c
> +++ b/net/ipv6/ip6_input.c
> @@ -281,7 +281,8 @@ int ip6_mc_input(struct sk_buff *skb)
> * IPv6 multicast router mode is now supported ;)
> */
> if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding &&
> - !(ipv6_addr_type(&hdr->daddr) & IPV6_ADDR_LINKLOCAL) &&
> + !(ipv6_addr_type(&hdr->daddr) &
> + (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL)) &&
> likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) {
> /*
> * Okay, we try to forward - split and duplicate
>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
And I think this should go to -stable as well,.
--yoshfuji
^ permalink raw reply
* Re: [PATCH net-next v4 2/4] ipv6: use newly introduced __ipv6_addr_needs_scope_id and ipv6_iface_scope_id
From: YOSHIFUJI Hideaki @ 2013-03-08 16:29 UTC (permalink / raw)
To: netdev, David Miller, YOSHIFUJI Hideaki
In-Reply-To: <20130308120719.GA5074@order.stressinduktion.org>
Hannes Frederic Sowa wrote:
> This patch requires multicast interface-scoped addresses to supply a
> sin6_scope_id. Because the sin6_scope_id is now also correctly used
> in case of interface-scoped multicast traffic this enables one to use
> interface scoped addresses over interfaces which are not targeted by the
> default multicast route (the route has to be put there manually, though).
>
> getsockname() and getpeername() now return the correct sin6_scope_id in
> case of interface-local mc addresses.
>
> v2:
> a) rebased ontop of patch 1/4 (now uses ipv6_addr_props)
>
> v3:
> a) reverted changes for ipv6_addr_props
>
> v4:
> a) unchanged
>
> Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> ---
> net/ipv6/af_inet6.c | 6 +++---
> net/ipv6/datagram.c | 16 +++++++++-------
> net/ipv6/icmp.c | 2 +-
> net/ipv6/inet6_connection_sock.c | 6 ++----
> net/ipv6/raw.c | 9 ++++-----
> net/ipv6/udp.c | 13 +++++++------
> 6 files changed, 26 insertions(+), 26 deletions(-)
>
> diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
> index 6b793bf..f56277f 100644
> --- a/net/ipv6/af_inet6.c
> +++ b/net/ipv6/af_inet6.c
> @@ -323,7 +323,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
> struct net_device *dev = NULL;
>
> rcu_read_lock();
> - if (addr_type & IPV6_ADDR_LINKLOCAL) {
> + if (__ipv6_addr_needs_scope_id(addr_type)) {
> if (addr_len >= sizeof(struct sockaddr_in6) &&
> addr->sin6_scope_id) {
> /* Override any existing binding, if another one
> @@ -471,8 +471,8 @@ int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
>
> sin->sin6_port = inet->inet_sport;
> }
> - if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
> - sin->sin6_scope_id = sk->sk_bound_dev_if;
> + sin->sin6_scope_id = ipv6_iface_scope_id(&sin->sin6_addr,
> + sk->sk_bound_dev_if);
> *uaddr_len = sizeof(*sin);
> return 0;
> }
> diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
> index f5a5478..b55e70a 100644
> --- a/net/ipv6/datagram.c
> +++ b/net/ipv6/datagram.c
> @@ -124,7 +124,7 @@ ipv4_connected:
> goto out;
> }
>
> - if (addr_type&IPV6_ADDR_LINKLOCAL) {
> + if (__ipv6_addr_needs_scope_id(addr_type)) {
> if (addr_len >= sizeof(struct sockaddr_in6) &&
> usin->sin6_scope_id) {
> if (sk->sk_bound_dev_if &&
> @@ -355,18 +355,19 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
> sin->sin6_family = AF_INET6;
> sin->sin6_flowinfo = 0;
> sin->sin6_port = serr->port;
> - sin->sin6_scope_id = 0;
> if (skb->protocol == htons(ETH_P_IPV6)) {
> const struct ipv6hdr *ip6h = container_of((struct in6_addr *)(nh + serr->addr_offset),
> struct ipv6hdr, daddr);
> sin->sin6_addr = ip6h->daddr;
> if (np->sndflow)
> sin->sin6_flowinfo = ip6_flowinfo(ip6h);
> - if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
> - sin->sin6_scope_id = IP6CB(skb)->iif;
> + sin->sin6_scope_id =
> + ipv6_iface_scope_id(&sin->sin6_addr,
> + IP6CB(skb)->iif);
> } else {
> ipv6_addr_set_v4mapped(*(__be32 *)(nh + serr->addr_offset),
> &sin->sin6_addr);
> + sin->sin6_scope_id = 0;
> }
> }
>
> @@ -376,18 +377,19 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
> if (serr->ee.ee_origin != SO_EE_ORIGIN_LOCAL) {
> sin->sin6_family = AF_INET6;
> sin->sin6_flowinfo = 0;
> - sin->sin6_scope_id = 0;
> if (skb->protocol == htons(ETH_P_IPV6)) {
> sin->sin6_addr = ipv6_hdr(skb)->saddr;
> if (np->rxopt.all)
> ip6_datagram_recv_ctl(sk, msg, skb);
> - if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
> - sin->sin6_scope_id = IP6CB(skb)->iif;
> + sin->sin6_scope_id =
> + ipv6_iface_scope_id(&sin->sin6_addr,
> + IP6CB(skb)->iif);
> } else {
> struct inet_sock *inet = inet_sk(sk);
>
> ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,
> &sin->sin6_addr);
> + sin->sin6_scope_id = 0;
> if (inet->cmsg_flags)
> ip_cmsg_recv(msg, skb);
> }
> diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
> index fff5bdd..71b900c 100644
> --- a/net/ipv6/icmp.c
> +++ b/net/ipv6/icmp.c
> @@ -434,7 +434,7 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
> * Source addr check
> */
>
> - if (addr_type & IPV6_ADDR_LINKLOCAL)
> + if (__ipv6_addr_needs_scope_id(addr_type))
> iif = skb->dev->ifindex;
>
> /*
> diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
> index 5f25510..e4311cb 100644
> --- a/net/ipv6/inet6_connection_sock.c
> +++ b/net/ipv6/inet6_connection_sock.c
> @@ -173,10 +173,8 @@ void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr * uaddr)
> sin6->sin6_port = inet_sk(sk)->inet_dport;
> /* We do not store received flowlabel for TCP */
> sin6->sin6_flowinfo = 0;
> - sin6->sin6_scope_id = 0;
> - if (sk->sk_bound_dev_if &&
> - ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
> - sin6->sin6_scope_id = sk->sk_bound_dev_if;
> + sin6->sin6_scope_id = ipv6_iface_scope_id(&sin6->sin6_addr,
> + sk->sk_bound_dev_if);
> }
>
> EXPORT_SYMBOL_GPL(inet6_csk_addr2sockaddr);
> diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
> index 330b5e7..eedff8c 100644
> --- a/net/ipv6/raw.c
> +++ b/net/ipv6/raw.c
> @@ -263,7 +263,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
> if (addr_type != IPV6_ADDR_ANY) {
> struct net_device *dev = NULL;
>
> - if (addr_type & IPV6_ADDR_LINKLOCAL) {
> + if (__ipv6_addr_needs_scope_id(addr_type)) {
> if (addr_len >= sizeof(struct sockaddr_in6) &&
> addr->sin6_scope_id) {
> /* Override any existing binding, if another
> @@ -498,9 +498,8 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk,
> sin6->sin6_port = 0;
> sin6->sin6_addr = ipv6_hdr(skb)->saddr;
> sin6->sin6_flowinfo = 0;
> - sin6->sin6_scope_id = 0;
> - if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
> - sin6->sin6_scope_id = IP6CB(skb)->iif;
> + sin6->sin6_scope_id = ipv6_iface_scope_id(&sin6->sin6_addr,
> + IP6CB(skb)->iif);
> }
>
> sock_recv_ts_and_drops(msg, sk, skb);
> @@ -802,7 +801,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
>
> if (addr_len >= sizeof(struct sockaddr_in6) &&
> sin6->sin6_scope_id &&
> - ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL)
> + __ipv6_addr_needs_scope_id(__ipv6_addr_type(daddr)))
> fl6.flowi6_oif = sin6->sin6_scope_id;
> } else {
> if (sk->sk_state != TCP_ESTABLISHED)
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index 599e1ba6..3ed57ec 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -450,15 +450,16 @@ try_again:
> sin6->sin6_family = AF_INET6;
> sin6->sin6_port = udp_hdr(skb)->source;
> sin6->sin6_flowinfo = 0;
> - sin6->sin6_scope_id = 0;
>
> - if (is_udp4)
> + if (is_udp4) {
> ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,
> &sin6->sin6_addr);
> - else {
> + sin6->sin6_scope_id = 0;
> + } else {
> sin6->sin6_addr = ipv6_hdr(skb)->saddr;
> - if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
> - sin6->sin6_scope_id = IP6CB(skb)->iif;
> + sin6->sin6_scope_id =
> + ipv6_iface_scope_id(&sin6->sin6_addr,
> + IP6CB(skb)->iif);
> }
>
> }
> @@ -1118,7 +1119,7 @@ do_udp_sendmsg:
>
> if (addr_len >= sizeof(struct sockaddr_in6) &&
> sin6->sin6_scope_id &&
> - ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL)
> + __ipv6_addr_needs_scope_id(__ipv6_addr_type(daddr)))
> fl6.flowi6_oif = sin6->sin6_scope_id;
> } else {
> if (sk->sk_state != TCP_ESTABLISHED)
>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>dave
^ permalink raw reply
* Re: [PATCH net-next v4 1/4] ipv6: introdcue __ipv6_addr_needs_scope_id and ipv6_iface_scope_id helper functions
From: YOSHIFUJI Hideaki @ 2013-03-08 16:28 UTC (permalink / raw)
To: netdev, David Miller; +Cc: YOSHIFUJI Hideaki
In-Reply-To: <20130308120716.GA5028@order.stressinduktion.org>
Hannes Frederic Sowa wrote:
> __ipv6_addr_needs_scope_id checks if an ipv6 address needs to supply
> a 'sin6_scope_id != 0'. 'sin6_scope_id != 0' was enforced in case
> of link-local addresses. To support interface-local multicast these
> checks had to be enhanced and are now consolidated into these new helper
> functions.
>
> v2:
> a) migrated to struct ipv6_addr_props
>
> v3:
> a) reverted changes for ipv6_addr_props
> b) test for address type instead of comparing scope
>
> v4:
> a) unchanged
>
> Suggested-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> ---
> include/net/ipv6.h | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/include/net/ipv6.h b/include/net/ipv6.h
> index 988c9f2..42ef6ab 100644
> --- a/include/net/ipv6.h
> +++ b/include/net/ipv6.h
> @@ -320,6 +320,18 @@ static inline int ipv6_addr_src_scope(const struct in6_addr *addr)
> return __ipv6_addr_src_scope(__ipv6_addr_type(addr));
> }
>
> +static inline bool __ipv6_addr_needs_scope_id(int type)
> +{
> + return type & IPV6_ADDR_LINKLOCAL ||
> + (type & IPV6_ADDR_MULTICAST &&
> + (type & (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL)));
> +}
> +
> +static inline __u32 ipv6_iface_scope_id(const struct in6_addr *addr, int iface)
> +{
> + return __ipv6_addr_needs_scope_id(__ipv6_addr_type(addr)) ? iface : 0;
> +}
> +
> static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2)
> {
> return memcmp(a1, a2, sizeof(struct in6_addr));
>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
^ permalink raw reply
* Re: [net-next.git 0/9] stmmac: update to March_2013 (adding PTP & RGMII/SGMII)
From: David Miller @ 2013-03-08 16:22 UTC (permalink / raw)
To: peppe.cavallaro; +Cc: netdev, bh74.an, rayagond
In-Reply-To: <51399048.3070505@st.com>
From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Fri, 08 Mar 2013 08:16:24 +0100
> Hello David
>
> On 3/7/2013 9:34 PM, David Miller wrote:
>> From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
>> Date: Thu, 7 Mar 2013 11:50:10 +0100
>>
>>> The PTP support is quite intrusive because it needs to support the
>>> extended
>>> descriptors used for saving the HW timestamps.
>>> These are available in new chip generations, only.
>>> So we have actually found useful to use some Kconfig options to
>>> surround PTP and extended descriptor support. This approach helped on
>>> old platform (embeeded system) where PTP is not supported and where we
>>> do not want to pay extra code and check in critical rx/tx paths.
>>
>> I would prefer run time handling of all of this.
>>
>> You do not need to put extra checks in the fast paths, instead you
>> have different methods that get hooked up into the netdev_ops
>> based upon chip capabilities/features/mode.
...
> Welcome advice.
Exactly what I told you above. You have two sets of routines,
one that deal with the older descriptors and one set that deals
with the new descriptors that can do PTP.
And you hook up different interrupt handler, NAPI poll, and
netdev_ops based upon the chip's capabilities.
You need no runtime testing, only a test a probe time to setup
things up properly.
What is so hard about this to understand?
^ permalink raw reply
* Re: [PATCH RFC] ipv6: use stronger hash for reassembly queue hash table
From: Hannes Frederic Sowa @ 2013-03-08 16:18 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, yoshfuji
In-Reply-To: <1362759310.15793.244.camel@edumazet-glaptop>
On Fri, Mar 08, 2013 at 08:15:10AM -0800, Eric Dumazet wrote:
> On Fri, 2013-03-08 at 16:54 +0100, Hannes Frederic Sowa wrote:
>
> > Btw. did s.o. have a look at skb->rxhash? I just started looking after
> > its many users but perhaps someone did this job already.
>
> You mean for IPv6 ?
Yes, because of the usage of ipv6_addr_hash in skb_flow_dissect.
> Most of us use the rxhash provided by the NIC, our software fallback is
> a best effort as well for RPS or some qdisc.
>
> If some hacker specifically cook packets hashing to same rxhash, thats
> fine.
Ok, good to know. Thanks!
^ permalink raw reply
* Re: [PATCH RFC] ipv6: use stronger hash for reassembly queue hash table
From: Eric Dumazet @ 2013-03-08 16:15 UTC (permalink / raw)
To: Hannes Frederic Sowa; +Cc: netdev, yoshfuji
In-Reply-To: <20130308155404.GE28531@order.stressinduktion.org>
On Fri, 2013-03-08 at 16:54 +0100, Hannes Frederic Sowa wrote:
> Btw. did s.o. have a look at skb->rxhash? I just started looking after
> its many users but perhaps someone did this job already.
You mean for IPv6 ?
Most of us use the rxhash provided by the NIC, our software fallback is
a best effort as well for RPS or some qdisc.
If some hacker specifically cook packets hashing to same rxhash, thats
fine.
^ permalink raw reply
* Re: [PATCH RFC] ipv6: use stronger hash for reassembly queue hash table
From: Hannes Frederic Sowa @ 2013-03-08 15:54 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, yoshfuji
In-Reply-To: <1362756219.15793.240.camel@edumazet-glaptop>
On Fri, Mar 08, 2013 at 07:23:39AM -0800, Eric Dumazet wrote:
> On Fri, 2013-03-08 at 16:08 +0100, Hannes Frederic Sowa wrote:
> > On Fri, Mar 08, 2013 at 06:53:06AM -0800, Eric Dumazet wrote:
> > > No matter how you hash, a hacker can easily fill your defrag unit with
> > > not complete datagrams, so what's the point ?
> >
> > I want to harden reassembly logic against all fragments being put in
> > the same hash bucket because of malicious traffic and thus creating
> > long list traversals in the fragment queue hash table.
>
> Note that the long traversal was a real issue with TCP (thats why I
> introduced ipv6_addr_jhash()), as a single ehash slot could contains
> thousand of sockets.
>
> But with fragments, we should just limit the depth of any particular
> slot, and drop above a particular threshold.
>
> reassembly is a best effort mechanism, better make sure it doesnt use
> all our cpu cycles.
Hm, I have to think about it, especially because it is used in the netfilter
code. There could be some fairness issues if packets get dropped in netfilter
if reassembly could not be performed. I'll check this.
Btw. did s.o. have a look at skb->rxhash? I just started looking after
its many users but perhaps someone did this job already.
^ permalink raw reply
* Re: [PATCH net-next] bond: add support to read speed and duplex via ethtool
From: Andy Gospodarek @ 2013-03-08 15:35 UTC (permalink / raw)
To: Glen Turner; +Cc: netdev
In-Reply-To: <58A138EA-ADB5-4DFC-AA35-2D0E578483FD@gdt.id.au>
On Thu, Mar 07, 2013 at 10:41:57PM +1030, Glen Turner wrote:
> Hi Andy,
>
> How does this relate to the bandwidth metric for an interface as seen by routing daemons?
>
> An interface bandwidth as seen by routing daemons cannot change once carrier is up. Otherwise flaps of a link within a bond will cause routing protocol flaps; which they do not do at the moment, and which would be deeply, deeply undesirable.
>
That is a great point. Are you saying that quagga or other
outside-the-kernel routing daemons actually query ethtool settings to
determine link speed and weight? How do they handle interfaces like
bonds and vlans that do not return a speed?
> I'd just add the maximum possible bandwidth of the interfaces, rather than the negotiated value. That's enough to get SNMP graphs working reasonably. It's not clear that a SNMP grapher will have reasonable behaviour with a changing bandwidth -- you'll end up with graphs where absolute throughput appears to fall, but what has happened is that a link has come online and utilisation has fallen. That's not a useful graph, as it's very much the "shape" of the traffic which is useful.
>
> Checked IOS and JUNOS. In the absence of nerd knobs, both report the sum of the maximum possible interface bandwidths. So that's probably the behaviour SNMP graphing tools expect in any case.
>
Do they look at the maximum capabilities of the interfaces to determine
this maximum speed? Right now bonding just queries the speed that is
actually connected. I'm not sure I want to get into the business of
reporting possible maximum bandwidth as that seems invalid -- even when
considering the routing case.
^ permalink raw reply
* Re: [patch net-next v5 10/11] tbf: take into account gso skbs
From: Jiri Pirko @ 2013-03-08 15:23 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, davem, edumazet, jhs, kuznet, j.vimal
In-Reply-To: <1361293287.19353.149.camel@edumazet-glaptop>
Tue, Feb 19, 2013 at 06:01:27PM CET, eric.dumazet@gmail.com wrote:
>On Tue, 2013-02-19 at 17:46 +0100, Jiri Pirko wrote:
>
>> About the gso_segment, do you see any cons doing that on enqueue path
>> rather than dequeue?
>>
>
>It would be fine, and could be done in core stack instead of qdisc.
>
So you mean for example in tcp code? the maximum possible size would be
propagated from set qdiscs up to the tcp code?
I'm not sure how exactly do that.
>netif_skb_features() for example has the following (incomplete) check
>
>if (skb_shinfo(skb)->gso_segs > skb->dev->gso_max_segs)
> features &= ~NETIF_F_GSO_MASK;
Why this is incomplete?
>
>We do have a dev->gso_max_size, but its currently used in TCP stack to
>size the skbs built in tcp_sendmsg().
Where exactly in tcp_sendmsg() this is? I found dev->gso_max_size is copied to
sk_gso_max_size in tcp_v4_connect->sk_setup_caps.
>
>In a forwarding workload, it seems we dont use/check gso_max_size.
Yep, that would require to do the segmentation in enqueue anyway. Maybe
I can implement segmentation in enqueue path first and provide tcp
optimalization after that. What do you think?
Thanks!
Jiri
^ permalink raw reply
* Re: [PATCH RFC] ipv6: use stronger hash for reassembly queue hash table
From: Eric Dumazet @ 2013-03-08 15:23 UTC (permalink / raw)
To: Hannes Frederic Sowa; +Cc: netdev, yoshfuji
In-Reply-To: <20130308150831.GD28531@order.stressinduktion.org>
On Fri, 2013-03-08 at 16:08 +0100, Hannes Frederic Sowa wrote:
> On Fri, Mar 08, 2013 at 06:53:06AM -0800, Eric Dumazet wrote:
> > No matter how you hash, a hacker can easily fill your defrag unit with
> > not complete datagrams, so what's the point ?
>
> I want to harden reassembly logic against all fragments being put in
> the same hash bucket because of malicious traffic and thus creating
> long list traversals in the fragment queue hash table.
Note that the long traversal was a real issue with TCP (thats why I
introduced ipv6_addr_jhash()), as a single ehash slot could contains
thousand of sockets.
But with fragments, we should just limit the depth of any particular
slot, and drop above a particular threshold.
reassembly is a best effort mechanism, better make sure it doesnt use
all our cpu cycles.
^ permalink raw reply
* Re: [RFC PATCH v2 net-next 0/3] Allow bridge to function in non-promisc mode
From: Vlad Yasevich @ 2013-03-08 15:17 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, bridge
In-Reply-To: <20130307214304.25e7784e@nehalam.linuxnetplumber.net>
On 03/08/2013 12:43 AM, Stephen Hemminger wrote:
> On Thu, 7 Mar 2013 16:28:45 -0500
> Vlad Yasevich <vyasevic@redhat.com> wrote:
>
>> The series adds an ability to configure the bridge into a non-primiscuous
>> mode. Instead, it provides the ability to identitfy some set of bridge
>> ports as uplinks and allows for MAC addresses to be programmed onto
>> those ports. In case the port hardware does not support mac filter,
>> that port will be placed in promiscuous mode.
>>
>> Default bridge operation continues to remain as "promiscuous". The new
>> functionality has to be enabled via sysfs (similar to other bridge extensions).
>>
>> The uplink mode is implemented as a flag on a bridge port. The api to
>> change that flag follows the existing api to enable/disable other existing
>> flags.
>>
>> All comments are welcome.
>>
>
> Can we make this a one step process and less visible to the user.
> If user defines an uplink device, and the uplink device is capable of filtering
> (and what ever other pre-conditions people can think of), then the bridge will
> transparently switch to uplink/non-promisc mode. This can also be used to trigger
> edge only mode in RSTP in the future.
>
> Less knobs.
>
Ok. Let me see what I can do.
Thanks
-vlad
^ permalink raw reply
* Re: [PATCH RFC] ipv6: use stronger hash for reassembly queue hash table
From: Hannes Frederic Sowa @ 2013-03-08 15:08 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, yoshfuji
In-Reply-To: <1362754386.15793.226.camel@edumazet-glaptop>
On Fri, Mar 08, 2013 at 06:53:06AM -0800, Eric Dumazet wrote:
> No matter how you hash, a hacker can easily fill your defrag unit with
> not complete datagrams, so what's the point ?
I want to harden reassembly logic against all fragments being put in
the same hash bucket because of malicious traffic and thus creating
long list traversals in the fragment queue hash table.
I totally agree that fragments should be avoided if possible.
Thanks,
Hannes
^ permalink raw reply
* Re: [PATCH 1/3] driver: net: ethernet: cpsw: implement ethtool get/set phy setting
From: Mugunthan V N @ 2013-03-08 15:08 UTC (permalink / raw)
To: Peter Korsgaard
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Ben Hutchings,
linux-omap-u79uwXL29TY76Z2rM5mHXA, davem-fT/PcQaiUtIeIZ0/mPfg9Q
In-Reply-To: <87ip523pc3.fsf-D6SC8u56vOOJDPpyT6T3/w@public.gmane.org>
On 3/8/2013 8:34 PM, Peter Korsgaard wrote:
>>>>>> "Ben" == Ben Hutchings <bhutchings-s/n/eUQHGBpZroRs9YW3xA@public.gmane.org> writes:
> Hi,
>
> Ben> The 'active slave' property would also be needed for the SIOCGMIIPHY
> Ben> ioctl and not just ethtool. But it's really quite arbitrary. Perhaps
> Ben> each of them should have their own net device (as with DSA).
>
> Indeed, I think that would simplify all of this quite a bit.
>
I will update this in the next patch series
Regards
Mugunthan V N
^ permalink raw reply
* Re: [PATCH 1/3] driver: net: ethernet: cpsw: implement ethtool get/set phy setting
From: Mugunthan V N @ 2013-03-08 15:07 UTC (permalink / raw)
To: Ben Hutchings
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-omap-u79uwXL29TY76Z2rM5mHXA, davem-fT/PcQaiUtIeIZ0/mPfg9Q
In-Reply-To: <1362754401.3248.8.camel-/LGg1Z1CJKReKY3V0RtoKmatzQS1i7+A3tAM5lWOD0I@public.gmane.org>
On 3/8/2013 8:23 PM, Ben Hutchings wrote:
> On Fri, 2013-03-08 at 12:53 +0530, Mugunthan V N wrote:
>> On 3/8/2013 1:29 AM, Ben Hutchings wrote:
>>> On Thu, 2013-03-07 at 14:24 +0100, Peter Korsgaard wrote:
>>>>>>>>> "M" == Mugunthan V N <mugunthanvnm-l0cyMroinI0@public.gmane.org> writes:
>>>> M> This patch implements get/set of the phy settings via ethtool apis
>>>> M> Signed-off-by: Mugunthan V N <mugunthanvnm-l0cyMroinI0@public.gmane.org>
>>>> M> ---
>>>> M> Documentation/devicetree/bindings/net/cpsw.txt | 3 +++
>>>> M> drivers/net/ethernet/ti/cpsw.c | 32 ++++++++++++++++++++++++
>>>> M> include/linux/platform_data/cpsw.h | 1 +
>>>> M> 3 files changed, 36 insertions(+)
>>>>
>>>> M> diff --git a/Documentation/devicetree/bindings/net/cpsw.txt b/Documentation/devicetree/bindings/net/cpsw.txt
>>>> M> index ecfdf75..8d61300 100644
>>>> M> --- a/Documentation/devicetree/bindings/net/cpsw.txt
>>>> M> +++ b/Documentation/devicetree/bindings/net/cpsw.txt
>>>> M> @@ -20,6 +20,7 @@ Required properties:
>>>> M> - cpts_clock_shift : Denominator to convert input clock ticks into nanoseconds
>>>> M> - phy_id : Specifies slave phy id
>>>> M> - mac-address : Specifies slave MAC address
>>>> M> +- ethtool-active-slave : Specifies the slave to use for ethtool command
>>>>
>>>> That again sounds like something Linux specific rather than a hardware
>>>> property.
>>> Yes, indeed. Isn't it redundant with the phy_id?
>>>
>>> Ben.
>> phy_id is part of slave data and will be present for both the slaves.
>> so phy_id cannot be used for get/set phy setting until phy framework
>> allows to change settings without going through eth interface.
> Now I've looked at the examples in this file, I think I see what you're
> getting at. What confused me is that you're adding to a single list of
> properties without a proper distinction of which devices they are
> applied to. It really ought to be properly divided between switch and
> 'slave' properties.
Will fix this in next patch series.
> The 'active slave' property would also be needed for the SIOCGMIIPHY
> ioctl and not just ethtool. But it's really quite arbitrary. Perhaps
> each of them should have their own net device (as with DSA).
But if we have net device for each of the slaves then it is dual EMAC
which will kill
hardware switching functionality. To achieve switching bridge has to be
done and
there will be a performance drop as well.
As Peter Korsgaard mentioned we need to have infrastructure to handle CPSW
kind of hardware.
Regards
Mugunthan V N
^ permalink raw reply
* Re: TCP small packets throughput and multiqueue virtio-net
From: Eric Dumazet @ 2013-03-08 15:05 UTC (permalink / raw)
To: Jason Wang
Cc: netdev, Michael S. Tsirkin, KVM, David Miller, Stephen Hemminger,
jpirko
In-Reply-To: <5139840A.6020204@redhat.com>
On Fri, 2013-03-08 at 14:24 +0800, Jason Wang wrote:
> Hello all:
>
> I meet an issue when testing multiqueue virtio-net. When I testing guest
> small packets stream sending performance with netperf. I find an
> regression of multiqueue. When I run 2 sessions of TCP_STREAM test with
> 1024 byte from guest to local host, I get following result:
>
> 1q result: 3457.64
> 2q result: 7781.45
>
> Statistics shows that: compared with one queue, multiqueue tends to send
> much more but smaller packets. Tcpdump shows single queue has a much
> higher possibility to produce a 64K gso packet compared to multiqueue.
> More but smaller packets will cause more vmexits and interrupts which
> lead a degradation on throughput.
>
> Then problem only exist for small packets sending. When I test with
> larger size, multiqueue will gradually outperfrom single queue. And
> multiqueue also outperfrom in both TCP_RR and pktgen test (even with
> small packets). The problem disappear when I turn off both gso and tso.
>
This makes little sense to me : TCP_RR workload (assuming one byte
payload) cannot use GSO or TSO anyway. Same for pktgen as it uses UDP.
> I'm not sure whether it's a bug or expected since anyway we get
> improvement on latency. And if it's a bug, I suspect it was related to
> TCP GSO batching algorithm who tends to batch less in this situation. (
> Jiri Pirko suspect it was the defect of virtio-net driver, but I didn't
> find any obvious clue on this). After some experiments, I find the it
> maybe related to tcp_tso_should_defer(), after
> 1) change the tcp_tso_win_divisor to 1
> 2) the following changes
> the throughput were almost the same (but still a little worse) as single
> queue:
>
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index fd0cea1..dedd2a6 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -1777,10 +1777,12 @@ static bool tcp_tso_should_defer(struct sock
> *sk, struct sk_buff *skb)
>
> limit = min(send_win, cong_win);
>
> +#if 0
> /* If a full-sized TSO skb can be sent, do it. */
> if (limit >= min_t(unsigned int, sk->sk_gso_max_size,
> sk->sk_gso_max_segs * tp->mss_cache))
> goto send_now;
> +#endif
>
> /* Middle in queue won't get any more data, full sendable
> already? */
> if ((skb != tcp_write_queue_tail(sk)) && (limit >= skb->len))
>
> Git history shows this check were added for both westwood and fasttcp,
> I'm not familiar with tcp but looks like we can easily hit this check
> under when multiqueue is enabled for virtio-net. Maybe I was wrong but I
> wonder whether we can still do some batching here.
>
> Any comments, thoughts are welcomed.
>
Well, the point is : if your app does write(1024) bytes, thats probably
because it wants small packets from the very beginning. (See the TCP
PUSH flag ?)
If the transport is slow, TCP stack will automatically collapse several
write into single skbs (assuming TSO or GSO is on), and you'll see big
GSO packets with tcpdump [1]. So TCP will help you to get less overhead
in this case.
But if transport is fast, you'll see small packets, and thats good for
latency.
So my opinion is : its exactly behaving as expected.
If you want bigger packets either :
- Make the application doing big write()
- Slow the vmexit ;)
[1] GSO fools tcpdump : Actual packets sent to the wire are not 'big
packets', but they hit dev_hard_start_xmit() as GSO packets.
^ permalink raw reply
* Re: [PATCH 1/3] driver: net: ethernet: cpsw: implement ethtool get/set phy setting
From: Peter Korsgaard @ 2013-03-08 15:04 UTC (permalink / raw)
To: Ben Hutchings
Cc: Mugunthan V N, netdev, davem, devicetree-discuss, linux-omap,
b-cousson, paul
In-Reply-To: <1362754401.3248.8.camel@bwh-desktop.uk.solarflarecom.com>
>>>>> "Ben" == Ben Hutchings <bhutchings@solarflare.com> writes:
Hi,
Ben> The 'active slave' property would also be needed for the SIOCGMIIPHY
Ben> ioctl and not just ethtool. But it's really quite arbitrary. Perhaps
Ben> each of them should have their own net device (as with DSA).
Indeed, I think that would simplify all of this quite a bit.
--
Bye, Peter Korsgaard
^ permalink raw reply
* Re: [PATCH net-next] bond: add support to read speed and duplex via ethtool
From: Andy Gospodarek @ 2013-03-08 14:57 UTC (permalink / raw)
To: Ben Hutchings; +Cc: netdev
In-Reply-To: <1362601037.3126.20.camel@bwh-desktop.uk.solarflarecom.com>
On Wed, Mar 06, 2013 at 08:17:17PM +0000, Ben Hutchings wrote:
> On Wed, 2013-03-06 at 13:39 -0500, Andy Gospodarek wrote:
> > This patch adds support for the get_settings ethtool op to the bonding
> > driver. This was motivated by users who wanted to get the speed of the
> > bond and compare that against throughput to understand utilization.
> > The behavior before this patch was added was problematic when computing
> > line utilization after trying to get link-speed and throughput via SNMP.
> >
> > The general plan for computing link-speed was as follows:
> >
> > Mode Formula
> > ---- -------
> > active-backup speed of current active slave
> > broadcast speed of first slave with known speed
> > all other modes aggregate speed of all slaves with known speed
> >
> > Output from ethtool looks like this for a round-robin bond:
> >
> > Settings for bond0:
> > Supported ports: [ ]
> > Supported link modes: Not reported
> > Supported pause frame use: No
> > Supports auto-negotiation: No
> > Advertised link modes: Not reported
> > Advertised pause frame use: No
> > Advertised auto-negotiation: No
> > Speed: 11000Mb/s
> > Duplex: Full
> > Port: Twisted Pair
>
> I think port should be PORT_OTHER. Or perhaps you could ask the current
> slave, if using active-backup. (Tricky since you can't do that while
> holding the bond rwlock.)
>
> > PHYAD: 0
>
> I don't think we have a properly defined 'not applicable' value for
> phy_address, though I've used 0xff in sfc.
>
[...]
>
> You must use ethtool_cmd_speed_set() instead of assigning just
> ecmd->speed.
>
> (bonding appears to be the first driver that could report a value >
> 65535.)
>
Thanks for the review, Ben. I'll take a look at these suggestions for v2.
>
> --
> Ben Hutchings, Staff Engineer, Solarflare
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 1/3] driver: net: ethernet: cpsw: implement ethtool get/set phy setting
From: Ben Hutchings @ 2013-03-08 14:53 UTC (permalink / raw)
To: Mugunthan V N
Cc: Peter Korsgaard, netdev, davem, devicetree-discuss, linux-omap,
b-cousson, paul
In-Reply-To: <513991E6.5080400@ti.com>
On Fri, 2013-03-08 at 12:53 +0530, Mugunthan V N wrote:
> On 3/8/2013 1:29 AM, Ben Hutchings wrote:
> > On Thu, 2013-03-07 at 14:24 +0100, Peter Korsgaard wrote:
> >>>>>>> "M" == Mugunthan V N <mugunthanvnm@ti.com> writes:
> >> M> This patch implements get/set of the phy settings via ethtool apis
> >> M> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> >> M> ---
> >> M> Documentation/devicetree/bindings/net/cpsw.txt | 3 +++
> >> M> drivers/net/ethernet/ti/cpsw.c | 32 ++++++++++++++++++++++++
> >> M> include/linux/platform_data/cpsw.h | 1 +
> >> M> 3 files changed, 36 insertions(+)
> >>
> >> M> diff --git a/Documentation/devicetree/bindings/net/cpsw.txt b/Documentation/devicetree/bindings/net/cpsw.txt
> >> M> index ecfdf75..8d61300 100644
> >> M> --- a/Documentation/devicetree/bindings/net/cpsw.txt
> >> M> +++ b/Documentation/devicetree/bindings/net/cpsw.txt
> >> M> @@ -20,6 +20,7 @@ Required properties:
> >> M> - cpts_clock_shift : Denominator to convert input clock ticks into nanoseconds
> >> M> - phy_id : Specifies slave phy id
> >> M> - mac-address : Specifies slave MAC address
> >> M> +- ethtool-active-slave : Specifies the slave to use for ethtool command
> >>
> >> That again sounds like something Linux specific rather than a hardware
> >> property.
> > Yes, indeed. Isn't it redundant with the phy_id?
> >
> > Ben.
> phy_id is part of slave data and will be present for both the slaves.
> so phy_id cannot be used for get/set phy setting until phy framework
> allows to change settings without going through eth interface.
Now I've looked at the examples in this file, I think I see what you're
getting at. What confused me is that you're adding to a single list of
properties without a proper distinction of which devices they are
applied to. It really ought to be properly divided between switch and
'slave' properties.
The 'active slave' property would also be needed for the SIOCGMIIPHY
ioctl and not just ethtool. But it's really quite arbitrary. Perhaps
each of them should have their own net device (as with DSA).
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH RFC] ipv6: use stronger hash for reassembly queue hash table
From: Eric Dumazet @ 2013-03-08 14:53 UTC (permalink / raw)
To: Hannes Frederic Sowa; +Cc: netdev, yoshfuji
In-Reply-To: <20130308130433.GB28531@order.stressinduktion.org>
On Fri, 2013-03-08 at 14:04 +0100, Hannes Frederic Sowa wrote:
> Ok if I send a patch later to revert this change? What do you think about
> increasing the size of the fragmentation queue hash table INETFRAGS_HASHSZ,
> too?
Thats because reassembly hash was so small, and number of in flight
reassembly is so small anyway, that I felt not worth having so many
instructions to compute a hash that is truncated to 6 bits
In real life I always advocate _not_ using fragments, I dont know why so
many people try to used them.
No matter how you hash, a hacker can easily fill your defrag unit with
not complete datagrams, so what's the point ?
^ permalink raw reply
* [PATCH] netlabel: fix build problems when CONFIG_IPV6=n
From: Paul Moore @ 2013-03-08 14:45 UTC (permalink / raw)
To: netdev; +Cc: fengguang.wu
My last patch to solve a problem where the static/fallback labels were
not fully displayed resulted in build problems when IPv6 was disabled.
This patch resolves the IPv6 build problems; sorry for the screw-up.
Please queue for -stable or simply merge with the previous patch.
Reported-by: Kbuild Test Robot <fengguang.wu@intel.com>
Signed-off-by: Paul Moore <pmoore@redhat.com>
---
net/netlabel/netlabel_unlabeled.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 85742b7..8a6c6ea 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -1189,8 +1189,6 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
struct netlbl_unlhsh_walk_arg cb_arg;
u32 skip_bkt = cb->args[0];
u32 skip_chain = cb->args[1];
- u32 skip_addr4 = cb->args[2];
- u32 skip_addr6 = cb->args[3];
u32 iter_bkt;
u32 iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0;
struct netlbl_unlhsh_iface *iface;
@@ -1215,7 +1213,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
continue;
netlbl_af4list_foreach_rcu(addr4,
&iface->addr4_list) {
- if (iter_addr4++ < skip_addr4)
+ if (iter_addr4++ < cb->args[2])
continue;
if (netlbl_unlabel_staticlist_gen(
NLBL_UNLABEL_C_STATICLIST,
@@ -1231,7 +1229,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
#if IS_ENABLED(CONFIG_IPV6)
netlbl_af6list_foreach_rcu(addr6,
&iface->addr6_list) {
- if (iter_addr6++ < skip_addr6)
+ if (iter_addr6++ < cb->args[3])
continue;
if (netlbl_unlabel_staticlist_gen(
NLBL_UNLABEL_C_STATICLIST,
@@ -1273,12 +1271,9 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb,
{
struct netlbl_unlhsh_walk_arg cb_arg;
struct netlbl_unlhsh_iface *iface;
- u32 skip_addr4 = cb->args[0];
- u32 skip_addr6 = cb->args[1];
- u32 iter_addr4 = 0;
+ u32 iter_addr4 = 0, iter_addr6 = 0;
struct netlbl_af4list *addr4;
#if IS_ENABLED(CONFIG_IPV6)
- u32 iter_addr6 = 0;
struct netlbl_af6list *addr6;
#endif
@@ -1292,7 +1287,7 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb,
goto unlabel_staticlistdef_return;
netlbl_af4list_foreach_rcu(addr4, &iface->addr4_list) {
- if (iter_addr4++ < skip_addr4)
+ if (iter_addr4++ < cb->args[0])
continue;
if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF,
iface,
@@ -1305,7 +1300,7 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb,
}
#if IS_ENABLED(CONFIG_IPV6)
netlbl_af6list_foreach_rcu(addr6, &iface->addr6_list) {
- if (iter_addr6++ < skip_addr6)
+ if (iter_addr6++ < cb->args[1])
continue;
if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF,
iface,
^ permalink raw reply related
* Re: [PATCH] sctp: don't break the loop while meeting the active_path so as to find the matched transport
From: Neil Horman @ 2013-03-08 14:27 UTC (permalink / raw)
To: Xufeng Zhang; +Cc: vyasevich, davem, linux-sctp, netdev, linux-kernel
In-Reply-To: <1362728377-11025-1-git-send-email-xufeng.zhang@windriver.com>
On Fri, Mar 08, 2013 at 03:39:37PM +0800, Xufeng Zhang wrote:
> sctp_assoc_lookup_tsn() function searchs which transport a certain TSN
> was sent on, if not found in the active_path transport, then go search
> all the other transports in the peer's transport_addr_list, however, we
> should continue to the next entry rather than break the loop when meet
> the active_path transport.
>
> Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
> ---
> net/sctp/associola.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/sctp/associola.c b/net/sctp/associola.c
> index 43cd0dd..d2709e2 100644
> --- a/net/sctp/associola.c
> +++ b/net/sctp/associola.c
> @@ -1079,7 +1079,7 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc,
> transports) {
>
> if (transport == active)
> - break;
> + continue;
> list_for_each_entry(chunk, &transport->transmitted,
> transmitted_list) {
> if (key == chunk->subh.data_hdr->tsn) {
> --
> 1.7.0.2
>
>
This works, but what might be better would be if we did a move to front
heuristic in sctp_assoc_set_primary. E.g. when we set the active_path, move the
requisite transport to the front of the transport_addr_list. If we did that,
then we could just do one for loop in sctp_assoc_lookup_tsn and wind up
implicitly check the active path first without having to check it seprately and
skip it in the second for loop.
Neil
^ permalink raw reply
* [PATCH] net: proc: revert proc_net_fops_create/proc_net_remove removal
From: Alexey Dobriyan @ 2013-03-08 13:56 UTC (permalink / raw)
To: davem; +Cc: netdev, gaofeng
Revert the following patches:
4fc1a601f147abe3bfb4d70fe718110ed21953e1 "net: proc: fix build failed when procfs is not configured"
c2399059a389ba686fa7f45d8913a708914752c4 "net: proc: remove proc_net_remove"
ece31ffd539e8e2b586b1ca5f50bc4f4591e3893 "net: proc: change proc_net_remove to remove_proc_entry"
b4278c961aca320839964e23cfc7906ff61af0c2 "net: proc: remove proc_net_fops_create"
d4beaa66add8aebf83ab16d2fde4e4de8dac36df "net: proc: change proc_net_fops_create to proc_create"
Their collective rationale is completely bogus:
> some modules such as bonding use proc_create
> to create proc entries under /proc/net/, and other modules
> such as ipv4 use proc_net_fops_create.
That's because conversion is not 100% complete.
> proc_net_remove is only used to remove proc entries
> that under /proc/net,
This is coincidence.
> it's not a general function for
> removing proc entries of netns.
Yes, it is.
> if we want to remove
> some proc entries which under /proc/net/stat/, we still
> need to call remove_proc_entry.
proc_net_remove() parses subdirectories just fine, i. e.
"proc_net_remove(net, "stat/foo")" should work.
Nobody bothered to do this.
proc_net_fops_create/proc_net_remove also hide implementation detail, namely,
->proc_net existense.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index f1b7e24..7b69591 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -276,7 +276,7 @@ static int cn_init(void)
cn_already_initialized = 1;
- proc_create("connector", S_IRUGO, init_net.proc_net, &cn_file_ops);
+ proc_net_fops_create(&init_net, "connector", S_IRUGO, &cn_file_ops);
return 0;
}
@@ -287,7 +287,7 @@ static void cn_fini(void)
cn_already_initialized = 0;
- remove_proc_entry("connector", init_net.proc_net);
+ proc_net_remove(&init_net, "connector");
cn_queue_free_dev(dev->cbdev);
netlink_kernel_release(dev->nls);
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index 02de6c8..c2e5497 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -586,8 +586,7 @@ static int bpq_device_event(struct notifier_block *this,unsigned long event, voi
static int __init bpq_init_driver(void)
{
#ifdef CONFIG_PROC_FS
- if (!proc_create("bpqether", S_IRUGO, init_net.proc_net,
- &bpq_info_fops)) {
+ if (!proc_net_fops_create(&init_net, "bpqether", S_IRUGO, &bpq_info_fops)) {
printk(KERN_ERR
"bpq: cannot create /proc/net/bpqether entry.\n");
return -ENOENT;
@@ -611,7 +610,7 @@ static void __exit bpq_cleanup_driver(void)
unregister_netdevice_notifier(&bpq_dev_notifier);
- remove_proc_entry("bpqether", init_net.proc_net);
+ proc_net_remove(&init_net, "bpqether");
rtnl_lock();
while (!list_empty(&bpq_devices)) {
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index bc1d521..1b4a47b 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -2118,7 +2118,7 @@ static int __init scc_init_driver (void)
}
rtnl_unlock();
- proc_create("z8530drv", 0, init_net.proc_net, &scc_net_seq_fops);
+ proc_net_fops_create(&init_net, "z8530drv", 0, &scc_net_seq_fops);
return 0;
}
@@ -2173,7 +2173,7 @@ static void __exit scc_cleanup_driver(void)
if (Vector_Latch)
release_region(Vector_Latch, 1);
- remove_proc_entry("z8530drv", init_net.proc_net);
+ proc_net_remove(&init_net, "z8530drv");
}
MODULE_AUTHOR("Joerg Reuter <jreuter@yaina.de>");
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 4cf8f10..c6645f1 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -1167,7 +1167,7 @@ static int __init yam_init_driver(void)
yam_timer.expires = jiffies + HZ / 100;
add_timer(&yam_timer);
- proc_create("yam", S_IRUGO, init_net.proc_net, &yam_info_fops);
+ proc_net_fops_create(&init_net, "yam", S_IRUGO, &yam_info_fops);
return 0;
error:
while (--i >= 0) {
@@ -1199,7 +1199,7 @@ static void __exit yam_cleanup_driver(void)
kfree(p);
}
- remove_proc_entry("yam", init_net.proc_net);
+ proc_net_remove(&init_net, "yam");
}
/* --------------------------------------------------------------------- */
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index bb07ba9..20f31d0 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -1134,7 +1134,7 @@ static __net_init int pppoe_init_net(struct net *net)
rwlock_init(&pn->hash_lock);
- pde = proc_create("pppoe", S_IRUGO, net->proc_net, &pppoe_seq_fops);
+ pde = proc_net_fops_create(net, "pppoe", S_IRUGO, &pppoe_seq_fops);
#ifdef CONFIG_PROC_FS
if (!pde)
return -ENOMEM;
@@ -1145,7 +1145,7 @@ static __net_init int pppoe_init_net(struct net *net)
static __net_exit void pppoe_exit_net(struct net *net)
{
- remove_proc_entry("pppoe", net->proc_net);
+ proc_net_remove(net, "pppoe");
}
static struct pernet_operations pppoe_net_ops = {
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index b4ac657..75df0d7 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -177,6 +177,20 @@ const struct file_operations proc_net_operations = {
.readdir = proc_tgid_net_readdir,
};
+
+struct proc_dir_entry *proc_net_fops_create(struct net *net,
+ const char *name, umode_t mode, const struct file_operations *fops)
+{
+ return proc_create(name, mode, net->proc_net, fops);
+}
+EXPORT_SYMBOL_GPL(proc_net_fops_create);
+
+void proc_net_remove(struct net *net, const char *name)
+{
+ remove_proc_entry(name, net->proc_net);
+}
+EXPORT_SYMBOL_GPL(proc_net_remove);
+
static __net_init int proc_net_ns_init(struct net *net)
{
struct proc_dir_entry *netd, *net_statd;
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 8307f2f..3c22538 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -176,6 +176,9 @@ static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
return res;
}
+extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
+ const char *name, umode_t mode, const struct file_operations *fops);
+extern void proc_net_remove(struct net *net, const char *name);
extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
struct proc_dir_entry *parent);
@@ -186,15 +189,21 @@ extern int proc_alloc_inum(unsigned int *pino);
extern void proc_free_inum(unsigned int inum);
#else
+#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; })
+static inline void proc_net_remove(struct net *net, const char *name) {}
+
static inline void proc_flush_task(struct task_struct *task)
{
}
static inline struct proc_dir_entry *create_proc_entry(const char *name,
umode_t mode, struct proc_dir_entry *parent) { return NULL; }
-
-#define proc_create(name, mode, parent, fops) ({ (void)(mode), NULL; })
-
+static inline struct proc_dir_entry *proc_create(const char *name,
+ umode_t mode, struct proc_dir_entry *parent,
+ const struct file_operations *proc_fops)
+{
+ return NULL;
+}
static inline struct proc_dir_entry *proc_create_data(const char *name,
umode_t mode, struct proc_dir_entry *parent,
const struct file_operations *proc_fops, void *data)
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index dc526ec..4de77ea 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -131,7 +131,7 @@ void vlan_proc_cleanup(struct net *net)
remove_proc_entry(name_conf, vn->proc_vlan_dir);
if (vn->proc_vlan_dir)
- remove_proc_entry(name_root, net->proc_net);
+ proc_net_remove(net, name_root);
/* Dynamically added entries should be cleaned up as their vlan_device
* is removed, so we should not have to take care of it here...
diff --git a/net/atm/proc.c b/net/atm/proc.c
index 6ac35ff..2518b5f 100644
--- a/net/atm/proc.c
+++ b/net/atm/proc.c
@@ -460,7 +460,7 @@ static void atm_proc_dirs_remove(void)
if (e->dirent)
remove_proc_entry(e->name, atm_proc_root);
}
- remove_proc_entry("atm", init_net.proc_net);
+ proc_net_remove(&init_net, "atm");
}
int __init atm_proc_init(void)
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 7b11f8b..282c66a 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1987,10 +1987,9 @@ static int __init ax25_init(void)
dev_add_pack(&ax25_packet_type);
register_netdevice_notifier(&ax25_dev_notifier);
- proc_create("ax25_route", S_IRUGO, init_net.proc_net,
- &ax25_route_fops);
- proc_create("ax25", S_IRUGO, init_net.proc_net, &ax25_info_fops);
- proc_create("ax25_calls", S_IRUGO, init_net.proc_net, &ax25_uid_fops);
+ proc_net_fops_create(&init_net, "ax25_route", S_IRUGO, &ax25_route_fops);
+ proc_net_fops_create(&init_net, "ax25", S_IRUGO, &ax25_info_fops);
+ proc_net_fops_create(&init_net, "ax25_calls", S_IRUGO, &ax25_uid_fops);
out:
return rc;
}
@@ -2004,9 +2003,9 @@ MODULE_ALIAS_NETPROTO(PF_AX25);
static void __exit ax25_exit(void)
{
- remove_proc_entry("ax25_route", init_net.proc_net);
- remove_proc_entry("ax25", init_net.proc_net);
- remove_proc_entry("ax25_calls", init_net.proc_net);
+ proc_net_remove(&init_net, "ax25_route");
+ proc_net_remove(&init_net, "ax25");
+ proc_net_remove(&init_net, "ax25_calls");
unregister_netdevice_notifier(&ax25_dev_notifier);
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index d3ee69b..5355df6 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -641,7 +641,7 @@ int bt_procfs_init(struct module* module, struct net *net, const char *name,
sk_list->fops.llseek = seq_lseek;
sk_list->fops.release = seq_release_private;
- pde = proc_create(name, 0, net->proc_net, &sk_list->fops);
+ pde = proc_net_fops_create(net, name, 0, &sk_list->fops);
if (!pde)
return -ENOMEM;
@@ -652,7 +652,7 @@ int bt_procfs_init(struct module* module, struct net *net, const char *name,
void bt_procfs_cleanup(struct net *net, const char *name)
{
- remove_proc_entry(name, net->proc_net);
+ proc_net_remove(net, name);
}
#else
int bt_procfs_init(struct module* module, struct net *net, const char *name,
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 5dcb200..28e12d1 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1633,7 +1633,7 @@ static void __exit bcm_module_exit(void)
can_proto_unregister(&bcm_can_proto);
if (proc_dir)
- remove_proc_entry("can-bcm", init_net.proc_net);
+ proc_net_remove(&init_net, "can-bcm");
}
module_init(bcm_module_init);
diff --git a/net/can/proc.c b/net/can/proc.c
index 1ab8c88..e21e133 100644
--- a/net/can/proc.c
+++ b/net/can/proc.c
@@ -530,5 +530,5 @@ void can_remove_proc(void)
can_remove_proc_readentry(CAN_PROC_RCVLIST_SFF);
if (can_dir)
- remove_proc_entry("can", init_net.proc_net);
+ proc_net_remove(&init_net, "can");
}
diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c
index 3174f19..3a16bfe 100644
--- a/net/core/net-procfs.c
+++ b/net/core/net-procfs.c
@@ -304,12 +304,11 @@ static int __net_init dev_proc_net_init(struct net *net)
{
int rc = -ENOMEM;
- if (!proc_create("dev", S_IRUGO, net->proc_net, &dev_seq_fops))
+ if (!proc_net_fops_create(net, "dev", S_IRUGO, &dev_seq_fops))
goto out;
- if (!proc_create("softnet_stat", S_IRUGO, net->proc_net,
- &softnet_seq_fops))
+ if (!proc_net_fops_create(net, "softnet_stat", S_IRUGO, &softnet_seq_fops))
goto out_dev;
- if (!proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops))
+ if (!proc_net_fops_create(net, "ptype", S_IRUGO, &ptype_seq_fops))
goto out_softnet;
if (wext_proc_init(net))
@@ -318,11 +317,11 @@ static int __net_init dev_proc_net_init(struct net *net)
out:
return rc;
out_ptype:
- remove_proc_entry("ptype", net->proc_net);
+ proc_net_remove(net, "ptype");
out_softnet:
- remove_proc_entry("softnet_stat", net->proc_net);
+ proc_net_remove(net, "softnet_stat");
out_dev:
- remove_proc_entry("dev", net->proc_net);
+ proc_net_remove(net, "dev");
goto out;
}
@@ -330,9 +329,9 @@ static void __net_exit dev_proc_net_exit(struct net *net)
{
wext_proc_exit(net);
- remove_proc_entry("ptype", net->proc_net);
- remove_proc_entry("softnet_stat", net->proc_net);
- remove_proc_entry("dev", net->proc_net);
+ proc_net_remove(net, "ptype");
+ proc_net_remove(net, "softnet_stat");
+ proc_net_remove(net, "dev");
}
static struct pernet_operations __net_initdata dev_proc_ops = {
@@ -387,14 +386,14 @@ static const struct file_operations dev_mc_seq_fops = {
static int __net_init dev_mc_net_init(struct net *net)
{
- if (!proc_create("dev_mcast", 0, net->proc_net, &dev_mc_seq_fops))
+ if (!proc_net_fops_create(net, "dev_mcast", 0, &dev_mc_seq_fops))
return -ENOMEM;
return 0;
}
static void __net_exit dev_mc_net_exit(struct net *net)
{
- remove_proc_entry("dev_mcast", net->proc_net);
+ proc_net_remove(net, "dev_mcast");
}
static struct pernet_operations __net_initdata dev_mc_net_ops = {
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 6048fc1..2201e69 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3650,7 +3650,7 @@ static int __net_init pg_net_init(struct net *net)
remove_entry:
remove_proc_entry(PGCTRL, pn->proc_dir);
remove:
- remove_proc_entry(PG_PROC_DIR, pn->net->proc_net);
+ proc_net_remove(pn->net, PG_PROC_DIR);
return ret;
}
@@ -3676,7 +3676,7 @@ static void __net_exit pg_net_exit(struct net *net)
}
remove_proc_entry(PGCTRL, pn->proc_dir);
- remove_proc_entry(PG_PROC_DIR, pn->net->proc_net);
+ proc_net_remove(pn->net, PG_PROC_DIR);
}
static struct pernet_operations pg_net_ops = {
diff --git a/net/core/sock.c b/net/core/sock.c
index b261a79..0c89410 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2838,7 +2838,7 @@ static const struct file_operations proto_seq_fops = {
static __net_init int proto_init_net(struct net *net)
{
- if (!proc_create("protocols", S_IRUGO, net->proc_net, &proto_seq_fops))
+ if (!proc_net_fops_create(net, "protocols", S_IRUGO, &proto_seq_fops))
return -ENOMEM;
return 0;
@@ -2846,7 +2846,7 @@ static __net_init int proto_init_net(struct net *net)
static __net_exit void proto_exit_net(struct net *net)
{
- remove_proc_entry("protocols", net->proc_net);
+ proc_net_remove(net, "protocols");
}
diff --git a/net/dccp/probe.c b/net/dccp/probe.c
index 4c6bdf9..0a8d6eb 100644
--- a/net/dccp/probe.c
+++ b/net/dccp/probe.c
@@ -171,7 +171,7 @@ static __init int dccpprobe_init(void)
spin_lock_init(&dccpw.lock);
if (kfifo_alloc(&dccpw.fifo, bufsize, GFP_KERNEL))
return ret;
- if (!proc_create(procname, S_IRUSR, init_net.proc_net, &dccpprobe_fops))
+ if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops))
goto err0;
ret = setup_jprobe();
@@ -181,7 +181,7 @@ static __init int dccpprobe_init(void)
pr_info("DCCP watch registered (port=%d)\n", port);
return 0;
err1:
- remove_proc_entry(procname, init_net.proc_net);
+ proc_net_remove(&init_net, procname);
err0:
kfifo_free(&dccpw.fifo);
return ret;
@@ -191,7 +191,7 @@ module_init(dccpprobe_init);
static __exit void dccpprobe_exit(void)
{
kfifo_free(&dccpw.fifo);
- remove_proc_entry(procname, init_net.proc_net);
+ proc_net_remove(&init_net, procname);
unregister_jprobe(&dccp_send_probe);
}
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index c21f200..ae06bd3 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -2381,7 +2381,7 @@ static int __init decnet_init(void)
dev_add_pack(&dn_dix_packet_type);
register_netdevice_notifier(&dn_dev_notifier);
- proc_create("decnet", S_IRUGO, init_net.proc_net, &dn_socket_seq_fops);
+ proc_net_fops_create(&init_net, "decnet", S_IRUGO, &dn_socket_seq_fops);
dn_register_sysctl();
out:
return rc;
@@ -2410,7 +2410,7 @@ static void __exit decnet_exit(void)
dn_neigh_cleanup();
dn_fib_cleanup();
- remove_proc_entry("decnet", init_net.proc_net);
+ proc_net_remove(&init_net, "decnet");
proto_unregister(&dn_proto);
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index c8da116..e47ba9f 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -1412,7 +1412,7 @@ void __init dn_dev_init(void)
rtnl_register(PF_DECnet, RTM_DELADDR, dn_nl_deladdr, NULL, NULL);
rtnl_register(PF_DECnet, RTM_GETADDR, NULL, dn_nl_dump_ifaddr, NULL);
- proc_create("decnet_dev", S_IRUGO, init_net.proc_net, &dn_dev_seq_fops);
+ proc_net_fops_create(&init_net, "decnet_dev", S_IRUGO, &dn_dev_seq_fops);
#ifdef CONFIG_SYSCTL
{
@@ -1433,7 +1433,7 @@ void __exit dn_dev_cleanup(void)
}
#endif /* CONFIG_SYSCTL */
- remove_proc_entry("decnet_dev", init_net.proc_net);
+ proc_net_remove(&init_net, "decnet_dev");
dn_dev_devices_off();
}
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c
index f8637f9..856636a 100644
--- a/net/decnet/dn_neigh.c
+++ b/net/decnet/dn_neigh.c
@@ -590,12 +590,11 @@ static const struct file_operations dn_neigh_seq_fops = {
void __init dn_neigh_init(void)
{
neigh_table_init(&dn_neigh_table);
- proc_create("decnet_neigh", S_IRUGO, init_net.proc_net,
- &dn_neigh_seq_fops);
+ proc_net_fops_create(&init_net, "decnet_neigh", S_IRUGO, &dn_neigh_seq_fops);
}
void __exit dn_neigh_cleanup(void)
{
- remove_proc_entry("decnet_neigh", init_net.proc_net);
+ proc_net_remove(&init_net, "decnet_neigh");
neigh_table_clear(&dn_neigh_table);
}
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 5ac0e15..1550028 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1901,8 +1901,7 @@ void __init dn_route_init(void)
dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1);
- proc_create("decnet_cache", S_IRUGO, init_net.proc_net,
- &dn_rt_cache_seq_fops);
+ proc_net_fops_create(&init_net, "decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops);
#ifdef CONFIG_DECNET_ROUTER
rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute,
@@ -1918,7 +1917,7 @@ void __exit dn_route_cleanup(void)
del_timer(&dn_route_timer);
dn_run_flush(0);
- remove_proc_entry("decnet_cache", init_net.proc_net);
+ proc_net_remove(&init_net, "decnet_cache");
dst_entries_destroy(&dn_dst_ops);
}
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index fea4929..ded146b 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1405,14 +1405,14 @@ static const struct file_operations arp_seq_fops = {
static int __net_init arp_net_init(struct net *net)
{
- if (!proc_create("arp", S_IRUGO, net->proc_net, &arp_seq_fops))
+ if (!proc_net_fops_create(net, "arp", S_IRUGO, &arp_seq_fops))
return -ENOMEM;
return 0;
}
static void __net_exit arp_net_exit(struct net *net)
{
- remove_proc_entry("arp", net->proc_net);
+ proc_net_remove(net, "arp");
}
static struct pernet_operations arp_net_ops = {
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index ff06b75..c13dc76 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2598,31 +2598,31 @@ static const struct file_operations fib_route_fops = {
int __net_init fib_proc_init(struct net *net)
{
- if (!proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops))
+ if (!proc_net_fops_create(net, "fib_trie", S_IRUGO, &fib_trie_fops))
goto out1;
- if (!proc_create("fib_triestat", S_IRUGO, net->proc_net,
- &fib_triestat_fops))
+ if (!proc_net_fops_create(net, "fib_triestat", S_IRUGO,
+ &fib_triestat_fops))
goto out2;
- if (!proc_create("route", S_IRUGO, net->proc_net, &fib_route_fops))
+ if (!proc_net_fops_create(net, "route", S_IRUGO, &fib_route_fops))
goto out3;
return 0;
out3:
- remove_proc_entry("fib_triestat", net->proc_net);
+ proc_net_remove(net, "fib_triestat");
out2:
- remove_proc_entry("fib_trie", net->proc_net);
+ proc_net_remove(net, "fib_trie");
out1:
return -ENOMEM;
}
void __net_exit fib_proc_exit(struct net *net)
{
- remove_proc_entry("fib_trie", net->proc_net);
- remove_proc_entry("fib_triestat", net->proc_net);
- remove_proc_entry("route", net->proc_net);
+ proc_net_remove(net, "fib_trie");
+ proc_net_remove(net, "fib_triestat");
+ proc_net_remove(net, "route");
}
#endif /* CONFIG_PROC_FS */
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index d8c2327..736ab70 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -2646,25 +2646,24 @@ static int __net_init igmp_net_init(struct net *net)
{
struct proc_dir_entry *pde;
- pde = proc_create("igmp", S_IRUGO, net->proc_net, &igmp_mc_seq_fops);
+ pde = proc_net_fops_create(net, "igmp", S_IRUGO, &igmp_mc_seq_fops);
if (!pde)
goto out_igmp;
- pde = proc_create("mcfilter", S_IRUGO, net->proc_net,
- &igmp_mcf_seq_fops);
+ pde = proc_net_fops_create(net, "mcfilter", S_IRUGO, &igmp_mcf_seq_fops);
if (!pde)
goto out_mcfilter;
return 0;
out_mcfilter:
- remove_proc_entry("igmp", net->proc_net);
+ proc_net_remove(net, "igmp");
out_igmp:
return -ENOMEM;
}
static void __net_exit igmp_net_exit(struct net *net)
{
- remove_proc_entry("mcfilter", net->proc_net);
- remove_proc_entry("igmp", net->proc_net);
+ proc_net_remove(net, "mcfilter");
+ proc_net_remove(net, "igmp");
}
static struct pernet_operations igmp_net_ops = {
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 98cbc68..a2e50ae 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1394,7 +1394,7 @@ static int __init ip_auto_config(void)
unsigned int i;
#ifdef CONFIG_PROC_FS
- proc_create("pnp", S_IRUGO, init_net.proc_net, &pnp_seq_fops);
+ proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops);
#endif /* CONFIG_PROC_FS */
if (!ic_enable)
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 5f95b3a..7085b9b 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -2703,16 +2703,16 @@ static int __net_init ipmr_net_init(struct net *net)
#ifdef CONFIG_PROC_FS
err = -ENOMEM;
- if (!proc_create("ip_mr_vif", 0, net->proc_net, &ipmr_vif_fops))
+ if (!proc_net_fops_create(net, "ip_mr_vif", 0, &ipmr_vif_fops))
goto proc_vif_fail;
- if (!proc_create("ip_mr_cache", 0, net->proc_net, &ipmr_mfc_fops))
+ if (!proc_net_fops_create(net, "ip_mr_cache", 0, &ipmr_mfc_fops))
goto proc_cache_fail;
#endif
return 0;
#ifdef CONFIG_PROC_FS
proc_cache_fail:
- remove_proc_entry("ip_mr_vif", net->proc_net);
+ proc_net_remove(net, "ip_mr_vif");
proc_vif_fail:
ipmr_rules_exit(net);
#endif
@@ -2723,8 +2723,8 @@ fail:
static void __net_exit ipmr_net_exit(struct net *net)
{
#ifdef CONFIG_PROC_FS
- remove_proc_entry("ip_mr_cache", net->proc_net);
- remove_proc_entry("ip_mr_vif", net->proc_net);
+ proc_net_remove(net, "ip_mr_cache");
+ proc_net_remove(net, "ip_mr_vif");
#endif
ipmr_rules_exit(net);
}
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
index f2ca127..9682b36 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
@@ -417,12 +417,12 @@ static int __net_init ip_conntrack_net_init(struct net *net)
{
struct proc_dir_entry *proc, *proc_exp, *proc_stat;
- proc = proc_create("ip_conntrack", 0440, net->proc_net, &ct_file_ops);
+ proc = proc_net_fops_create(net, "ip_conntrack", 0440, &ct_file_ops);
if (!proc)
goto err1;
- proc_exp = proc_create("ip_conntrack_expect", 0440, net->proc_net,
- &ip_exp_file_ops);
+ proc_exp = proc_net_fops_create(net, "ip_conntrack_expect", 0440,
+ &ip_exp_file_ops);
if (!proc_exp)
goto err2;
@@ -433,9 +433,9 @@ static int __net_init ip_conntrack_net_init(struct net *net)
return 0;
err3:
- remove_proc_entry("ip_conntrack_expect", net->proc_net);
+ proc_net_remove(net, "ip_conntrack_expect");
err2:
- remove_proc_entry("ip_conntrack", net->proc_net);
+ proc_net_remove(net, "ip_conntrack");
err1:
return -ENOMEM;
}
@@ -443,8 +443,8 @@ err1:
static void __net_exit ip_conntrack_net_exit(struct net *net)
{
remove_proc_entry("ip_conntrack", net->proc_net_stat);
- remove_proc_entry("ip_conntrack_expect", net->proc_net);
- remove_proc_entry("ip_conntrack", net->proc_net);
+ proc_net_remove(net, "ip_conntrack_expect");
+ proc_net_remove(net, "ip_conntrack");
}
static struct pernet_operations ip_conntrack_net_ops = {
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 2e91006..dc454cc 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -889,7 +889,7 @@ static int ping_proc_register(struct net *net)
struct proc_dir_entry *p;
int rc = 0;
- p = proc_create("icmp", S_IRUGO, net->proc_net, &ping_seq_fops);
+ p = proc_net_fops_create(net, "icmp", S_IRUGO, &ping_seq_fops);
if (!p)
rc = -ENOMEM;
return rc;
@@ -897,7 +897,7 @@ static int ping_proc_register(struct net *net)
static void ping_proc_unregister(struct net *net)
{
- remove_proc_entry("icmp", net->proc_net);
+ proc_net_remove(net, "icmp");
}
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 32030a2..8de53e1 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -471,29 +471,28 @@ static const struct file_operations netstat_seq_fops = {
static __net_init int ip_proc_init_net(struct net *net)
{
- if (!proc_create("sockstat", S_IRUGO, net->proc_net,
- &sockstat_seq_fops))
+ if (!proc_net_fops_create(net, "sockstat", S_IRUGO, &sockstat_seq_fops))
goto out_sockstat;
- if (!proc_create("netstat", S_IRUGO, net->proc_net, &netstat_seq_fops))
+ if (!proc_net_fops_create(net, "netstat", S_IRUGO, &netstat_seq_fops))
goto out_netstat;
- if (!proc_create("snmp", S_IRUGO, net->proc_net, &snmp_seq_fops))
+ if (!proc_net_fops_create(net, "snmp", S_IRUGO, &snmp_seq_fops))
goto out_snmp;
return 0;
out_snmp:
- remove_proc_entry("netstat", net->proc_net);
+ proc_net_remove(net, "netstat");
out_netstat:
- remove_proc_entry("sockstat", net->proc_net);
+ proc_net_remove(net, "sockstat");
out_sockstat:
return -ENOMEM;
}
static __net_exit void ip_proc_exit_net(struct net *net)
{
- remove_proc_entry("snmp", net->proc_net);
- remove_proc_entry("netstat", net->proc_net);
- remove_proc_entry("sockstat", net->proc_net);
+ proc_net_remove(net, "snmp");
+ proc_net_remove(net, "netstat");
+ proc_net_remove(net, "sockstat");
}
static __net_initdata struct pernet_operations ip_proc_ops = {
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index dd44e0a..63a0aab 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -1046,7 +1046,7 @@ static const struct file_operations raw_seq_fops = {
static __net_init int raw_init_net(struct net *net)
{
- if (!proc_create("raw", S_IRUGO, net->proc_net, &raw_seq_fops))
+ if (!proc_net_fops_create(net, "raw", S_IRUGO, &raw_seq_fops))
return -ENOMEM;
return 0;
@@ -1054,7 +1054,7 @@ static __net_init int raw_init_net(struct net *net)
static __net_exit void raw_exit_net(struct net *net)
{
- remove_proc_entry("raw", net->proc_net);
+ proc_net_remove(net, "raw");
}
static __net_initdata struct pernet_operations raw_net_ops = {
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 6e28514..fce785c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -380,8 +380,8 @@ static int __net_init ip_rt_do_proc_init(struct net *net)
{
struct proc_dir_entry *pde;
- pde = proc_create("rt_cache", S_IRUGO, net->proc_net,
- &rt_cache_seq_fops);
+ pde = proc_net_fops_create(net, "rt_cache", S_IRUGO,
+ &rt_cache_seq_fops);
if (!pde)
goto err1;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 4a8ec45..c83a788 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2615,7 +2615,7 @@ EXPORT_SYMBOL(tcp_proc_register);
void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo)
{
- remove_proc_entry(afinfo->name, net->proc_net);
+ proc_net_remove(net, afinfo->name);
}
EXPORT_SYMBOL(tcp_proc_unregister);
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c
index d4943f6..4526fe6 100644
--- a/net/ipv4/tcp_probe.c
+++ b/net/ipv4/tcp_probe.c
@@ -234,7 +234,7 @@ static __init int tcpprobe_init(void)
if (!tcp_probe.log)
goto err0;
- if (!proc_create(procname, S_IRUSR, init_net.proc_net, &tcpprobe_fops))
+ if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &tcpprobe_fops))
goto err0;
ret = register_jprobe(&tcp_jprobe);
@@ -244,7 +244,7 @@ static __init int tcpprobe_init(void)
pr_info("probe registered (port=%d) bufsize=%u\n", port, bufsize);
return 0;
err1:
- remove_proc_entry(procname, init_net.proc_net);
+ proc_net_remove(&init_net, procname);
err0:
kfree(tcp_probe.log);
return ret;
@@ -253,7 +253,7 @@ module_init(tcpprobe_init);
static __exit void tcpprobe_exit(void)
{
- remove_proc_entry(procname, init_net.proc_net);
+ proc_net_remove(&init_net, procname);
unregister_jprobe(&tcp_jprobe);
kfree(tcp_probe.log);
}
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 265c42c..39a5e7a 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2122,7 +2122,7 @@ EXPORT_SYMBOL(udp_proc_register);
void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo)
{
- remove_proc_entry(afinfo->name, net->proc_net);
+ proc_net_remove(net, afinfo->name);
}
EXPORT_SYMBOL(udp_proc_unregister);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index f2c7e61..30a1b21 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3319,14 +3319,14 @@ static const struct file_operations if6_fops = {
static int __net_init if6_proc_net_init(struct net *net)
{
- if (!proc_create("if_inet6", S_IRUGO, net->proc_net, &if6_fops))
+ if (!proc_net_fops_create(net, "if_inet6", S_IRUGO, &if6_fops))
return -ENOMEM;
return 0;
}
static void __net_exit if6_proc_net_exit(struct net *net)
{
- remove_proc_entry("if_inet6", net->proc_net);
+ proc_net_remove(net, "if_inet6");
}
static struct pernet_operations if6_proc_net_ops = {
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 5a80f15..921b8b3 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -509,7 +509,7 @@ static const struct file_operations ac6_seq_fops = {
int __net_init ac6_proc_init(struct net *net)
{
- if (!proc_create("anycast6", S_IRUGO, net->proc_net, &ac6_seq_fops))
+ if (!proc_net_fops_create(net, "anycast6", S_IRUGO, &ac6_seq_fops))
return -ENOMEM;
return 0;
@@ -517,7 +517,7 @@ int __net_init ac6_proc_init(struct net *net)
void ac6_proc_exit(struct net *net)
{
- remove_proc_entry("anycast6", net->proc_net);
+ proc_net_remove(net, "anycast6");
}
#endif
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index b973ed3..a7da2f4 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -806,15 +806,15 @@ static const struct file_operations ip6fl_seq_fops = {
static int __net_init ip6_flowlabel_proc_init(struct net *net)
{
- if (!proc_create("ip6_flowlabel", S_IRUGO, net->proc_net,
- &ip6fl_seq_fops))
+ if (!proc_net_fops_create(net, "ip6_flowlabel",
+ S_IRUGO, &ip6fl_seq_fops))
return -ENOMEM;
return 0;
}
static void __net_exit ip6_flowlabel_proc_fini(struct net *net)
{
- remove_proc_entry("ip6_flowlabel", net->proc_net);
+ proc_net_remove(net, "ip6_flowlabel");
}
#else
static inline int ip6_flowlabel_proc_init(struct net *net)
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 96bfb4e..351ce98 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1359,9 +1359,9 @@ static int __net_init ip6mr_net_init(struct net *net)
#ifdef CONFIG_PROC_FS
err = -ENOMEM;
- if (!proc_create("ip6_mr_vif", 0, net->proc_net, &ip6mr_vif_fops))
+ if (!proc_net_fops_create(net, "ip6_mr_vif", 0, &ip6mr_vif_fops))
goto proc_vif_fail;
- if (!proc_create("ip6_mr_cache", 0, net->proc_net, &ip6mr_mfc_fops))
+ if (!proc_net_fops_create(net, "ip6_mr_cache", 0, &ip6mr_mfc_fops))
goto proc_cache_fail;
#endif
@@ -1369,7 +1369,7 @@ static int __net_init ip6mr_net_init(struct net *net)
#ifdef CONFIG_PROC_FS
proc_cache_fail:
- remove_proc_entry("ip6_mr_vif", net->proc_net);
+ proc_net_remove(net, "ip6_mr_vif");
proc_vif_fail:
ip6mr_rules_exit(net);
#endif
@@ -1380,8 +1380,8 @@ fail:
static void __net_exit ip6mr_net_exit(struct net *net)
{
#ifdef CONFIG_PROC_FS
- remove_proc_entry("ip6_mr_cache", net->proc_net);
- remove_proc_entry("ip6_mr_vif", net->proc_net);
+ proc_net_remove(net, "ip6_mr_cache");
+ proc_net_remove(net, "ip6_mr_vif");
#endif
ip6mr_rules_exit(net);
}
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index bfa6cc3..3a2849f 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -2599,10 +2599,10 @@ static int __net_init igmp6_proc_init(struct net *net)
int err;
err = -ENOMEM;
- if (!proc_create("igmp6", S_IRUGO, net->proc_net, &igmp6_mc_seq_fops))
+ if (!proc_net_fops_create(net, "igmp6", S_IRUGO, &igmp6_mc_seq_fops))
goto out;
- if (!proc_create("mcfilter6", S_IRUGO, net->proc_net,
- &igmp6_mcf_seq_fops))
+ if (!proc_net_fops_create(net, "mcfilter6", S_IRUGO,
+ &igmp6_mcf_seq_fops))
goto out_proc_net_igmp6;
err = 0;
@@ -2610,14 +2610,14 @@ out:
return err;
out_proc_net_igmp6:
- remove_proc_entry("igmp6", net->proc_net);
+ proc_net_remove(net, "igmp6");
goto out;
}
static void __net_exit igmp6_proc_exit(struct net *net)
{
- remove_proc_entry("mcfilter6", net->proc_net);
- remove_proc_entry("igmp6", net->proc_net);
+ proc_net_remove(net, "mcfilter6");
+ proc_net_remove(net, "igmp6");
}
#else
static inline int igmp6_proc_init(struct net *net)
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index bbbe53a..745a320 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -295,11 +295,11 @@ int snmp6_unregister_dev(struct inet6_dev *idev)
static int __net_init ipv6_proc_init_net(struct net *net)
{
- if (!proc_create("sockstat6", S_IRUGO, net->proc_net,
- &sockstat6_seq_fops))
+ if (!proc_net_fops_create(net, "sockstat6", S_IRUGO,
+ &sockstat6_seq_fops))
return -ENOMEM;
- if (!proc_create("snmp6", S_IRUGO, net->proc_net, &snmp6_seq_fops))
+ if (!proc_net_fops_create(net, "snmp6", S_IRUGO, &snmp6_seq_fops))
goto proc_snmp6_fail;
net->mib.proc_net_devsnmp6 = proc_mkdir("dev_snmp6", net->proc_net);
@@ -308,17 +308,17 @@ static int __net_init ipv6_proc_init_net(struct net *net)
return 0;
proc_dev_snmp6_fail:
- remove_proc_entry("snmp6", net->proc_net);
+ proc_net_remove(net, "snmp6");
proc_snmp6_fail:
- remove_proc_entry("sockstat6", net->proc_net);
+ proc_net_remove(net, "sockstat6");
return -ENOMEM;
}
static void __net_exit ipv6_proc_exit_net(struct net *net)
{
- remove_proc_entry("sockstat6", net->proc_net);
- remove_proc_entry("dev_snmp6", net->proc_net);
- remove_proc_entry("snmp6", net->proc_net);
+ proc_net_remove(net, "sockstat6");
+ proc_net_remove(net, "dev_snmp6");
+ proc_net_remove(net, "snmp6");
}
static struct pernet_operations ipv6_proc_ops = {
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 330b5e7..9cbc011 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -1291,7 +1291,7 @@ static const struct file_operations raw6_seq_fops = {
static int __net_init raw6_init_net(struct net *net)
{
- if (!proc_create("raw6", S_IRUGO, net->proc_net, &raw6_seq_fops))
+ if (!proc_net_fops_create(net, "raw6", S_IRUGO, &raw6_seq_fops))
return -ENOMEM;
return 0;
@@ -1299,7 +1299,7 @@ static int __net_init raw6_init_net(struct net *net)
static void __net_exit raw6_exit_net(struct net *net)
{
- remove_proc_entry("raw6", net->proc_net);
+ proc_net_remove(net, "raw6");
}
static struct pernet_operations raw6_net_ops = {
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index e5fe004..8c663e4 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2994,8 +2994,8 @@ static void __net_exit ip6_route_net_exit(struct net *net)
static int __net_init ip6_route_net_init_late(struct net *net)
{
#ifdef CONFIG_PROC_FS
- proc_create("ipv6_route", 0, net->proc_net, &ipv6_route_proc_fops);
- proc_create("rt6_stats", S_IRUGO, net->proc_net, &rt6_stats_seq_fops);
+ proc_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops);
+ proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops);
#endif
return 0;
}
@@ -3003,8 +3003,8 @@ static int __net_init ip6_route_net_init_late(struct net *net)
static void __net_exit ip6_route_net_exit_late(struct net *net)
{
#ifdef CONFIG_PROC_FS
- remove_proc_entry("ipv6_route", net->proc_net);
- remove_proc_entry("rt6_stats", net->proc_net);
+ proc_net_remove(net, "ipv6_route");
+ proc_net_remove(net, "rt6_stats");
#endif
}
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 556fdaf..ace8212 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3739,7 +3739,7 @@ static int __net_init pfkey_init_proc(struct net *net)
{
struct proc_dir_entry *e;
- e = proc_create("pfkey", 0, net->proc_net, &pfkey_proc_ops);
+ e = proc_net_fops_create(net, "pfkey", 0, &pfkey_proc_ops);
if (e == NULL)
return -ENOMEM;
@@ -3748,7 +3748,7 @@ static int __net_init pfkey_init_proc(struct net *net)
static void __net_exit pfkey_exit_proc(struct net *net)
{
- remove_proc_entry("pfkey", net->proc_net);
+ proc_net_remove(net, "pfkey");
}
#else
static inline int pfkey_init_proc(struct net *net)
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index 6a53371..044e9e1 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -1784,8 +1784,7 @@ static __net_init int pppol2tp_init_net(struct net *net)
struct proc_dir_entry *pde;
int err = 0;
- pde = proc_create("pppol2tp", S_IRUGO, net->proc_net,
- &pppol2tp_proc_fops);
+ pde = proc_net_fops_create(net, "pppol2tp", S_IRUGO, &pppol2tp_proc_fops);
if (!pde) {
err = -ENOMEM;
goto out;
@@ -1797,7 +1796,7 @@ out:
static __net_exit void pppol2tp_exit_net(struct net *net)
{
- remove_proc_entry("pppol2tp", net->proc_net);
+ proc_net_remove(net, "pppol2tp");
}
static struct pernet_operations pppol2tp_net_ops = {
diff --git a/net/netfilter/ipvs/ip_vs_app.c b/net/netfilter/ipvs/ip_vs_app.c
index 0b779d7..9713e6e 100644
--- a/net/netfilter/ipvs/ip_vs_app.c
+++ b/net/netfilter/ipvs/ip_vs_app.c
@@ -605,12 +605,12 @@ int __net_init ip_vs_app_net_init(struct net *net)
struct netns_ipvs *ipvs = net_ipvs(net);
INIT_LIST_HEAD(&ipvs->app_list);
- proc_create("ip_vs_app", 0, net->proc_net, &ip_vs_app_fops);
+ proc_net_fops_create(net, "ip_vs_app", 0, &ip_vs_app_fops);
return 0;
}
void __net_exit ip_vs_app_net_cleanup(struct net *net)
{
unregister_ip_vs_app(net, NULL /* all */);
- remove_proc_entry("ip_vs_app", net->proc_net);
+ proc_net_remove(net, "ip_vs_app");
}
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 704e514..b1d164e 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -1283,8 +1283,8 @@ int __net_init ip_vs_conn_net_init(struct net *net)
atomic_set(&ipvs->conn_count, 0);
- proc_create("ip_vs_conn", 0, net->proc_net, &ip_vs_conn_fops);
- proc_create("ip_vs_conn_sync", 0, net->proc_net, &ip_vs_conn_sync_fops);
+ proc_net_fops_create(net, "ip_vs_conn", 0, &ip_vs_conn_fops);
+ proc_net_fops_create(net, "ip_vs_conn_sync", 0, &ip_vs_conn_sync_fops);
return 0;
}
@@ -1292,8 +1292,8 @@ void __net_exit ip_vs_conn_net_cleanup(struct net *net)
{
/* flush all the connection entries first */
ip_vs_conn_flush(net);
- remove_proc_entry("ip_vs_conn", net->proc_net);
- remove_proc_entry("ip_vs_conn_sync", net->proc_net);
+ proc_net_remove(net, "ip_vs_conn");
+ proc_net_remove(net, "ip_vs_conn_sync");
}
int __init ip_vs_conn_init(void)
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index c68198b..ec664cb 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -3800,10 +3800,10 @@ int __net_init ip_vs_control_net_init(struct net *net)
spin_lock_init(&ipvs->tot_stats.lock);
- proc_create("ip_vs", 0, net->proc_net, &ip_vs_info_fops);
- proc_create("ip_vs_stats", 0, net->proc_net, &ip_vs_stats_fops);
- proc_create("ip_vs_stats_percpu", 0, net->proc_net,
- &ip_vs_stats_percpu_fops);
+ proc_net_fops_create(net, "ip_vs", 0, &ip_vs_info_fops);
+ proc_net_fops_create(net, "ip_vs_stats", 0, &ip_vs_stats_fops);
+ proc_net_fops_create(net, "ip_vs_stats_percpu", 0,
+ &ip_vs_stats_percpu_fops);
if (ip_vs_control_net_init_sysctl(net))
goto err;
@@ -3822,9 +3822,9 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net)
ip_vs_trash_cleanup(net);
ip_vs_stop_estimator(net, &ipvs->tot_stats);
ip_vs_control_net_cleanup_sysctl(net);
- remove_proc_entry("ip_vs_stats_percpu", net->proc_net);
- remove_proc_entry("ip_vs_stats", net->proc_net);
- remove_proc_entry("ip_vs", net->proc_net);
+ proc_net_remove(net, "ip_vs_stats_percpu");
+ proc_net_remove(net, "ip_vs_stats");
+ proc_net_remove(net, "ip_vs");
free_percpu(ipvs->tot_stats.cpustats);
}
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index 8c10e3d..3e3bf89 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -568,8 +568,7 @@ static int exp_proc_init(struct net *net)
#ifdef CONFIG_NF_CONNTRACK_PROCFS
struct proc_dir_entry *proc;
- proc = proc_create("nf_conntrack_expect", 0440, net->proc_net,
- &exp_file_ops);
+ proc = proc_net_fops_create(net, "nf_conntrack_expect", 0440, &exp_file_ops);
if (!proc)
return -ENOMEM;
#endif /* CONFIG_NF_CONNTRACK_PROCFS */
@@ -579,7 +578,7 @@ static int exp_proc_init(struct net *net)
static void exp_proc_remove(struct net *net)
{
#ifdef CONFIG_NF_CONNTRACK_PROCFS
- remove_proc_entry("nf_conntrack_expect", net->proc_net);
+ proc_net_remove(net, "nf_conntrack_expect");
#endif /* CONFIG_NF_CONNTRACK_PROCFS */
}
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 6bcce40..7936bf7 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -366,7 +366,7 @@ static int nf_conntrack_standalone_init_proc(struct net *net)
{
struct proc_dir_entry *pde;
- pde = proc_create("nf_conntrack", 0440, net->proc_net, &ct_file_ops);
+ pde = proc_net_fops_create(net, "nf_conntrack", 0440, &ct_file_ops);
if (!pde)
goto out_nf_conntrack;
@@ -377,7 +377,7 @@ static int nf_conntrack_standalone_init_proc(struct net *net)
return 0;
out_stat_nf_conntrack:
- remove_proc_entry("nf_conntrack", net->proc_net);
+ proc_net_remove(net, "nf_conntrack");
out_nf_conntrack:
return -ENOMEM;
}
@@ -385,7 +385,7 @@ out_nf_conntrack:
static void nf_conntrack_standalone_fini_proc(struct net *net)
{
remove_proc_entry("nf_conntrack", net->proc_net_stat);
- remove_proc_entry("nf_conntrack", net->proc_net);
+ proc_net_remove(net, "nf_conntrack");
}
#else
static int nf_conntrack_standalone_init_proc(struct net *net)
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 686c771..7b3a9e5 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1323,12 +1323,12 @@ int xt_proto_init(struct net *net, u_int8_t af)
out_remove_matches:
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_MATCHES, sizeof(buf));
- remove_proc_entry(buf, net->proc_net);
+ proc_net_remove(net, buf);
out_remove_tables:
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_TABLES, sizeof(buf));
- remove_proc_entry(buf, net->proc_net);
+ proc_net_remove(net, buf);
out:
return -1;
#endif
@@ -1342,15 +1342,15 @@ void xt_proto_fini(struct net *net, u_int8_t af)
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_TABLES, sizeof(buf));
- remove_proc_entry(buf, net->proc_net);
+ proc_net_remove(net, buf);
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_TARGETS, sizeof(buf));
- remove_proc_entry(buf, net->proc_net);
+ proc_net_remove(net, buf);
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_MATCHES, sizeof(buf));
- remove_proc_entry(buf, net->proc_net);
+ proc_net_remove(net, buf);
#endif /*CONFIG_PROC_FS*/
}
EXPORT_SYMBOL_GPL(xt_proto_fini);
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index f330e8b..78e4a45 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -864,7 +864,7 @@ static int __net_init hashlimit_proc_net_init(struct net *net)
#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
hashlimit_net->ip6t_hashlimit = proc_mkdir("ip6t_hashlimit", net->proc_net);
if (!hashlimit_net->ip6t_hashlimit) {
- remove_proc_entry("ipt_hashlimit", net->proc_net);
+ proc_net_remove(net, "ipt_hashlimit");
return -ENOMEM;
}
#endif
@@ -893,9 +893,9 @@ static void __net_exit hashlimit_proc_net_exit(struct net *net)
hashlimit_net->ip6t_hashlimit = NULL;
mutex_unlock(&hashlimit_mutex);
- remove_proc_entry("ipt_hashlimit", net->proc_net);
+ proc_net_remove(net, "ipt_hashlimit");
#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
- remove_proc_entry("ip6t_hashlimit", net->proc_net);
+ proc_net_remove(net, "ip6t_hashlimit");
#endif
}
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index d9cad31..c3cdcb4 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -643,7 +643,7 @@ static void __net_exit recent_proc_net_exit(struct net *net)
recent_net->xt_recent = NULL;
spin_unlock_bh(&recent_lock);
- remove_proc_entry("xt_recent", net->proc_net);
+ proc_net_remove(net, "xt_recent");
}
#else
static inline int recent_proc_net_init(struct net *net)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 1e3fd5b..ffddbee 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2137,7 +2137,7 @@ static const struct net_proto_family netlink_family_ops = {
static int __net_init netlink_net_init(struct net *net)
{
#ifdef CONFIG_PROC_FS
- if (!proc_create("netlink", 0, net->proc_net, &netlink_seq_fops))
+ if (!proc_net_fops_create(net, "netlink", 0, &netlink_seq_fops))
return -ENOMEM;
#endif
return 0;
@@ -2146,7 +2146,7 @@ static int __net_init netlink_net_init(struct net *net)
static void __net_exit netlink_net_exit(struct net *net)
{
#ifdef CONFIG_PROC_FS
- remove_proc_entry("netlink", net->proc_net);
+ proc_net_remove(net, "netlink");
#endif
}
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index d1fa1d9..92c43aa 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -1448,9 +1448,9 @@ static int __init nr_proto_init(void)
nr_loopback_init();
- proc_create("nr", S_IRUGO, init_net.proc_net, &nr_info_fops);
- proc_create("nr_neigh", S_IRUGO, init_net.proc_net, &nr_neigh_fops);
- proc_create("nr_nodes", S_IRUGO, init_net.proc_net, &nr_nodes_fops);
+ proc_net_fops_create(&init_net, "nr", S_IRUGO, &nr_info_fops);
+ proc_net_fops_create(&init_net, "nr_neigh", S_IRUGO, &nr_neigh_fops);
+ proc_net_fops_create(&init_net, "nr_nodes", S_IRUGO, &nr_nodes_fops);
out:
return rc;
fail:
@@ -1478,9 +1478,9 @@ static void __exit nr_exit(void)
{
int i;
- remove_proc_entry("nr", init_net.proc_net);
- remove_proc_entry("nr_neigh", init_net.proc_net);
- remove_proc_entry("nr_nodes", init_net.proc_net);
+ proc_net_remove(&init_net, "nr");
+ proc_net_remove(&init_net, "nr_neigh");
+ proc_net_remove(&init_net, "nr_nodes");
nr_loopback_clear();
nr_rt_free();
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 1d6793d..6a5d590 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -3827,7 +3827,7 @@ static int __net_init packet_net_init(struct net *net)
mutex_init(&net->packet.sklist_lock);
INIT_HLIST_HEAD(&net->packet.sklist);
- if (!proc_create("packet", 0, net->proc_net, &packet_seq_fops))
+ if (!proc_net_fops_create(net, "packet", 0, &packet_seq_fops))
return -ENOMEM;
return 0;
@@ -3835,7 +3835,7 @@ static int __net_init packet_net_init(struct net *net)
static void __net_exit packet_net_exit(struct net *net)
{
- remove_proc_entry("packet", net->proc_net);
+ proc_net_remove(net, "packet");
}
static struct pernet_operations packet_net_ops = {
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index 45a7df6..5bf6341 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -320,7 +320,7 @@ static int __net_init phonet_init_net(struct net *net)
{
struct phonet_net *pnn = phonet_pernet(net);
- if (!proc_create("phonet", 0, net->proc_net, &pn_sock_seq_fops))
+ if (!proc_net_fops_create(net, "phonet", 0, &pn_sock_seq_fops))
return -ENOMEM;
INIT_LIST_HEAD(&pnn->pndevs.list);
@@ -331,7 +331,7 @@ static int __net_init phonet_init_net(struct net *net)
static void __net_exit phonet_exit_net(struct net *net)
{
- remove_proc_entry("phonet", net->proc_net);
+ proc_net_remove(net, "phonet");
}
static struct pernet_operations phonet_net_ops = {
@@ -348,7 +348,7 @@ int __init phonet_device_init(void)
if (err)
return err;
- proc_create("pnresource", 0, init_net.proc_net, &pn_res_seq_fops);
+ proc_net_fops_create(&init_net, "pnresource", 0, &pn_res_seq_fops);
register_netdevice_notifier(&phonet_device_notifier);
err = phonet_netlink_register();
if (err)
@@ -361,7 +361,7 @@ void phonet_device_exit(void)
rtnl_unregister_all(PF_PHONET);
unregister_netdevice_notifier(&phonet_device_notifier);
unregister_pernet_subsys(&phonet_net_ops);
- remove_proc_entry("pnresource", init_net.proc_net);
+ proc_net_remove(&init_net, "pnresource");
}
int phonet_route_add(struct net_device *dev, u8 daddr)
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index cf68e6e..39396d8 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -1571,13 +1571,10 @@ static int __init rose_proto_init(void)
rose_add_loopback_neigh();
- proc_create("rose", S_IRUGO, init_net.proc_net, &rose_info_fops);
- proc_create("rose_neigh", S_IRUGO, init_net.proc_net,
- &rose_neigh_fops);
- proc_create("rose_nodes", S_IRUGO, init_net.proc_net,
- &rose_nodes_fops);
- proc_create("rose_routes", S_IRUGO, init_net.proc_net,
- &rose_routes_fops);
+ proc_net_fops_create(&init_net, "rose", S_IRUGO, &rose_info_fops);
+ proc_net_fops_create(&init_net, "rose_neigh", S_IRUGO, &rose_neigh_fops);
+ proc_net_fops_create(&init_net, "rose_nodes", S_IRUGO, &rose_nodes_fops);
+ proc_net_fops_create(&init_net, "rose_routes", S_IRUGO, &rose_routes_fops);
out:
return rc;
fail:
@@ -1604,10 +1601,10 @@ static void __exit rose_exit(void)
{
int i;
- remove_proc_entry("rose", init_net.proc_net);
- remove_proc_entry("rose_neigh", init_net.proc_net);
- remove_proc_entry("rose_nodes", init_net.proc_net);
- remove_proc_entry("rose_routes", init_net.proc_net);
+ proc_net_remove(&init_net, "rose");
+ proc_net_remove(&init_net, "rose_neigh");
+ proc_net_remove(&init_net, "rose_nodes");
+ proc_net_remove(&init_net, "rose_routes");
rose_loopback_clear();
rose_rt_free();
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index e61aa60..5b0fd29 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -839,9 +839,8 @@ static int __init af_rxrpc_init(void)
}
#ifdef CONFIG_PROC_FS
- proc_create("rxrpc_calls", 0, init_net.proc_net, &rxrpc_call_seq_fops);
- proc_create("rxrpc_conns", 0, init_net.proc_net,
- &rxrpc_connection_seq_fops);
+ proc_net_fops_create(&init_net, "rxrpc_calls", 0, &rxrpc_call_seq_fops);
+ proc_net_fops_create(&init_net, "rxrpc_conns", 0, &rxrpc_connection_seq_fops);
#endif
return 0;
@@ -879,8 +878,8 @@ static void __exit af_rxrpc_exit(void)
_debug("flush scheduled work");
flush_workqueue(rxrpc_workqueue);
- remove_proc_entry("rxrpc_conns", init_net.proc_net);
- remove_proc_entry("rxrpc_calls", init_net.proc_net);
+ proc_net_remove(&init_net, "rxrpc_conns");
+ proc_net_remove(&init_net, "rxrpc_calls");
destroy_workqueue(rxrpc_workqueue);
kmem_cache_destroy(rxrpc_call_jar);
_leave("");
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index c297e2a..265f6ff 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1768,7 +1768,7 @@ static int __net_init psched_net_init(struct net *net)
{
struct proc_dir_entry *e;
- e = proc_create("psched", 0, net->proc_net, &psched_fops);
+ e = proc_net_fops_create(net, "psched", 0, &psched_fops);
if (e == NULL)
return -ENOMEM;
@@ -1777,7 +1777,7 @@ static int __net_init psched_net_init(struct net *net)
static void __net_exit psched_net_exit(struct net *net)
{
- remove_proc_entry("psched", net->proc_net);
+ proc_net_remove(net, "psched");
}
#else
static int __net_init psched_net_init(struct net *net)
diff --git a/net/sctp/probe.c b/net/sctp/probe.c
index ad0dba8..261b7b9 100644
--- a/net/sctp/probe.c
+++ b/net/sctp/probe.c
@@ -195,8 +195,8 @@ static __init int sctpprobe_init(void)
if (kfifo_alloc(&sctpw.fifo, bufsize, GFP_KERNEL))
return ret;
- if (!proc_create(procname, S_IRUSR, init_net.proc_net,
- &sctpprobe_fops))
+ if (!proc_net_fops_create(&init_net, procname, S_IRUSR,
+ &sctpprobe_fops))
goto free_kfifo;
ret = register_jprobe(&sctp_recv_probe);
@@ -208,7 +208,7 @@ static __init int sctpprobe_init(void)
return 0;
remove_proc:
- remove_proc_entry(procname, init_net.proc_net);
+ proc_net_remove(&init_net, procname);
free_kfifo:
kfifo_free(&sctpw.fifo);
return ret;
@@ -217,7 +217,7 @@ free_kfifo:
static __exit void sctpprobe_exit(void)
{
kfifo_free(&sctpw.fifo);
- remove_proc_entry(procname, init_net.proc_net);
+ proc_net_remove(&init_net, procname);
unregister_jprobe(&sctp_recv_probe);
}
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 51be64f..97d303c 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2400,7 +2400,7 @@ static int __net_init unix_net_init(struct net *net)
goto out;
#ifdef CONFIG_PROC_FS
- if (!proc_create("unix", 0, net->proc_net, &unix_seq_fops)) {
+ if (!proc_net_fops_create(net, "unix", 0, &unix_seq_fops)) {
unix_sysctl_unregister(net);
goto out;
}
@@ -2413,7 +2413,7 @@ out:
static void __net_exit unix_net_exit(struct net *net)
{
unix_sysctl_unregister(net);
- remove_proc_entry("unix", net->proc_net);
+ proc_net_remove(net, "unix");
}
static struct pernet_operations unix_net_ops = {
diff --git a/net/wireless/wext-proc.c b/net/wireless/wext-proc.c
index e98a01c..8bafa31 100644
--- a/net/wireless/wext-proc.c
+++ b/net/wireless/wext-proc.c
@@ -143,8 +143,7 @@ static const struct file_operations wireless_seq_fops = {
int __net_init wext_proc_init(struct net *net)
{
/* Create /proc/net/wireless entry */
- if (!proc_create("wireless", S_IRUGO, net->proc_net,
- &wireless_seq_fops))
+ if (!proc_net_fops_create(net, "wireless", S_IRUGO, &wireless_seq_fops))
return -ENOMEM;
return 0;
@@ -152,5 +151,5 @@ int __net_init wext_proc_init(struct net *net)
void __net_exit wext_proc_exit(struct net *net)
{
- remove_proc_entry("wireless", net->proc_net);
+ proc_net_remove(net, "wireless");
}
diff --git a/net/xfrm/xfrm_proc.c b/net/xfrm/xfrm_proc.c
index c721b0d..6039038 100644
--- a/net/xfrm/xfrm_proc.c
+++ b/net/xfrm/xfrm_proc.c
@@ -74,13 +74,13 @@ static const struct file_operations xfrm_statistics_seq_fops = {
int __net_init xfrm_proc_init(struct net *net)
{
- if (!proc_create("xfrm_stat", S_IRUGO, net->proc_net,
- &xfrm_statistics_seq_fops))
+ if (!proc_net_fops_create(net, "xfrm_stat", S_IRUGO,
+ &xfrm_statistics_seq_fops))
return -ENOMEM;
return 0;
}
void xfrm_proc_fini(struct net *net)
{
- remove_proc_entry("xfrm_stat", net->proc_net);
+ proc_net_remove(net, "xfrm_stat");
}
^ permalink raw reply related
* [PATCH net-next] cxgb4: Allow for backward compatibility with new VPD scheme.
From: Vipul Pandya @ 2013-03-08 13:35 UTC (permalink / raw)
To: netdev; +Cc: davem, divy, dm, abhishek, Santosh Rastapur, Vipul Pandya
From: Santosh Rastapur <santosh@chelsio.com>
New scheme calls for 3rd party VPD at offset 0x0 and Chelsio VPD at offset
0x400 of the function. If no 3rd party VPD is present, then a copy of
Chelsio's VPD will be at offset 0x0 to keep in line with PCI spec which
requires the VPD to be present at offset 0x0.
Signed-off-by: Santosh Rastapur <santosh@chelsio.com>
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
---
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 4ce6203..8049268 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -497,8 +497,9 @@ int t4_memory_write(struct adapter *adap, int mtype, u32 addr, u32 len,
}
#define EEPROM_STAT_ADDR 0x7bfc
-#define VPD_BASE 0
#define VPD_LEN 512
+#define VPD_BASE 0x400
+#define VPD_BASE_OLD 0
/**
* t4_seeprom_wp - enable/disable EEPROM write protection
@@ -524,7 +525,7 @@ int t4_seeprom_wp(struct adapter *adapter, bool enable)
int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
{
u32 cclk_param, cclk_val;
- int i, ret;
+ int i, ret, addr;
int ec, sn;
u8 *vpd, csum;
unsigned int vpdr_len, kw_offset, id_len;
@@ -533,7 +534,12 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
if (!vpd)
return -ENOMEM;
- ret = pci_read_vpd(adapter->pdev, VPD_BASE, VPD_LEN, vpd);
+ ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(u32), vpd);
+ if (ret < 0)
+ goto out;
+ addr = *vpd == 0x82 ? VPD_BASE : VPD_BASE_OLD;
+
+ ret = pci_read_vpd(adapter->pdev, addr, VPD_LEN, vpd);
if (ret < 0)
goto out;
--
1.7.1
^ permalink raw reply related
* Re: [PATCH v2 6/6] ARM: davinci: da850: configure system configuration chip(CFGCHIP3) for emac
From: Prabhakar Lad @ 2013-03-08 13:28 UTC (permalink / raw)
To: Sekhar Nori
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Heiko Schocher,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <CA+V-a8uE6jymk5Z14ydCmuoCAkcLM-ZJKpwp2-0CRXWQtXvTSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Sekhar,
On Mon, Feb 4, 2013 at 10:33 AM, Prabhakar Lad
<prabhakar.csengg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Sekhar ,
>
> On Sun, Feb 3, 2013 at 6:15 PM, Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org> wrote:
>> On 1/28/2013 7:17 PM, Prabhakar Lad wrote:
>>> From: Lad, Prabhakar <prabhakar.lad-l0cyMroinI0@public.gmane.org>
>>>
>>> The system configuration chip CFGCHIP3, controls the emac module.
>>> This patch appropriately configures this register for emac and
>>> sets DA850_MII_MDIO_CLKEN_PIN GPIO pin appropriately.
>>>
>>> Signed-off-by: Lad, Prabhakar <prabhakar.lad-l0cyMroinI0@public.gmane.org>
>>> Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
>>> Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org
>>> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
>>> Cc: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>
>>> Cc: Heiko Schocher <hs-ynQEQJNshbs@public.gmane.org>
>>> ---
>>> arch/arm/mach-davinci/da8xx-dt.c | 28 ++++++++++++++++++++++++++++
>>> 1 files changed, 28 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
>>> index e533a0a..4a096e3 100644
>>> --- a/arch/arm/mach-davinci/da8xx-dt.c
>>> +++ b/arch/arm/mach-davinci/da8xx-dt.c
>>> @@ -8,6 +8,7 @@
>>> * published by the Free Software Foundation.
>>> */
>>> #include <linux/io.h>
>>> +#include <linux/gpio.h>
>>> #include <linux/of_irq.h>
>>> #include <linux/of_platform.h>
>>> #include <linux/irqdomain.h>
>>> @@ -39,6 +40,32 @@ static void __init da8xx_init_irq(void)
>>>
>>> #ifdef CONFIG_ARCH_DAVINCI_DA850
>>>
>>> +static void __init da8xx_config_emac(void)
>>> +{
>>> +#define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6)
>>> +#define DA850_EMAC_MODE_SELECT BIT(8)
>>> + void __iomem *cfg_chip3_base;
>>> + int ret;
>>> + u32 val;
>>> +
>>> + cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
>>> +
>>> + val = __raw_readl(cfg_chip3_base);
>>> + val &= ~DA850_EMAC_MODE_SELECT;
>>> + /* configure the CFGCHIP3 register for MII */
>>> + __raw_writel(val, cfg_chip3_base);
>>
>> Use readl/writel instead.
>>
> Ok.
>
>>> + pr_info("EMAC: MII PHY configured\n");
>>> +
>>> + ret = gpio_request(DA850_MII_MDIO_CLKEN_PIN, "mdio_clk_en");
>>> + if (ret) {
>>> + pr_warn("Cannot open GPIO %d\n",
>>> + DA850_MII_MDIO_CLKEN_PIN);
>>> + return;
>>> + }
>>> + /* Enable/Disable MII MDIO clock */
>>> + gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, 0);
>>> +}
>>> +
>>> struct of_dev_auxdata da8xx_auxdata[] __initdata = {
>>> OF_DEV_AUXDATA("ti,davinci_mdio", 0x01e24000, "davinci_mdio.0", NULL),
>>> OF_DEV_AUXDATA("ti,davinci-dm6467-emac", 0x01e20000, "davinci_emac.1",
>>> @@ -52,6 +79,7 @@ static void __init da850_init_machine(void)
>>> da8xx_auxdata, NULL);
>>>
>>> da8xx_uart_clk_enable();
>>> + da8xx_config_emac();
>>
>> There are couple of issues with this implementation.
>>
>> 1) da8xx_config_emac() is specific to DA850 EVM, but masquerades as
>> generic for da8xx. Looks like you need two functions, one for soc
>> specific configuration and one board specific.
> Ok.
>
>> 2) da8xx_config_emac() goes through all the time, whether the
>> particular board has emac module or not. Shouldn't
>> da8xx_config_emac() check if emac is actually enabled in the passed
>> dtb and only the do the configuration?
>
> Ok. Can you give some pointers how we can access the dtb in board files.
>
Any pointers on this could be helpful.
Regards,
--Prabhakar
>> 3) The function assumes mii is used always, you can use the rmii_en dt
>> property to check if rmii/mii is enabled and configure the soc/board
>> accordingly.
>
> Ok.
>
>> 4) If the same function can work both for da850 and da830, then it can
>> be implemented outside of CONFIG_ARCH_DAVINCI_DA850.
>>
> Ok.
>
> Regards,
> --Prabhakar
>
>> Thanks,
>> Sekhar
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox