* Re: [PATCH 0/2] Indirect phy access for mv88e6171
From: Andrew Lunn @ 2015-02-15 20:25 UTC (permalink / raw)
To: Guenter Roeck; +Cc: davem, netdev, f.fainelli
In-Reply-To: <54E0E648.8080206@roeck-us.net>
> I'll try. My primary problem right now is that I run Lennert Buytenhek's
> patch set to support bridging offload (aka hardware bridging) on top of
> the upstream dsa code, and the upstream code now supports a competing /
> alternate means to support bridging/switching offload (NET_SWITCHDEV)
> which doesn't work with dsa (at least not yet). So I'll have to figure
> out if / how I can run your patches with my code base, or how I can add
> add support for NET_SWITCHDEV into dsa.
We should be adding switchdev support to DSA for hardware
bridging. The concepts in Lennert Buytenhek's should be a good
starting point for this.
> Do you know if there are any efforts going on in that direction ?
Florian has expressed an interest in getting hardware bridging
working. I've no idea if he has looked at it from the perspective of
switchdev.
Andrew
^ permalink raw reply
* Re: [PATCH net-next] net: Reflect RX hash for transmit
From: Daniel Borkmann @ 2015-02-15 20:27 UTC (permalink / raw)
To: Tom Herbert; +Cc: David Miller, Linux Netdev List
In-Reply-To: <CA+mtBx-Mp5k4TmoDK29ui=jB79drq-K-vhPqK3GgFNoqA2Mifg@mail.gmail.com>
On 02/15/2015 09:19 PM, Tom Herbert wrote:
> On Sun, Feb 15, 2015 at 11:59 AM, Daniel Borkmann <daniel@iogearbox.net> wrote:
>> On 02/15/2015 07:37 PM, Tom Herbert wrote:
>>>
>>> This patch allows a driver to request that the receive hash it provides
>>> to the stack is reflected back in skb->hash for packets transmitted
>>> on the associated connection.
>>
>> [...]
>>>
>>> + if (unlikely(skb->reflect_hash && sk->sk_txhash != skb->hash))
>>> + sk->sk_txhash = skb->hash;
>>
>>
>> Is there also an initial user setting this somewhere?
>
> inet_set_txhash and ip6_set_txhash are called for connected sockets.
> There is no user API to set these.
Yes sure, this was maybe a bit unclear; I was referring to reflect_hash.
Thanks,
Daniel
^ permalink raw reply
* Re: [PATCH net-next] net: Reflect RX hash for transmit
From: Tom Herbert @ 2015-02-15 20:19 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: David Miller, Linux Netdev List
In-Reply-To: <54E0FAA1.7000900@iogearbox.net>
On Sun, Feb 15, 2015 at 11:59 AM, Daniel Borkmann <daniel@iogearbox.net> wrote:
> On 02/15/2015 07:37 PM, Tom Herbert wrote:
>>
>> This patch allows a driver to request that the receive hash it provides
>> to the stack is reflected back in skb->hash for packets transmitted
>> on the associated connection.
>
> [...]
>>
>> + if (unlikely(skb->reflect_hash && sk->sk_txhash != skb->hash))
>> + sk->sk_txhash = skb->hash;
>
>
> Is there also an initial user setting this somewhere?
inet_set_txhash and ip6_set_txhash are called for connected sockets.
There is no user API to set these.
Tom
^ permalink raw reply
* Re: [PATCH net-next 0/6] bpf: Enable BPF JIT on ppc32
From: Daniel Borkmann @ 2015-02-15 20:09 UTC (permalink / raw)
To: Denis Kirjanov; +Cc: netdev, linuxppc-dev, benh, mpe, ast
In-Reply-To: <1424023605-2416-1-git-send-email-kda@linux-powerpc.org>
On 02/15/2015 07:06 PM, Denis Kirjanov wrote:
> This patch series enables BPF JIT on ppc32. There are relatevily
> few chnages in the code to make it work.
>
> All test_bpf tests passed both on 7447a and P2041-based machines.
I'm just wondering, next to the feedback that has already been
provided, would opening this up for ppc32 make it significantly
more difficult in future to migrate from classic BPF JIT to eBPF
JIT eventually (which is what we want long-term)? Being curious,
is there any ongoing effort from ppc people?
^ permalink raw reply
* Re: [PATCH net-next] net: Reflect RX hash for transmit
From: Daniel Borkmann @ 2015-02-15 19:59 UTC (permalink / raw)
To: Tom Herbert, davem, netdev
In-Reply-To: <1424025438-1659-1-git-send-email-therbert@google.com>
On 02/15/2015 07:37 PM, Tom Herbert wrote:
> This patch allows a driver to request that the receive hash it provides
> to the stack is reflected back in skb->hash for packets transmitted
> on the associated connection.
[...]
> + if (unlikely(skb->reflect_hash && sk->sk_txhash != skb->hash))
> + sk->sk_txhash = skb->hash;
Is there also an initial user setting this somewhere?
^ permalink raw reply
* Re: [RFC net-next 3/4] openvswitch: Add conntrack action.
From: Nicolas Dichtel @ 2015-02-15 19:51 UTC (permalink / raw)
To: Thomas Graf, Joe Stringer
Cc: Linux Netdev List, Justin Pettit, Pablo Neira Ayuso,
dev@openvswitch.org
In-Reply-To: <20150215191356.GA14888@casper.infradead.org>
Le 15/02/2015 20:13, Thomas Graf a écrit :
> On 02/15/15 at 11:06am, Joe Stringer wrote:
>> On 15 February 2015 at 07:08, Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
>>> Le 15/02/2015 05:47, Joe Stringer a écrit :
>>>> Right, it was more of a general sanity check which is likely unneeded.
>>>> I'm not aware of any particular case that this handles.
>>>
>>> I agree with Thomas. If we fall into this case, it's probably a real bug ;-)
>>
>> We can BUG_ON(), then.
>
> Let's do a WARN() and just error so we keep the kernel running ;-)
Yes. I wonder if there are more generic places to do this kind of check, because
I don't think that this kind of bug will be specific to ovs.
^ permalink raw reply
* [PATCH] ehea: Register memory hotplug, reboot and crash hooks on adapter probe
From: Thadeu Lima de Souza Cascardo @ 2015-02-15 19:44 UTC (permalink / raw)
To: netdev; +Cc: Anton Blanchard, Thadeu Lima de Souza Cascardo
From: Anton Blanchard <anton@samba.org>
ehea creates memory hotplug, reboot and crash hooks even if there
are no adapters in the box. Just create them when we probe our
first adapter.
[cascardo: use ehea_register_memory_hooks return code]
Signed-off-by: Anton Blanchard <anton@samba.org>
Tested-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ehea/ehea_main.c | 246 +++++++++++++++++------------
1 file changed, 141 insertions(+), 105 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index 566b17d..6adfcdb 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -3262,6 +3262,139 @@ static void ehea_remove_device_sysfs(struct platform_device *dev)
device_remove_file(&dev->dev, &dev_attr_remove_port);
}
+static int ehea_reboot_notifier(struct notifier_block *nb,
+ unsigned long action, void *unused)
+{
+ if (action == SYS_RESTART) {
+ pr_info("Reboot: freeing all eHEA resources\n");
+ ibmebus_unregister_driver(&ehea_driver);
+ }
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block ehea_reboot_nb = {
+ .notifier_call = ehea_reboot_notifier,
+};
+
+static int ehea_mem_notifier(struct notifier_block *nb,
+ unsigned long action, void *data)
+{
+ int ret = NOTIFY_BAD;
+ struct memory_notify *arg = data;
+
+ mutex_lock(&dlpar_mem_lock);
+
+ switch (action) {
+ case MEM_CANCEL_OFFLINE:
+ pr_info("memory offlining canceled");
+ /* Fall through: re-add canceled memory block */
+
+ case MEM_ONLINE:
+ pr_info("memory is going online");
+ set_bit(__EHEA_STOP_XFER, &ehea_driver_flags);
+ if (ehea_add_sect_bmap(arg->start_pfn, arg->nr_pages))
+ goto out_unlock;
+ ehea_rereg_mrs();
+ break;
+
+ case MEM_GOING_OFFLINE:
+ pr_info("memory is going offline");
+ set_bit(__EHEA_STOP_XFER, &ehea_driver_flags);
+ if (ehea_rem_sect_bmap(arg->start_pfn, arg->nr_pages))
+ goto out_unlock;
+ ehea_rereg_mrs();
+ break;
+
+ default:
+ break;
+ }
+
+ ehea_update_firmware_handles();
+ ret = NOTIFY_OK;
+
+out_unlock:
+ mutex_unlock(&dlpar_mem_lock);
+ return ret;
+}
+
+static struct notifier_block ehea_mem_nb = {
+ .notifier_call = ehea_mem_notifier,
+};
+
+static void ehea_crash_handler(void)
+{
+ int i;
+
+ if (ehea_fw_handles.arr)
+ for (i = 0; i < ehea_fw_handles.num_entries; i++)
+ ehea_h_free_resource(ehea_fw_handles.arr[i].adh,
+ ehea_fw_handles.arr[i].fwh,
+ FORCE_FREE);
+
+ if (ehea_bcmc_regs.arr)
+ for (i = 0; i < ehea_bcmc_regs.num_entries; i++)
+ ehea_h_reg_dereg_bcmc(ehea_bcmc_regs.arr[i].adh,
+ ehea_bcmc_regs.arr[i].port_id,
+ ehea_bcmc_regs.arr[i].reg_type,
+ ehea_bcmc_regs.arr[i].macaddr,
+ 0, H_DEREG_BCMC);
+}
+
+static atomic_t ehea_memory_hooks_registered;
+
+/* Register memory hooks on probe of first adapter */
+static int ehea_register_memory_hooks(void)
+{
+ int ret = 0;
+
+ if (atomic_inc_and_test(&ehea_memory_hooks_registered))
+ return 0;
+
+ ret = ehea_create_busmap();
+ if (ret) {
+ pr_info("ehea_create_busmap failed\n");
+ goto out;
+ }
+
+ ret = register_reboot_notifier(&ehea_reboot_nb);
+ if (ret) {
+ pr_info("register_reboot_notifier failed\n");
+ goto out;
+ }
+
+ ret = register_memory_notifier(&ehea_mem_nb);
+ if (ret) {
+ pr_info("register_memory_notifier failed\n");
+ goto out2;
+ }
+
+ ret = crash_shutdown_register(ehea_crash_handler);
+ if (ret) {
+ pr_info("crash_shutdown_register failed\n");
+ goto out3;
+ }
+
+ return 0;
+
+out3:
+ unregister_memory_notifier(&ehea_mem_nb);
+out2:
+ unregister_reboot_notifier(&ehea_reboot_nb);
+out:
+ return ret;
+}
+
+static void ehea_unregister_memory_hooks(void)
+{
+ if (atomic_read(&ehea_memory_hooks_registered))
+ return;
+
+ unregister_reboot_notifier(&ehea_reboot_nb);
+ if (crash_shutdown_unregister(ehea_crash_handler))
+ pr_info("failed unregistering crash handler\n");
+ unregister_memory_notifier(&ehea_mem_nb);
+}
+
static int ehea_probe_adapter(struct platform_device *dev)
{
struct ehea_adapter *adapter;
@@ -3269,6 +3402,10 @@ static int ehea_probe_adapter(struct platform_device *dev)
int ret;
int i;
+ ret = ehea_register_memory_hooks();
+ if (ret)
+ return ret;
+
if (!dev || !dev->dev.of_node) {
pr_err("Invalid ibmebus device probed\n");
return -EINVAL;
@@ -3392,81 +3529,6 @@ static int ehea_remove(struct platform_device *dev)
return 0;
}
-static void ehea_crash_handler(void)
-{
- int i;
-
- if (ehea_fw_handles.arr)
- for (i = 0; i < ehea_fw_handles.num_entries; i++)
- ehea_h_free_resource(ehea_fw_handles.arr[i].adh,
- ehea_fw_handles.arr[i].fwh,
- FORCE_FREE);
-
- if (ehea_bcmc_regs.arr)
- for (i = 0; i < ehea_bcmc_regs.num_entries; i++)
- ehea_h_reg_dereg_bcmc(ehea_bcmc_regs.arr[i].adh,
- ehea_bcmc_regs.arr[i].port_id,
- ehea_bcmc_regs.arr[i].reg_type,
- ehea_bcmc_regs.arr[i].macaddr,
- 0, H_DEREG_BCMC);
-}
-
-static int ehea_mem_notifier(struct notifier_block *nb,
- unsigned long action, void *data)
-{
- int ret = NOTIFY_BAD;
- struct memory_notify *arg = data;
-
- mutex_lock(&dlpar_mem_lock);
-
- switch (action) {
- case MEM_CANCEL_OFFLINE:
- pr_info("memory offlining canceled");
- /* Readd canceled memory block */
- case MEM_ONLINE:
- pr_info("memory is going online");
- set_bit(__EHEA_STOP_XFER, &ehea_driver_flags);
- if (ehea_add_sect_bmap(arg->start_pfn, arg->nr_pages))
- goto out_unlock;
- ehea_rereg_mrs();
- break;
- case MEM_GOING_OFFLINE:
- pr_info("memory is going offline");
- set_bit(__EHEA_STOP_XFER, &ehea_driver_flags);
- if (ehea_rem_sect_bmap(arg->start_pfn, arg->nr_pages))
- goto out_unlock;
- ehea_rereg_mrs();
- break;
- default:
- break;
- }
-
- ehea_update_firmware_handles();
- ret = NOTIFY_OK;
-
-out_unlock:
- mutex_unlock(&dlpar_mem_lock);
- return ret;
-}
-
-static struct notifier_block ehea_mem_nb = {
- .notifier_call = ehea_mem_notifier,
-};
-
-static int ehea_reboot_notifier(struct notifier_block *nb,
- unsigned long action, void *unused)
-{
- if (action == SYS_RESTART) {
- pr_info("Reboot: freeing all eHEA resources\n");
- ibmebus_unregister_driver(&ehea_driver);
- }
- return NOTIFY_DONE;
-}
-
-static struct notifier_block ehea_reboot_nb = {
- .notifier_call = ehea_reboot_notifier,
-};
-
static int check_module_parm(void)
{
int ret = 0;
@@ -3520,26 +3582,10 @@ static int __init ehea_module_init(void)
if (ret)
goto out;
- ret = ehea_create_busmap();
- if (ret)
- goto out;
-
- ret = register_reboot_notifier(&ehea_reboot_nb);
- if (ret)
- pr_info("failed registering reboot notifier\n");
-
- ret = register_memory_notifier(&ehea_mem_nb);
- if (ret)
- pr_info("failed registering memory remove notifier\n");
-
- ret = crash_shutdown_register(ehea_crash_handler);
- if (ret)
- pr_info("failed registering crash handler\n");
-
ret = ibmebus_register_driver(&ehea_driver);
if (ret) {
pr_err("failed registering eHEA device driver on ebus\n");
- goto out2;
+ goto out;
}
ret = driver_create_file(&ehea_driver.driver,
@@ -3547,32 +3593,22 @@ static int __init ehea_module_init(void)
if (ret) {
pr_err("failed to register capabilities attribute, ret=%d\n",
ret);
- goto out3;
+ goto out2;
}
return ret;
-out3:
- ibmebus_unregister_driver(&ehea_driver);
out2:
- unregister_memory_notifier(&ehea_mem_nb);
- unregister_reboot_notifier(&ehea_reboot_nb);
- crash_shutdown_unregister(ehea_crash_handler);
+ ibmebus_unregister_driver(&ehea_driver);
out:
return ret;
}
static void __exit ehea_module_exit(void)
{
- int ret;
-
driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities);
ibmebus_unregister_driver(&ehea_driver);
- unregister_reboot_notifier(&ehea_reboot_nb);
- ret = crash_shutdown_unregister(ehea_crash_handler);
- if (ret)
- pr_info("failed unregistering crash handler\n");
- unregister_memory_notifier(&ehea_mem_nb);
+ ehea_unregister_memory_hooks();
kfree(ehea_fw_handles.arr);
kfree(ehea_bcmc_regs.arr);
ehea_destroy_busmap();
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH net-next 1/6] ppc: Kconfig: Enable BPF JIT on ppc32
From: Denis Kirjanov @ 2015-02-15 19:16 UTC (permalink / raw)
To: David Miller; +Cc: joe, netdev, linuxppc-dev
In-Reply-To: <20150215.110729.1985006476906451021.davem@davemloft.net>
On 2/15/15, David Miller <davem@davemloft.net> wrote:
> From: Joe Perches <joe@perches.com>
> Date: Sun, 15 Feb 2015 10:15:54 -0800
>
>> On Sun, 2015-02-15 at 21:06 +0300, Denis Kirjanov wrote:
>> []
>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>> []
>>> @@ -126,7 +126,7 @@ config PPC
>>> select IRQ_FORCED_THREADING
>>> select HAVE_RCU_TABLE_FREE if SMP
>>> select HAVE_SYSCALL_TRACEPOINTS
>>> - select HAVE_BPF_JIT if PPC64
>>> + select HAVE_BPF_JIT
>>
>> trivia:
>>
>> Should this be the last patch of the series?
>
> Yes, that's the way I see it too.
>
Ok, I'll resend the series if the such thing matters.
Thank you.
^ permalink raw reply
* Re: [RFC net-next 3/4] openvswitch: Add conntrack action.
From: Thomas Graf @ 2015-02-15 19:13 UTC (permalink / raw)
To: Joe Stringer
Cc: nicolas.dichtel, Linux Netdev List, Justin Pettit,
Pablo Neira Ayuso, dev@openvswitch.org
In-Reply-To: <CANr6G5yBW5JNMk3qvAuyD+OgtnhV6vg2E-41DO51bVtyeSWSNg@mail.gmail.com>
On 02/15/15 at 11:06am, Joe Stringer wrote:
> On 15 February 2015 at 07:08, Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> > Le 15/02/2015 05:47, Joe Stringer a écrit :
> >> Right, it was more of a general sanity check which is likely unneeded.
> >> I'm not aware of any particular case that this handles.
> >
> > I agree with Thomas. If we fall into this case, it's probably a real bug ;-)
>
> We can BUG_ON(), then.
Let's do a WARN() and just error so we keep the kernel running ;-)
^ permalink raw reply
* Re: [RFC net-next 3/4] openvswitch: Add conntrack action.
From: Joe Stringer @ 2015-02-15 19:06 UTC (permalink / raw)
To: nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w
Cc: Linux Netdev List, dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org,
Pablo Neira Ayuso
In-Reply-To: <54E0B67A.1030000-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
On 15 February 2015 at 07:08, Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> Le 15/02/2015 05:47, Joe Stringer a écrit :
>
>> On 14 February 2015 at 11:56, Thomas Graf <tgraf@suug.ch> wrote:
>>>
>>> On 02/14/15 at 12:13am, Joe Stringer wrote:
>>>
>>> [..]
>>>
>>>> +static bool skb_has_valid_nfct(const struct net *net, u16 zone,
>>>> + const struct sk_buff *skb)
>>>> +{
>>>> + enum ip_conntrack_info ctinfo;
>>>> + struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
>>>> +
>>>> + if (!ct)
>>>> + return false;
>>>> + if (!net_eq(net, ct->ct_net))
>>>> + return false;
>>>
>>>
>>> I'm surprised that this is needed. Shouldn't we call skb_scrub_packet()
>>> between namespaces and invalidate the ct associated with the skb.
>>
>>
>> Right, it was more of a general sanity check which is likely unneeded.
>> I'm not aware of any particular case that this handles.
>
> I agree with Thomas. If we fall into this case, it's probably a real bug ;-)
We can BUG_ON(), then.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
^ permalink raw reply
* Re: [PATCH net-next 1/6] ppc: Kconfig: Enable BPF JIT on ppc32
From: David Miller @ 2015-02-15 19:07 UTC (permalink / raw)
To: joe; +Cc: kda, netdev, linuxppc-dev
In-Reply-To: <1424024154.2685.1.camel@perches.com>
From: Joe Perches <joe@perches.com>
Date: Sun, 15 Feb 2015 10:15:54 -0800
> On Sun, 2015-02-15 at 21:06 +0300, Denis Kirjanov wrote:
> []
>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> []
>> @@ -126,7 +126,7 @@ config PPC
>> select IRQ_FORCED_THREADING
>> select HAVE_RCU_TABLE_FREE if SMP
>> select HAVE_SYSCALL_TRACEPOINTS
>> - select HAVE_BPF_JIT if PPC64
>> + select HAVE_BPF_JIT
>
> trivia:
>
> Should this be the last patch of the series?
Yes, that's the way I see it too.
^ permalink raw reply
* Re: vnet problem (bug? feature?)
From: Toerless Eckert @ 2015-02-15 19:00 UTC (permalink / raw)
To: Bill Fink; +Cc: Cong Wang, netdev
In-Reply-To: <20150214131744.051b90fc8dfdbf4e1bfe6bfb@mindspring.com>
*Bingo* rp_filter did the trick.
nstat is fairly useless to figrue this out, no RPF counters.
Quite strange to see rp_filter. Especilly for multicast. But i haven't
followed linux for many years in this level of detail. I thought
Linux was always weak host model. But even for strong host model,
i can't remember that RPF checking was done in the past (for hosts,
not routers obviously).
Cheers
Toerless
On Sat, Feb 14, 2015 at 01:17:44PM -0500, Bill Fink wrote:
> > ip link add name veth1 type veth peer name veth2
> > ip addr add 10.0.0.1/24 dev veth1
> > ip addr add 10.0.0.2/24 dev veth2
> > ip link set dev veth1 up
> > ip link set dev veth2 up
>
> Did you try disabling reverse path filtering:
>
> echo 0 > /proc/sys/net/ipv4/conf/veth1/rp_filter
> echo 0 > /proc/sys/net/ipv4/conf/veth2/rp_filter
>
> Both veth1 and veth2 are in the same subnet, but only one
> (presumably veth1) is the expected source for packets coming
> from net 10, so when the muticast packets from a net 10
> source arrive on veth2, they are rejected for arriving
> on the wrong interface.
>
> You could check this with "nstat -z | grep -i filter".
>
> The above is an educated guess on my part, and could
> be something completely different.
>
> -Bill
>
>
>
> > Receiver socket, eg: on veth2:
> > socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
> > setsockopt(SO_REUSEADDR, 1)
> > bind(0.0.0.0/<port>)
> > setsockopt(IP_ADD_MEMBERSHIP, 224.0.0.33/10.0.0.2)
> >
> > check wih "netstat -gn" that there is IGMP membership on veth2:
> > veth2 1 224.0.0.33
> >
> > Sender socket, eg: on veth1:
> > socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
> > setsockopt(SO_REUSEADDR, 1)
> > bind(10.0.0.1/7000)
> > connect(224.0.0.33/<port>)
> >
> > Sending packet, check how they're transmitted:
> > - TX countes on veth1 go up (ifconfig output)
> > - RX counters on veth2 go up (ifconfig output)
> > - tcpdump -i veth2 -P in shows packets being received
> > - tcpdump -i veth1 -P out shows packets being sent
> >
> > Played around with lots of parameters:
> > - same behavior for non-link-local-scope multicast, TTL > 1 doesn't elp.
> > - same behavior if setting "multicast, "allmulticast", "promiscuous" on the veth
> > - same behavior when setting IP_MULTICAST_LOOP on sender.
> >
> > Routing table:
> > netstat -r -n
> > Kernel IP routing table
> > Destination Gateway Genmask Flags MSS Window irtt Iface
> > 0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 eth1
> > 10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 veth1
> > 10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 veth2
> > 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
> >
> > And of course it works if one side is put into a separate namespace,
> > but that doesn't help me.
> >
> > But: it really seems to be a problem with the kernel/sockets, not with veth.
> > Just replaced the veth pair with a pair of ethernets with a loopback cable and
> > pretty much exactly the same result (except that receiver side does not see
> > packets in RX unless it's promiscuous or has a real receiver socket, but that's
> > perfect). But not being a veth problem but other kernel network stack "feature"
> > doesn't make it right IMHO. I can't see by which "logic" the receiver socket
> > seemingly does not care about these packets even though it's explicitly bound
> > to the interface and the multicast group. "Gimme the darn packets, socket,
> > they are received on the interface"! ;-))
> >
> > I can play around with the receiver side socket API call details, but i really
> > don't see why those should be different if the packets happen to be looped
> > than if they're not.
> >
> > Cheers
> > Toerless
^ permalink raw reply
* [PATCH net-next] net: Reflect RX hash for transmit
From: Tom Herbert @ 2015-02-15 18:37 UTC (permalink / raw)
To: davem, netdev
This patch allows a driver to request that the receive hash it provides
to the stack is reflected back in skb->hash for packets transmitted
on the associated connection. The hash value returned by a device could
have meaning when used in transmit to identify a flow, for instance
the hash may by a flow ID for a flow created in a (virtual) device.
With the flow ID provided on transmit this can obviate the need
to create the hash and do the lookup on the fly in transmit.
Note that this is an opportunistic optimization, there is no
separate negotiation between the stack and driver/device for
the hash used in either TX or RX.
Signed-off-by: Tom Herbert <therbert@google.com>
---
include/linux/skbuff.h | 3 ++-
include/net/sock.h | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 1bb36ed..f792a0d 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -605,7 +605,8 @@ struct sk_buff {
__u8 ipvs_property:1;
__u8 inner_protocol_type:1;
__u8 remcsum_offload:1;
- /* 3 or 5 bit hole */
+ __u8 reflect_hash:1;
+ /* 2 or 4 bit hole */
#ifdef CONFIG_NET_SCHED
__u16 tc_index; /* traffic control index */
diff --git a/include/net/sock.h b/include/net/sock.h
index e138245..133fc51 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -871,6 +871,8 @@ static inline void sock_rps_save_rxhash(struct sock *sk,
if (unlikely(sk->sk_rxhash != skb->hash))
sk->sk_rxhash = skb->hash;
#endif
+ if (unlikely(skb->reflect_hash && sk->sk_txhash != skb->hash))
+ sk->sk_txhash = skb->hash;
}
static inline void sock_rps_reset_rxhash(struct sock *sk)
--
2.2.0.rc0.207.ga3a616c
^ permalink raw reply related
* Re: [PATCH 0/2] Indirect phy access for mv88e6171
From: Guenter Roeck @ 2015-02-15 18:32 UTC (permalink / raw)
To: Andrew Lunn, davem; +Cc: netdev
In-Reply-To: <1423937871-9180-1-git-send-email-andrew@lunn.ch>
On 02/14/2015 10:17 AM, Andrew Lunn wrote:
> These two patches allow the mv88e6171 driver to access the port phys
> using indirect addressing. Depending on pin strapping, the switch
> either uses a single address on the host MDIO bus, requiring the port
> phys are accessed indirectly, or the switch uses a number of addresses
> on the host bus and the phys can be directly accessed.
>
> The 370RD, the first supported platform to use the 6171 uses multiple
> addresses, so this indirect mode was not required. However the
> WRT1900AC has the switch configured to use a single address, and so
> indirect access is needed.
>
> The mv88e6352 already has all the needed code. Refactor it into the
> shared mv88e6xxx and then use it in the mv88e6171 driver.
>
> Tested on the 370RD and WRT1900AC.
>
> It would be good if Guenter Roeck could test on his platform to ensure
> i've not broken anything for the mv88e6352.
>
I'll try. My primary problem right now is that I run Lennert Buytenhek's
patch set to support bridging offload (aka hardware bridging) on top of
the upstream dsa code, and the upstream code now supports a competing /
alternate means to support bridging/switching offload (NET_SWITCHDEV)
which doesn't work with dsa (at least not yet). So I'll have to figure
out if / how I can run your patches with my code base, or how I can add
add support for NET_SWITCHDEV into dsa.
Do you know if there are any efforts going on in that direction ?
Thanks,
Guenter
^ permalink raw reply
* Re: [PATCH net-next 1/6] ppc: Kconfig: Enable BPF JIT on ppc32
From: Joe Perches @ 2015-02-15 18:15 UTC (permalink / raw)
To: Denis Kirjanov; +Cc: netdev, linuxppc-dev
In-Reply-To: <1424023605-2416-2-git-send-email-kda@linux-powerpc.org>
On Sun, 2015-02-15 at 21:06 +0300, Denis Kirjanov wrote:
[]
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
[]
> @@ -126,7 +126,7 @@ config PPC
> select IRQ_FORCED_THREADING
> select HAVE_RCU_TABLE_FREE if SMP
> select HAVE_SYSCALL_TRACEPOINTS
> - select HAVE_BPF_JIT if PPC64
> + select HAVE_BPF_JIT
trivia:
Should this be the last patch of the series?
^ permalink raw reply
* [PATCH net-next 6/6] ppc: bpf: Add SKF_AD_CPU for ppc32
From: Denis Kirjanov @ 2015-02-15 18:06 UTC (permalink / raw)
To: netdev; +Cc: linuxppc-dev, Denis Kirjanov
In-Reply-To: <1424023605-2416-1-git-send-email-kda@linux-powerpc.org>
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
arch/powerpc/net/bpf_jit.h | 17 +++++++++++++++++
arch/powerpc/net/bpf_jit_comp.c | 14 +-------------
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index 2d5e715..889fd19 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -154,6 +154,23 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
#define PPC_LL_OFFS(r, base, i) do { PPC_LWZ_OFFS(r, base, i); } while(0)
#endif
+#ifdef CONFIG_SMP
+#ifdef CONFIG_PPC64
+#define PPC_BPF_LOAD_CPU(r) \
+ do { BUILD_BUG_ON(FIELD_SIZEOF(struct paca_struct, paca_index) != 2); \
+ PPC_LHZ_OFFS(r, 13, offsetof(struct paca_struct, paca_index)); \
+ } while (0)
+#else
+#define PPC_BPF_LOAD_CPU(r) \
+ do { BUILD_BUG_ON(FIELD_SIZEOF(struct thread_info, cpu) != 4); \
+ PPC_LHZ_OFFS(r, (1 & ~(THREAD_SIZE - 1)), \
+ offsetof(struct thread_info, cpu)); \
+ } while(0)
+#endif
+#else
+#define PPC_BPF_LOAD_CPU(r) do { PPC_LI(r, 0); } while(0)
+#endif
+
#define PPC_CMPWI(a, i) EMIT(PPC_INST_CMPWI | ___PPC_RA(a) | IMM_L(i))
#define PPC_CMPDI(a, i) EMIT(PPC_INST_CMPDI | ___PPC_RA(a) | IMM_L(i))
#define PPC_CMPLWI(a, i) EMIT(PPC_INST_CMPLWI | ___PPC_RA(a) | IMM_L(i))
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 8b29268..17cea18 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -411,20 +411,8 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
PPC_SRWI(r_A, r_A, 5);
break;
case BPF_ANC | SKF_AD_CPU:
-#ifdef CONFIG_SMP
- /*
- * PACA ptr is r13:
- * raw_smp_processor_id() = local_paca->paca_index
- */
- BUILD_BUG_ON(FIELD_SIZEOF(struct paca_struct,
- paca_index) != 2);
- PPC_LHZ_OFFS(r_A, 13,
- offsetof(struct paca_struct, paca_index));
-#else
- PPC_LI(r_A, 0);
-#endif
+ PPC_BPF_LOAD_CPU(r_A);
break;
-
/*** Absolute loads from packet header/data ***/
case BPF_LD | BPF_W | BPF_ABS:
func = CHOOSE_LOAD_FUNC(K, sk_load_word);
--
2.1.3
^ permalink raw reply related
* [PATCH net-next 5/6] ppc: bpf: rename bpf_jit_64.S to bpf_jit_asm.S
From: Denis Kirjanov @ 2015-02-15 18:06 UTC (permalink / raw)
To: netdev; +Cc: linuxppc-dev, Denis Kirjanov
In-Reply-To: <1424023605-2416-1-git-send-email-kda@linux-powerpc.org>
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
arch/powerpc/net/Makefile | 2 +-
arch/powerpc/net/{bpf_jit_64.S => bpf_jit_asm.S} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename arch/powerpc/net/{bpf_jit_64.S => bpf_jit_asm.S} (100%)
diff --git a/arch/powerpc/net/Makefile b/arch/powerpc/net/Makefile
index 266b395..1306a58 100644
--- a/arch/powerpc/net/Makefile
+++ b/arch/powerpc/net/Makefile
@@ -1,4 +1,4 @@
#
# Arch-specific network modules
#
-obj-$(CONFIG_BPF_JIT) += bpf_jit_64.o bpf_jit_comp.o
+obj-$(CONFIG_BPF_JIT) += bpf_jit_asm.o bpf_jit_comp.o
diff --git a/arch/powerpc/net/bpf_jit_64.S b/arch/powerpc/net/bpf_jit_asm.S
similarity index 100%
rename from arch/powerpc/net/bpf_jit_64.S
rename to arch/powerpc/net/bpf_jit_asm.S
--
2.1.3
^ permalink raw reply related
* [PATCH net-next 4/6] ppc: bpf: update jit to use compatibility macros
From: Denis Kirjanov @ 2015-02-15 18:06 UTC (permalink / raw)
To: netdev; +Cc: linuxppc-dev, Denis Kirjanov
In-Reply-To: <1424023605-2416-1-git-send-email-kda@linux-powerpc.org>
Use helpers from the asm-compat.h to wrap up assembly mnemonics
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
arch/powerpc/net/bpf_jit.h | 47 ++++++++++++++++++++++++++-
arch/powerpc/net/bpf_jit_64.S | 70 ++++++++++++++++++++---------------------
arch/powerpc/net/bpf_jit_comp.c | 32 ++++++++++---------
3 files changed, 98 insertions(+), 51 deletions(-)
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index c406aa9..2d5e715 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -10,12 +10,25 @@
#ifndef _BPF_JIT_H
#define _BPF_JIT_H
+#ifdef CONFIG_PPC64
+#define BPF_PPC_STACK_R3_OFF 48
#define BPF_PPC_STACK_LOCALS 32
#define BPF_PPC_STACK_BASIC (48+64)
#define BPF_PPC_STACK_SAVE (18*8)
#define BPF_PPC_STACKFRAME (BPF_PPC_STACK_BASIC+BPF_PPC_STACK_LOCALS+ \
BPF_PPC_STACK_SAVE)
#define BPF_PPC_SLOWPATH_FRAME (48+64)
+#else
+#define BPF_PPC_STACK_R3_OFF 24
+#define BPF_PPC_STACK_LOCALS 16
+#define BPF_PPC_STACK_BASIC (24+32)
+#define BPF_PPC_STACK_SAVE (18*4)
+#define BPF_PPC_STACKFRAME (BPF_PPC_STACK_BASIC+BPF_PPC_STACK_LOCALS+ \
+ BPF_PPC_STACK_SAVE)
+#define BPF_PPC_SLOWPATH_FRAME (24+32)
+#endif
+
+#define REG_SZ (BITS_PER_LONG/8)
/*
* Generated code register usage:
@@ -57,7 +70,11 @@ DECLARE_LOAD_FUNC(sk_load_half);
DECLARE_LOAD_FUNC(sk_load_byte);
DECLARE_LOAD_FUNC(sk_load_byte_msh);
+#ifdef CONFIG_PPC64
#define FUNCTION_DESCR_SIZE 24
+#else
+#define FUNCTION_DESCR_SIZE 0
+#endif
/*
* 16-bit immediate helper macros: HA() is for use with sign-extending instrs
@@ -86,7 +103,12 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
#define PPC_LIS(r, i) PPC_ADDIS(r, 0, i)
#define PPC_STD(r, base, i) EMIT(PPC_INST_STD | ___PPC_RS(r) | \
___PPC_RA(base) | ((i) & 0xfffc))
-
+#define PPC_STDU(r, base, i) EMIT(PPC_INST_STDU | ___PPC_RS(r) | \
+ ___PPC_RA(base) | ((i) & 0xfffc))
+#define PPC_STW(r, base, i) EMIT(PPC_INST_STW | ___PPC_RS(r) | \
+ ___PPC_RA(base) | ((i) & 0xfffc))
+#define PPC_STWU(r, base, i) EMIT(PPC_INST_STWU | ___PPC_RS(r) | \
+ ___PPC_RA(base) | ((i) & 0xfffc))
#define PPC_LBZ(r, base, i) EMIT(PPC_INST_LBZ | ___PPC_RT(r) | \
___PPC_RA(base) | IMM_L(i))
@@ -98,6 +120,17 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
___PPC_RA(base) | IMM_L(i))
#define PPC_LHBRX(r, base, b) EMIT(PPC_INST_LHBRX | ___PPC_RT(r) | \
___PPC_RA(base) | ___PPC_RB(b))
+
+#ifdef CONFIG_PPC64
+#define PPC_BPF_LL(r, base, i) do { PPC_LD(r, base, i); } while(0)
+#define PPC_BPF_STL(r, base, i) do { PPC_STD(r, base, i); } while(0)
+#define PPC_BPF_STLU(r, base, i) do { PPC_STDU(r, base, i); } while(0)
+#else
+#define PPC_BPF_LL(r, base, i) do { PPC_LWZ(r, base, i); } while(0)
+#define PPC_BPF_STL(r, base, i) do { PPC_STW(r, base, i); } while(0)
+#define PPC_BPF_STLU(r, base, i) do { PPC_STWU(r, base, i); } while(0)
+#endif
+
/* Convenience helpers for the above with 'far' offsets: */
#define PPC_LBZ_OFFS(r, base, i) do { if ((i) < 32768) PPC_LBZ(r, base, i); \
else { PPC_ADDIS(r, base, IMM_HA(i)); \
@@ -115,6 +148,12 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
else { PPC_ADDIS(r, base, IMM_HA(i)); \
PPC_LHZ(r, r, IMM_L(i)); } } while(0)
+#ifdef CONFIG_PPC64
+#define PPC_LL_OFFS(r, base, i) do { PPC_LD_OFFS(r, base, i); } while(0)
+#else
+#define PPC_LL_OFFS(r, base, i) do { PPC_LWZ_OFFS(r, base, i); } while(0)
+#endif
+
#define PPC_CMPWI(a, i) EMIT(PPC_INST_CMPWI | ___PPC_RA(a) | IMM_L(i))
#define PPC_CMPDI(a, i) EMIT(PPC_INST_CMPDI | ___PPC_RA(a) | IMM_L(i))
#define PPC_CMPLWI(a, i) EMIT(PPC_INST_CMPLWI | ___PPC_RA(a) | IMM_L(i))
@@ -196,6 +235,12 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
PPC_ORI(d, d, (uintptr_t)(i) & 0xffff); \
} } while (0);
+#ifdef CONFIG_PPC64
+#define PPC_FUNC_ADDR(d,i) do { PPC_LI64(d, i); } while(0)
+#else
+#define PPC_FUNC_ADDR(d,i) do { PPC_LI32(d, i); } while(0)
+#endif
+
#define PPC_LHBRX_OFFS(r, base, i) \
do { PPC_LI32(r, i); PPC_LHBRX(r, r, base); } while(0)
#ifdef __LITTLE_ENDIAN__
diff --git a/arch/powerpc/net/bpf_jit_64.S b/arch/powerpc/net/bpf_jit_64.S
index 8f87d92..8ff5a3b 100644
--- a/arch/powerpc/net/bpf_jit_64.S
+++ b/arch/powerpc/net/bpf_jit_64.S
@@ -34,13 +34,13 @@
*/
.globl sk_load_word
sk_load_word:
- cmpdi r_addr, 0
+ PPC_LCMPI r_addr, 0
blt bpf_slow_path_word_neg
.globl sk_load_word_positive_offset
sk_load_word_positive_offset:
/* Are we accessing past headlen? */
subi r_scratch1, r_HL, 4
- cmpd r_scratch1, r_addr
+ PPC_LCMP r_scratch1, r_addr
blt bpf_slow_path_word
/* Nope, just hitting the header. cr0 here is eq or gt! */
#ifdef __LITTLE_ENDIAN__
@@ -52,12 +52,12 @@ sk_load_word_positive_offset:
.globl sk_load_half
sk_load_half:
- cmpdi r_addr, 0
+ PPC_LCMPI r_addr, 0
blt bpf_slow_path_half_neg
.globl sk_load_half_positive_offset
sk_load_half_positive_offset:
subi r_scratch1, r_HL, 2
- cmpd r_scratch1, r_addr
+ PPC_LCMP r_scratch1, r_addr
blt bpf_slow_path_half
#ifdef __LITTLE_ENDIAN__
lhbrx r_A, r_D, r_addr
@@ -68,11 +68,11 @@ sk_load_half_positive_offset:
.globl sk_load_byte
sk_load_byte:
- cmpdi r_addr, 0
+ PPC_LCMPI r_addr, 0
blt bpf_slow_path_byte_neg
.globl sk_load_byte_positive_offset
sk_load_byte_positive_offset:
- cmpd r_HL, r_addr
+ PPC_LCMP r_HL, r_addr
ble bpf_slow_path_byte
lbzx r_A, r_D, r_addr
blr
@@ -83,11 +83,11 @@ sk_load_byte_positive_offset:
*/
.globl sk_load_byte_msh
sk_load_byte_msh:
- cmpdi r_addr, 0
+ PPC_LCMPI r_addr, 0
blt bpf_slow_path_byte_msh_neg
.globl sk_load_byte_msh_positive_offset
sk_load_byte_msh_positive_offset:
- cmpd r_HL, r_addr
+ PPC_LCMP r_HL, r_addr
ble bpf_slow_path_byte_msh
lbzx r_X, r_D, r_addr
rlwinm r_X, r_X, 2, 32-4-2, 31-2
@@ -101,13 +101,13 @@ sk_load_byte_msh_positive_offset:
*/
#define bpf_slow_path_common(SIZE) \
mflr r0; \
- std r0, 16(r1); \
+ PPC_STL r0, PPC_LR_STKOFF(r1); \
/* R3 goes in parameter space of caller's frame */ \
- std r_skb, (BPF_PPC_STACKFRAME+48)(r1); \
- std r_A, (BPF_PPC_STACK_BASIC+(0*8))(r1); \
- std r_X, (BPF_PPC_STACK_BASIC+(1*8))(r1); \
- addi r5, r1, BPF_PPC_STACK_BASIC+(2*8); \
- stdu r1, -BPF_PPC_SLOWPATH_FRAME(r1); \
+ PPC_STL r_skb, (BPF_PPC_STACKFRAME+BPF_PPC_STACK_R3_OFF)(r1); \
+ PPC_STL r_A, (BPF_PPC_STACK_BASIC+(0*REG_SZ))(r1); \
+ PPC_STL r_X, (BPF_PPC_STACK_BASIC+(1*REG_SZ))(r1); \
+ addi r5, r1, BPF_PPC_STACK_BASIC+(2*REG_SZ); \
+ PPC_STLU r1, -BPF_PPC_SLOWPATH_FRAME(r1); \
/* R3 = r_skb, as passed */ \
mr r4, r_addr; \
li r6, SIZE; \
@@ -115,19 +115,19 @@ sk_load_byte_msh_positive_offset:
nop; \
/* R3 = 0 on success */ \
addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \
- ld r0, 16(r1); \
- ld r_A, (BPF_PPC_STACK_BASIC+(0*8))(r1); \
- ld r_X, (BPF_PPC_STACK_BASIC+(1*8))(r1); \
+ PPC_LL r0, PPC_LR_STKOFF(r1); \
+ PPC_LL r_A, (BPF_PPC_STACK_BASIC+(0*REG_SZ))(r1); \
+ PPC_LL r_X, (BPF_PPC_STACK_BASIC+(1*REG_SZ))(r1); \
mtlr r0; \
- cmpdi r3, 0; \
+ PPC_LCMPI r3, 0; \
blt bpf_error; /* cr0 = LT */ \
- ld r_skb, (BPF_PPC_STACKFRAME+48)(r1); \
+ PPC_LL r_skb, (BPF_PPC_STACKFRAME+BPF_PPC_STACK_R3_OFF)(r1); \
/* Great success! */
bpf_slow_path_word:
bpf_slow_path_common(4)
/* Data value is on stack, and cr0 != LT */
- lwz r_A, BPF_PPC_STACK_BASIC+(2*8)(r1)
+ lwz r_A, BPF_PPC_STACK_BASIC+(2*REG_SZ)(r1)
blr
bpf_slow_path_half:
@@ -154,12 +154,12 @@ bpf_slow_path_byte_msh:
*/
#define sk_negative_common(SIZE) \
mflr r0; \
- std r0, 16(r1); \
+ PPC_STL r0, PPC_LR_STKOFF(r1); \
/* R3 goes in parameter space of caller's frame */ \
- std r_skb, (BPF_PPC_STACKFRAME+48)(r1); \
- std r_A, (BPF_PPC_STACK_BASIC+(0*8))(r1); \
- std r_X, (BPF_PPC_STACK_BASIC+(1*8))(r1); \
- stdu r1, -BPF_PPC_SLOWPATH_FRAME(r1); \
+ PPC_STL r_skb, (BPF_PPC_STACKFRAME+BPF_PPC_STACK_R3_OFF)(r1); \
+ PPC_STL r_A, (BPF_PPC_STACK_BASIC+(0*REG_SZ))(r1); \
+ PPC_STL r_X, (BPF_PPC_STACK_BASIC+(1*REG_SZ))(r1); \
+ PPC_STLU r1, -BPF_PPC_SLOWPATH_FRAME(r1); \
/* R3 = r_skb, as passed */ \
mr r4, r_addr; \
li r5, SIZE; \
@@ -167,19 +167,19 @@ bpf_slow_path_byte_msh:
nop; \
/* R3 != 0 on success */ \
addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \
- ld r0, 16(r1); \
- ld r_A, (BPF_PPC_STACK_BASIC+(0*8))(r1); \
- ld r_X, (BPF_PPC_STACK_BASIC+(1*8))(r1); \
+ PPC_LL r0, PPC_LR_STKOFF(r1); \
+ PPC_LL r_A, (BPF_PPC_STACK_BASIC+(0*REG_SZ))(r1); \
+ PPC_LL r_X, (BPF_PPC_STACK_BASIC+(1*REG_SZ))(r1); \
mtlr r0; \
- cmpldi r3, 0; \
+ PPC_LCMPLI r3, 0; \
beq bpf_error_slow; /* cr0 = EQ */ \
mr r_addr, r3; \
- ld r_skb, (BPF_PPC_STACKFRAME+48)(r1); \
+ PPC_LL r_skb, (BPF_PPC_STACKFRAME+BPF_PPC_STACK_R3_OFF)(r1); \
/* Great success! */
bpf_slow_path_word_neg:
lis r_scratch1,-32 /* SKF_LL_OFF */
- cmpd r_addr, r_scratch1 /* addr < SKF_* */
+ PPC_LCMP r_addr, r_scratch1 /* addr < SKF_* */
blt bpf_error /* cr0 = LT */
.globl sk_load_word_negative_offset
sk_load_word_negative_offset:
@@ -189,7 +189,7 @@ sk_load_word_negative_offset:
bpf_slow_path_half_neg:
lis r_scratch1,-32 /* SKF_LL_OFF */
- cmpd r_addr, r_scratch1 /* addr < SKF_* */
+ PPC_LCMP r_addr, r_scratch1 /* addr < SKF_* */
blt bpf_error /* cr0 = LT */
.globl sk_load_half_negative_offset
sk_load_half_negative_offset:
@@ -199,7 +199,7 @@ sk_load_half_negative_offset:
bpf_slow_path_byte_neg:
lis r_scratch1,-32 /* SKF_LL_OFF */
- cmpd r_addr, r_scratch1 /* addr < SKF_* */
+ PPC_LCMP r_addr, r_scratch1 /* addr < SKF_* */
blt bpf_error /* cr0 = LT */
.globl sk_load_byte_negative_offset
sk_load_byte_negative_offset:
@@ -209,7 +209,7 @@ sk_load_byte_negative_offset:
bpf_slow_path_byte_msh_neg:
lis r_scratch1,-32 /* SKF_LL_OFF */
- cmpd r_addr, r_scratch1 /* addr < SKF_* */
+ PPC_LCMP r_addr, r_scratch1 /* addr < SKF_* */
blt bpf_error /* cr0 = LT */
.globl sk_load_byte_msh_negative_offset
sk_load_byte_msh_negative_offset:
@@ -221,7 +221,7 @@ sk_load_byte_msh_negative_offset:
bpf_error_slow:
/* fabricate a cr0 = lt */
li r_scratch1, -1
- cmpdi r_scratch1, 0
+ PPC_LCMPI r_scratch1, 0
bpf_error:
/* Entered with cr0 = lt */
li r3, 0
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index d1916b5..8b29268 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -1,8 +1,9 @@
-/* bpf_jit_comp.c: BPF JIT compiler for PPC64
+/* bpf_jit_comp.c: BPF JIT compiler
*
* Copyright 2011 Matt Evans <matt@ozlabs.org>, IBM Corporation
*
* Based on the x86 BPF compiler, by Eric Dumazet (eric.dumazet@gmail.com)
+ * Ported to ppc32 by Denis Kirjanov <kda@linux-powerpc.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -36,11 +37,11 @@ static void bpf_jit_build_prologue(struct bpf_prog *fp, u32 *image,
if (ctx->seen & SEEN_DATAREF) {
/* If we call any helpers (for loads), save LR */
EMIT(PPC_INST_MFLR | __PPC_RT(R0));
- PPC_STD(0, 1, 16);
+ PPC_BPF_STL(0, 1, PPC_LR_STKOFF);
/* Back up non-volatile regs. */
- PPC_STD(r_D, 1, -(8*(32-r_D)));
- PPC_STD(r_HL, 1, -(8*(32-r_HL)));
+ PPC_BPF_STL(r_D, 1, -(REG_SZ*(32-r_D)));
+ PPC_BPF_STL(r_HL, 1, -(REG_SZ*(32-r_HL)));
}
if (ctx->seen & SEEN_MEM) {
/*
@@ -49,11 +50,10 @@ static void bpf_jit_build_prologue(struct bpf_prog *fp, u32 *image,
*/
for (i = r_M; i < (r_M+16); i++) {
if (ctx->seen & (1 << (i-r_M)))
- PPC_STD(i, 1, -(8*(32-i)));
+ PPC_BPF_STL(i, 1, -(REG_SZ*(32-i)));
}
}
- EMIT(PPC_INST_STDU | __PPC_RS(R1) | __PPC_RA(R1) |
- (-BPF_PPC_STACKFRAME & 0xfffc));
+ PPC_BPF_STLU(1, 1, -BPF_PPC_STACKFRAME);
}
if (ctx->seen & SEEN_DATAREF) {
@@ -67,7 +67,7 @@ static void bpf_jit_build_prologue(struct bpf_prog *fp, u32 *image,
data_len));
PPC_LWZ_OFFS(r_HL, r_skb, offsetof(struct sk_buff, len));
PPC_SUB(r_HL, r_HL, r_scratch1);
- PPC_LD_OFFS(r_D, r_skb, offsetof(struct sk_buff, data));
+ PPC_LL_OFFS(r_D, r_skb, offsetof(struct sk_buff, data));
}
if (ctx->seen & SEEN_XREG) {
@@ -99,16 +99,16 @@ static void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)
if (ctx->seen & (SEEN_MEM | SEEN_DATAREF)) {
PPC_ADDI(1, 1, BPF_PPC_STACKFRAME);
if (ctx->seen & SEEN_DATAREF) {
- PPC_LD(0, 1, 16);
+ PPC_BPF_LL(0, 1, PPC_LR_STKOFF);
PPC_MTLR(0);
- PPC_LD(r_D, 1, -(8*(32-r_D)));
- PPC_LD(r_HL, 1, -(8*(32-r_HL)));
+ PPC_BPF_LL(r_D, 1, -(REG_SZ*(32-r_D)));
+ PPC_BPF_LL(r_HL, 1, -(REG_SZ*(32-r_HL)));
}
if (ctx->seen & SEEN_MEM) {
/* Restore any saved non-vol registers */
for (i = r_M; i < (r_M+16); i++) {
if (ctx->seen & (1 << (i-r_M)))
- PPC_LD(i, 1, -(8*(32-i)));
+ PPC_BPF_LL(i, 1, -(REG_SZ*(32-i)));
}
}
}
@@ -355,7 +355,7 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
ifindex) != 4);
BUILD_BUG_ON(FIELD_SIZEOF(struct net_device,
type) != 2);
- PPC_LD_OFFS(r_scratch1, r_skb, offsetof(struct sk_buff,
+ PPC_LL_OFFS(r_scratch1, r_skb, offsetof(struct sk_buff,
dev));
PPC_CMPDI(r_scratch1, 0);
if (ctx->pc_ret0 != -1) {
@@ -437,7 +437,7 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
common_load:
/* Load from [K]. */
ctx->seen |= SEEN_DATAREF;
- PPC_LI64(r_scratch1, func);
+ PPC_FUNC_ADDR(r_scratch1, func);
PPC_MTLR(r_scratch1);
PPC_LI32(r_addr, K);
PPC_BLRL();
@@ -463,7 +463,7 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
* in the helper functions.
*/
ctx->seen |= SEEN_DATAREF | SEEN_XREG;
- PPC_LI64(r_scratch1, func);
+ PPC_FUNC_ADDR(r_scratch1, func);
PPC_MTLR(r_scratch1);
PPC_ADDI(r_addr, r_X, IMM_L(K));
if (K >= 32768)
@@ -685,9 +685,11 @@ void bpf_jit_compile(struct bpf_prog *fp)
if (image) {
bpf_flush_icache(code_base, code_base + (proglen/4));
+#ifdef CONFIG_PPC64
/* Function descriptor nastiness: Address + TOC */
((u64 *)image)[0] = (u64)code_base;
((u64 *)image)[1] = local_paca->kernel_toc;
+#endif
fp->bpf_func = (void *)image;
fp->jited = true;
}
--
2.1.3
^ permalink raw reply related
* [PATCH net-next 3/6] ppc: bpf: add reqired opcodes for ppc32
From: Denis Kirjanov @ 2015-02-15 18:06 UTC (permalink / raw)
To: netdev; +Cc: linuxppc-dev, Denis Kirjanov
In-Reply-To: <1424023605-2416-1-git-send-email-kda@linux-powerpc.org>
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
arch/powerpc/include/asm/ppc-opcode.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 03cd858..2eadde0 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -212,6 +212,8 @@
#define PPC_INST_LWZ 0x80000000
#define PPC_INST_STD 0xf8000000
#define PPC_INST_STDU 0xf8000001
+#define PPC_INST_STW 0x90000000
+#define PPC_INST_STWU 0x94000000
#define PPC_INST_MFLR 0x7c0802a6
#define PPC_INST_MTLR 0x7c0803a6
#define PPC_INST_CMPWI 0x2c000000
--
2.1.3
^ permalink raw reply related
* [PATCH net-next 2/6] ppc: bpf: add required compatibility macros for jit
From: Denis Kirjanov @ 2015-02-15 18:06 UTC (permalink / raw)
To: netdev; +Cc: linuxppc-dev, Denis Kirjanov
In-Reply-To: <1424023605-2416-1-git-send-email-kda@linux-powerpc.org>
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
arch/powerpc/include/asm/asm-compat.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/powerpc/include/asm/asm-compat.h b/arch/powerpc/include/asm/asm-compat.h
index 21be8ae..dc85dcb 100644
--- a/arch/powerpc/include/asm/asm-compat.h
+++ b/arch/powerpc/include/asm/asm-compat.h
@@ -23,6 +23,8 @@
#define PPC_STL stringify_in_c(std)
#define PPC_STLU stringify_in_c(stdu)
#define PPC_LCMPI stringify_in_c(cmpdi)
+#define PPC_LCMPLI stringify_in_c(cmpldi)
+#define PPC_LCMP stringify_in_c(cmpd)
#define PPC_LONG stringify_in_c(.llong)
#define PPC_LONG_ALIGN stringify_in_c(.balign 8)
#define PPC_TLNEI stringify_in_c(tdnei)
@@ -52,6 +54,8 @@
#define PPC_STL stringify_in_c(stw)
#define PPC_STLU stringify_in_c(stwu)
#define PPC_LCMPI stringify_in_c(cmpwi)
+#define PPC_LCMPLI stringify_in_c(cmplwi)
+#define PPC_LCMP stringify_in_c(cmpw)
#define PPC_LONG stringify_in_c(.long)
#define PPC_LONG_ALIGN stringify_in_c(.balign 4)
#define PPC_TLNEI stringify_in_c(twnei)
--
2.1.3
^ permalink raw reply related
* [PATCH net-next 1/6] ppc: Kconfig: Enable BPF JIT on ppc32
From: Denis Kirjanov @ 2015-02-15 18:06 UTC (permalink / raw)
To: netdev; +Cc: linuxppc-dev, Denis Kirjanov
In-Reply-To: <1424023605-2416-1-git-send-email-kda@linux-powerpc.org>
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
arch/powerpc/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 22b0940..5084bdc 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -126,7 +126,7 @@ config PPC
select IRQ_FORCED_THREADING
select HAVE_RCU_TABLE_FREE if SMP
select HAVE_SYSCALL_TRACEPOINTS
- select HAVE_BPF_JIT if PPC64
+ select HAVE_BPF_JIT
select HAVE_ARCH_JUMP_LABEL
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select ARCH_HAS_GCOV_PROFILE_ALL
--
2.1.3
^ permalink raw reply related
* [PATCH net-next 0/6] bpf: Enable BPF JIT on ppc32
From: Denis Kirjanov @ 2015-02-15 18:06 UTC (permalink / raw)
To: netdev; +Cc: linuxppc-dev
This patch series enables BPF JIT on ppc32. There are relatevily
few chnages in the code to make it work.
All test_bpf tests passed both on 7447a and P2041-based machines.
arch/powerpc/Kconfig | 2 +-
arch/powerpc/include/asm/asm-compat.h | 4 +
arch/powerpc/include/asm/ppc-opcode.h | 2 +
arch/powerpc/net/Makefile | 2 +-
arch/powerpc/net/bpf_jit.h | 47 ++++++-
arch/powerpc/net/bpf_jit_64.S | 229 ----------------------------------
arch/powerpc/net/bpf_jit_asm.S | 229 ++++++++++++++++++++++++++++++++++
arch/powerpc/net/bpf_jit_comp.c | 32 ++---
8 files changed, 300 insertions(+), 247 deletions(-)
^ permalink raw reply
* [PATCH 1/1] iproute2: Add support for connmark action
From: Jamal Hadi Salim @ 2015-02-15 16:57 UTC (permalink / raw)
To: stephen; +Cc: nbd, netdev, Jamal Hadi Salim
From: Felix Fietkau <nbd@openwrt.org>
Add ability to add the netfilter connmark support.
Typical usage:
...lets tag outgoing icmp with mark 0x10..
iptables -tmangle -A PREROUTING -p icmp -j CONNMARK --set-mark 0x10
..add on ingress of $ETH an extractor for connmark...
tc filter add dev $ETH parent ffff: prio 4 protocol ip \
u32 match ip protocol 1 0xff \
flowid 1:1 \
action connmark continue
...if the connmark was 0x11, we police to a ridic rate of 10Kbps
tc filter add dev $ETH parent ffff: prio 5 protocol ip \
handle 0x11 fw flowid 1:1 \
action police rate 10kbit burst 10k
Other ways to use the connmark is to supply the zone, index and
branching choice. Refer to help.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
tc/Makefile | 1 +
tc/m_connmark.c | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 168 insertions(+)
create mode 100644 tc/m_connmark.c
diff --git a/tc/Makefile b/tc/Makefile
index d831a15..6210b4b 100644
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -46,6 +46,7 @@ TCMODULES += m_skbedit.o
TCMODULES += m_csum.o
TCMODULES += m_simple.o
TCMODULES += m_vlan.o
+TCMODULES += m_connmark.o
TCMODULES += m_bpf.o
TCMODULES += p_ip.o
TCMODULES += p_icmp.o
diff --git a/tc/m_connmark.c b/tc/m_connmark.c
new file mode 100644
index 0000000..51938dc
--- /dev/null
+++ b/tc/m_connmark.c
@@ -0,0 +1,167 @@
+/*
+ * m_connmark.c Connection tracking marking import
+ *
+ * Copyright (c) 2011 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include "utils.h"
+#include "tc_util.h"
+#include <linux/tc_act/tc_connmark.h>
+
+static void
+explain(void)
+{
+ fprintf(stderr, "Usage: ... connmark [ZONE] [BRANCH] [index <INDEX>]\n");
+ fprintf(stderr, "where :\n"
+ "\tZONE is the conntrack zone\n"
+ "\tBRANCH := reclassify|pipe|drop|continue|ok\n");
+}
+
+static void
+usage(void)
+{
+ explain();
+ exit(-1);
+}
+
+static int
+parse_connmark(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
+ struct nlmsghdr *n)
+{
+ struct tc_connmark sel = {};
+ char **argv = *argv_p;
+ int argc = *argc_p;
+ int ok = 0;
+ struct rtattr *tail;
+
+ while (argc > 0) {
+ if (matches(*argv, "connmark") == 0) {
+ ok = 1;
+ argc--;
+ argv++;
+ } else if (matches(*argv, "help") == 0) {
+ usage();
+ } else {
+ break;
+ }
+
+ }
+
+ if (!ok) {
+ explain();
+ return -1;
+ }
+
+ if (argc) {
+ if (matches(*argv, "zone") == 0) {
+ NEXT_ARG();
+ if (get_u16(&sel.zone, *argv, 10)) {
+ fprintf(stderr, "simple: Illegal \"index\"\n");
+ return -1;
+ }
+ argc--;
+ argv++;
+ }
+ }
+
+ sel.action = TC_ACT_PIPE;
+ if (argc) {
+ if (matches(*argv, "reclassify") == 0) {
+ sel.action = TC_ACT_RECLASSIFY;
+ argc--;
+ argv++;
+ } else if (matches(*argv, "pipe") == 0) {
+ sel.action = TC_ACT_PIPE;
+ argc--;
+ argv++;
+ } else if (matches(*argv, "drop") == 0 ||
+ matches(*argv, "shot") == 0) {
+ sel.action = TC_ACT_SHOT;
+ argc--;
+ argv++;
+ } else if (matches(*argv, "continue") == 0) {
+ sel.action = TC_ACT_UNSPEC;
+ argc--;
+ argv++;
+ } else if (matches(*argv, "pass") == 0) {
+ sel.action = TC_ACT_OK;
+ argc--;
+ argv++;
+ }
+ }
+
+ if (argc) {
+ if (matches(*argv, "index") == 0) {
+ NEXT_ARG();
+ if (get_u32(&sel.index, *argv, 10)) {
+ fprintf(stderr, "simple: Illegal \"index\"\n");
+ return -1;
+ }
+ argc--;
+ argv++;
+ }
+ }
+
+ tail = NLMSG_TAIL(n);
+ addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ addattr_l(n, MAX_MSG, TCA_CONNMARK_PARMS, &sel, sizeof(sel));
+ tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
+
+ *argc_p = argc;
+ *argv_p = argv;
+ return 0;
+}
+
+static int print_connmark(struct action_util *au, FILE *f, struct rtattr *arg)
+{
+ struct rtattr *tb[TCA_CONNMARK_MAX + 1];
+ struct tc_connmark *ci;
+
+ if (arg == NULL)
+ return -1;
+
+ parse_rtattr_nested(tb, TCA_CONNMARK_MAX, arg);
+ if (tb[TCA_CONNMARK_PARMS] == NULL) {
+ fprintf(f, "[NULL connmark parameters]");
+ return -1;
+ }
+
+ ci = RTA_DATA(tb[TCA_CONNMARK_PARMS]);
+
+ fprintf(f, " connmark zone %d\n", ci->zone);
+ fprintf(f, "\t index %d ref %d bind %d", ci->index,
+ ci->refcnt, ci->bindcnt);
+
+ if (show_stats) {
+ if (tb[TCA_CONNMARK_TM]) {
+ struct tcf_t *tm = RTA_DATA(tb[TCA_CONNMARK_TM]);
+ print_tm(f, tm);
+ }
+ }
+ fprintf(f, "\n");
+
+ return 0;
+}
+
+struct action_util connmark_action_util = {
+ .id = "connmark",
+ .parse_aopt = parse_connmark,
+ .print_aopt = print_connmark,
+};
--
1.7.9.5
^ permalink raw reply related
* Re: [Patch] rtnetlink: call ->dellink on failure when ->newlink exists
From: David Miller @ 2015-02-15 16:31 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, ignacy.gawedzki
In-Reply-To: <1423864613-29637-1-git-send-email-xiyou.wangcong@gmail.com>
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Fri, 13 Feb 2015 13:56:53 -0800
> Ignacy reported that when eth0 is down and add a vlan device
> on top of it like:
>
> ip link add link eth0 name eth0.1 up type vlan id 1
>
> We will get a refcount leak:
>
> unregister_netdevice: waiting for eth0.1 to become free. Usage count = 2
>
> The problem is when rtnl_configure_link() fails in rtnl_newlink(),
> we simply call unregister_device(), but for stacked device like vlan,
> we almost do nothing when we unregister the upper device, more work
> is done when we unregister the lower device, so call its ->dellink().
>
> Reported-by: Ignacy Gawedzki <ignacy.gawedzki@green-communications.fr>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH] com20020-pci: add support for eae single card
From: David Miller @ 2015-02-15 16:22 UTC (permalink / raw)
To: m.grzeschik; +Cc: netdev, linux-kernel, kernel
In-Reply-To: <1423829030-20682-1-git-send-email-m.grzeschik@pengutronix.de>
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
Date: Fri, 13 Feb 2015 13:03:50 +0100
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Applied, thanks.
^ 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