* Re: [3.8-rc1] Networking problems after pulling-in net.git#master
From: Sedat Dilek @ 2012-12-23 14:36 UTC (permalink / raw)
To: Cong Wang
Cc: Borislav Petkov, Linux Kernel Network Developers, LKML,
David Miller, Eric Dumazet
In-Reply-To: <CAM_iQpU5VLGOAcZ=RfF8VqpRNTy7rueVpm=+U0Zy5SoAYk4THw@mail.gmail.com>
On Sun, Dec 23, 2012 at 3:25 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> On Sun, Dec 23, 2012 at 10:14 PM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
>>
>> [ CCing Eric ]
>>
>> YES, thie fixes my problem.
>> But your patch was somehow malformed, so I attached mine.
>>
>
> Thanks for testing!
>
> I knew it as I replied in wed Gmail. :) I will send a normal patch
> with your Reported-by and Tested-by.
/o\ for your quick reply and patch!
Just as a sidenote:
The mentioned MEI patch [1] did also fix the ugly locking on
soft-reboot (for people who are affected and know about GIYF) :-).
Good I am doing a (filesystem) sync before reboots.
I did not much testing, but for a -rc1 release this looks now fine to me.
- Sedat -
[1] http://marc.info/?l=linux-kernel&m=135612627527193&w=2
^ permalink raw reply
* Re: [Patch] arp: fix a regression in arp_solicit()
From: Sedat Dilek @ 2012-12-23 14:49 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev, Eric Dumazet, David S. Miller, Julian Anastasov
In-Reply-To: <1356273778-19113-1-git-send-email-xiyou.wangcong@gmail.com>
On Sun, Dec 23, 2012 at 3:42 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> From: Cong Wang <xiyou.wangcong@gmail.com>
>
> Sedat reported the following commit caused a regression:
>
> commit 9650388b5c56578fdccc79c57a8c82fb92b8e7f1
> Author: Eric Dumazet <edumazet@google.com>
> Date: Fri Dec 21 07:32:10 2012 +0000
>
> ipv4: arp: fix a lockdep splat in arp_solicit
>
> This is due to the 6th parameter of arp_send() needs to be NULL
> for broatcase case, the above commit changed it to all-zero non-NULL
> hw addr.
>
s/broatcase/broadcast ?
- Sedat -
> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
> Cc: Sedat Dilek <sedat.dilek@gmail.com>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Julian Anastasov <ja@ssi.bg>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>
> ---
> diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
> index 1169ed4..9547a273 100644
> --- a/net/ipv4/arp.c
> +++ b/net/ipv4/arp.c
> @@ -321,7 +321,7 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb)
> static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
> {
> __be32 saddr = 0;
> - u8 dst_ha[MAX_ADDR_LEN];
> + u8 dst_ha[MAX_ADDR_LEN], *dst_hw = NULL;
> struct net_device *dev = neigh->dev;
> __be32 target = *(__be32 *)neigh->primary_key;
> int probes = atomic_read(&neigh->probes);
> @@ -364,8 +364,8 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
> if (!(neigh->nud_state & NUD_VALID))
> pr_debug("trying to ucast probe in NUD_INVALID\n");
> neigh_ha_snapshot(dst_ha, neigh, dev);
> + dst_hw = dst_ha;
> } else {
> - memset(dst_ha, 0, dev->addr_len);
> probes -= neigh->parms->app_probes;
> if (probes < 0) {
> #ifdef CONFIG_ARPD
> @@ -376,7 +376,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
> }
>
> arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
> - dst_ha, dev->dev_addr, NULL);
> + dst_hw, dev->dev_addr, NULL);
> }
>
> static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
^ permalink raw reply
* [Patch] arp: fix a regression in arp_solicit()
From: Cong Wang @ 2012-12-23 14:42 UTC (permalink / raw)
To: netdev
Cc: Sedat Dilek, Eric Dumazet, David S. Miller, Julian Anastasov,
Cong Wang
From: Cong Wang <xiyou.wangcong@gmail.com>
Sedat reported the following commit caused a regression:
commit 9650388b5c56578fdccc79c57a8c82fb92b8e7f1
Author: Eric Dumazet <edumazet@google.com>
Date: Fri Dec 21 07:32:10 2012 +0000
ipv4: arp: fix a lockdep splat in arp_solicit
This is due to the 6th parameter of arp_send() needs to be NULL
for broatcase case, the above commit changed it to all-zero non-NULL
hw addr.
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 1169ed4..9547a273 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -321,7 +321,7 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb)
static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
{
__be32 saddr = 0;
- u8 dst_ha[MAX_ADDR_LEN];
+ u8 dst_ha[MAX_ADDR_LEN], *dst_hw = NULL;
struct net_device *dev = neigh->dev;
__be32 target = *(__be32 *)neigh->primary_key;
int probes = atomic_read(&neigh->probes);
@@ -364,8 +364,8 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
if (!(neigh->nud_state & NUD_VALID))
pr_debug("trying to ucast probe in NUD_INVALID\n");
neigh_ha_snapshot(dst_ha, neigh, dev);
+ dst_hw = dst_ha;
} else {
- memset(dst_ha, 0, dev->addr_len);
probes -= neigh->parms->app_probes;
if (probes < 0) {
#ifdef CONFIG_ARPD
@@ -376,7 +376,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
}
arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
- dst_ha, dev->dev_addr, NULL);
+ dst_hw, dev->dev_addr, NULL);
}
static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
^ permalink raw reply related
* Re: [Patch] arp: fix a regression in arp_solicit()
From: Sedat Dilek @ 2012-12-23 14:58 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev, Eric Dumazet, David S. Miller, Julian Anastasov
In-Reply-To: <CA+icZUWKNAGe+jMbsonrigVZ5Sk7dDdciZn1r7oMcsAWe7i3fQ@mail.gmail.com>
On Sun, Dec 23, 2012 at 3:49 PM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> On Sun, Dec 23, 2012 at 3:42 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> From: Cong Wang <xiyou.wangcong@gmail.com>
>>
>> Sedat reported the following commit caused a regression:
>>
>> commit 9650388b5c56578fdccc79c57a8c82fb92b8e7f1
>> Author: Eric Dumazet <edumazet@google.com>
>> Date: Fri Dec 21 07:32:10 2012 +0000
>>
>> ipv4: arp: fix a lockdep splat in arp_solicit
>>
>> This is due to the 6th parameter of arp_send() needs to be NULL
>> for broatcase case, the above commit changed it to all-zero non-NULL
>> hw addr.
>>
>
> s/broatcase/broadcast ?
>
While at it you might enhance the label with "ipv4"?
ipv4: arp: fix a regression in arp_solicit()
> - Sedat -
>
>> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
>> Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
>> Cc: Sedat Dilek <sedat.dilek@gmail.com>
>> Cc: Eric Dumazet <edumazet@google.com>
>> Cc: David S. Miller <davem@davemloft.net>
>> Cc: Julian Anastasov <ja@ssi.bg>
>> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>>
>> ---
>> diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
>> index 1169ed4..9547a273 100644
>> --- a/net/ipv4/arp.c
>> +++ b/net/ipv4/arp.c
>> @@ -321,7 +321,7 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb)
>> static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
>> {
>> __be32 saddr = 0;
>> - u8 dst_ha[MAX_ADDR_LEN];
>> + u8 dst_ha[MAX_ADDR_LEN], *dst_hw = NULL;
>> struct net_device *dev = neigh->dev;
>> __be32 target = *(__be32 *)neigh->primary_key;
>> int probes = atomic_read(&neigh->probes);
>> @@ -364,8 +364,8 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
>> if (!(neigh->nud_state & NUD_VALID))
>> pr_debug("trying to ucast probe in NUD_INVALID\n");
>> neigh_ha_snapshot(dst_ha, neigh, dev);
>> + dst_hw = dst_ha;
>> } else {
>> - memset(dst_ha, 0, dev->addr_len);
>> probes -= neigh->parms->app_probes;
>> if (probes < 0) {
>> #ifdef CONFIG_ARPD
>> @@ -376,7 +376,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
>> }
>>
>> arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
>> - dst_ha, dev->dev_addr, NULL);
>> + dst_hw, dev->dev_addr, NULL);
>> }
>>
>> static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
^ permalink raw reply
* Re: IPv6 over Firewire
From: YOSHIFUJI Hideaki @ 2012-12-23 17:09 UTC (permalink / raw)
To: stephan.gatzka; +Cc: netdev, linux1394-devel, YOSHIFUJI Hideaki
In-Reply-To: <50D7062D.8040901@gmail.com>
Stephan Gatzka wrote:
> So may aim is to rewrite the LL address option both while transmitting and receiving IPv6 data on firewire. While transmitting, I append the required information, while receiving I cut away the the firewire specific stuff. So the upper layers will not see the firewire related information. Yes, that mangling also involves recalculation of the ICMPv6 checksum.
No, it is not enough. For example, Signature Option of SEND
(RFC3971) takes link-layer address options into account.
If anything is happened to be altered, verification will
fail.
> Again, if I shall not mangle the ndisc packets in the driver I have to build RFC 3146 conformant packets in ndisc_build_skb(). But I see no (general) way to get the firewire specific information into the linux ndisc stuff. Of course I can add some if/else into ndisc_fill_addr_option() and ndisc_recv_na(). But then I have to pull a lot of firewire related stuff into the ndisc code.
>
> I think this makes no sense, especially because I need that firewire specific information in the firewire net driver to send correct firewire packets. Besides that, the IPv4 portion of the firewire net drivers does exactly the same with ARP packets what I want to do with IPv6 LL address options.
Please, please do not alter bits in your driver, to maintain
extensibility of protocols.
I am definitely okay to have firewire supporting stuff in
net/ipv6/ndisc.c. Since we already have notification
mechanism, I don't think it will be large.
--yoshfuji
^ permalink raw reply
* Re: [PATCH] brcmsmac: initialize morepending in brcms_b_recv()
From: Arend van Spriel @ 2012-12-23 17:31 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Piotr Haber, John W. Linville,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
brcm80211-dev-list-dY08KVG/lbpWk0Htik3J/w,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1356210434-28435-1-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
On 12/22/2012 10:07 PM, Geert Uytterhoeven wrote:
> drivers/net/wireless/brcm80211/brcmsmac/main.c: In function ‘brcms_b_recv’:
> drivers/net/wireless/brcm80211/brcmsmac/main.c:7636: warning: ‘morepending’ may be used uninitialized in this function
>
Reading the code this warning seems to be invalid except when RXBND is
defined as zero, which would make the whole function totally bogus.
Would be good to have a WARN_ON(!RXBND) in brcms_b_attach().
I don't like pleasing a compiler with unnecessary initializers but I am
also for builds with zero warnings. So...
Acked-by: Arend van Spriel <arend-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
> ---
> drivers/net/wireless/brcm80211/brcmsmac/main.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
> index 17594de..5f0f444 100644
> --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
> +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
> @@ -7633,7 +7633,7 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)
>
> uint n = 0;
> uint bound_limit = bound ? RXBND : -1;
> - bool morepending;
> + bool morepending = false;
>
> skb_queue_head_init(&recv_frames);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: IPv6 over Firewire
From: Stephan Gatzka @ 2012-12-23 18:25 UTC (permalink / raw)
To: YOSHIFUJI Hideaki; +Cc: netdev, linux1394-devel, stefanr
In-Reply-To: <50D73ABB.4020800@linux-ipv6.org>
> Please, please do not alter bits in your driver, to maintain
> extensibility of protocols.
>
> I am definitely okay to have firewire supporting stuff in
> net/ipv6/ndisc.c. Since we already have notification
> mechanism, I don't think it will be large.
>
O.k., let's try it your way.
I believe the the changes in the transmit portions for ndisc are rather
simple. All firewire specific information is stored in the private data
of struct net_device. For the receive section I think I have to change
something in ndisc_recv_ns(), I'll figure that out. Maybe I need some
(small) support from you, but I think we can do that off list.
I'll try it out but after Christmas. :)
But I have to emphasize that I really need (read) access to the firewire
specific portions of the link layer option in the firewire net driver.
That _is_ necessary to build the relation between the firewire hardware
address (GUID) and the corresponding firewire node.
Because you mentioned IPSEC: Are the ndisc packets also encrypted? If
so, I just can't imagine how I can do the mapping of firewire hardware
addresses and firewire nodes.
@Stefan: Are you o.k. if I go that way?
Regards,
Stephan
^ permalink raw reply
* Re: IPv6 over Firewire
From: YOSHIFUJI Hideaki @ 2012-12-23 19:38 UTC (permalink / raw)
To: stephan.gatzka; +Cc: netdev, linux1394-devel, stefanr, YOSHIFUJI Hideaki
In-Reply-To: <50D74C81.1000400@gmail.com>
Stephan Gatzka wrote:
> I believe the the changes in the transmit portions for ndisc are rather simple. All firewire specific information is stored in the private data of struct net_device. For the receive section I think I have to change something in ndisc_recv_ns(), I'll figure that out. Maybe I need some (small) support from you, but I think we can do that off list.
>
> I'll try it out but after Christmas. :)
>
> But I have to emphasize that I really need (read) access to the firewire specific portions of the link layer option in the firewire net driver. That _is_ necessary to build the relation between the firewire hardware address (GUID) and the corresponding firewire node.
If you change the "hardware address length", you can get
notification when you have new neighbor.
Even if you did not change that, you could introduce new
netevent notification.
> Because you mentioned IPSEC: Are the ndisc packets also encrypted? If so, I just can't imagine how I can do the mapping of firewire hardware addresses and firewire nodes.
I don't think we will see encrypted ND messages, but
IP layer should handle encrypted NDISC messages.
--yoshfuji
^ permalink raw reply
* Re: [patch net-next V3 0/4] net: allow to change carrier from userspace
From: Stephen Hemminger @ 2012-12-23 19:51 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, edumazet, bhutchings, mirqus, greearb, fbl,
john.r.fastabend
In-Reply-To: <20121223101206.GA1715@minipsycho.orion>
On Sun, 23 Dec 2012 11:12:06 +0100
Jiri Pirko <jiri@resnulli.us> wrote:
> Dave, I see that the patchwork status of this is "Deferred".
> Should I repost the patchset?
>
> thanks
The merge window for 3.8 is complete, only bug fixes are accepted.
And Net-next is not open yet. And this is a new feature.
^ permalink raw reply
* recvmmsg() timeout behavior strangeness
From: Michael Kerrisk @ 2012-12-23 20:50 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Caitlin Bestler, David Miller, netdev-u79uwXL29TY76Z2rM5mHXA,
Chris Van Hoof, Clark Williams, Neil Horman,
Arnaldo Carvalho de Melo, Andrew Grover, Michael Kerrisk,
Elie De Brauwer, linux-man-u79uwXL29TY76Z2rM5mHXA,
Steven Whitehouse, Rémi Denis-Courmont
Hello Arnaldo,
As part of his attempt to better document the recvmmsg() syscall that
you added in commit a2e2725541fad72416326798c2d7fa4dafb7d337, Elie de
Brauwer alerted to me to some strangeness in the timeout behavior of
the syscall. I suspect there's a bug that needs fixing, as detailed
below.
AFAICT, the timeout argument was added to this syscall as a result of
the discussion here:
http://thread.gmane.org/gmane.linux.network/128582 .
If I understand correctly, the *intended* purpose of the timeout
argument is to set a limit on how long to wait for additional
datagrams after the arrival of an initial datagram. However, the
syscall behaves in quite a different way. Instead, it potentially
blocks forever, regardless of the timeout. The way the timeout seems
to work is as follows:
1. The timeout, T, is armed on receipt of first diagram, starting at time X.
2. After each further datagram is received, a check is made if we have
reached time X+T. If we have reached that time, then the syscall
returns.
Since the timeout is only checked after the arrival of each datagram,
we can have scenarios like the following:
0. Assume a timeout of 10 seconds, and that vlen is 5.
1. First datagram arrives at time X.
2. Second datagram arrives at time X+2 secs
3. No more datagrams arrive.
In this case, the call blocks forever. Is that intended behavior?
(Basically, if vlen-1 datagrams arrive before X+T, but then no more
datagrams arrive, the call will remain blocked forever.) If it's
intended behavior, could you elaborate the use case, since it would be
good to add that to the man page.
Thanks,
Michael
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [patch net-next V3 0/4] net: allow to change carrier from userspace
From: David Miller @ 2012-12-23 22:11 UTC (permalink / raw)
To: jiri
Cc: netdev, edumazet, bhutchings, mirqus, shemminger, greearb, fbl,
john.r.fastabend
In-Reply-To: <20121223101206.GA1715@minipsycho.orion>
From: Jiri Pirko <jiri@resnulli.us>
Date: Sun, 23 Dec 2012 11:12:06 +0100
> Dave, I see that the patchwork status of this is "Deferred".
> Should I repost the patchset?
It's deferred because I haven't openned up the net-next tree
yet, so you're wasting your time if you just keep reposting
the serious while the tree is closed.
Please instead wait patiently for when I announce here that
the net-next tree is open again.
^ permalink raw reply
* Re: [Patch] arp: fix a regression in arp_solicit()
From: David Miller @ 2012-12-23 22:17 UTC (permalink / raw)
To: sedat.dilek; +Cc: xiyou.wangcong, netdev, edumazet, ja
In-Reply-To: <CA+icZUXo+OQ4XZ8V588FHKrDanqwq8jR1pAHwVPjJcu+14TKeQ@mail.gmail.com>
From: Sedat Dilek <sedat.dilek@gmail.com>
Date: Sun, 23 Dec 2012 15:58:52 +0100
> While at it you might enhance the label with "ipv4"?
That's excessive.
ARP is ipv4 and ipv4 only, in other protocols it has completely
different names.
^ permalink raw reply
* Re: IPv6 over Firewire
From: Stefan Richter @ 2012-12-23 23:52 UTC (permalink / raw)
To: stephan.gatzka; +Cc: YOSHIFUJI Hideaki, netdev, linux1394-devel
In-Reply-To: <50D74C81.1000400@gmail.com>
On Dec 23 Stephan Gatzka wrote:
> @Stefan: Are you o.k. if I go that way?
Sure, go ahead. If it comes to networking issues, I am certainly not
someone to seek advise at, let alone permission. :-)
--
Stefan Richter
-=====-===-- ==-- ==---
http://arcgraph.de/sr/
^ permalink raw reply
* Re: [Patch] arp: fix a regression in arp_solicit()
From: Cong Wang @ 2012-12-24 1:21 UTC (permalink / raw)
To: David Miller
Cc: sedat.dilek, Linux Kernel Network Developers, edumazet,
Julian Anastasov
In-Reply-To: <20121223.141706.1783471119472317669.davem@davemloft.net>
On Mon, Dec 24, 2012 at 6:17 AM, David Miller <davem@davemloft.net> wrote:
> From: Sedat Dilek <sedat.dilek@gmail.com>
> Date: Sun, 23 Dec 2012 15:58:52 +0100
>
>> While at it you might enhance the label with "ipv4"?
>
> That's excessive.
>
> ARP is ipv4 and ipv4 only, in other protocols it has completely
> different names.
Agreed. I will resend the patch with the typo fixed.
Thanks.
^ permalink raw reply
* [Patch v2] arp: fix a regression in arp_solicit()
From: Cong Wang @ 2012-12-24 1:23 UTC (permalink / raw)
To: netdev
Cc: Sedat Dilek, Eric Dumazet, David S. Miller, Julian Anastasov,
Cong Wang
From: Cong Wang <xiyou.wangcong@gmail.com>
Sedat reported the following commit caused a regression:
commit 9650388b5c56578fdccc79c57a8c82fb92b8e7f1
Author: Eric Dumazet <edumazet@google.com>
Date: Fri Dec 21 07:32:10 2012 +0000
ipv4: arp: fix a lockdep splat in arp_solicit
This is due to the 6th parameter of arp_send() needs to be NULL
for the broadcast case, the above commit changed it to an all-zero
array by mistake.
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 1169ed4..9547a273 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -321,7 +321,7 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb)
static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
{
__be32 saddr = 0;
- u8 dst_ha[MAX_ADDR_LEN];
+ u8 dst_ha[MAX_ADDR_LEN], *dst_hw = NULL;
struct net_device *dev = neigh->dev;
__be32 target = *(__be32 *)neigh->primary_key;
int probes = atomic_read(&neigh->probes);
@@ -364,8 +364,8 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
if (!(neigh->nud_state & NUD_VALID))
pr_debug("trying to ucast probe in NUD_INVALID\n");
neigh_ha_snapshot(dst_ha, neigh, dev);
+ dst_hw = dst_ha;
} else {
- memset(dst_ha, 0, dev->addr_len);
probes -= neigh->parms->app_probes;
if (probes < 0) {
#ifdef CONFIG_ARPD
@@ -376,7 +376,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
}
arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
- dst_ha, dev->dev_addr, NULL);
+ dst_hw, dev->dev_addr, NULL);
}
static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
^ permalink raw reply related
* Re: [Patch] arp: fix a regression in arp_solicit()
From: Sedat Dilek @ 2012-12-24 1:33 UTC (permalink / raw)
To: David Miller; +Cc: xiyou.wangcong, netdev, edumazet, ja
In-Reply-To: <20121223.141706.1783471119472317669.davem@davemloft.net>
On Sun, Dec 23, 2012 at 11:17 PM, David Miller <davem@davemloft.net> wrote:
> From: Sedat Dilek <sedat.dilek@gmail.com>
> Date: Sun, 23 Dec 2012 15:58:52 +0100
>
>> While at it you might enhance the label with "ipv4"?
>
> That's excessive.
>
> ARP is ipv4 and ipv4 only, in other protocols it has completely
> different names.
OK, I see (shorter subject is always good).
I oriented myself at the original commit from Eric which was labeled the same.
Just had a look at the git-history [1] myself...
- Sedat -
[1] http://git.kernel.org/?p=linux/kernel/git/davem/net.git;a=history;f=net/ipv4/arp.c
^ permalink raw reply
* Re: [Patch] arp: fix a regression in arp_solicit()
From: Sedat Dilek @ 2012-12-24 1:44 UTC (permalink / raw)
To: David Miller; +Cc: xiyou.wangcong, netdev, edumazet, ja
In-Reply-To: <CA+icZUX4W0zAbxJOO1di4Y1-f4w=h4WUVS7tfCLvkRG+Muc61g@mail.gmail.com>
On Mon, Dec 24, 2012 at 2:33 AM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> On Sun, Dec 23, 2012 at 11:17 PM, David Miller <davem@davemloft.net> wrote:
>> From: Sedat Dilek <sedat.dilek@gmail.com>
>> Date: Sun, 23 Dec 2012 15:58:52 +0100
>>
>>> While at it you might enhance the label with "ipv4"?
>>
>> That's excessive.
>>
>> ARP is ipv4 and ipv4 only, in other protocols it has completely
>> different names.
>
> OK, I see (shorter subject is always good).
> I oriented myself at the original commit from Eric which was labeled the same.
> Just had a look at the git-history [1] myself...
>
Hmm, 'man arp' does not mention as IPv4-only.
So, Neighbor Discovery Protocol (NDP) is the "IPv6 equivalent".
Just as a note to myself.
- Sedat -
[1] http://en.wikipedia.org/wiki/Address_Resolution_Protocol
[2] https://kb.wisc.edu/ns/page.php?id=12364
> - Sedat -
>
> [1] http://git.kernel.org/?p=linux/kernel/git/davem/net.git;a=history;f=net/ipv4/arp.c
^ permalink raw reply
* [PATCH 00/29] rename random32 and net_random to prandom
From: Akinobu Mita @ 2012-12-24 2:13 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, Theodore Ts'o, David S. Miller, netdev
Commit 496f2f93b1cc286f5a4f4f9acdc1e5314978683f ("random32: rename random32
to prandom") renamed random32() and srandom32() to prandom_u32() and
prandom_seed() respectively. Due to the volume of existing random32()
callers, they were preserved as backword compatibility wrapper macros.
This patch series aims for finishing the naming transition and removing
the backword compatibility wrapper macros.
The naming transition is mainly simple substitution work for random32()
and srandom32(). Furthermore, net_random() and net_srandom() are another
wrapper macros for random32() and srandom32(). They also should be
renamed to prandom_* while I'm at it.
This patch series also includes minor cleanup and bugfix which were found
while I was working on the substitution.
Akinobu Mita (29):
raid6test: use prandom_bytes()
uuid: use prandom_bytes()
x86: pageattr-test: remove srandom32 call
x86: rename random32() to prandom_u32()
lib/: rename random32() to prandom_u32()
mm/: rename random32() to prandom_u32()
kernel/: rename random32() to prandom_u32()
drbd: rename random32() to prandom_u32()
infiniband: rename random32() and net_random() to prandom_u32()
mmc: rename random32() to prandom_u32()
video/uvesafb: rename random32() to prandom_u32()
xfs: rename random32() to prandom_u32()
ubifs: rename random32() to prandom_u32()
uwb: rename random32() to prandom_u32()
lguest: rename random32() to prandom_u32()
scsi: rename random32() to prandom_u32()
mtd: rename random32() to prandom_u32()
drivers/net: rename random32() to prandom_u32()
batman-adv: fix random jitter calculation
batman-adv: rename random32() to prandom_u32()
net/sunrpc: rename random32() and net_random() to prandom_u32()
net/sched: rename random32() and net_random() to prandom_u32()
net/ipv4: rename net_random() to prandom_u32()
net/ipv6: rename net_random() to prandom_u32()
net/netfilter: rename random32() and net_random() to prandom_u32()
net/core: rename random32() and net_random() to prandom_u32()
net/core: remove duplicate statements by do-while loop
net/: rename net_random() to prandom_u32()
remove unused net_random(), net_srandom(), random32(), and
srandom32()
arch/x86/mm/pageattr-test.c | 5 ++--
crypto/async_tx/raid6test.c | 9 ++-----
drivers/block/drbd/drbd_receiver.c | 5 ++--
drivers/infiniband/core/cma.c | 2 +-
drivers/infiniband/hw/cxgb3/cxio_resource.c | 4 +--
drivers/infiniband/hw/cxgb4/id_table.c | 4 +--
drivers/infiniband/hw/mlx4/mad.c | 2 +-
drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 +-
drivers/lguest/page_tables.c | 2 +-
drivers/mmc/core/core.c | 4 +--
drivers/mtd/nand/nandsim.c | 6 ++---
drivers/mtd/tests/mtd_nandecctest.c | 10 +++----
drivers/mtd/tests/mtd_stresstest.c | 8 +++---
drivers/mtd/ubi/debug.h | 6 ++---
drivers/net/ethernet/broadcom/cnic.c | 4 +--
drivers/net/hamradio/baycom_epp.c | 2 +-
drivers/net/hamradio/hdlcdrv.c | 2 +-
drivers/net/hamradio/yam.c | 2 +-
drivers/net/wireless/mwifiex/cfg80211.c | 4 +--
drivers/scsi/fcoe/fcoe_ctlr.c | 4 +--
drivers/scsi/lpfc/lpfc_hbadisc.c | 6 ++---
drivers/scsi/qla2xxx/qla_attr.c | 7 +++--
drivers/uwb/rsv.c | 4 +--
drivers/video/uvesafb.c | 2 +-
fs/ubifs/debug.c | 8 +++---
fs/ubifs/lpt_commit.c | 14 +++++-----
fs/ubifs/tnc_commit.c | 2 +-
fs/xfs/xfs_alloc.c | 2 +-
fs/xfs/xfs_error.c | 2 +-
fs/xfs/xfs_ialloc.c | 2 +-
fs/xfs/xfs_log.c | 2 +-
include/linux/net.h | 3 ---
include/linux/random.h | 7 -----
include/net/red.h | 2 +-
kernel/rcutree.c | 2 +-
kernel/test_kprobes.c | 2 +-
lib/fault-inject.c | 2 +-
lib/list_sort.c | 2 +-
lib/uuid.c | 8 +-----
mm/swapfile.c | 2 +-
net/802/garp.c | 2 +-
net/batman-adv/bat_iv_ogm.c | 4 +--
net/core/neighbour.c | 4 +--
net/core/pktgen.c | 42 ++++++++++++++---------------
net/core/stream.c | 2 +-
net/ipv4/devinet.c | 2 +-
net/ipv4/igmp.c | 6 ++---
net/ipv4/inet_connection_sock.c | 2 +-
net/ipv4/udp.c | 2 +-
net/ipv6/addrconf.c | 4 +--
net/ipv6/ip6_flowlabel.c | 2 +-
net/ipv6/mcast.c | 8 +++---
net/netfilter/ipvs/ip_vs_conn.c | 2 +-
net/netfilter/nf_conntrack_core.c | 4 +--
net/netfilter/xt_statistic.c | 2 +-
net/openvswitch/actions.c | 2 +-
net/rds/bind.c | 2 +-
net/sched/act_gact.c | 2 +-
net/sched/sch_choke.c | 2 +-
net/sched/sch_fq_codel.c | 2 +-
net/sched/sch_netem.c | 19 ++++++-------
net/sched/sch_sfb.c | 4 +--
net/sched/sch_sfq.c | 6 ++---
net/sctp/socket.c | 2 +-
net/sunrpc/auth_gss/gss_krb5_wrap.c | 4 +--
net/sunrpc/cache.c | 2 +-
net/sunrpc/xprt.c | 2 +-
net/sunrpc/xprtsock.c | 2 +-
net/xfrm/xfrm_state.c | 2 +-
69 files changed, 145 insertions(+), 164 deletions(-)
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
--
1.7.11.7
^ permalink raw reply
* [PATCH 19/29] batman-adv: fix random jitter calculation
From: Akinobu Mita @ 2012-12-24 2:14 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, Marek Lindner, Simon Wunderlich, Antonio Quartulli,
b.a.t.m.a.n, David S. Miller, netdev
In-Reply-To: <1356315256-6572-1-git-send-email-akinobu.mita@gmail.com>
batadv_iv_ogm_emit_send_time() attempts to calculates a random integer
in the range of 'orig_interval +- BATADV_JITTER' by the below lines.
msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER;
msecs += (random32() % 2 * BATADV_JITTER);
But it actually gets 'orig_interval' or 'orig_interval - BATADV_JITTER'
because '%' and '*' have same precedence and associativity is
left-to-right.
This adds the parentheses at the appropriate position so that it matches
original intension.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Marek Lindner <lindner_marek@yahoo.de>
Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Cc: Antonio Quartulli <ordex@autistici.org>
Cc: b.a.t.m.a.n@lists.open-mesh.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---
net/batman-adv/bat_iv_ogm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 9f3925a..7d02ebd 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -123,7 +123,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv *bat_priv)
unsigned int msecs;
msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER;
- msecs += (random32() % 2 * BATADV_JITTER);
+ msecs += random32() % (2 * BATADV_JITTER);
return jiffies + msecs_to_jiffies(msecs);
}
--
1.7.11.7
^ permalink raw reply related
* [PATCH 20/29] batman-adv: rename random32() to prandom_u32()
From: Akinobu Mita @ 2012-12-24 2:14 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, Marek Lindner, Simon Wunderlich, Antonio Quartulli,
b.a.t.m.a.n, David S. Miller, netdev
In-Reply-To: <1356315256-6572-1-git-send-email-akinobu.mita@gmail.com>
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Marek Lindner <lindner_marek@yahoo.de>
Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Cc: Antonio Quartulli <ordex@autistici.org>
Cc: b.a.t.m.a.n@lists.open-mesh.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---
net/batman-adv/bat_iv_ogm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 7d02ebd..bc434c4 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -123,7 +123,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv *bat_priv)
unsigned int msecs;
msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER;
- msecs += random32() % (2 * BATADV_JITTER);
+ msecs += prandom_u32() % (2 * BATADV_JITTER);
return jiffies + msecs_to_jiffies(msecs);
}
@@ -131,7 +131,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv *bat_priv)
/* when do we schedule a ogm packet to be sent */
static unsigned long batadv_iv_ogm_fwd_send_time(void)
{
- return jiffies + msecs_to_jiffies(random32() % (BATADV_JITTER / 2));
+ return jiffies + msecs_to_jiffies(prandom_u32() % (BATADV_JITTER / 2));
}
/* apply hop penalty for a normal link */
--
1.7.11.7
^ permalink raw reply related
* [PATCH 21/29] net/sunrpc: rename random32() and net_random() to prandom_u32()
From: Akinobu Mita @ 2012-12-24 2:14 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, J. Bruce Fields, Trond Myklebust, David S. Miller,
netdev, linux-nfs
In-Reply-To: <1356315256-6572-1-git-send-email-akinobu.mita@gmail.com>
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-nfs@vger.kernel.org
---
net/sunrpc/auth_gss/gss_krb5_wrap.c | 4 ++--
net/sunrpc/cache.c | 2 +-
net/sunrpc/xprt.c | 2 +-
net/sunrpc/xprtsock.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c
index 107c452..daf301f 100644
--- a/net/sunrpc/auth_gss/gss_krb5_wrap.c
+++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c
@@ -130,8 +130,8 @@ gss_krb5_make_confounder(char *p, u32 conflen)
/* initialize to random value */
if (i == 0) {
- i = random32();
- i = (i << 32) | random32();
+ i = prandom_u32();
+ i = (i << 32) | prandom_u32();
}
switch (conflen) {
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 9afa439..0f85674 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -629,7 +629,7 @@ static void cache_limit_defers(void)
/* Consider removing either the first or the last */
if (cache_defer_cnt > DFR_MAX) {
- if (net_random() & 1)
+ if (prandom_u32() & 1)
discard = list_entry(cache_defer_list.next,
struct cache_deferred_req, recent);
else
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index bd462a5..0b51154 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1109,7 +1109,7 @@ static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)
static inline void xprt_init_xid(struct rpc_xprt *xprt)
{
- xprt->xid = net_random();
+ xprt->xid = prandom_u32();
}
static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 68b0a81..3b126ae 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1654,7 +1654,7 @@ static void xs_udp_timer(struct rpc_task *task)
static unsigned short xs_get_random_port(void)
{
unsigned short range = xprt_max_resvport - xprt_min_resvport;
- unsigned short rand = (unsigned short) net_random() % range;
+ unsigned short rand = (unsigned short) prandom_u32() % range;
return rand + xprt_min_resvport;
}
--
1.7.11.7
^ permalink raw reply related
* [PATCH 22/29] net/sched: rename random32() and net_random() to prandom_u32()
From: Akinobu Mita @ 2012-12-24 2:14 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, Stephen Hemminger, Jamal Hadi Salim,
David S. Miller, netem, netdev
In-Reply-To: <1356315256-6572-1-git-send-email-akinobu.mita@gmail.com>
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netem@lists.linux-foundation.org
Cc: netdev@vger.kernel.org
Cc: netdev@vger.kernel.org
---
net/sched/act_gact.c | 2 +-
net/sched/sch_choke.c | 2 +-
net/sched/sch_fq_codel.c | 2 +-
net/sched/sch_netem.c | 19 ++++++++++---------
net/sched/sch_sfb.c | 4 ++--
net/sched/sch_sfq.c | 6 +++---
6 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 05d60859..d3ceed8 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -37,7 +37,7 @@ static struct tcf_hashinfo gact_hash_info = {
#ifdef CONFIG_GACT_PROB
static int gact_net_rand(struct tcf_gact *gact)
{
- if (!gact->tcfg_pval || net_random() % gact->tcfg_pval)
+ if (!gact->tcfg_pval || prandom_u32() % gact->tcfg_pval)
return gact->tcf_action;
return gact->tcfg_paction;
}
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c
index cc37dd5..ef53ab8 100644
--- a/net/sched/sch_choke.c
+++ b/net/sched/sch_choke.c
@@ -80,7 +80,7 @@ struct choke_sched_data {
/* deliver a random number between 0 and N - 1 */
static u32 random_N(unsigned int N)
{
- return reciprocal_divide(random32(), N);
+ return reciprocal_divide(prandom_u32(), N);
}
/* number of elements in queue including holes */
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
index 4e606fc..93d7f41 100644
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -390,7 +390,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt)
sch->limit = 10*1024;
q->flows_cnt = 1024;
q->quantum = psched_mtu(qdisc_dev(sch));
- q->perturbation = net_random();
+ q->perturbation = prandom_u32();
INIT_LIST_HEAD(&q->new_flows);
INIT_LIST_HEAD(&q->old_flows);
codel_params_init(&q->cparams);
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 298c0dd..e3126e2 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -142,7 +142,7 @@ static inline struct netem_skb_cb *netem_skb_cb(struct sk_buff *skb)
static void init_crandom(struct crndstate *state, unsigned long rho)
{
state->rho = rho;
- state->last = net_random();
+ state->last = prandom_u32();
}
/* get_crandom - correlated random number generator
@@ -155,9 +155,9 @@ static u32 get_crandom(struct crndstate *state)
unsigned long answer;
if (state->rho == 0) /* no correlation */
- return net_random();
+ return prandom_u32();
- value = net_random();
+ value = prandom_u32();
rho = (u64)state->rho + 1;
answer = (value * ((1ull<<32) - rho) + state->last * rho) >> 32;
state->last = answer;
@@ -171,7 +171,7 @@ static u32 get_crandom(struct crndstate *state)
static bool loss_4state(struct netem_sched_data *q)
{
struct clgstate *clg = &q->clg;
- u32 rnd = net_random();
+ u32 rnd = prandom_u32();
/*
* Makes a comparison between rnd and the transition
@@ -238,14 +238,14 @@ static bool loss_gilb_ell(struct netem_sched_data *q)
switch (clg->state) {
case 1:
- if (net_random() < clg->a1)
+ if (prandom_u32() < clg->a1)
clg->state = 2;
- if (net_random() < clg->a4)
+ if (prandom_u32() < clg->a4)
return true;
case 2:
- if (net_random() < clg->a2)
+ if (prandom_u32() < clg->a2)
clg->state = 1;
- if (clg->a3 > net_random())
+ if (clg->a3 > prandom_u32())
return true;
}
@@ -415,7 +415,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
skb_checksum_help(skb)))
return qdisc_drop(skb, sch);
- skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8);
+ skb->data[prandom_u32() % skb_headlen(skb)] ^=
+ 1 << (prandom_u32() % 8);
}
if (unlikely(skb_queue_len(&sch->q) >= sch->limit))
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c
index 30ea467..9b0f709 100644
--- a/net/sched/sch_sfb.c
+++ b/net/sched/sch_sfb.c
@@ -220,7 +220,7 @@ static u32 sfb_compute_qlen(u32 *prob_r, u32 *avgpm_r, const struct sfb_sched_da
static void sfb_init_perturbation(u32 slot, struct sfb_sched_data *q)
{
- q->bins[slot].perturbation = net_random();
+ q->bins[slot].perturbation = prandom_u32();
}
static void sfb_swap_slot(struct sfb_sched_data *q)
@@ -381,7 +381,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
goto enqueue;
}
- r = net_random() & SFB_MAX_PROB;
+ r = prandom_u32() & SFB_MAX_PROB;
if (unlikely(r < p_min)) {
if (unlikely(p_min > SFB_MAX_PROB / 2)) {
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index d3a1bc2..921130e 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -627,7 +627,7 @@ static void sfq_perturbation(unsigned long arg)
spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch));
spin_lock(root_lock);
- q->perturbation = net_random();
+ q->perturbation = prandom_u32();
if (!q->filter_list && q->tail)
sfq_rehash(sch);
spin_unlock(root_lock);
@@ -696,7 +696,7 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt)
del_timer(&q->perturb_timer);
if (q->perturb_period) {
mod_timer(&q->perturb_timer, jiffies + q->perturb_period);
- q->perturbation = net_random();
+ q->perturbation = prandom_u32();
}
sch_tree_unlock(sch);
kfree(p);
@@ -757,7 +757,7 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt)
q->quantum = psched_mtu(qdisc_dev(sch));
q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum);
q->perturb_period = 0;
- q->perturbation = net_random();
+ q->perturbation = prandom_u32();
if (opt) {
int err = sfq_change(sch, opt);
--
1.7.11.7
^ permalink raw reply related
* [PATCH 25/29] net/netfilter: rename random32() and net_random() to prandom_u32()
From: Akinobu Mita @ 2012-12-24 2:14 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, Pablo Neira Ayuso, Patrick McHardy, netfilter-devel,
netfilter, coreteam, David S. Miller, netdev
In-Reply-To: <1356315256-6572-1-git-send-email-akinobu.mita@gmail.com>
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org
Cc: netfilter@vger.kernel.org
Cc: coreteam@netfilter.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---
net/netfilter/ipvs/ip_vs_conn.c | 2 +-
net/netfilter/nf_conntrack_core.c | 4 ++--
net/netfilter/xt_statistic.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 30e764a..870dff6 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -1200,7 +1200,7 @@ void ip_vs_random_dropentry(struct net *net)
* Randomly scan 1/32 of the whole table every second
*/
for (idx = 0; idx < (ip_vs_conn_tab_size>>5); idx++) {
- unsigned int hash = net_random() & ip_vs_conn_tab_mask;
+ unsigned int hash = prandom_u32() & ip_vs_conn_tab_mask;
struct hlist_node *n;
/*
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 08cdc71..a8f5c7a 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -263,7 +263,7 @@ static void death_by_event(unsigned long ul_conntrack)
if (nf_conntrack_event(IPCT_DESTROY, ct) < 0) {
/* bad luck, let's retry again */
ecache->timeout.expires = jiffies +
- (random32() % net->ct.sysctl_events_retry_timeout);
+ (prandom_u32() % net->ct.sysctl_events_retry_timeout);
add_timer(&ecache->timeout);
return;
}
@@ -282,7 +282,7 @@ void nf_ct_dying_timeout(struct nf_conn *ct)
/* set a new timer to retry event delivery */
setup_timer(&ecache->timeout, death_by_event, (unsigned long)ct);
ecache->timeout.expires = jiffies +
- (random32() % net->ct.sysctl_events_retry_timeout);
+ (prandom_u32() % net->ct.sysctl_events_retry_timeout);
add_timer(&ecache->timeout);
}
EXPORT_SYMBOL_GPL(nf_ct_dying_timeout);
diff --git a/net/netfilter/xt_statistic.c b/net/netfilter/xt_statistic.c
index 4fe4fb4..11de55e 100644
--- a/net/netfilter/xt_statistic.c
+++ b/net/netfilter/xt_statistic.c
@@ -37,7 +37,7 @@ statistic_mt(const struct sk_buff *skb, struct xt_action_param *par)
switch (info->mode) {
case XT_STATISTIC_MODE_RANDOM:
- if ((net_random() & 0x7FFFFFFF) < info->u.random.probability)
+ if ((prandom_u32() & 0x7FFFFFFF) < info->u.random.probability)
ret = !ret;
break;
case XT_STATISTIC_MODE_NTH:
--
1.7.11.7
^ permalink raw reply related
* [PATCH 26/29] net/core: rename random32() and net_random() to prandom_u32()
From: Akinobu Mita @ 2012-12-24 2:14 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, David S. Miller, netdev
In-Reply-To: <1356315256-6572-1-git-send-email-akinobu.mita@gmail.com>
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---
net/core/neighbour.c | 4 ++--
net/core/pktgen.c | 29 +++++++++++++++--------------
net/core/stream.c | 2 +-
3 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index c815f28..6818badb 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -123,7 +123,7 @@ static void neigh_cleanup_and_release(struct neighbour *neigh)
unsigned long neigh_rand_reach_time(unsigned long base)
{
- return base ? (net_random() % base) + (base >> 1) : 0;
+ return base ? (prandom_u32() % base) + (base >> 1) : 0;
}
EXPORT_SYMBOL(neigh_rand_reach_time);
@@ -1402,7 +1402,7 @@ void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
struct sk_buff *skb)
{
unsigned long now = jiffies;
- unsigned long sched_next = now + (net_random() % p->proxy_delay);
+ unsigned long sched_next = now + (prandom_u32() % p->proxy_delay);
if (tbl->proxy_queue.qlen > p->proxy_qlen) {
kfree_skb(skb);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index b29dacf..d23ec86 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2182,7 +2182,7 @@ static inline int f_pick(struct pktgen_dev *pkt_dev)
pkt_dev->curfl = 0; /*reset */
}
} else {
- flow = random32() % pkt_dev->cflows;
+ flow = prandom_u32() % pkt_dev->cflows;
pkt_dev->curfl = flow;
if (pkt_dev->flows[flow].count > pkt_dev->lflow) {
@@ -2229,7 +2229,7 @@ static void set_cur_queue_map(struct pktgen_dev *pkt_dev)
else if (pkt_dev->queue_map_min <= pkt_dev->queue_map_max) {
__u16 t;
if (pkt_dev->flags & F_QUEUE_MAP_RND) {
- t = random32() %
+ t = prandom_u32() %
(pkt_dev->queue_map_max -
pkt_dev->queue_map_min + 1)
+ pkt_dev->queue_map_min;
@@ -2261,7 +2261,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
__u32 tmp;
if (pkt_dev->flags & F_MACSRC_RND)
- mc = random32() % pkt_dev->src_mac_count;
+ mc = prandom_u32() % pkt_dev->src_mac_count;
else {
mc = pkt_dev->cur_src_mac_offset++;
if (pkt_dev->cur_src_mac_offset >=
@@ -2287,7 +2287,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
__u32 tmp;
if (pkt_dev->flags & F_MACDST_RND)
- mc = random32() % pkt_dev->dst_mac_count;
+ mc = prandom_u32() % pkt_dev->dst_mac_count;
else {
mc = pkt_dev->cur_dst_mac_offset++;
@@ -2314,21 +2314,21 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
for (i = 0; i < pkt_dev->nr_labels; i++)
if (pkt_dev->labels[i] & MPLS_STACK_BOTTOM)
pkt_dev->labels[i] = MPLS_STACK_BOTTOM |
- ((__force __be32)random32() &
+ ((__force __be32)prandom_u32() &
htonl(0x000fffff));
}
if ((pkt_dev->flags & F_VID_RND) && (pkt_dev->vlan_id != 0xffff)) {
- pkt_dev->vlan_id = random32() & (4096-1);
+ pkt_dev->vlan_id = prandom_u32() & (4096 - 1);
}
if ((pkt_dev->flags & F_SVID_RND) && (pkt_dev->svlan_id != 0xffff)) {
- pkt_dev->svlan_id = random32() & (4096 - 1);
+ pkt_dev->svlan_id = prandom_u32() & (4096 - 1);
}
if (pkt_dev->udp_src_min < pkt_dev->udp_src_max) {
if (pkt_dev->flags & F_UDPSRC_RND)
- pkt_dev->cur_udp_src = random32() %
+ pkt_dev->cur_udp_src = prandom_u32() %
(pkt_dev->udp_src_max - pkt_dev->udp_src_min)
+ pkt_dev->udp_src_min;
@@ -2341,7 +2341,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
if (pkt_dev->udp_dst_min < pkt_dev->udp_dst_max) {
if (pkt_dev->flags & F_UDPDST_RND) {
- pkt_dev->cur_udp_dst = random32() %
+ pkt_dev->cur_udp_dst = prandom_u32() %
(pkt_dev->udp_dst_max - pkt_dev->udp_dst_min)
+ pkt_dev->udp_dst_min;
} else {
@@ -2358,7 +2358,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
if (imn < imx) {
__u32 t;
if (pkt_dev->flags & F_IPSRC_RND)
- t = random32() % (imx - imn) + imn;
+ t = prandom_u32() % (imx - imn) + imn;
else {
t = ntohl(pkt_dev->cur_saddr);
t++;
@@ -2379,7 +2379,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
__be32 s;
if (pkt_dev->flags & F_IPDST_RND) {
- t = random32() % (imx - imn) + imn;
+ t = prandom_u32() % (imx - imn) + imn;
s = htonl(t);
while (ipv4_is_loopback(s) ||
@@ -2387,7 +2387,8 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
ipv4_is_lbcast(s) ||
ipv4_is_zeronet(s) ||
ipv4_is_local_multicast(s)) {
- t = random32() % (imx - imn) + imn;
+ t = prandom_u32() %
+ (imx - imn) + imn;
s = htonl(t);
}
pkt_dev->cur_daddr = s;
@@ -2420,7 +2421,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
for (i = 0; i < 4; i++) {
pkt_dev->cur_in6_daddr.s6_addr32[i] =
- (((__force __be32)random32() |
+ (((__force __be32)prandom_u32() |
pkt_dev->min_in6_daddr.s6_addr32[i]) &
pkt_dev->max_in6_daddr.s6_addr32[i]);
}
@@ -2430,7 +2431,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
if (pkt_dev->min_pkt_size < pkt_dev->max_pkt_size) {
__u32 t;
if (pkt_dev->flags & F_TXSIZE_RND) {
- t = random32() %
+ t = prandom_u32() %
(pkt_dev->max_pkt_size - pkt_dev->min_pkt_size)
+ pkt_dev->min_pkt_size;
} else {
diff --git a/net/core/stream.c b/net/core/stream.c
index f5df85d..6881f0c 100644
--- a/net/core/stream.c
+++ b/net/core/stream.c
@@ -122,7 +122,7 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p)
DEFINE_WAIT(wait);
if (sk_stream_memory_free(sk))
- current_timeo = vm_wait = (net_random() % (HZ / 5)) + 2;
+ current_timeo = vm_wait = (prandom_u32() % (HZ / 5)) + 2;
while (1) {
set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
--
1.7.11.7
^ permalink raw reply related
* [PATCH 28/29] net/: rename net_random() to prandom_u32()
From: Akinobu Mita @ 2012-12-24 2:14 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
Cc: Steffen Klassert, dev-yBygre7rU0TnMu66kgdUjQ, Herbert Xu,
Neil Horman, netdev-u79uwXL29TY76Z2rM5mHXA, Vlad Yasevich,
Akinobu Mita, Venkat Venkatsubra,
linux-sctp-u79uwXL29TY76Z2rM5mHXA, David S. Miller,
Sridhar Samudrala
In-Reply-To: <1356315256-6572-1-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
Cc: Venkat Venkatsubra <venkat.x.venkatsubra-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: Vlad Yasevich <vyasevich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Sridhar Samudrala <sri-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: Steffen Klassert <steffen.klassert-opNxpl+3fjRBDgjK7y7TUQ@public.gmane.org>
Cc: Herbert Xu <herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: linux-sctp-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
include/net/red.h | 2 +-
net/802/garp.c | 2 +-
net/openvswitch/actions.c | 2 +-
net/rds/bind.c | 2 +-
net/sctp/socket.c | 2 +-
net/xfrm/xfrm_state.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/net/red.h b/include/net/red.h
index ef46058..168bb2f 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -303,7 +303,7 @@ static inline unsigned long red_calc_qavg(const struct red_parms *p,
static inline u32 red_random(const struct red_parms *p)
{
- return reciprocal_divide(net_random(), p->max_P_reciprocal);
+ return reciprocal_divide(prandom_u32(), p->max_P_reciprocal);
}
static inline int red_mark_probability(const struct red_parms *p,
diff --git a/net/802/garp.c b/net/802/garp.c
index 8456f5d..cf7410d 100644
--- a/net/802/garp.c
+++ b/net/802/garp.c
@@ -397,7 +397,7 @@ static void garp_join_timer_arm(struct garp_applicant *app)
{
unsigned long delay;
- delay = (u64)msecs_to_jiffies(garp_join_time) * net_random() >> 32;
+ delay = (u64)msecs_to_jiffies(garp_join_time) * prandom_u32() >> 32;
mod_timer(&app->join_timer, jiffies + delay);
}
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index ac2defe..257bc36 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -404,7 +404,7 @@ static int sample(struct datapath *dp, struct sk_buff *skb,
a = nla_next(a, &rem)) {
switch (nla_type(a)) {
case OVS_SAMPLE_ATTR_PROBABILITY:
- if (net_random() >= nla_get_u32(a))
+ if (prandom_u32() >= nla_get_u32(a))
return 0;
break;
diff --git a/net/rds/bind.c b/net/rds/bind.c
index 637bde5..7f95f4b 100644
--- a/net/rds/bind.c
+++ b/net/rds/bind.c
@@ -118,7 +118,7 @@ static int rds_add_bound(struct rds_sock *rs, __be32 addr, __be16 *port)
rover = be16_to_cpu(*port);
last = rover;
} else {
- rover = max_t(u16, net_random(), 2);
+ rover = max_t(u16, prandom_u32(), 2);
last = rover - 1;
}
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 9e65758..95860aa 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5899,7 +5899,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
inet_get_local_port_range(&low, &high);
remaining = (high - low) + 1;
- rover = net_random() % remaining + low;
+ rover = prandom_u32() % remaining + low;
do {
rover++;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 3459692..35ddaab 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1546,7 +1546,7 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high)
} else {
u32 spi = 0;
for (h=0; h<high-low+1; h++) {
- spi = low + net_random()%(high-low+1);
+ spi = low + prandom_u32() % (high - low + 1);
x0 = xfrm_state_lookup(net, mark, &x->id.daddr, htonl(spi), x->id.proto, x->props.family);
if (x0 == NULL) {
x->id.spi = htonl(spi);
--
1.7.11.7
^ permalink raw reply related
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