* Re: [PATCH] tcp: handle tcp_net_metrics_init() order-5 memory allocation failures
From: David Miller @ 2012-11-16 18:37 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, jln
In-Reply-To: <1353079913.10798.31.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 16 Nov 2012 07:31:53 -0800
> Well, we dont really know what the size needs to be, and your proposal
> reduces the size by a 4 factor, even for the initial namespace.
>
> Julien report was about Chrome browser own netns, on a suspend/resume
> cycle (or something like that)
>
> If size can influence behavior, we could try a vmalloc() if kmalloc()
> fails...
Agreed.
> [PATCH v3] tcp: handle tcp_net_metrics_init() order-5 memory allocation failures
>
> order-5 allocations can fail with current kernels, we should
> try vmalloc() as well.
>
> Reported-by: Julien Tinnes <jln@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
This looks great, applied, thanks.
^ permalink raw reply
* Re: pull request: batman-adv 2012-11-16
From: David Miller @ 2012-11-16 18:39 UTC (permalink / raw)
To: ordex; +Cc: netdev, simon.wunderlich, lindner_marek, sven
In-Reply-To: <1353055758-2901-1-git-send-email-ordex@autistici.org>
From: Antonio Quartulli <ordex@autistici.org>
Date: Fri, 16 Nov 2012 09:49:14 +0100
> here is small set of fixes intended for net/linux-3.7.
> These patches are fixing some interoperability problems due to the features we
> added in 3.7. Mainly we have two big issues: one is preventing clients connected
> to the mesh network to contact any other hosts, caused by a not proper
> translation table handling; the second one compromises the AP isolation feature
> causing it to be completely useless, no matter it was on or off.
Pulled, thanks.
^ permalink raw reply
* Re: [PATCH net-next] net: use right lock in __dev_remove_offload
From: David Miller @ 2012-11-16 18:41 UTC (permalink / raw)
To: vyasevic; +Cc: eric.dumazet, netdev
In-Reply-To: <50A682DA.2060201@redhat.com>
From: Vlad Yasevich <vyasevic@redhat.com>
Date: Fri, 16 Nov 2012 13:15:54 -0500
> On 11/16/2012 01:08 PM, Eric Dumazet wrote:
>> From: Eric Dumazet <edumazet@google.com>
>>
>> offload_base is protected by offload_lock, not ptype_lock
>>
>> Signed-off-by: Eric Dumazet <edumazet@google.com>
...
> Acked-by: Vlad Yasevich <vyasevic@redhat.com>
Applied, thanks everyone.
^ permalink raw reply
* Re: [RFC PATCH] tcp: introduce raw access to experimental options
From: David Miller @ 2012-11-16 18:44 UTC (permalink / raw)
To: elelueck; +Cc: netdev, frankbla, raspl, ubacher, samudrala
In-Reply-To: <1353084898-42264-1-git-send-email-elelueck@linux.vnet.ibm.com>
Unprivileged access to set and fetch these things? I don't think
that's a good idea.
Also, your code has a lot of coding style errors.
^ permalink raw reply
* Re: [PATCH] openvswitch: Make IPv6 packet parsing dependent on IPv6 config
From: Jesse Gross @ 2012-11-16 18:46 UTC (permalink / raw)
To: vyasevic-H+wXaHxf7aLQT0dZR+AlfA
Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA,
fengguang.wu-ral2JQCrhuEAvxtiuMwx3w, davem-fT/PcQaiUtIeIZ0/mPfg9Q
In-Reply-To: <50A67B44.9040508-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Fri, Nov 16, 2012 at 9:43 AM, Vlad Yasevich <vyasevic-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> On 11/16/2012 12:26 PM, Jesse Gross wrote:
>>
>> On Fri, Nov 16, 2012 at 7:40 AM, Vlad Yasevich <vyasevic-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> wrote:
>>
>>> Openvswitch attempts to use IPv6 packet parsing functions without
>>> any dependency on IPv6 (unlike every other place in kernel). Pull
>>> the IPv6 code in openvswitch togeter and put a conditional that's
>>> dependent on CONFIG_IPV6.
>>>
>>> Resolves:
>>> net/built-in.o: In function `ovs_flow_extract':
>>> (.text+0xbf5d5): undefined reference to `ipv6_skip_exthdr'
>>>
>>> Signed-off-by: Vlad Yasevich <vyasevic-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>
>>
>>
>> Doesn't this move in the opposite direction of your patches to make IPv6
>> GSO/GRO always available? The packets being processed here
>> are generally created by the guest but with Open vSwitch running on the
>> host. Also, ipv6_skip_exthdr() is in exthdrs_core.c, so it actually is
>> always available. I suspect that the real problem is that the dependency
>> on the ipv6 directory changed to CONFIG_INET and Open vSwitch should now
>> depend on this.
>>
>
> Yes and no... :) IPv6 uses a bunch of IPv4 code all over. IPv4 is enabled
> with CONFIG_INET and IPv6 with CONFIG_NET. So creates a strange imbalance.
> By shifting IPv6 to CONFIG_INET (which is where it
> lives and what enables its selection during config process), we now have a
> dependency with openvswitch.
>
> All other users of ipv6_skip_exthdr have it either under the IS_ENABLED
> conditional or through some other means that don't build it when INET is
> completely turned off. This patch does the same for openvswitch.
>
> I see 2 alternatives to this:
> 1) Make openvswitch depend on CONFIG_INET.
> 2) Pull a ton of code out of CONFIG_INET (v4 and v6) and into CONFIG_NET.
> This could start with IPv6 header parsing and maybe even
> include GSO/TSO (but not sure how much sense that would be).
>
> What's your take?
I agree the IPv4 and IPv6 code is all tangled together and that IPv6
should use CONFIG_INET as well. I think in an ideal world we would
separate them out but it seems like a lot of work for not much
practical benefit.
I think if you took this to the logical extension and restricted all
the protocols based on the kernel config (i.e. IPv4, TCP, and UDP are
conditional on CONFIG_INET) then you end up with a confusing mess. On
the other hand, if you do it only for IPv6 it's also confusing because
the fact that the other protocols are simple enough to parse on their
own and IPv6 is more complicated is really an implementation detail
that shouldn't be exposed.
I guess the simplest thing to do seems to just make Open vSwitch
depend on CONFIG_INET seeing as it is practically useless without
upper layer protocol support anyways.
^ permalink raw reply
* Re: [PATCH] tcp: handle tcp_net_metrics_init() order-5 memory allocation failures
From: Julien Tinnes @ 2012-11-16 18:51 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
In-Reply-To: <1353079913.10798.31.camel@edumazet-glaptop>
On Fri, Nov 16, 2012 at 7:31 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Fri, 2012-11-16 at 01:39 -0500, David Miller wrote:
>> From: Eric Dumazet <eric.dumazet@gmail.com>
>> Date: Thu, 15 Nov 2012 15:41:04 -0800
>>
>> > From: Eric Dumazet <edumazet@google.com>
>> >
>> > order-5 allocations can fail with current kernels, we should
>> > try to reduce allocation sizes to allow network namespace
>> > creation.
>> >
>> > Reported-by: Julien Tinnes <jln@google.com>
>> > Signed-off-by: Eric Dumazet <edumazet@google.com>
>>
>> Indeed, this has to be done better.
>>
>> But this kind of retry solution results in non-deterministic behavior.
>> Yes the tcp metrics cache is best effort, but it's size can influence
>> behavior in a substantial way depending upon the workload.
>>
>> I would suggest that we instead use different limits, ones which the
>> page allocator will satisfy for us always with GFP_KERNEL.
>>
>> 1) include linux/mmzone.h
>>
>> 2) Make the two limits based upon PAGE_ALLOC_COSTLY_ORDER.
>>
>> That is, make the larger table size PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER
>> and the smaller one PAGE_SIZE << (PAGE_ALLOC_COSTLY_ORDER - 1).
>
> Well, we dont really know what the size needs to be, and your proposal
> reduces the size by a 4 factor, even for the initial namespace.
>
> Julien report was about Chrome browser own netns, on a suspend/resume
> cycle (or something like that)
It happens when users start Chrome. Chrome will create one new network
NS (for the sandbox).
This has been used for a few years now, but we had our first report in
January of this year and we've been getting a few reports very
recently at a rate that is starting to worry me (crbug.com/110756).
Thanks a lot for helping with this!
Julien
^ permalink raw reply
* Re: [PATCH] openvswitch: Make IPv6 packet parsing dependent on IPv6 config
From: David Miller @ 2012-11-16 18:53 UTC (permalink / raw)
To: jesse; +Cc: vyasevic, dev, netdev, fengguang.wu
In-Reply-To: <CAEP_g=80_P=sLkQCGXwdTLKOFN5FgqYYoDbVDXMTipbtM-GhbA@mail.gmail.com>
From: Jesse Gross <jesse@nicira.com>
Date: Fri, 16 Nov 2012 10:46:17 -0800
> I guess the simplest thing to do seems to just make Open vSwitch
> depend on CONFIG_INET seeing as it is practically useless without
> upper layer protocol support anyways.
The reason we have the ipv6 extension header parsing in a seperate,
always compiled statically into the kernel, module is exactly for
situations like this.
We need to think seriously if we want to go down this road of only
using INET as protection for every module that has some kind of ipv6
component to it.
^ permalink raw reply
* [PATCH] net-rps: Fix brokeness causing OOO packets
From: Eric Dumazet @ 2012-11-16 19:04 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Ben Hutchings
From: Tom Herbert <therbert@google.com>
In commit c445477d74ab3779 which adds aRFS to the kernel, the CPU
selected for RFS is not set correctly when CPU is changing.
This is causing OOO packets and probably other issues.
Signed-off-by: Tom Herbert <therbert@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
---
net/core/dev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index bda6d00..c0946cb 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2818,8 +2818,10 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
if (unlikely(tcpu != next_cpu) &&
(tcpu == RPS_NO_CPU || !cpu_online(tcpu) ||
((int)(per_cpu(softnet_data, tcpu).input_queue_head -
- rflow->last_qtail)) >= 0))
+ rflow->last_qtail)) >= 0)) {
+ tcpu = next_cpu;
rflow = set_rps_cpu(dev, skb, rflow, next_cpu);
+ }
if (tcpu != RPS_NO_CPU && cpu_online(tcpu)) {
*rflowp = rflow;
^ permalink raw reply related
* Re: [PATCH] tcp: handle tcp_net_metrics_init() order-5 memory allocation failures
From: Eric Dumazet @ 2012-11-16 19:08 UTC (permalink / raw)
To: Julien Tinnes; +Cc: David Miller, netdev
In-Reply-To: <CAKyRK=iKnoRZbjyEXSYbKoFq8=wtVKAJYTQYeE9y_84YevdagA@mail.gmail.com>
On Fri, 2012-11-16 at 10:51 -0800, Julien Tinnes wrote:
> It happens when users start Chrome. Chrome will create one new network
> NS (for the sandbox).
>
> This has been used for a few years now, but we had our first report in
> January of this year and we've been getting a few reports very
> recently at a rate that is starting to worry me (crbug.com/110756).
>
> Thanks a lot for helping with this!
Thanks for bringing this issue to our attention !
^ permalink raw reply
* Re: [PATCH] net-rps: Fix brokeness causing OOO packets
From: David Miller @ 2012-11-16 19:36 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, bhutchings
In-Reply-To: <1353092655.10798.44.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 16 Nov 2012 11:04:15 -0800
> From: Tom Herbert <therbert@google.com>
>
> In commit c445477d74ab3779 which adds aRFS to the kernel, the CPU
> selected for RFS is not set correctly when CPU is changing.
> This is causing OOO packets and probably other issues.
>
> Signed-off-by: Tom Herbert <therbert@google.com>
> Acked-by: Eric Dumazet <edumazet@google.com>
> Acked-by: Ben Hutchings <bhutchings@solarflare.com>
Applied and queued up for -stable, thanks everyone.
^ permalink raw reply
* Re: Optics (SFP) monitoring on ixgbe and igbe
From: Ben Hutchings @ 2012-11-16 19:38 UTC (permalink / raw)
To: footplus; +Cc: netdev, jeffrey.t.kirsher
In-Reply-To: <CAPN4dA_ymo-Bx+GM+JLLKGHghq+qBYxR0zO7K6H6Nn0pqZsJRg@mail.gmail.com>
On Fri, 2012-11-16 at 03:23 +0100, Aurélien wrote:
> On Fri, Nov 16, 2012 at 12:30 AM, Ben Hutchings
> <bhutchings@solarflare.com> wrote:
> >
> > Yes, Jeff's the one you should be talking to about these drivers. I
> > just look after the ethtool utility and API.
> >
>
> Ok, so I will discuss the ixgbe patch with Jeff :)
>
> Ben, on the ethtool side, attached is a patch to enable the following
> option and output; It's still missing externally calibrated optics
> support (my current one is internally calibrated, so that's difficult
> to test anything). What do you think ? Is there any other data that
> could be interesting to show with -O or -m options ?
[...]
> --- a/configure.ac
> +++ b/configure.ac
> @@ -13,9 +13,11 @@ AC_PROG_GCC_TRADITIONAL
> AM_PROG_CC_C_O
>
> dnl Checks for libraries.
> +AC_CHECK_LIB([m], [log10])
>
> dnl Checks for header files.
> AC_CHECK_HEADERS(sys/ioctl.h)
> +AC_CHECK_HEADERS(math.h)
This is silly; log10() and <math.h> are part of standard C and -lm is
standard on Unix. Just use <math.h> and -lm unconditionally.
> dnl Checks for typedefs, structures, and compiler characteristics.
> AC_MSG_CHECKING([whether <linux/types.h> defines big-endian types])
> diff --git a/ethtool.c b/ethtool.c
> index 3db7fec..e18fc85 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -3549,6 +3549,47 @@ static int do_tsinfo(struct cmd_context *ctx)
> return 0;
> }
>
> +static int do_getmoduleoptics(struct cmd_context *ctx)
> +{
> + struct ethtool_modinfo modinfo;
> + struct ethtool_eeprom *eeprom;
> + int err;
> +
> + modinfo.cmd = ETHTOOL_GMODULEINFO;
> + err = send_ioctl(ctx, &modinfo);
> + if (err < 0) {
> + perror("Cannot get module information");
> + return 1;
> + }
> +
> + if (modinfo.type != ETH_MODULE_SFF_8472)
> + {
> + perror("Module is not SFF-8472 (DOM) compliant");
> + return 1;
> + }
> +
> + eeprom = calloc(1, sizeof(*eeprom) + modinfo.eeprom_len);
> + if (!eeprom) {
> + perror("Cannot allocate memory for module EEPROM data");
> + return 1;
> + }
> +
> + eeprom->cmd = ETHTOOL_GMODULEEEPROM;
> + eeprom->len = modinfo.eeprom_len;
> + eeprom->offset = 0;
> + err = send_ioctl(ctx, eeprom);
> + if (err < 0) {
> + perror("Cannot access module EEPROM");
> + free(eeprom);
> + return 1;
> + }
> +
> + printf("Physical interface: %s\n", ctx->devname);
> + sff8472_show_all(eeprom->data);
> + free(eeprom);
> + return 0;
> +}
Please merge this with the existing -m option and update the
documentation to say that this covers diagnostics where available. You
could add a long option alias like --dump-module or --module-info that
covers the two types of information.
> static int do_getmodule(struct cmd_context *ctx)
> {
> struct ethtool_modinfo modinfo;
> @@ -3832,11 +3873,13 @@ static const struct option {
> { "--set-priv-flags", 1, do_sprivflags, "Set private flags",
> " FLAG on|off ...\n" },
> { "-m|--dump-module-eeprom", 1, do_getmodule,
> - "Qeuery/Decode Module EEPROM information",
> + "Query/Decode Module EEPROM information",
> " [ raw on|off ]\n"
> " [ hex on|off ]\n"
> " [ offset N ]\n"
> " [ length N ]\n" },
> + { "-O|--module-optics", 1, do_getmoduleoptics,
> + "Show module optical diagnostics" },
> { "--show-eee", 1, do_geee, "Show EEE settings"},
> { "--set-eee", 1, do_seee, "Set EEE settings",
> " [ eee on|off ]\n"
> diff --git a/internal.h b/internal.h
> index 4f96fd5..e977a81 100644
> --- a/internal.h
> +++ b/internal.h
> @@ -253,4 +253,7 @@ int rxclass_rule_del(struct cmd_context *ctx, __u32 loc);
> /* Module EEPROM parsing code */
> void sff8079_show_all(const __u8 *id);
>
> +/* Optics diagnostics */
> +void sff8472_show_all(const __u8 *id);
> +
> #endif /* ETHTOOL_INTERNAL_H__ */
> diff --git a/sfpdiag.c b/sfpdiag.c
> new file mode 100644
> index 0000000..aa7c14c
> --- /dev/null
> +++ b/sfpdiag.c
[...]
> +#define SFF_A2_TEMP 0x100 + 96
> +#define SFF_A2_TEMP_HALRM 0x100 + 0
[...]
> +#define SFF_A2_ALRM_FLG 0x100 + 112
> +#define SFF_A2_WARN_FLG 0x100 + 116
All the above offsets need parentheses around their definitions.
> +struct sff8472_diags {
> +
> +#define MCURR 0
> +#define LWARN 1
> +#define HWARN 2
> +#define LALRM 3
> +#define HALRM 4
> +
> + /* [5] tables are current, low/high warn, low/high alarm */
> + __u8 supports_dom; /* Supports DOM */
> + __u8 supports_alarms; /* Supports alarm/warning thold */
> + __u8 calibrated_int; /* Is internally calibrated */
> + __u16 bias_cur[5]; /* Measured bias current in 2uA units (cur, l/h warn, l/h alarm) */
> + __u16 tx_power[5]; /* Measured TX Power in 0.1uW units (cur, warn, alarm) */
> + __u16 rx_power[5]; /* Measured RX Power (cur, warn, alarm) */
> + __u8 rx_power_type; /* 0 = OMA, 1 = Average power */
> + __s16 sfp_temp[5]; /* SFP Temp in 0.1 Celcius (cur, warn, alarm) */
> + __u16 sfp_voltage[5]; /* SFP voltage in 0.1mV units (cur, warn, alarm) */
> +
> +};
> +
> +static struct sff8472_aw_flags {
> + const char *str; /* Human-readable string, null at the end */
> + int offset; /* A2-relative adress offset */
This is commented as an offset in the A2 'EEPROM' but the offsets
actually used include the 0x100 offset from the start of the
concatenated 'EEPROM'.
> + __u8 value; /* 1-bit mask, alarm is on if offset & value != 0. */
> +} sff8472_aw_flags[] =
> +{
> + { "Laser bias current high alarm", SFF_A2_ALRM_FLG, (1 << 3) },
> + { "Laser bias current low alarm", SFF_A2_ALRM_FLG, (1 << 2) },
> + { "Laser bias current high warning", SFF_A2_WARN_FLG, (1 << 3) },
> + { "Laser bias current low warning", SFF_A2_WARN_FLG, (1 << 2) },
> +
> + { "Laser output power high alarm", SFF_A2_ALRM_FLG, (1 << 1) },
> + { "Laser output power low alarm", SFF_A2_ALRM_FLG, (1 << 0) },
> + { "Laser output power high warning", SFF_A2_WARN_FLG, (1 << 1) },
> + { "Laser output power low warning", SFF_A2_WARN_FLG, (1 << 0) },
> +
> + { "Module temperature high alarm", SFF_A2_ALRM_FLG, (1 << 7) },
> + { "Module temperature low alarm", SFF_A2_ALRM_FLG, (1 << 6) },
> + { "Module temperature high warning", SFF_A2_WARN_FLG, (1 << 7) },
> + { "Module temperature low warning", SFF_A2_WARN_FLG, (1 << 6) },
> +
> + { "Module voltage high alarm", SFF_A2_ALRM_FLG, (1 << 5) },
> + { "Module voltage low alarm", SFF_A2_ALRM_FLG, (1 << 4) },
> + { "Module voltage high warning", SFF_A2_WARN_FLG, (1 << 5) },
> + { "Module voltage low warning", SFF_A2_WARN_FLG, (1 << 4) },
> +
> + { "Laser rx power high alarm", SFF_A2_ALRM_FLG + 1, (1 << 7) },
> + { "Laser rx power low alarm", SFF_A2_ALRM_FLG + 1, (1 << 6) },
> + { "Laser rx power high warning", SFF_A2_WARN_FLG + 1, (1 << 7) },
> + { "Laser rx power low warning", SFF_A2_WARN_FLG + 1, (1 << 6) },
> +
> + { NULL, 0, 0 },
> +};
> +
> +#ifdef HAVE_LIBM
> +
> +static double convert_mw_to_dbm(double mw)
> +{
> + return (10.f * log10(mw / 1000.f)) + 30.f;
Why are all the literals explicitly float and not double?
> +}
> +
> +#endif
> +
> +/* Externally calibrated SFP calculations */
> +#define ECAL(v, s, o) (( ((double) (s>>8)) + (s & 0xFF)) * (double) v + o)
Please follow kernel coding style for spacing. checkpatch.pl will show
you what should be changed.
> +static void sff8472_parse_eeprom(const __u8 *id, struct sff8472_diags *sd)
> +{
> + sd->supports_dom = id[SFF_A0_DOM] & SFF_A0_DOM_IMPL;
> + sd->supports_alarms = id[SFF_A0_OPTIONS] & SFF_A0_OPTIONS_AW;
> + sd->calibrated_int = id[SFF_A0_DOM] & SFF_A0_DOM_INTCAL;
> + sd->rx_power_type = id[SFF_A0_DOM] & SFF_A0_DOM_PWRT;
> +
> +
> +#define OFFSET_TO_U16(offset) (id[(offset)] << 8 | id[(offset) + 1])
> +
> + sd->bias_cur[MCURR] = OFFSET_TO_U16(SFF_A2_BIAS);
> + sd->bias_cur[HALRM] = OFFSET_TO_U16(SFF_A2_BIAS_HALRM);
> + sd->bias_cur[LALRM] = OFFSET_TO_U16(SFF_A2_BIAS_LALRM);
> + sd->bias_cur[HWARN] = OFFSET_TO_U16(SFF_A2_BIAS_HWARN);
> + sd->bias_cur[LWARN] = OFFSET_TO_U16(SFF_A2_BIAS_LWARN);
> +
> + sd->sfp_voltage[MCURR] = OFFSET_TO_U16(SFF_A2_VCC);
> + sd->sfp_voltage[HALRM] = OFFSET_TO_U16(SFF_A2_VCC_HALRM);
> + sd->sfp_voltage[LALRM] = OFFSET_TO_U16(SFF_A2_VCC_LALRM);
> + sd->sfp_voltage[HWARN] = OFFSET_TO_U16(SFF_A2_VCC_HWARN);
> + sd->sfp_voltage[LWARN] = OFFSET_TO_U16(SFF_A2_VCC_LWARN);
> +
> + sd->tx_power[MCURR] = OFFSET_TO_U16(SFF_A2_TX_PWR);
> + sd->tx_power[HALRM] = OFFSET_TO_U16(SFF_A2_TX_PWR_HALRM);
> + sd->tx_power[LALRM] = OFFSET_TO_U16(SFF_A2_TX_PWR_LALRM);
> + sd->tx_power[HWARN] = OFFSET_TO_U16(SFF_A2_TX_PWR_HWARN);
> + sd->tx_power[LWARN] = OFFSET_TO_U16(SFF_A2_TX_PWR_LWARN);
> +
> + sd->rx_power[MCURR] = OFFSET_TO_U16(SFF_A2_RX_PWR);
> + sd->rx_power[HALRM] = OFFSET_TO_U16(SFF_A2_RX_PWR_HALRM);
> + sd->rx_power[LALRM] = OFFSET_TO_U16(SFF_A2_RX_PWR_LALRM);
> + sd->rx_power[HWARN] = OFFSET_TO_U16(SFF_A2_RX_PWR_HWARN);
> + sd->rx_power[LWARN] = OFFSET_TO_U16(SFF_A2_RX_PWR_LWARN);
> +
> + /* Temperature conversions */
> +#define OFFSET_TO_TEMP(offset) \
> + ((*(__s8 *)(&id[(offset)])) * 1000 + ((id[(offset) + 1] * 1000) / 256)) / 100;
This seems awfuly complicated; why not:
#define OFFSET_TO_TEMP(offset) (((s16)OFFSET_TO_U16(offset)) * 10 / 256)
But why round to tenths of a degree here and then round again to whole
degrees celsius/fahrenheit when printing?
[...]
> +#define PRINT_TEMP(string, index) \
> + printf(" %-41s : %.0f degrees C / %.0f degrees F\n", (string), \
> + (double)(sd.sfp_temp[(index)] / 10.f), \
> + (double)(sd.sfp_temp[(index)] / 10.f * 1.8f + 32.f));
[...]
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] openvswitch: Make IPv6 packet parsing dependent on IPv6 config
From: Vlad Yasevich @ 2012-11-16 19:41 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA,
fengguang.wu-ral2JQCrhuEAvxtiuMwx3w
In-Reply-To: <20121116.135341.453792886356015492.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
On 11/16/2012 01:53 PM, David Miller wrote:> From: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
> Date: Fri, 16 Nov 2012 10:46:17 -0800
>
>> I guess the simplest thing to do seems to just make Open vSwitch
>> depend on CONFIG_INET seeing as it is practically useless without
>> upper layer protocol support anyways.
>
> The reason we have the ipv6 extension header parsing in a seperate,
> always compiled statically into the kernel, module is exactly for
> situations like this.
>
> We need to think seriously if we want to go down this road of only
> using INET as protection for every module that has some kind of ipv6
> component to it.
Ok. How about this approach instead. This keeps core functions we need
still dependent on CONFIG_NET and makes new GSO stuff depend on CONFIG_INET
since its quite useless without CONFIG_INET anyway...
-vlad
-- >8 --
Subject: [PATCH] ipv6: Preserve ipv6 functionality needed by NET
Some pieces of network use core pieces of IPv6 stack. Keep
them available while letting new GSO offload pieces depend
on CONFIG_INET.
Signed-off-by: Vlad Yasevich <vyasevic-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
net/Makefile | 2 +-
net/ipv6/Makefile | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/Makefile b/net/Makefile
index e050d9d..4f4ee08 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -19,7 +19,7 @@ obj-$(CONFIG_NETFILTER) += netfilter/
obj-$(CONFIG_INET) += ipv4/
obj-$(CONFIG_XFRM) += xfrm/
obj-$(CONFIG_UNIX) += unix/
-obj-$(CONFIG_INET) += ipv6/
+obj-$(CONFIG_NET) += ipv6/
obj-$(CONFIG_PACKET) += packet/
obj-$(CONFIG_NET_KEY) += key/
obj-$(CONFIG_BRIDGE) += bridge/
diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile
index 04a475d..2068ac4 100644
--- a/net/ipv6/Makefile
+++ b/net/ipv6/Makefile
@@ -40,7 +40,7 @@ obj-$(CONFIG_IPV6_SIT) += sit.o
obj-$(CONFIG_IPV6_TUNNEL) += ip6_tunnel.o
obj-$(CONFIG_IPV6_GRE) += ip6_gre.o
-obj-y += addrconf_core.o exthdrs_core.o output_core.o protocol.o
-obj-y += $(ipv6-offload)
+obj-y += addrconf_core.o exthdrs_core.o
+obj-$(CONFIG_INET) += output_core.o protocol.o $(ipv6_offload)
obj-$(subst m,y,$(CONFIG_IPV6)) += inet6_hashtables.o
--
1.7.7.6
^ permalink raw reply related
* Re: pull request: wireless 2012-11-16
From: David Miller @ 2012-11-16 19:41 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <20121116183011.GA29426@tuxdriver.com>
From: "John W. Linville" <linville@tuxdriver.com>
Date: Fri, 16 Nov 2012 13:30:11 -0500
> This batch of fixes is intended for the 3.7 stream...
Pulled, thanks John.
^ permalink raw reply
* [PATCH] checkpatch: add double empty line check
From: Eilon Greenstein @ 2012-11-16 19:41 UTC (permalink / raw)
To: Andy Whitcroft, linux-kernel; +Cc: Joe Perches, netdev
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
scripts/checkpatch.pl | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 21a9f5d..7a9c153 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3579,6 +3579,13 @@ sub process {
WARN("EXPORTED_WORLD_WRITABLE",
"Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr);
}
+
+# check for double empty lines
+ if ($line =~ /^\+\s*$/ &&
+ ($prevline =~ /^\+?\s*$/ || $rawlines[$linenr] =~ /^\s*$/)) {
+ WARN("DOUBLE_EMPTY_LINE",
+ "One empty line should be sufficient. Consider removing this one.\n" . $herecurr);
+ }
}
# If we have no input at all, then there is nothing to report on
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH] checkpatch: add double empty line check
From: David Rientjes @ 2012-11-16 19:55 UTC (permalink / raw)
To: Eilon Greenstein; +Cc: Andy Whitcroft, linux-kernel, Joe Perches, netdev
In-Reply-To: <1353094919.14327.4.camel@lb-tlvb-eilong.il.broadcom.com>
On Fri, 16 Nov 2012, Eilon Greenstein wrote:
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 21a9f5d..7a9c153 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3579,6 +3579,13 @@ sub process {
> WARN("EXPORTED_WORLD_WRITABLE",
> "Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr);
> }
> +
> +# check for double empty lines
> + if ($line =~ /^\+\s*$/ &&
> + ($prevline =~ /^\+?\s*$/ || $rawlines[$linenr] =~ /^\s*$/)) {
> + WARN("DOUBLE_EMPTY_LINE",
> + "One empty line should be sufficient. Consider removing this one.\n" . $herecurr);
> + }
> }
>
> # If we have no input at all, then there is nothing to report on
This is fairly common in all the acpi code where variables declared in a
function are separated from the code in a function.
^ permalink raw reply
* Re: [PATCH] checkpatch: add double empty line check
From: Eilon Greenstein @ 2012-11-16 20:04 UTC (permalink / raw)
To: David Rientjes, Joe Perches; +Cc: Andy Whitcroft, linux-kernel, netdev
In-Reply-To: <alpine.DEB.2.00.1211161154280.2788@chino.kir.corp.google.com>
On Fri, 2012-11-16 at 11:55 -0800, David Rientjes wrote:
> On Fri, 16 Nov 2012, Eilon Greenstein wrote:
>
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 21a9f5d..7a9c153 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -3579,6 +3579,13 @@ sub process {
> > WARN("EXPORTED_WORLD_WRITABLE",
> > "Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr);
> > }
> > +
> > +# check for double empty lines
> > + if ($line =~ /^\+\s*$/ &&
> > + ($prevline =~ /^\+?\s*$/ || $rawlines[$linenr] =~ /^\s*$/)) {
> > + WARN("DOUBLE_EMPTY_LINE",
> > + "One empty line should be sufficient. Consider removing this one.\n" . $herecurr);
> > + }
> > }
> >
> > # If we have no input at all, then there is nothing to report on
>
> This is fairly common in all the acpi code where variables declared in a
> function are separated from the code in a function.
>
Indeed, I see that you do use it in some functions.
Maybe we can limit it only to the networking tree (similar to the
networking comments style) or if the ACPI is the exception, we can apply
to all but ACPI.
^ permalink raw reply
* [PATCH net-next] gro: Handle inline VLAN tags
From: Ben Hutchings @ 2012-11-16 20:17 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-net-drivers, Eric Dumazet, Andrew Gallatin,
Herbert Xu
The receive paths for skbs with inline and out-of-line VLAN tags (VLAN
RX accleration) were made largely consistent in 2.6.37, with tags
pulled out by software as necessary. However GRO doesn't do this, so
it is not effective for VLAN-tagged packets received on devices
without VLAN RX acceleration.
napi_gro_frags() must not free the skb and does not advance the
skb->data pointer, so cannot use vlan_untag(). Extract the core of
vlan_untag() into a new function __vlan_untag() that allows the offset
to the VLAN tag to be specified and returns an error code. Add
kernel-doc comments for both those functions.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
Tested with sfc using both napi_gro_receive() and napi_gro_frags(). On
a Core i7 920 (Nehalem) system it increased TCP/IPv4 receive throughput
over a VLAN from ~8.0 to ~9.3 Gbit/s.
Ben.
include/linux/if_vlan.h | 6 ++++
net/8021q/vlan_core.c | 60 ++++++++++++++++++++++++++++++++---------------
net/core/dev.c | 27 ++++++++++++++++----
3 files changed, 68 insertions(+), 25 deletions(-)
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index d06cc5c..a2167c3 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -91,6 +91,7 @@ extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
extern u16 vlan_dev_vlan_id(const struct net_device *dev);
extern bool vlan_do_receive(struct sk_buff **skb);
+extern int __vlan_untag(struct sk_buff *skb, int offset);
extern struct sk_buff *vlan_untag(struct sk_buff *skb);
extern int vlan_vid_add(struct net_device *dev, unsigned short vid);
@@ -126,6 +127,11 @@ static inline bool vlan_do_receive(struct sk_buff **skb)
return false;
}
+static inline int __vlan_untag(struct sk_buff *skb, int offset)
+{
+ return 0;
+}
+
static inline struct sk_buff *vlan_untag(struct sk_buff *skb)
{
return skb;
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 65e06ab..8486430 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -93,20 +93,53 @@ u16 vlan_dev_vlan_id(const struct net_device *dev)
}
EXPORT_SYMBOL(vlan_dev_vlan_id);
-static struct sk_buff *vlan_reorder_header(struct sk_buff *skb)
+/**
+ * __vlan_untag - pull VLAN tag out of 802.1q packet header
+ * @skb: sk_buff to edit; may be cloned but not shared.
+ * @offset: Offset from @skb->data to VLAN tag. Must be either
+ * 0 or %ETH_HLEN.
+ *
+ * This updates the @mac_header but no other header offset. The
+ * caller is expected to check the @protocol and that there is no
+ * out-of-line tag before calling this.
+ */
+int __vlan_untag(struct sk_buff *skb, int offset)
{
+ struct vlan_hdr *vhdr;
+ u16 vlan_tci;
+
+ if (unlikely(!pskb_may_pull(skb, offset + VLAN_HLEN)))
+ return -EINVAL;
+
+ vhdr = (struct vlan_hdr *) (skb->data + offset);
+ vlan_tci = ntohs(vhdr->h_vlan_TCI);
+ __vlan_hwaccel_put_tag(skb, vlan_tci);
+
+ skb->len -= VLAN_HLEN;
+ skb_postpull_rcsum(skb, skb->data + offset, VLAN_HLEN);
+ skb->data += VLAN_HLEN;
+ vlan_set_encap_proto(skb, vhdr);
+
if (skb_cow(skb, skb_headroom(skb)) < 0)
- return NULL;
- memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN);
+ return -ENOMEM;
+
+ memmove(skb->data + offset - ETH_HLEN,
+ skb->data + offset - VLAN_ETH_HLEN, 2 * ETH_ALEN);
skb->mac_header += VLAN_HLEN;
- return skb;
+ return 0;
}
+/**
+ * vlan_untag - pull VLAN tag out of packet header, if appropriate
+ * @skb: sk_buff to edit; may be cloned or shared.
+ *
+ * If @skb has an inline VLAN tag and no out-of-line VLAN tag,
+ * pull the tag out-of-line and reset all header offsets. Return
+ * the edited sk_buff. If allocation fails or the VLAN tag is
+ * invalid, free @skb and return NULL.
+ */
struct sk_buff *vlan_untag(struct sk_buff *skb)
{
- struct vlan_hdr *vhdr;
- u16 vlan_tci;
-
if (unlikely(vlan_tx_tag_present(skb))) {
/* vlan_tci is already set-up so leave this for another time */
return skb;
@@ -116,18 +149,7 @@ struct sk_buff *vlan_untag(struct sk_buff *skb)
if (unlikely(!skb))
goto err_free;
- if (unlikely(!pskb_may_pull(skb, VLAN_HLEN)))
- goto err_free;
-
- vhdr = (struct vlan_hdr *) skb->data;
- vlan_tci = ntohs(vhdr->h_vlan_TCI);
- __vlan_hwaccel_put_tag(skb, vlan_tci);
-
- skb_pull_rcsum(skb, VLAN_HLEN);
- vlan_set_encap_proto(skb, vhdr);
-
- skb = vlan_reorder_header(skb);
- if (unlikely(!skb))
+ if (unlikely(__vlan_untag(skb, 0)))
goto err_free;
skb_reset_network_header(skb);
diff --git a/net/core/dev.c b/net/core/dev.c
index b4978e2..9d658eb 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3668,6 +3668,13 @@ static void skb_gro_reset_offset(struct sk_buff *skb)
gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
{
+ if (unlikely(skb->protocol == htons(ETH_P_8021Q)) &&
+ !vlan_tx_tag_present(skb)) {
+ skb = vlan_untag(skb);
+ if (unlikely(!skb))
+ return GRO_DROP;
+ }
+
skb_gro_reset_offset(skb);
return napi_skb_finish(__napi_gro_receive(napi, skb), skb);
@@ -3743,11 +3750,8 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
eth = skb_gro_header_fast(skb, off);
if (skb_gro_header_hard(skb, hlen)) {
eth = skb_gro_header_slow(skb, hlen, off);
- if (unlikely(!eth)) {
- napi_reuse_skb(napi, skb);
- skb = NULL;
- goto out;
- }
+ if (unlikely(!eth))
+ goto fail;
}
skb_gro_pull(skb, sizeof(*eth));
@@ -3758,8 +3762,19 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
*/
skb->protocol = eth->h_proto;
-out:
+ if (unlikely(skb->protocol == htons(ETH_P_8021Q)) &&
+ !vlan_tx_tag_present(skb)) {
+ if (unlikely(__vlan_untag(skb, sizeof(*eth))))
+ goto fail;
+ skb_gro_reset_offset(skb);
+ skb_gro_pull(skb, sizeof(*eth));
+ }
+
return skb;
+
+fail:
+ napi_reuse_skb(napi, skb);
+ return NULL;
}
gro_result_t napi_gro_frags(struct napi_struct *napi)
--
1.7.7.6
--
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 related
* [PATCH] net: remove unnecessary wireless includes
From: Johannes Berg @ 2012-11-16 20:59 UTC (permalink / raw)
To: linux-wireless; +Cc: netdev, Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
The wireless and wext includes in net-sysfs.c aren't
needed, so remove them.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/core/net-sysfs.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index bcf02f6..b407879 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -18,11 +18,9 @@
#include <net/sock.h>
#include <net/net_namespace.h>
#include <linux/rtnetlink.h>
-#include <linux/wireless.h>
#include <linux/vmalloc.h>
#include <linux/export.h>
#include <linux/jiffies.h>
-#include <net/wext.h>
#include "net-sysfs.h"
--
1.8.0
^ permalink raw reply related
* [PATCH v2 net-next] sockopt: Change getsockopt() of SO_BINDTODEVICE to return an interface name
From: Brian Haley @ 2012-11-16 20:58 UTC (permalink / raw)
To: David Miller; +Cc: Pavel Emelyanov, Eric Dumazet, netdev@vger.kernel.org
Instead of having the getsockopt() of SO_BINDTODEVICE return an index, which
will then require another call like if_indextoname() to get the actual interface
name, have it return the name directly.
This also matches the existing man page description on socket(7) which mentions
the argument being an interface name.
If the value has not been set, zero is returned and optlen will be set to zero
to indicate there is no interface name present.
Added a seqlock to protect this code path, and dev_ifname(), from someone
changing the device name via dev_change_name().
v2: Added seqlock protection while copying device name.
Signed-off-by: Brian Haley <brian.haley@hp.com>
--
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index e46c830..e9929ab 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1567,6 +1567,8 @@ extern int call_netdevice_notifiers(unsigned long val,
struct net_device *dev);
extern rwlock_t dev_base_lock; /* Device list lock */
+extern seqlock_t devnet_rename_seq; /* Device rename lock */
+
#define for_each_netdev(net, d) \
list_for_each_entry(d, &(net)->dev_base_head, dev_list)
diff --git a/net/core/dev.c b/net/core/dev.c
index 2705a2a..3a576ed 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -203,6 +203,8 @@ static struct list_head offload_base __read_mostly;
DEFINE_RWLOCK(dev_base_lock);
EXPORT_SYMBOL(dev_base_lock);
+DEFINE_SEQLOCK(devnet_rename_seq);
+
static inline void dev_base_seq_inc(struct net *net)
{
while (++net->dev_base_seq == 0);
@@ -1091,22 +1093,31 @@ int dev_change_name(struct net_device *dev, const char
*newname)
if (dev->flags & IFF_UP)
return -EBUSY;
- if (strncmp(newname, dev->name, IFNAMSIZ) == 0)
+ write_seqlock(&devnet_rename_seq);
+
+ if (strncmp(newname, dev->name, IFNAMSIZ) == 0) {
+ write_sequnlock(&devnet_rename_seq);
return 0;
+ }
memcpy(oldname, dev->name, IFNAMSIZ);
err = dev_get_valid_name(net, dev, newname);
- if (err < 0)
+ if (err < 0) {
+ write_sequnlock(&devnet_rename_seq);
return err;
+ }
rollback:
ret = device_rename(&dev->dev, dev->name);
if (ret) {
memcpy(dev->name, oldname, IFNAMSIZ);
+ write_sequnlock(&devnet_rename_seq);
return ret;
}
+ write_sequnlock(&devnet_rename_seq);
+
write_lock_bh(&dev_base_lock);
hlist_del_rcu(&dev->name_hlist);
write_unlock_bh(&dev_base_lock);
@@ -1124,6 +1135,7 @@ rollback:
/* err >= 0 after dev_alloc_name() or stores the first errno */
if (err >= 0) {
err = ret;
+ write_seqlock(&devnet_rename_seq);
memcpy(dev->name, oldname, IFNAMSIZ);
goto rollback;
} else {
@@ -4148,6 +4160,7 @@ static int dev_ifname(struct net *net, struct ifreq __user
*arg)
{
struct net_device *dev;
struct ifreq ifr;
+ unsigned seq;
/*
* Fetch the caller's info block.
@@ -4156,6 +4169,8 @@ static int dev_ifname(struct net *net, struct ifreq __user
*arg)
if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
return -EFAULT;
+retry:
+ seq = read_seqbegin(&devnet_rename_seq);
rcu_read_lock();
dev = dev_get_by_index_rcu(net, ifr.ifr_ifindex);
if (!dev) {
@@ -4165,6 +4180,8 @@ static int dev_ifname(struct net *net, struct ifreq __user
*arg)
strcpy(ifr.ifr_name, dev->name);
rcu_read_unlock();
+ if (read_seqretry(&devnet_rename_seq, seq))
+ goto retry;
if (copy_to_user(arg, &ifr, sizeof(struct ifreq)))
return -EFAULT;
diff --git a/net/core/sock.c b/net/core/sock.c
index 0628600..f2a42e3 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -505,7 +505,8 @@ struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie)
}
EXPORT_SYMBOL(sk_dst_check);
-static int sock_bindtodevice(struct sock *sk, char __user *optval, int optlen)
+static int sock_setbindtodevice(struct sock *sk, char __user *optval,
+ int optlen)
{
int ret = -ENOPROTOOPT;
#ifdef CONFIG_NETDEVICES
@@ -562,6 +563,59 @@ out:
return ret;
}
+static int sock_getbindtodevice(struct sock *sk, char __user *optval,
+ int __user *optlen, int len)
+{
+ int ret = -ENOPROTOOPT;
+#ifdef CONFIG_NETDEVICES
+ struct net *net = sock_net(sk);
+ struct net_device *dev;
+ char devname[IFNAMSIZ];
+ unsigned seq;
+
+ if (sk->sk_bound_dev_if == 0) {
+ len = 0;
+ goto zero;
+ }
+
+ ret = -EINVAL;
+ if (len < IFNAMSIZ)
+ goto out;
+
+retry:
+ seq = read_seqbegin(&devnet_rename_seq);
+ rcu_read_lock();
+ dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if);
+ ret = -ENODEV;
+ if (!dev) {
+ rcu_read_unlock();
+ goto out;
+ }
+
+ strcpy(devname, dev->name);
+ rcu_read_unlock();
+ if (read_seqretry(&devnet_rename_seq, seq))
+ goto retry;
+
+ len = strlen(devname) + 1;
+
+ ret = -EFAULT;
+ if (copy_to_user(optval, devname, len))
+ goto out;
+
+zero:
+ ret = -EFAULT;
+ if (put_user(len, optlen))
+ goto out;
+
+ ret = 0;
+
+out:
+#endif
+
+ return ret;
+}
+
static inline void sock_valbool_flag(struct sock *sk, int bit, int valbool)
{
if (valbool)
@@ -589,7 +643,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
*/
if (optname == SO_BINDTODEVICE)
- return sock_bindtodevice(sk, optval, optlen);
+ return sock_setbindtodevice(sk, optval, optlen);
if (optlen < sizeof(int))
return -EINVAL;
@@ -1074,15 +1128,17 @@ int sock_getsockopt(struct socket *sock, int level, int
optname,
case SO_NOFCS:
v.val = sock_flag(sk, SOCK_NOFCS);
break;
+
case SO_BINDTODEVICE:
- v.val = sk->sk_bound_dev_if;
- break;
+ return sock_getbindtodevice(sk, optval, optlen, len);
+
case SO_GET_FILTER:
len = sk_get_filter(sk, (struct sock_filter __user *)optval, len);
if (len < 0)
return len;
goto lenout;
+
default:
return -ENOPROTOOPT;
}
^ permalink raw reply related
* Re: Linux kernel handling of IPv6 temporary addresses
From: Ben Hutchings @ 2012-11-16 21:27 UTC (permalink / raw)
To: David Miller; +Cc: kargig, netdev
In-Reply-To: <20121114.180824.1930899985436392426.davem@davemloft.net>
On Wed, 2012-11-14 at 18:08 -0500, David Miller wrote:
> From: George Kargiotakis <kargig@void.gr>
> Date: Thu, 15 Nov 2012 01:03:24 +0200
>
> > I think it's an issue that a LAN root user can disable a
> > locally enabled kernel "feature" for good. The kernel could provide a
> > somewhat more informative message on such an occasion taking place,
> > since it knows that max_addresses limit has been reached and it's not a
> > DAD failure.
> >
> > My point is that I'd like the kernel to handle this situation a bit
> > differently than it currently does.
>
> Read my example again, it's the same thing for ipv4.
>
> The root LAN user can disable all IPV4 communications to arbitrary IP
> addresses on the local LAN by emitting bogus ARP requests and
> poisoning everyone's caches. What's the difference between that
> and this arbitrary ipv6 issue?
>
> There is none at all.
>
> If you have a root person on your local LAN you're subject to injection
> of bogus addressing and routing information. This issue is not specific
> to ipv4 or ipv6 and is fundamental in nature.
>
> So it is misleading to bring this up as an ipv6 specific problem, it's
> not.
You're quite right about this, but I think George's point may be that
it's harder to recover if and when the malicious traffic is stopped.
Poisoned ARP table entries will expire fairly quickly.
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 v2 net-next] sctp: Add support to per-association statistics via a new SCTP_GET_ASSOC_STATS call
From: Thomas Graf @ 2012-11-16 21:47 UTC (permalink / raw)
To: Neil Horman
Cc: Michele Baldessari, linux-sctp, Vlad Yasevich, netdev,
David S. Miller
In-Reply-To: <20121116163922.GA9722@hmsreliant.think-freely.org>
On 11/16/12 at 11:39am, Neil Horman wrote:
> Yes, I think this is good, I still don't like the idea of having to do these via
> an ioctl, but I suppose it fits well enough.
I'm with you on this. I have started scribbling notes on paper for
a netlink based stats retriever. We should discuss this at some
point making sure we get everyone on board with interests in this
and solve this nice and clean for everyone to enjoy.
I guess the ioctl is the best we can do as long as we don't have
the above.
^ permalink raw reply
* Re: linux-next: Tree for Nov 15 (pch_gbe)
From: Randy Dunlap @ 2012-11-16 21:48 UTC (permalink / raw)
To: Stephen Rothwell
Cc: linux-next, linux-kernel, netdev@vger.kernel.org, Andrew Morton,
LAPIS SEMICONDUCTOR
In-Reply-To: <20121115181740.4fb08780f0b92149a5ed2ca4@canb.auug.org.au>
On 11/14/2012 11:17 PM, Stephen Rothwell wrote:
> Hi all,
>
> News: this one will be the last release until next-20121126 (which should
> be just be after -rc7, I guess - assuming that Linus does not release
> v3.7 before then).
>
> Changes since 20121114:
>
on x86_64:
drivers/built-in.o: In function `pch_tx_timestamp':
pch_gbe_main.c:(.text+0x5b9b08): undefined reference to `pch_ch_event_read'
pch_gbe_main.c:(.text+0x5b9b39): undefined reference to `pch_tx_snap_read'
pch_gbe_main.c:(.text+0x5b9b6c): undefined reference to `pch_ch_event_write'
drivers/built-in.o: In function `pch_rx_timestamp':
pch_gbe_main.c:(.text+0x5ba648): undefined reference to `pch_ch_event_read'
pch_gbe_main.c:(.text+0x5ba658): undefined reference to `pch_src_uuid_lo_read'
pch_gbe_main.c:(.text+0x5ba663): undefined reference to `pch_src_uuid_hi_read'
pch_gbe_main.c:(.text+0x5ba709): undefined reference to `pch_ch_event_write'
pch_gbe_main.c:(.text+0x5ba717): undefined reference to `pch_rx_snap_read'
drivers/built-in.o: In function `hwtstamp_ioctl.clone.13':
pch_gbe_main.c:(.text+0x5bb3b0): undefined reference to `pch_ch_control_write'
pch_gbe_main.c:(.text+0x5bb3c9): undefined reference to `pch_ch_control_write'
pch_gbe_main.c:(.text+0x5bb3e2): undefined reference to `pch_ch_control_write'
pch_gbe_main.c:(.text+0x5bb406): undefined reference to `pch_ch_control_write'
pch_gbe_main.c:(.text+0x5bb426): undefined reference to `pch_set_station_address'
pch_gbe_main.c:(.text+0x5bb433): undefined reference to `pch_ch_event_write'
when PTP_1588_CLOCK_PCH is not enabled.
Want to select PTP_1588_CLOCK_PCH for PCH_GBE?
--
~Randy
^ permalink raw reply
* Re: [PATCH v4 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper
From: Jesse Gross @ 2012-11-16 21:53 UTC (permalink / raw)
To: Shan Wei
Cc: dev-yBygre7rU0TnMu66kgdUjQ, Tejun Heo,
cl-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, NetDev, Kernel-Maillist,
David Miller
In-Reply-To: <50A5FAEB.7090202-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
On Fri, Nov 16, 2012 at 12:35 AM, Shan Wei <shanwei88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Shan Wei said, at 2012/11/13 9:52:
>> From: Shan Wei <davidshan-1Nz4purKYjRBDgjK7y7TUQ@public.gmane.org>
>>
>> just use more faster this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id());
>>
>>
>> Signed-off-by: Shan Wei <davidshan-1Nz4purKYjRBDgjK7y7TUQ@public.gmane.org>
>> Reviewed-by: Christoph Lameter <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
>
> Jesse Gross, would you like to pick it up to your tree?
Applied, thanks.
^ permalink raw reply
* Re: [RFC PATCH 13/13] ipv6: Pull IPv6 GSO registration out of the module
From: Ben Hutchings @ 2012-11-16 22:04 UTC (permalink / raw)
To: Vlad Yasevich; +Cc: netdev, eric.dumazet, davem
In-Reply-To: <1352856254-29667-14-git-send-email-vyasevic@redhat.com>
On Tue, 2012-11-13 at 20:24 -0500, Vlad Yasevich wrote:
> Sing GSO support is now separate, pull it out of the module
Sing? Can we dance, too?
> and make it its own init call.
> Remove the cleanup functions as they are no longer called.
[...]
> --- a/include/net/protocol.h
> +++ b/include/net/protocol.h
> @@ -25,6 +25,7 @@
> #define _PROTOCOL_H
>
> #include <linux/in6.h>
> +#include <linux/skbuff.h>
> #if IS_ENABLED(CONFIG_IPV6)
> #include <linux/ipv6.h>
> #endif
> @@ -59,8 +60,6 @@ struct inet6_protocol {
>
> #define INET6_PROTO_NOPOLICY 0x1
> #define INET6_PROTO_FINAL 0x2
> -/* This should be set for any extension header which is compatible with GSO. */
> -#define INET6_PROTO_GSO_EXTHDR 0x4
> #endif
>
> struct net_offload {
> @@ -72,6 +71,8 @@ struct net_offload {
> int (*gro_complete)(struct sk_buff *skb);
> unsigned int flags; /* Flags used by IPv6 for now */
> };
> +/* This should be set for any extension header which is compatible with GSO. */
> +#define INET6_PROTO_GSO_EXTHDR 0x1
[...]
Should be renamed to INET6_OFFLOAD_GSO_EXTHDR, matching the new
structure name.
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
* [GIT] Networking
From: David Miller @ 2012-11-16 22:07 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
1) tx_filtered/ps_tx_buf queues need to be accessed with the SKB queue
lock, from Arik Nemtsov.
2) Don't call 802.11 driver's filter configure method until it's
actually open, from Felix Fietkau.
3) Use ieee80211_free_txskb otherwise we leak control information.
From Johannes Berg.
4) Fix memory leak in bluetooth UUID removal,f rom Johan Hedberg.
5) The shift mask trick doesn't work properly when 'optname' is
out of range in do_ip_setsockopt(). Use a straightforward
switch statement instead, the compiler emits essentially the
same code but without the missing range check. From Xi Wang.
6) Fix when we call tcp_replace_ts_recent() otherwise we can
erroneously accept a too-high tsval. From Eric Dumazet.
7) VXLAN bug fixes, mostly to do with VLAN header length handling,
from Alexander Duyck.
8) Missing return value initialization for IPV6_MINHOPCOUNT socket
option handling. From Hannes Frederic.
9) Fix regression in tasklet handling in jme/ksz884x/xilinx drivers,
from Xiaotian Feng.
10) At smsc911x driver init time, we don't know if the chip is in word
swap mode or not. However we do need to wait for the control
register's ready bit to be set before we program any other part of
the chip. Adjust the wait loop to account for this. From
Kamlakant Patel.
11) Revert erroneous MDIO bus unregister change to mdio-bitbang.c
12) Fix memory leak in /proc/net/sctp/, from Tommi Rantala.
13) tilegx driver registers IRQ with NULL name, oops, from Simon
Marchi.
14) TCP metrics hash table kzalloc() based allocation can fail, back
down to using vmalloc() if it does. From Eric Dumazet.
15) Fix packet steering out-of-order delivery regression, from Tom
Herbert.
Please pull, thanks a lot!
The following changes since commit 77b67063bb6bce6d475e910d3b886a606d0d91f7:
Linux 3.7-rc5 (2012-11-11 13:44:33 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net master
for you to fetch changes up to a8203d3ccd7796675739aaa50f708a047601eed2:
Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless (2012-11-16 14:37:18 -0500)
----------------------------------------------------------------
Alexander Duyck (2):
vxlan: Fix error that was resulting in VXLAN MTU size being 10 bytes too large
vxlan: Update hard_header_len based on lowerdev when instantiating VXLAN
Andrew Vagin (1):
tcp: fix retransmission in repair mode
Antonio Quartulli (4):
batman-adv: fix tt_global_entries flags update
batman-adv: correctly pass the client flag on tt_response
batman-adv: don't add TEMP clients belonging to other backbone nodes
batman-adv: process broadcast packets in BLA earlier
Arik Nemtsov (1):
mac80211: sync acccess to tx_filtered/ps_tx_buf queues
Bjørn Mork (1):
net: cdc_ncm: add Huawei devices
David S. Miller (3):
Revert "drivers/net/phy/mdio-bitbang.c: Call mdiobus_unregister before mdiobus_free"
Merge tag 'batman-adv-fix-for-davem' of git://git.open-mesh.org/linux-merge
Merge branch 'for-davem' of git://git.kernel.org/.../linville/wireless
David Spinadel (1):
mac80211: init sched_scan_ies
Eric Dumazet (2):
tcp: tcp_replace_ts_recent() should not be called from tcp_validate_incoming()
tcp: handle tcp_net_metrics_init() order-5 memory allocation failures
Felix Fietkau (2):
mac80211: do not call ieee80211_configure_filter if no interfaces are up
mac80211: call skb_dequeue/ieee80211_free_txskb instead of __skb_queue_purge
Hannes Frederic Sowa (1):
ipv6: setsockopt(IPIPPROTO_IPV6, IPV6_MINHOPCOUNT) forgot to set return value
Hauke Mehrtens (1):
brcmfmac: fix typo in CONFIG_BRCMISCAN
Jiri Pirko (1):
net: correct check in dev_addr_del()
Johan Hedberg (2):
Bluetooth: Fix having bogus entries in mgmt_read_index_list reply
Bluetooth: Fix memory leak when removing a UUID
Johannes Berg (5):
iwlwifi: handle DMA mapping failures
iwlwifi: use ieee80211_free_txskb
mac80211: fix memory leak in device registration error path
mac80211: don't send null data packet when not associated
wireless: allow 40 MHz on world roaming channels 12/13
John W. Linville (4):
Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211
Merge branch 'for-john' of git://git.kernel.org/.../iwlwifi/iwlwifi-fixes
Merge branch 'master' of git://git.kernel.org/.../bluetooth/bluetooth
Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem
Kamlakant Patel (1):
net/smsc911x: Fix ready check in cases where WORD_SWAP is needed
Kirill Smelkov (1):
doc/net: Fix typo in netdev-features.txt
Marcel Holtmann (1):
Bluetooth: Notify about device registration before power on
Marcos Chaparro (1):
Bluetooth: ath3k: Add support for VAIO VPCEH [0489:e027]
Paulo Sérgio (1):
Bluetooth: Fix error status when pairing fails
Rami Rosen (1):
vxlan: fix a typo.
Saurabh Mohan (1):
ipv4/ip_vti.c: VTI fix post-decryption forwarding
Simon Marchi (1):
tilegx: request_irq with a non-null device name
Stefan Raspl (1):
qeth: Fix IPA_CMD_QIPASSIST return code handling
Steve Glendinning (1):
smsc95xx: set MII_BUSY bit to read/write PHY regs
Tom Herbert (1):
net-rps: Fix brokeness causing OOO packets
Tommi Rantala (1):
sctp: fix /proc/net/sctp/ memory leak
Ursula Braun (1):
qeth: set new mac even if old mac is gone
Xi Wang (1):
ipv4: avoid undefined behavior in do_ip_setsockopt()
Xiaotian Feng (1):
drivers/net: fix tasklet misuse issue
Documentation/networking/netdev-features.txt | 2 +-
drivers/bluetooth/ath3k.c | 1 +
drivers/bluetooth/btusb.c | 1 +
drivers/net/ethernet/jme.c | 28 ++++++++--------------------
drivers/net/ethernet/micrel/ksz884x.c | 16 ++++------------
drivers/net/ethernet/smsc/smsc911x.c | 17 +++++++++++++++--
drivers/net/ethernet/tile/tilegx.c | 2 +-
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 12 ++++++------
drivers/net/phy/mdio-bitbang.c | 1 -
drivers/net/usb/cdc_ncm.c | 22 ++++++++++++++++++----
drivers/net/usb/smsc95xx.c | 4 ++--
drivers/net/vxlan.c | 10 +++++++---
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 2 +-
drivers/net/wireless/iwlwifi/dvm/mac80211.c | 2 +-
drivers/net/wireless/iwlwifi/dvm/main.c | 2 +-
drivers/net/wireless/iwlwifi/pcie/rx.c | 23 +++++++++++++++++++++--
drivers/s390/net/qeth_core_main.c | 24 ++++++++++++++++++++++--
drivers/s390/net/qeth_l2_main.c | 13 ++++++++-----
net/batman-adv/soft-interface.c | 12 ++++++------
net/batman-adv/translation-table.c | 15 ++++++++++++++-
net/bluetooth/hci_core.c | 4 ++--
net/bluetooth/mgmt.c | 12 +++++++-----
net/bluetooth/smp.c | 2 +-
net/core/dev.c | 4 +++-
net/core/dev_addr_lists.c | 3 ++-
net/ipv4/ip_sockglue.c | 35 ++++++++++++++++++++++-------------
net/ipv4/ip_vti.c | 5 +++++
net/ipv4/tcp.c | 4 ++--
net/ipv4/tcp_input.c | 15 ++++++++++-----
net/ipv4/tcp_metrics.c | 12 +++++++++---
net/ipv4/tcp_output.c | 4 ++++
net/ipv6/ipv6_sockglue.c | 1 +
net/mac80211/cfg.c | 3 +++
net/mac80211/ieee80211_i.h | 2 ++
net/mac80211/main.c | 6 ++++--
net/mac80211/scan.c | 2 +-
net/mac80211/sta_info.c | 11 ++++++++---
net/mac80211/status.c | 9 +++++++++
net/mac80211/tx.c | 9 ++++++---
net/mac80211/util.c | 2 ++
net/sctp/proc.c | 8 ++++----
net/wireless/reg.c | 5 ++---
42 files changed, 247 insertions(+), 120 deletions(-)
^ 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