* Re: Is fallback vhost_net to qemu for live migrate available?
From: Jason Wang @ 2013-09-02 3:19 UTC (permalink / raw)
To: Qin Chuanyu
Cc: Anthony Liguori, Michael S. Tsirkin, KVM list, netdev, qianhuibin,
xen-devel@lists.xen.org, wangfuhai, likunyun, liuyongan,
liuyingdong
In-Reply-To: <522174D7.6080903@huawei.com>
On 08/31/2013 12:45 PM, Qin Chuanyu wrote:
> On 2013/8/30 0:08, Anthony Liguori wrote:
>> Hi Qin,
>
>>> By change the memory copy and notify mechanism ,currently
>>> virtio-net with
>>> vhost_net could run on Xen with good performance。
>>
>> I think the key in doing this would be to implement a property
>> ioeventfd and irqfd interface in the driver domain kernel. Just
>> hacking vhost_net with Xen specific knowledge would be pretty nasty
>> IMHO.
>>
> Yes, I add a kernel module which persist virtio-net pio_addr and msix
> address as what kvm module did. Guest wake up vhost thread by adding a
> hook func in evtchn_interrupt.
>
>> Did you modify the front end driver to do grant table mapping or is
>> this all being done by mapping the domain's memory?
>>
> There is nothing changed in front end driver. Currently I use
> alloc_vm_area to get address space, and map the domain's memory as
> what what qemu did.
>
>> KVM and Xen represent memory in a very different way. KVM can only
>> track when guest mode code dirties memory. It relies on QEMU to track
>> when guest memory is dirtied by QEMU. Since vhost is running outside
>> of QEMU, vhost also needs to tell QEMU when it has dirtied memory.
>>
>> I don't think this is a problem with Xen though. I believe (although
>> could be wrong) that Xen is able to track when either the domain or
>> dom0 dirties memory.
>>
>> So I think you can simply ignore the dirty logging with vhost and it
>> should Just Work.
>>
> Thanks for your advice, I have tried it, without ping, it could
> migrate successfully, but if there has skb been received, domU would
> crash. I guess that because though Xen track domU memory, but it could
> only track memory that changed in DomU. memory changed by Dom0 is out
> of control.
>
>>
>> No, we don't have a mechanism to fallback to QEMU for the datapath.
>> It would be possible but I think it's a bad idea to mix and match the
>> two.
>>
> Next I would try to fallback datapath to qemu for three reason:
> 1: memory translate mechanism has been changed for vhost_net on
> Xen,so there would be some necessary changed needed for vhost_log in
> kernel.
>
> 2: I also maped IOREQ_PFN page(which is used for communication between
> qemu and Xen) in kernel notify module, so it also needed been marked
> as dirty when tx/rx exist in migrate period.
>
> 3: Most important of all, Michael S. Tsirkin said that he hadn't
> considered about vhost_net migrate on Xen,so there would be some
> changed needed in vhost_log for qemu.
>
> fallback to qemu seems to much easier, isn't it.
Maybe we can just stop vhost_net in pre_save() and enable it in
post_load()? Then no need to use enable the dirty logging of vhost_net.
>
>
> Regards
> Qin chuanyu
>
>
^ permalink raw reply
* Re: [PATCH V2 4/6] vhost_net: determine whether or not to use zerocopy at one time
From: Jason Wang @ 2013-09-02 3:15 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: netdev, virtualization, linux-kernel, kvm, mst
In-Reply-To: <5220E606.8010008@cogentembedded.com>
On 08/31/2013 02:35 AM, Sergei Shtylyov wrote:
> Hello.
>
> On 08/30/2013 08:29 AM, Jason Wang wrote:
>
>> Currently, even if the packet length is smaller than
>> VHOST_GOODCOPY_LEN, if
>> upend_idx != done_idx we still set zcopy_used to true and rollback
>> this choice
>> later. This could be avoided by determine zerocopy once by checking all
>> conditions at one time before.
>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> drivers/vhost/net.c | 46
>> +++++++++++++++++++---------------------------
>> 1 files changed, 19 insertions(+), 27 deletions(-)
>
>> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
>> index 8a6dd0d..ff60c2a 100644
>> --- a/drivers/vhost/net.c
>> +++ b/drivers/vhost/net.c
>> @@ -404,43 +404,35 @@ static void handle_tx(struct vhost_net *net)
>> iov_length(nvq->hdr, s), hdr_size);
>> break;
>> }
>> - zcopy_used = zcopy && (len >= VHOST_GOODCOPY_LEN ||
>> - nvq->upend_idx != nvq->done_idx);
>> +
>> + zcopy_used = zcopy && len >= VHOST_GOODCOPY_LEN
>> + && (nvq->upend_idx + 1) % UIO_MAXIOV != nvq->done_idx
>> + && vhost_net_tx_select_zcopy(net);
>
> Could you leave && on a first of two lines, matching the previous
> style?
>
ok.
>>
>> /* use msg_control to pass vhost zerocopy ubuf info to skb */
>> if (zcopy_used) {
>> + struct ubuf_info *ubuf;
>> + ubuf = nvq->ubuf_info + nvq->upend_idx;
>> +
>> vq->heads[nvq->upend_idx].id = head;
> [...]
>> + vq->heads[nvq->upend_idx].len = VHOST_DMA_IN_PROGRESS;
>> + ubuf->callback = vhost_zerocopy_callback;
>> + ubuf->ctx = nvq->ubufs;
>> + ubuf->desc = nvq->upend_idx;
>> + msg.msg_control = ubuf;
>> + msg.msg_controllen = sizeof(ubuf);
>
> 'sizeof(ubuf)' where 'ubuf' is a pointer? Are you sure it shouldn't
> be 'sizeof(*ubuf)'?
Yes, pointer is sufficiet. Vhost allocate an arrays of ubuf and
tun/macvtap just need a reference of it.
>
> WBR, Sergei
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* linux-next: manual merge of the net-next tree with Linus' tree
From: Stephen Rothwell @ 2013-09-02 3:12 UTC (permalink / raw)
To: David Miller, netdev; +Cc: linux-next, linux-kernel, Byungho An, Sonic Zhang
[-- Attachment #1: Type: text/plain, Size: 1938 bytes --]
Hi all,
Today's linux-next merge of the net-next tree got a conflict in
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c between commit
64c3b252e9fc ("net: stmmac: fixed the pbl setting with DT") from the
tree and commit e2a240c7d3bc ("driver:net:stmmac: Disable DMA store and
forward mode if platform data force_thresh_dma_mode is set") from the
net-next tree.
I fixed it up (I think - see below) and can carry the fix as necessary (no
action is required).
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --cc drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 1c83a44,623ebc5..0000000
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@@ -71,18 -71,19 +71,23 @@@ static int stmmac_probe_config_dt(struc
plat->force_sf_dma_mode = 1;
}
- dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg), GFP_KERNEL);
- if (!dma_cfg)
- return -ENOMEM;
-
- plat->dma_cfg = dma_cfg;
- of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
- dma_cfg->fixed_burst = of_property_read_bool(np, "snps,fixed-burst");
- dma_cfg->mixed_burst = of_property_read_bool(np, "snps,mixed-burst");
+ if (of_find_property(np, "snps,pbl", NULL)) {
+ dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
+ GFP_KERNEL);
+ if (!dma_cfg)
+ return -ENOMEM;
+ plat->dma_cfg = dma_cfg;
+ of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
+ dma_cfg->fixed_burst =
+ of_property_read_bool(np, "snps,fixed-burst");
+ dma_cfg->mixed_burst =
+ of_property_read_bool(np, "snps,mixed-burst");
+ }
+ plat->force_thresh_dma_mode = of_property_read_bool(np, "snps,force_thresh_dma_mode");
+ if (plat->force_thresh_dma_mode) {
+ plat->force_sf_dma_mode = 0;
+ pr_warn("force_sf_dma_mode is ignored if force_thresh_dma_mode is set.");
+ }
return 0;
}
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH V2 5/6] vhost_net: poll vhost queue after marking DMA is done
From: Jason Wang @ 2013-09-02 3:06 UTC (permalink / raw)
To: Ben Hutchings; +Cc: netdev, virtualization, linux-kernel, kvm, mst
In-Reply-To: <1377881073.2065.10.camel@bwh-desktop.uk.level5networks.com>
On 08/31/2013 12:44 AM, Ben Hutchings wrote:
> On Fri, 2013-08-30 at 12:29 +0800, Jason Wang wrote:
>> We used to poll vhost queue before making DMA is done, this is racy if vhost
>> thread were waked up before marking DMA is done which can result the signal to
>> be missed. Fix this by always poll the vhost thread before DMA is done.
> Does this bug only exist in net-next or is it older? Should the fix go
> to net and stable branches?
This should go for the stable branches too (3.4 above).
Thanks for the checking.
>
> Ben.
>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> drivers/vhost/net.c | 9 +++++----
>> 1 files changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
>> index ff60c2a..d09c17c 100644
>> --- a/drivers/vhost/net.c
>> +++ b/drivers/vhost/net.c
>> @@ -308,6 +308,11 @@ static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success)
>> struct vhost_virtqueue *vq = ubufs->vq;
>> int cnt = atomic_read(&ubufs->kref.refcount);
>>
>> + /* set len to mark this desc buffers done DMA */
>> + vq->heads[ubuf->desc].len = success ?
>> + VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN;
>> + vhost_net_ubuf_put(ubufs);
>> +
>> /*
>> * Trigger polling thread if guest stopped submitting new buffers:
>> * in this case, the refcount after decrement will eventually reach 1
>> @@ -318,10 +323,6 @@ static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success)
>> */
>> if (cnt <= 2 || !(cnt % 16))
>> vhost_poll_queue(&vq->poll);
>> - /* set len to mark this desc buffers done DMA */
>> - vq->heads[ubuf->desc].len = success ?
>> - VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN;
>> - vhost_net_ubuf_put(ubufs);
>> }
>>
>> /* Expects to be always run from workqueue - which acts as
^ permalink raw reply
* Re: [PATCH] drivers: net: ethernet: 8390: Kconfig: add H8300H_AKI3068NET and H8300H_H8MAX dependancy for NE_H8300
From: Chen Gang @ 2013-09-02 2:39 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: Yoshinori Sato, Kees Cook, David Miller, netdev
In-Reply-To: <5223EE80.8000305@asianux.com>
On 09/02/2013 09:48 AM, Chen Gang wrote:
> On 08/30/2013 10:36 PM, Paul Gortmaker wrote:
>> [[PATCH] drivers: net: ethernet: 8390: Kconfig: add H8300H_AKI3068NET and H8300H_H8MAX dependancy for NE_H8300] On 30/08/2013 (Fri 11:29) Chen Gang wrote:
>>
>>> Only H8300H_AKI3068NET and H8300H_H8MAX can support NE_H8300 (or it
>>> will no related irq and base address).
>>
>> Do you have an H83000 and really know that is true? I'm guessing no.
Oh, sorry, forgot reply this item.
And I have no related hardware (I am just cross compiling).
Hmm... according to the implementation, we can assume original author
though: "currently only H8300H_AKI3068NET and H8300H_H8MAX can/need
support NE_H8300" (may better use "need" instead of "can").
Thanks.
>>
>> Looking at the driver, it is kind of broken that it only assigns I/O and
>> irq for two platforms, but the H8300 arch Kconfig.cpu only allows building
>> a single platform in a given kernel anyway, so a dependency fix is
>> probably acceptable here.
>>
>
> OK, thanks.
>
>> Given that, what you really want to indicate is something like:
>>
>> Currently only H8300H_AKI3068NET and H8300H_H8MAX define default
>> I/O base and IRQ values for the NE_H8300 driver. Hence builds
>> for other H8300H platforms will fail as per below. Since H8300H
>> does not support multi platform builds, we simply limit building
>> the driver to those two platforms specifically.
>>
>
> Hmm... that sounds good to me.
>
>>>
>>> The release error:
>>>
>>> CC [M] drivers/net/hamradio/bpqether.o
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>> This file has nothing to do with the problem in question. [If you are
>> going to do a "make -j30" in testing, then at least restart with -j1 to
>> properly capture the error message.]
>>
>
> Oh, it is a waste, which I should remove, thanks.
>
>
>> Please update the commit log appropriately and resubmit.
>>
>
> OK, I will send patch v2.
>
>> Paul.
>> --
>>
>>> drivers/net/ethernet/8390/ne-h8300.c: In function 'init_dev':
>>> drivers/net/ethernet/8390/ne-h8300.c:117:23: error: 'h8300_ne_base' undeclared (first use in this function)
>>> drivers/net/ethernet/8390/ne-h8300.c:117:23: note: each undeclared identifier is reported only once for each function it appears in
>>> drivers/net/ethernet/8390/ne-h8300.c:117:23: error: bit-field '<anonymous>' width not an integer constant
>>> drivers/net/ethernet/8390/ne-h8300.c:119:20: error: 'h8300_ne_irq' undeclared (first use in this function)
>>> drivers/net/ethernet/8390/ne-h8300.c: In function 'init_module':
>>> drivers/net/ethernet/8390/ne-h8300.c:647:21: error: 'h8300_ne_base' undeclared (first use in this function)
>>> drivers/net/ethernet/8390/ne-h8300.c:648:15: error: 'h8300_ne_irq' undeclared (first use in this function)
>>> drivers/net/ethernet/8390/ne-h8300.c:661:4: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat]
>>>
>>>
>>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>>> ---
>>> drivers/net/ethernet/8390/Kconfig | 2 +-
>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig
>>> index a5f91e1..becef25 100644
>>> --- a/drivers/net/ethernet/8390/Kconfig
>>> +++ b/drivers/net/ethernet/8390/Kconfig
>>> @@ -148,7 +148,7 @@ config PCMCIA_PCNET
>>>
>>> config NE_H8300
>>> tristate "NE2000 compatible support for H8/300"
>>> - depends on H8300
>>> + depends on H8300H_AKI3068NET || H8300H_H8MAX
>>> ---help---
>>> Say Y here if you want to use the NE2000 compatible
>>> controller on the Renesas H8/300 processor.
>>> --
>>> 1.7.7.6
>>
>>
>
> Thanks.
>
--
Chen Gang
^ permalink raw reply
* Re: [PATCH v3] ipv6:introduce function to find route for redirect
From: Duan Jiong @ 2013-09-02 2:38 UTC (permalink / raw)
To: hannes; +Cc: davem, netdev
In-Reply-To: <20130901210825.GD19455@order.stressinduktion.org>
于 2013年09月02日 05:08, Hannes Frederic Sowa 写道:
> On Sat, Aug 31, 2013 at 01:09:33PM +0800, Duan Jiong wrote:
>> RFC 4861 says that the IP source address of the Redirect is the
>> same as the current first-hop router for the specified ICMP
>> Destination Address, so the gateway should be taken into
>> consideration when we find the route for redirect.
>>
>> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>
> This patch looks good!
>
> Maybe you could also point to commit
> a6279458c534d01ccc39498aba61c93083ee0372 ("NDISC: Search over all possible
> rules on receipt of redirect.") and where the check went away?
>
> The bug is only "exploitable" on layer-2 because the source address of the
> redirect is checked to be a valid link-local address but it makes spoofing a
> lot easier in the same L2 domain nonetheless.
>
> Nice work!
>
> Some smaller comments inline:
>
Thanks very much for you comments, and i will correct those problems.
>> ---
>> Changes for v3:
>> 1.Fix the comments style problems
>>
>> net/ipv6/ah6.c | 2 +-
>> net/ipv6/esp6.c | 2 +-
>> net/ipv6/icmp.c | 2 +-
>> net/ipv6/ipcomp6.c | 2 +-
>> net/ipv6/ndisc.c | 3 ++-
>> net/ipv6/route.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++-----
>> 6 files changed, 78 insertions(+), 11 deletions(-)
>>
>> diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
>> index bb02e17..73784c3 100644
>> --- a/net/ipv6/ah6.c
>> +++ b/net/ipv6/ah6.c
>> @@ -628,7 +628,7 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
>> return;
>>
>> if (type == NDISC_REDIRECT)
>> - ip6_redirect(skb, net, 0, 0);
>> + ip6_redirect(skb, net, skb->dev->ifindex, 0);
>> else
>> ip6_update_pmtu(skb, net, info, 0, 0);
>> xfrm_state_put(x);
>> diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
>> index aeac0dc..d3618a7 100644
>> --- a/net/ipv6/esp6.c
>> +++ b/net/ipv6/esp6.c
>> @@ -447,7 +447,7 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
>> return;
>>
>> if (type == NDISC_REDIRECT)
>> - ip6_redirect(skb, net, 0, 0);
>> + ip6_redirect(skb, net, skb->dev->ifindex, 0);
>> else
>> ip6_update_pmtu(skb, net, info, 0, 0);
>> xfrm_state_put(x);
>> diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
>> index 7cfc8d2..73681c2 100644
>> --- a/net/ipv6/icmp.c
>> +++ b/net/ipv6/icmp.c
>> @@ -92,7 +92,7 @@ static void icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
>> if (type == ICMPV6_PKT_TOOBIG)
>> ip6_update_pmtu(skb, net, info, 0, 0);
>> else if (type == NDISC_REDIRECT)
>> - ip6_redirect(skb, net, 0, 0);
>> + ip6_redirect(skb, net, skb->dev->ifindex, 0);
>>
>> if (!(type & ICMPV6_INFOMSG_MASK))
>> if (icmp6->icmp6_type == ICMPV6_ECHO_REQUEST)
>> diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
>> index 7af5aee..5636a91 100644
>> --- a/net/ipv6/ipcomp6.c
>> +++ b/net/ipv6/ipcomp6.c
>> @@ -76,7 +76,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
>> return;
>>
>> if (type == NDISC_REDIRECT)
>> - ip6_redirect(skb, net, 0, 0);
>> + ip6_redirect(skb, net, skb->dev->ifindex, 0);
>> else
>> ip6_update_pmtu(skb, net, info, 0, 0);
>> xfrm_state_put(x);
>> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
>> index 04d31c2..90f474b 100644
>> --- a/net/ipv6/ndisc.c
>> +++ b/net/ipv6/ndisc.c
>> @@ -1370,7 +1370,8 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
>> return;
>>
>> if (!ndopts.nd_opts_rh) {
>> - ip6_redirect_no_header(skb, dev_net(skb->dev), 0, 0);
>> + ip6_redirect_no_header(skb, dev_net(skb->dev),
>> + skb->dev->ifindex, 0);
>
> This is not indented correctly. skb->dev->ifindex should be placed right below
> the upper skb variable.
>
>> return;
>> }
>>
>> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
>> index 8d9a93e..2e1d378 100644
>> --- a/net/ipv6/route.c
>> +++ b/net/ipv6/route.c
>> @@ -1157,6 +1157,74 @@ void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu)
>> }
>> EXPORT_SYMBOL_GPL(ip6_sk_update_pmtu);
>>
>> +/* Handle redirects */
>> +struct ip6rd_flowi {
>> + struct flowi6 fl6;
>> + struct in6_addr gateway;
>> +};
>> +
>> +static struct rt6_info *__ip6_route_redirect(struct net *net,
>> + struct fib6_table *table,
>> + struct flowi6 *fl6,
>> + int flags)
>> +{
>> + struct ip6rd_flowi *rdfl = (struct ip6rd_flowi *)fl6;
>> + struct rt6_info *rt;
>> + struct fib6_node *fn;
>> +
>> + /* Get the "current" route for this destination and
>> + * check if the redirect has come from approriate router.
>> + *
>> + * RFC 4861 specifies that redirects should only be
>> + * accepted if they come from the nexthop to the target.
>> + * Due to the way the routes are chosen, this notion
>> + * is a bit fuzzy and one might need to check all possible
>> + * routes.
>> + */
>> +
>> + read_lock_bh(&table->tb6_lock);
>> + fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
>> +restart:
>> + for (rt = fn->leaf; rt; rt = rt->dst.rt6_next) {
>> + if (rt6_check_expired(rt))
>> + continue;
>
> [1] (backreference for a comment below)
>
>> + if (!(rt->rt6i_flags & RTF_GATEWAY))
>> + continue;
>> + if (fl6->flowi6_oif != rt->dst.dev->ifindex)
>> + continue;
>> + if (!ipv6_addr_equal(&rdfl->gateway, &rt->rt6i_gateway))
>> + continue;
>> + break;
>> + }
>> +
>> + if (!rt)
>> + rt = net->ipv6.ip6_null_entry;
>> + BACKTRACK(net, &fl6->saddr);
>> +out:
>> + dst_hold(&rt->dst);
>> +
>> + read_unlock_bh(&table->tb6_lock);
>> +
>> + return rt;
>> +};
>> +
>> +static struct dst_entry *ip6_route_redirect(const struct flowi6 *fl6,
>> + const struct in6_addr *gateway,
>> + struct net *net)
>
> The ordering of the arguments could be in the same style as the other
> ip6_route_* functions (net, flow, gateway). But that is not that important.
>
>> +{
>> + int flags = RT6_LOOKUP_F_HAS_SADDR;
>> + struct ip6rd_flowi rdfl;
>> +
>> + rdfl.fl6 = *fl6;
>> + rdfl.gateway = *gateway;
>> +
>> + if (rt6_need_strict(&fl6->daddr))
>> + flags |= RT6_LOOKUP_F_IFACE;
>
> This is not needed because you do the matching on interfaces yourself
> in __ip6_route_redirect. The flag should currently not be checked on
> this code path down in fib6_rule_lookup.
>
>> +
>> + return fib6_rule_lookup(net, &rdfl.fl6,
>> + flags, __ip6_route_redirect);
>
> This line jumped a bit too far to the right, too. ;)
>
>> +}
>> +
>> void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark)
>
> Maybe we should rename oif to iif now?
Yes, that looks no ambiguity.
>
>> {
>> const struct ipv6hdr *iph = (struct ipv6hdr *) skb->data;
>> @@ -1171,9 +1239,8 @@ void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark)
>> fl6.saddr = iph->saddr;
>> fl6.flowlabel = ip6_flowinfo(iph);
>>
>> - dst = ip6_route_output(net, NULL, &fl6);
>> - if (!dst->error)
>> - rt6_do_redirect(dst, NULL, skb);
>> + dst = ip6_route_redirect(&fl6, &ipv6_hdr(skb)->saddr, net);
>> + rt6_do_redirect(dst, NULL, skb);
>
> What is the reason you left out the dst.error check? E.g. if a system had a
> prohbit rule it is possible to circumvent this with a redirect packet now.
>
That's my fault. i just understand the meaning of dst.error incorrectly, and
i will modify the patch according to your comment below.
> I would think about placing this check at [1] and fail the lookup
> early. rt6_do_redirect does check for null-entry, so you could omit the
> check here, then.
>
Thanks,
Duan
^ permalink raw reply
* RE: [PATCH] net: fec: fix the error to get the previous BD entry
From: Li Frank-B20596 @ 2013-09-02 2:25 UTC (permalink / raw)
To: Duan Fugang-B38611, David Miller
Cc: netdev@vger.kernel.org, bhutchings@solarflare.com,
l.stach@pengutronix.de
In-Reply-To: <9848F2DB572E5649BA045B288BE08FBE0167E411@039-SN2MPN1-021.039d.mgd.msft.net>
> > > Due to get tx & rx previous description use the same function
> > > fec_enet_get_prevdesc(). If put the logic into
> > > fec_enet_get_prevdesc(), I think it is better to split the function
> > > to fec_enet_get_tx_prevdesc(),fec_enet_get_rx_prevdesc().
> > >
> > > If you agree it, I will submit one patch to do it.
> >
> > It doesn't looks good to split to two functions.
> > Can we use if (p == fep->tx_base || p == fep->rx_base) to check if get
> > first entry of queue?
>
> Yes, this check can get the first entry of queue, but the ring size is
> different for rx and tx ring.
> In current driver, there have no tx/rx ring size variable define in struct
> fec_enet_private.
>
> And, if change fec_enet_get_prevdesc(), the fec_enet_get_nextdesc() may need
> to do related logic change for nicety code.
Yes, it should be better handle this logical in get_prevdesc and get_nextdesc.
So we have unified place to handle wrap.
>
> > Best regards
> > Frank Li
^ permalink raw reply
* RE: [PATCH] net: fec: fix the error to get the previous BD entry
From: Duan Fugang-B38611 @ 2013-09-02 2:23 UTC (permalink / raw)
To: Li Frank-B20596, David Miller
Cc: netdev@vger.kernel.org, bhutchings@solarflare.com,
l.stach@pengutronix.de
In-Reply-To: <1F990F8245A4214A8CC4BFFBD9F790F908B40731@039-SN1MPN1-001.039d.mgd.msft.net>
From: Li Frank-B20596
Data: Monday, September 02, 2013 10:10 AM + 800
> To: Duan Fugang-B38611; David Miller
> Cc: netdev@vger.kernel.org; bhutchings@solarflare.com;
> l.stach@pengutronix.de
> Subject: RE: [PATCH] net: fec: fix the error to get the previous BD entry
>
> >
> > Due to get tx & rx previous description use the same function
> > fec_enet_get_prevdesc(). If put the logic into
> > fec_enet_get_prevdesc(), I think it is better to split the function to
> > fec_enet_get_tx_prevdesc(),fec_enet_get_rx_prevdesc().
> >
> > If you agree it, I will submit one patch to do it.
>
> It doesn't looks good to split to two functions.
> Can we use if (p == fep->tx_base || p == fep->rx_base) to check if get
> first entry of queue?
Yes, this check can get the first entry of queue, but the ring size is different for rx and tx ring.
In current driver, there have no tx/rx ring size variable define in struct fec_enet_private.
And, if change fec_enet_get_prevdesc(), the fec_enet_get_nextdesc() may need to do related logic change for nicety code.
> Best regards
> Frank Li
^ permalink raw reply
* [PATCH v2] drivers: net: ethernet: 8390: Kconfig: add H8300H_AKI3068NET and H8300H_H8MAX dependancy for NE_H8300
From: Chen Gang @ 2013-09-02 2:20 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: Yoshinori Sato, Kees Cook, David Miller, netdev
In-Reply-To: <20130830143639.GA16269@windriver.com>
Currently only H8300H_AKI3068NET and H8300H_H8MAX define default
I/O base and IRQ values for the NE_H8300 driver. Hence builds
for other H8300H platforms will fail as per below. Since H8300H
does not support multi platform builds, we simply limit building
the driver to those two platforms specifically.
The release error:
drivers/net/ethernet/8390/ne-h8300.c: In function 'init_dev':
drivers/net/ethernet/8390/ne-h8300.c:117:23: error: 'h8300_ne_base' undeclared (first use in this function)
drivers/net/ethernet/8390/ne-h8300.c:117:23: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/ethernet/8390/ne-h8300.c:117:23: error: bit-field '<anonymous>' width not an integer constant
drivers/net/ethernet/8390/ne-h8300.c:119:20: error: 'h8300_ne_irq' undeclared (first use in this function)
drivers/net/ethernet/8390/ne-h8300.c: In function 'init_module':
drivers/net/ethernet/8390/ne-h8300.c:647:21: error: 'h8300_ne_base' undeclared (first use in this function)
drivers/net/ethernet/8390/ne-h8300.c:648:15: error: 'h8300_ne_irq' undeclared (first use in this function)
drivers/net/ethernet/8390/ne-h8300.c:661:4: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat]
Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
drivers/net/ethernet/8390/Kconfig | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig
index a5f91e1..becef25 100644
--- a/drivers/net/ethernet/8390/Kconfig
+++ b/drivers/net/ethernet/8390/Kconfig
@@ -148,7 +148,7 @@ config PCMCIA_PCNET
config NE_H8300
tristate "NE2000 compatible support for H8/300"
- depends on H8300
+ depends on H8300H_AKI3068NET || H8300H_H8MAX
---help---
Say Y here if you want to use the NE2000 compatible
controller on the Renesas H8/300 processor.
--
1.7.7.6
^ permalink raw reply related
* RE: [PATCH] net: fec: fix the error to get the previous BD entry
From: Li Frank-B20596 @ 2013-09-02 2:09 UTC (permalink / raw)
To: Duan Fugang-B38611, David Miller
Cc: netdev@vger.kernel.org, bhutchings@solarflare.com,
l.stach@pengutronix.de
In-Reply-To: <9848F2DB572E5649BA045B288BE08FBE0167B047@039-SN2MPN1-021.039d.mgd.msft.net>
>
> Due to get tx & rx previous description use the same function
> fec_enet_get_prevdesc(). If put the logic into fec_enet_get_prevdesc(), I
> think it is better to split the function to
> fec_enet_get_tx_prevdesc(),fec_enet_get_rx_prevdesc().
>
> If you agree it, I will submit one patch to do it.
It doesn't looks good to split to two functions.
Can we use if (p == fep->tx_base || p == fep->rx_base) to check if get first entry of queue?
Best regards
Frank Li
>
> Thanks,
> Andy
^ permalink raw reply
* [PATCH net-next] net: make snmp_mib_free static inline
From: Cong Wang @ 2013-09-02 2:06 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Cong Wang
In-Reply-To: <1378087613-15279-1-git-send-email-amwang@redhat.com>
From: Cong Wang <amwang@redhat.com>
Fengguang reported:
net/built-in.o: In function `in6_dev_finish_destroy':
(.text+0x4ca7d): undefined reference to `snmp_mib_free'
this is due to snmp_mib_free() is defined when CONFIG_INET is enabled,
but in6_dev_finish_destroy() is now moved to core kernel.
I think snmp_mib_free() is small enough to be inlined, so just make it
static inline.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
include/net/ip.h | 12 +++++++++++-
net/ipv4/af_inet.c | 12 ------------
2 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/include/net/ip.h b/include/net/ip.h
index a68f838..48f5597 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -194,7 +194,17 @@ static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp
}
#endif
extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align);
-extern void snmp_mib_free(void __percpu *ptr[2]);
+
+static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
+{
+ int i;
+
+ BUG_ON(ptr == NULL);
+ for (i = 0; i < SNMP_ARRAY_SZ; i++) {
+ free_percpu(ptr[i]);
+ ptr[i] = NULL;
+ }
+}
extern struct local_ports {
seqlock_t lock;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index b4d0be2..7a1874b 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1532,18 +1532,6 @@ int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align)
}
EXPORT_SYMBOL_GPL(snmp_mib_init);
-void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
-{
- int i;
-
- BUG_ON(ptr == NULL);
- for (i = 0; i < SNMP_ARRAY_SZ; i++) {
- free_percpu(ptr[i]);
- ptr[i] = NULL;
- }
-}
-EXPORT_SYMBOL_GPL(snmp_mib_free);
-
#ifdef CONFIG_IP_MULTICAST
static const struct net_protocol igmp_protocol = {
.handler = igmp_rcv,
--
1.7.7.6
^ permalink raw reply related
* [PATCH net-next] vxlan: include net/ip6_checksum.h for csum_ipv6_magic()
From: Cong Wang @ 2013-09-02 2:06 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Cong Wang
In-Reply-To: <1378087613-15279-1-git-send-email-amwang@redhat.com>
From: Cong Wang <amwang@redhat.com>
Fengguang reported a compile warning:
drivers/net/vxlan.c: In function 'vxlan6_xmit_skb':
drivers/net/vxlan.c:1352:3: error: implicit declaration of function 'csum_ipv6_magic' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
this patch fixes it.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
drivers/net/vxlan.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 0fcf3f7..6b560f3 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -44,6 +44,7 @@
#include <net/ipv6.h>
#include <net/addrconf.h>
#include <net/ip6_tunnel.h>
+#include <net/ip6_checksum.h>
#endif
#define VXLAN_VERSION "0.1"
--
1.7.7.6
^ permalink raw reply related
* [PATCH net-next] vxlan: fix flowi6_proto value
From: Cong Wang @ 2013-09-02 2:06 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Cong Wang
From: Cong Wang <amwang@redhat.com>
It should be IPPROTO_UDP.
Signed-off-by: Cong Wang <amwang@redhat.com>
---
drivers/net/vxlan.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 3ffb22d..0fcf3f7 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1671,7 +1671,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
fl6.flowi6_oif = rdst->remote_ifindex;
fl6.daddr = dst->sin6.sin6_addr;
fl6.saddr = vxlan->saddr.sin6.sin6_addr;
- fl6.flowi6_proto = skb->protocol;
+ fl6.flowi6_proto = IPPROTO_UDP;
if (ipv6_stub->ipv6_dst_lookup(sk, &ndst, &fl6)) {
netdev_dbg(dev, "no route to %pI6\n",
--
1.7.7.6
^ permalink raw reply related
* Re: [PATCH] drivers: net: ethernet: 8390: Kconfig: add H8300H_AKI3068NET and H8300H_H8MAX dependancy for NE_H8300
From: Chen Gang @ 2013-09-02 1:48 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: Yoshinori Sato, Kees Cook, David Miller, netdev
In-Reply-To: <20130830143639.GA16269@windriver.com>
On 08/30/2013 10:36 PM, Paul Gortmaker wrote:
> [[PATCH] drivers: net: ethernet: 8390: Kconfig: add H8300H_AKI3068NET and H8300H_H8MAX dependancy for NE_H8300] On 30/08/2013 (Fri 11:29) Chen Gang wrote:
>
>> Only H8300H_AKI3068NET and H8300H_H8MAX can support NE_H8300 (or it
>> will no related irq and base address).
>
> Do you have an H83000 and really know that is true? I'm guessing no.
>
> Looking at the driver, it is kind of broken that it only assigns I/O and
> irq for two platforms, but the H8300 arch Kconfig.cpu only allows building
> a single platform in a given kernel anyway, so a dependency fix is
> probably acceptable here.
>
OK, thanks.
> Given that, what you really want to indicate is something like:
>
> Currently only H8300H_AKI3068NET and H8300H_H8MAX define default
> I/O base and IRQ values for the NE_H8300 driver. Hence builds
> for other H8300H platforms will fail as per below. Since H8300H
> does not support multi platform builds, we simply limit building
> the driver to those two platforms specifically.
>
Hmm... that sounds good to me.
>>
>> The release error:
>>
>> CC [M] drivers/net/hamradio/bpqether.o
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> This file has nothing to do with the problem in question. [If you are
> going to do a "make -j30" in testing, then at least restart with -j1 to
> properly capture the error message.]
>
Oh, it is a waste, which I should remove, thanks.
> Please update the commit log appropriately and resubmit.
>
OK, I will send patch v2.
> Paul.
> --
>
>> drivers/net/ethernet/8390/ne-h8300.c: In function 'init_dev':
>> drivers/net/ethernet/8390/ne-h8300.c:117:23: error: 'h8300_ne_base' undeclared (first use in this function)
>> drivers/net/ethernet/8390/ne-h8300.c:117:23: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/net/ethernet/8390/ne-h8300.c:117:23: error: bit-field '<anonymous>' width not an integer constant
>> drivers/net/ethernet/8390/ne-h8300.c:119:20: error: 'h8300_ne_irq' undeclared (first use in this function)
>> drivers/net/ethernet/8390/ne-h8300.c: In function 'init_module':
>> drivers/net/ethernet/8390/ne-h8300.c:647:21: error: 'h8300_ne_base' undeclared (first use in this function)
>> drivers/net/ethernet/8390/ne-h8300.c:648:15: error: 'h8300_ne_irq' undeclared (first use in this function)
>> drivers/net/ethernet/8390/ne-h8300.c:661:4: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat]
>>
>>
>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>> ---
>> drivers/net/ethernet/8390/Kconfig | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig
>> index a5f91e1..becef25 100644
>> --- a/drivers/net/ethernet/8390/Kconfig
>> +++ b/drivers/net/ethernet/8390/Kconfig
>> @@ -148,7 +148,7 @@ config PCMCIA_PCNET
>>
>> config NE_H8300
>> tristate "NE2000 compatible support for H8/300"
>> - depends on H8300
>> + depends on H8300H_AKI3068NET || H8300H_H8MAX
>> ---help---
>> Say Y here if you want to use the NE2000 compatible
>> controller on the Renesas H8/300 processor.
>> --
>> 1.7.7.6
>
>
Thanks.
--
Chen Gang
^ permalink raw reply
* Re: [PATCH] virtio-net: Set RXCSUM feature if GUEST_CSUM is available
From: Rusty Russell @ 2013-09-02 1:47 UTC (permalink / raw)
To: David Miller, thuth; +Cc: netdev, mst, virtualization
In-Reply-To: <20130829.155704.248095796202059854.davem@davemloft.net>
David Miller <davem@davemloft.net> writes:
> From: Thomas Huth <thuth@linux.vnet.ibm.com>
> Date: Tue, 27 Aug 2013 17:09:02 +0200
>
>> If the VIRTIO_NET_F_GUEST_CSUM virtio feature is available, the guest
>> does not have to calculate the checksums on all received packets. This
>> is pretty much the same feature as RX checksum offloading on real
>> network cards, so the virtio-net driver should report this by setting
>> the NETIF_F_RXCSUM flag. When the user now runs "ethtool -k", he or she
>> can see whether the virtio-net interface has to calculate RX checksums
>> or not.
>>
>> Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
>
> Can one of the virtio_net folks please review this?
Hmm, so NETIF_F_RXCSUM only exists for ethtool's benefit. Weird.
But this patch is correct:
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Thanks,
Rusty.
^ permalink raw reply
* RE: [PATCH] net: fec: fix the error to get the previous BD entry
From: Duan Fugang-B38611 @ 2013-09-02 1:37 UTC (permalink / raw)
To: David Miller
Cc: Li Frank-B20596, netdev@vger.kernel.org,
bhutchings@solarflare.com, l.stach@pengutronix.de
In-Reply-To: <20130830.175909.1743525148095642605.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Data: Saturday, August 31, 2013 5:59 AM
> To: Duan Fugang-B38611
> Cc: Li Frank-B20596; netdev@vger.kernel.org; bhutchings@solarflare.com;
> l.stach@pengutronix.de
> Subject: Re: [PATCH] net: fec: fix the error to get the previous BD entry
>
> From: Fugang Duan <B38611@freescale.com>
> Date: Fri, 30 Aug 2013 12:35:25 +0800
>
> > When the current BD is the first BD, the previous BD entry must be the
> > last BD, not "bdp - 1".
> >
> > Add BD entry check to get the previous BD entry correctly.
> >
> > Signed-off-by: Fugang Duan <B38611@freescale.com>
>
> The correct fix is to put this logic into fec_enet_get_prevdesc().
> With this current limitation, the function is completely useless.
Due to get tx & rx previous description use the same function fec_enet_get_prevdesc(). If put the logic into fec_enet_get_prevdesc(),
I think it is better to split the function to fec_enet_get_tx_prevdesc(),fec_enet_get_rx_prevdesc().
If you agree it, I will submit one patch to do it.
Thanks,
Andy
^ permalink raw reply
* Re: [PATCH net-next v12 06/11] vxlan: add ipv6 support
From: Cong Wang @ 2013-09-02 1:17 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, David S. Miller, David Stevens
In-Reply-To: <20130831102726.21896150@nehalam.linuxnetplumber.net>
On Sat, 2013-08-31 at 10:27 -0700, Stephen Hemminger wrote:
> On Sat, 31 Aug 2013 13:44:33 +0800
> Cong Wang <amwang@redhat.com> wrote:
>
> > +#if IS_ENABLED(CONFIG_IPV6)
> > + } else {
> > + ipv6_stub->ipv6_sock_mc_join(sk, ifindex,
> > + &ip->sin6.sin6_addr);
> > +#endif
>
> This isn't safe against IPv6 module getting unloaded. You either
> have to figure out a reference count method, or disable IPv6
> module unload.
>
> Since it can only be forced unload anyway, I still argue
> it should just be disabled (by removing the module exit hook
> and code).
I will send a patch to remove ipv6 module exit code, since there is
other problem too.
Thanks!
^ permalink raw reply
* [PATCH] net: netx-eth: remove unnecessary casting when using dev_get_platdata()
From: Jingoo Han @ 2013-09-02 0:37 UTC (permalink / raw)
To: 'David S. Miller'
Cc: netdev, 'Sergei Shtylyov', 'Jingoo Han'
Casting from 'void *' is unnecessary when using dev_get_platdata().
Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/net/ethernet/netx-eth.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/netx-eth.c b/drivers/net/ethernet/netx-eth.c
index 235fd51..e6f0a43 100644
--- a/drivers/net/ethernet/netx-eth.c
+++ b/drivers/net/ethernet/netx-eth.c
@@ -390,7 +390,7 @@ static int netx_eth_drv_probe(struct platform_device *pdev)
priv = netdev_priv(ndev);
- pdata = (struct netxeth_platform_data *)dev_get_platdata(&pdev->dev);
+ pdata = dev_get_platdata(&pdev->dev);
priv->xc = request_xc(pdata->xcno, &pdev->dev);
if (!priv->xc) {
dev_err(&pdev->dev, "unable to request xc engine\n");
--
1.7.10.4
^ permalink raw reply related
* [PATCH net-hext] wireless: scan: Remove comment to compare_ether_addr
From: Joe Perches @ 2013-09-01 22:48 UTC (permalink / raw)
To: Johannes Berg
Cc: John W. Linville, David S. Miller, linux-wireless, netdev, LKML
This function is being removed, so remove the reference to it.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/wireless/scan.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index ad1e406..eeb7148 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -465,10 +465,6 @@ static int cmp_bss(struct cfg80211_bss *a,
}
}
- /*
- * we can't use compare_ether_addr here since we need a < > operator.
- * The binary return value of compare_ether_addr isn't enough
- */
r = memcmp(a->bssid, b->bssid, sizeof(a->bssid));
if (r)
return r;
^ permalink raw reply related
* [PATCH] batman: Remove reference to compare_ether_addr
From: Joe Perches @ 2013-09-01 22:45 UTC (permalink / raw)
To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
Cc: David S. Miller, b.a.t.m.a.n, netdev, LKML
This function is being removed, rename the reference.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/batman-adv/main.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 5e9aebb..7333cf8 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -253,7 +253,7 @@ static inline void batadv_dbg(int type __always_unused,
/* returns 1 if they are the same ethernet addr
*
- * note: can't use compare_ether_addr() as it requires aligned memory
+ * note: can't use ether_addr_equal() as it requires aligned memory
*/
static inline int batadv_compare_eth(const void *data1, const void *data2)
{
^ permalink raw reply related
* Re: Realtek r8168 hangs when sending data at full speed on a gigabit link
From: Francois Romieu @ 2013-09-01 21:36 UTC (permalink / raw)
To: Frédéric Leroy; +Cc: netdev, Realtek linux nic maintainers
In-Reply-To: <5221C226.9040209@starox.org>
Frédéric Leroy <fredo@starox.org> :
[...]
> For triggering the bug, I use iperf, which either works, or hangs almost
> immediately
> with multiple threads :
>
> iperf -c myiperfserver -P 3 -t 60
>
> Could you help me to fix this ?
Does it behave the same if you don't load the vbox modules at all ?
--
Ueimor
^ permalink raw reply
* [PATCH net-next] bcm87xx: Add MODULE_DEVICE_TABLE
From: Ben Hutchings @ 2013-09-01 21:33 UTC (permalink / raw)
To: David Miller; +Cc: David Daney, netdev
[-- Attachment #1: Type: text/plain, Size: 705 bytes --]
bcm87xx currently isn't auto-loaded if built as a module.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
Compile-tested only.
Ben.
drivers/net/phy/bcm87xx.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c
index 7997895..f5b44ff 100644
--- a/drivers/net/phy/bcm87xx.c
+++ b/drivers/net/phy/bcm87xx.c
@@ -230,4 +230,11 @@ static void __exit bcm87xx_exit(void)
}
module_exit(bcm87xx_exit);
+static struct mdio_device_id __maybe_unused bcm87xx_tbl[] = {
+ { PHY_ID_BCM8706, 0xffffffff },
+ { PHY_ID_BCM8727, 0xffffffff },
+ { }
+};
+
MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(mdio, bcm87xx_tbl);
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply related
* Re: [PATCH v3] ipv6:introduce function to find route for redirect
From: Hannes Frederic Sowa @ 2013-09-01 21:08 UTC (permalink / raw)
To: Duan Jiong; +Cc: davem, netdev
In-Reply-To: <52217A8D.9010008@cn.fujitsu.com>
On Sat, Aug 31, 2013 at 01:09:33PM +0800, Duan Jiong wrote:
> RFC 4861 says that the IP source address of the Redirect is the
> same as the current first-hop router for the specified ICMP
> Destination Address, so the gateway should be taken into
> consideration when we find the route for redirect.
>
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
This patch looks good!
Maybe you could also point to commit
a6279458c534d01ccc39498aba61c93083ee0372 ("NDISC: Search over all possible
rules on receipt of redirect.") and where the check went away?
The bug is only "exploitable" on layer-2 because the source address of the
redirect is checked to be a valid link-local address but it makes spoofing a
lot easier in the same L2 domain nonetheless.
Nice work!
Some smaller comments inline:
> ---
> Changes for v3:
> 1.Fix the comments style problems
>
> net/ipv6/ah6.c | 2 +-
> net/ipv6/esp6.c | 2 +-
> net/ipv6/icmp.c | 2 +-
> net/ipv6/ipcomp6.c | 2 +-
> net/ipv6/ndisc.c | 3 ++-
> net/ipv6/route.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++-----
> 6 files changed, 78 insertions(+), 11 deletions(-)
>
> diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
> index bb02e17..73784c3 100644
> --- a/net/ipv6/ah6.c
> +++ b/net/ipv6/ah6.c
> @@ -628,7 +628,7 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
> return;
>
> if (type == NDISC_REDIRECT)
> - ip6_redirect(skb, net, 0, 0);
> + ip6_redirect(skb, net, skb->dev->ifindex, 0);
> else
> ip6_update_pmtu(skb, net, info, 0, 0);
> xfrm_state_put(x);
> diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
> index aeac0dc..d3618a7 100644
> --- a/net/ipv6/esp6.c
> +++ b/net/ipv6/esp6.c
> @@ -447,7 +447,7 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
> return;
>
> if (type == NDISC_REDIRECT)
> - ip6_redirect(skb, net, 0, 0);
> + ip6_redirect(skb, net, skb->dev->ifindex, 0);
> else
> ip6_update_pmtu(skb, net, info, 0, 0);
> xfrm_state_put(x);
> diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
> index 7cfc8d2..73681c2 100644
> --- a/net/ipv6/icmp.c
> +++ b/net/ipv6/icmp.c
> @@ -92,7 +92,7 @@ static void icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
> if (type == ICMPV6_PKT_TOOBIG)
> ip6_update_pmtu(skb, net, info, 0, 0);
> else if (type == NDISC_REDIRECT)
> - ip6_redirect(skb, net, 0, 0);
> + ip6_redirect(skb, net, skb->dev->ifindex, 0);
>
> if (!(type & ICMPV6_INFOMSG_MASK))
> if (icmp6->icmp6_type == ICMPV6_ECHO_REQUEST)
> diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
> index 7af5aee..5636a91 100644
> --- a/net/ipv6/ipcomp6.c
> +++ b/net/ipv6/ipcomp6.c
> @@ -76,7 +76,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
> return;
>
> if (type == NDISC_REDIRECT)
> - ip6_redirect(skb, net, 0, 0);
> + ip6_redirect(skb, net, skb->dev->ifindex, 0);
> else
> ip6_update_pmtu(skb, net, info, 0, 0);
> xfrm_state_put(x);
> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
> index 04d31c2..90f474b 100644
> --- a/net/ipv6/ndisc.c
> +++ b/net/ipv6/ndisc.c
> @@ -1370,7 +1370,8 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
> return;
>
> if (!ndopts.nd_opts_rh) {
> - ip6_redirect_no_header(skb, dev_net(skb->dev), 0, 0);
> + ip6_redirect_no_header(skb, dev_net(skb->dev),
> + skb->dev->ifindex, 0);
This is not indented correctly. skb->dev->ifindex should be placed right below
the upper skb variable.
> return;
> }
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 8d9a93e..2e1d378 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1157,6 +1157,74 @@ void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu)
> }
> EXPORT_SYMBOL_GPL(ip6_sk_update_pmtu);
>
> +/* Handle redirects */
> +struct ip6rd_flowi {
> + struct flowi6 fl6;
> + struct in6_addr gateway;
> +};
> +
> +static struct rt6_info *__ip6_route_redirect(struct net *net,
> + struct fib6_table *table,
> + struct flowi6 *fl6,
> + int flags)
> +{
> + struct ip6rd_flowi *rdfl = (struct ip6rd_flowi *)fl6;
> + struct rt6_info *rt;
> + struct fib6_node *fn;
> +
> + /* Get the "current" route for this destination and
> + * check if the redirect has come from approriate router.
> + *
> + * RFC 4861 specifies that redirects should only be
> + * accepted if they come from the nexthop to the target.
> + * Due to the way the routes are chosen, this notion
> + * is a bit fuzzy and one might need to check all possible
> + * routes.
> + */
> +
> + read_lock_bh(&table->tb6_lock);
> + fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
> +restart:
> + for (rt = fn->leaf; rt; rt = rt->dst.rt6_next) {
> + if (rt6_check_expired(rt))
> + continue;
[1] (backreference for a comment below)
> + if (!(rt->rt6i_flags & RTF_GATEWAY))
> + continue;
> + if (fl6->flowi6_oif != rt->dst.dev->ifindex)
> + continue;
> + if (!ipv6_addr_equal(&rdfl->gateway, &rt->rt6i_gateway))
> + continue;
> + break;
> + }
> +
> + if (!rt)
> + rt = net->ipv6.ip6_null_entry;
> + BACKTRACK(net, &fl6->saddr);
> +out:
> + dst_hold(&rt->dst);
> +
> + read_unlock_bh(&table->tb6_lock);
> +
> + return rt;
> +};
> +
> +static struct dst_entry *ip6_route_redirect(const struct flowi6 *fl6,
> + const struct in6_addr *gateway,
> + struct net *net)
The ordering of the arguments could be in the same style as the other
ip6_route_* functions (net, flow, gateway). But that is not that important.
> +{
> + int flags = RT6_LOOKUP_F_HAS_SADDR;
> + struct ip6rd_flowi rdfl;
> +
> + rdfl.fl6 = *fl6;
> + rdfl.gateway = *gateway;
> +
> + if (rt6_need_strict(&fl6->daddr))
> + flags |= RT6_LOOKUP_F_IFACE;
This is not needed because you do the matching on interfaces yourself
in __ip6_route_redirect. The flag should currently not be checked on
this code path down in fib6_rule_lookup.
> +
> + return fib6_rule_lookup(net, &rdfl.fl6,
> + flags, __ip6_route_redirect);
This line jumped a bit too far to the right, too. ;)
> +}
> +
> void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark)
Maybe we should rename oif to iif now?
> {
> const struct ipv6hdr *iph = (struct ipv6hdr *) skb->data;
> @@ -1171,9 +1239,8 @@ void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark)
> fl6.saddr = iph->saddr;
> fl6.flowlabel = ip6_flowinfo(iph);
>
> - dst = ip6_route_output(net, NULL, &fl6);
> - if (!dst->error)
> - rt6_do_redirect(dst, NULL, skb);
> + dst = ip6_route_redirect(&fl6, &ipv6_hdr(skb)->saddr, net);
> + rt6_do_redirect(dst, NULL, skb);
What is the reason you left out the dst.error check? E.g. if a system had a
prohbit rule it is possible to circumvent this with a redirect packet now.
I would think about placing this check at [1] and fail the lookup
early. rt6_do_redirect does check for null-entry, so you could omit the
check here, then.
> dst_release(dst);
> }
> EXPORT_SYMBOL_GPL(ip6_redirect);
> @@ -1193,9 +1260,8 @@ void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
> fl6.daddr = msg->dest;
> fl6.saddr = iph->daddr;
>
> - dst = ip6_route_output(net, NULL, &fl6);
> - if (!dst->error)
> - rt6_do_redirect(dst, NULL, skb);
> + dst = ip6_route_redirect(&fl6, &iph->saddr, net);
> + rt6_do_redirect(dst, NULL, skb);
Likewise.
> dst_release(dst);
> }
Thanks,
Hannes
^ permalink raw reply
* [PATCH net-next] llc: Use normal etherdevice.h tests
From: Joe Perches @ 2013-09-01 20:11 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: David Miller, netdev, LKML
Convert the llc_<foo> static inlines to the
equivalents from etherdevice.h and remove
the llc_<foo> static inline functions.
llc_mac_null -> is_zero_ether_addr
llc_mac_multicast -> is_multicast_ether_addr
llc_mac_match -> ether_addr_equal
Signed-off-by: Joe Perches <joe@perches.com>
---
include/net/llc_if.h | 30 ------------------------------
net/llc/af_llc.c | 6 +++---
net/llc/llc_conn.c | 6 +++---
net/llc/llc_sap.c | 4 ++--
4 files changed, 8 insertions(+), 38 deletions(-)
diff --git a/include/net/llc_if.h b/include/net/llc_if.h
index b595a00..f0cb909 100644
--- a/include/net/llc_if.h
+++ b/include/net/llc_if.h
@@ -62,36 +62,6 @@
#define LLC_STATUS_CONFLICT 7 /* disconnect conn */
#define LLC_STATUS_RESET_DONE 8 /* */
-/**
- * llc_mac_null - determines if a address is a null mac address
- * @mac: Mac address to test if null.
- *
- * Determines if a given address is a null mac address. Returns 0 if the
- * address is not a null mac, 1 if the address is a null mac.
- */
-static inline int llc_mac_null(const u8 *mac)
-{
- return is_zero_ether_addr(mac);
-}
-
-static inline int llc_mac_multicast(const u8 *mac)
-{
- return is_multicast_ether_addr(mac);
-}
-/**
- * llc_mac_match - determines if two mac addresses are the same
- * @mac1: First mac address to compare.
- * @mac2: Second mac address to compare.
- *
- * Determines if two given mac address are the same. Returns 0 if there
- * is not a complete match up to len, 1 if a complete match up to len is
- * found.
- */
-static inline int llc_mac_match(const u8 *mac1, const u8 *mac2)
-{
- return !compare_ether_addr(mac1, mac2);
-}
-
extern int llc_establish_connection(struct sock *sk, u8 *lmac,
u8 *dmac, u8 dsap);
extern int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb);
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 48aaa89..6cba486 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -321,12 +321,12 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
if (llc->dev) {
if (!addr->sllc_arphrd)
addr->sllc_arphrd = llc->dev->type;
- if (llc_mac_null(addr->sllc_mac))
+ if (is_zero_ether_addr(addr->sllc_mac))
memcpy(addr->sllc_mac, llc->dev->dev_addr,
IFHWADDRLEN);
if (addr->sllc_arphrd != llc->dev->type ||
- !llc_mac_match(addr->sllc_mac,
- llc->dev->dev_addr)) {
+ !ether_addr_equal(addr->sllc_mac,
+ llc->dev->dev_addr)) {
rc = -EINVAL;
llc->dev = NULL;
}
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index 0d0d416..cd87241 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -478,8 +478,8 @@ static inline bool llc_estab_match(const struct llc_sap *sap,
return llc->laddr.lsap == laddr->lsap &&
llc->daddr.lsap == daddr->lsap &&
- llc_mac_match(llc->laddr.mac, laddr->mac) &&
- llc_mac_match(llc->daddr.mac, daddr->mac);
+ ether_addr_equal(llc->laddr.mac, laddr->mac) &&
+ ether_addr_equal(llc->daddr.mac, daddr->mac);
}
/**
@@ -550,7 +550,7 @@ static inline bool llc_listener_match(const struct llc_sap *sap,
return sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN &&
llc->laddr.lsap == laddr->lsap &&
- llc_mac_match(llc->laddr.mac, laddr->mac);
+ ether_addr_equal(llc->laddr.mac, laddr->mac);
}
static struct sock *__llc_lookup_listener(struct llc_sap *sap,
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c
index 78be45c..e585069 100644
--- a/net/llc/llc_sap.c
+++ b/net/llc/llc_sap.c
@@ -302,7 +302,7 @@ static inline bool llc_dgram_match(const struct llc_sap *sap,
return sk->sk_type == SOCK_DGRAM &&
llc->laddr.lsap == laddr->lsap &&
- llc_mac_match(llc->laddr.mac, laddr->mac);
+ ether_addr_equal(llc->laddr.mac, laddr->mac);
}
/**
@@ -425,7 +425,7 @@ void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb)
llc_pdu_decode_da(skb, laddr.mac);
llc_pdu_decode_dsap(skb, &laddr.lsap);
- if (llc_mac_multicast(laddr.mac)) {
+ if (is_multicast_ether_addr(laddr.mac)) {
llc_sap_mcast(sap, &laddr, skb);
kfree_skb(skb);
} else {
^ permalink raw reply related
* WLAN setting "Power Management:on" lost after suspend
From: Toralf Förster @ 2013-09-01 20:01 UTC (permalink / raw)
To: netdev
After an s2disk I've to run "iwconfig wlp3s0 power on" again at a
ThinkPad T420 although I did it before suspend.
(kernel 3.11-rc7+, but older kernels shows same behaviour)
Is this intended ?
--
MfG/Sincerely
Toralf Förster
pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6 9DA3
^ 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