* Re: [PATCH net-next v2 2/2] openvswitch: remove unnecessary EXPORT_SYMBOLs
From: Pravin Shelar @ 2016-10-19 18:34 UTC (permalink / raw)
To: Jiri Benc; +Cc: ovs dev, Linux Kernel Network Developers
In-Reply-To: <4653b9825aa5e4047c4a91241dcafd1706171e80.1476869133.git.jbenc-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Wed, Oct 19, 2016 at 2:26 AM, Jiri Benc <jbenc@redhat.com> wrote:
> Some symbols exported to other modules are really used only by
> openvswitch.ko. Remove the exports.
>
> Tested by loading all 4 openvswitch modules, nothing breaks.
>
> Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
^ permalink raw reply
* Re: [PATCH] net: limit a number of namespaces which can be cleaned up concurrently
From: Andrey Vagin @ 2016-10-19 18:46 UTC (permalink / raw)
To: Eric W. Biederman, David S. Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Linux Containers, Andrei Vagin
In-Reply-To: <87eg3hy3fm.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 12106 bytes --]
On Sat, Oct 15, 2016 at 9:36 AM, Eric W. Biederman
<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org> wrote:
> Andrei Vagin <avagin-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> writes:
>
>> On Thu, Oct 13, 2016 at 10:06:28PM -0500, Eric W. Biederman wrote:
>>> Andrei Vagin <avagin-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> writes:
>>>
>>> > On Thu, Oct 13, 2016 at 10:49:38AM -0500, Eric W. Biederman wrote:
>>> >> Andrei Vagin <avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org> writes:
>>> >>
>>> >> > From: Andrey Vagin <avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
>>> >> >
>>> >> > The operation of destroying netns is heavy and it is executed under
>>> >> > net_mutex. If many namespaces are destroyed concurrently, net_mutex can
>>> >> > be locked for a long time. It is impossible to create a new netns during
>>> >> > this period of time.
>>> >>
>>> >> This may be the right approach or at least the right approach to bound
>>> >> net_mutex hold times but I have to take exception to calling network
>>> >> namespace cleanup heavy.
>>> >>
>>> >> The only particularly time consuming operation I have ever found are calls to
>>> >> synchronize_rcu/sycrhonize_sched/synchronize_net.
>>> >
>>> > I booted the kernel with maxcpus=1, in this case these functions work
>>> > very fast and the problem is there any way.
>>> >
>>> > Accoding to perf, we spend a lot of time in kobject_uevent:
>>> >
>>> > - 99.96% 0.00% kworker/u4:1 [kernel.kallsyms] [k] unregister_netdevice_many
>>> > - unregister_netdevice_many
>>> > - 99.95% rollback_registered_many
>>> > - 99.64% netdev_unregister_kobject
>>> > - 33.43% netdev_queue_update_kobjects
>>> > - 33.40% kobject_put
>>> > - kobject_release
>>> > + 33.37% kobject_uevent
>>> > + 0.03% kobject_del
>>> > + 0.03% sysfs_remove_group
>>> > - 33.13% net_rx_queue_update_kobjects
>>> > - kobject_put
>>> > - kobject_release
>>> > + 33.11% kobject_uevent
>>> > + 0.01% kobject_del
>>> > 0.00% rx_queue_release
>>> > - 33.08% device_del
>>> > + 32.75% kobject_uevent
>>> > + 0.17% device_remove_attrs
>>> > + 0.07% dpm_sysfs_remove
>>> > + 0.04% device_remove_class_symlinks
>>> > + 0.01% kobject_del
>>> > + 0.01% device_pm_remove
>>> > + 0.01% sysfs_remove_file_ns
>>> > + 0.00% klist_del
>>> > + 0.00% driver_deferred_probe_del
>>> > 0.00% cleanup_glue_dir.isra.14.part.15
>>> > 0.00% to_acpi_device_node
>>> > 0.00% sysfs_remove_group
>>> > 0.00% klist_del
>>> > 0.00% device_remove_attrs
>>> > + 0.26% call_netdevice_notifiers_info
>>> > + 0.04% rtmsg_ifinfo_build_skb
>>> > + 0.01% rtmsg_ifinfo_send
>>> > 0.00% dev_uc_flush
>>> > 0.00% netif_reset_xps_queues_gt
>>> >
>>> > Someone can listen these uevents, so we can't stop sending them without
>>> > breaking backward compatibility. We can try to optimize
>>> > kobject_uevent...
>>>
>>> Oh that is a surprise. We can definitely skip genenerating uevents for
>>> network namespaces that are exiting because by definition no one can see
>>> those network namespaces. If a socket existed that could see those
>>> uevents it would hold a reference to the network namespace and as such
>>> the network namespace could not exit.
>>>
>>> That sounds like it is worth investigating a little more deeply.
>>>
>>> I am surprised that allocation and freeing is so heavy we are spending
>>> lots of time doing that. On the other hand kobj_bcast_filter is very
>>> dumb and very late so I expect something can be moved earlier and make
>>> that code cheaper with the tiniest bit of work.
>>>
>>
>> I'm sorry, I've collected this data for a kernel with debug options
>> (DEBUG_SPINLOCK, PROVE_LOCKING, DEBUG_LIST, etc). If a kernel is
>> compiled without debug options, kobject_uevent becomes less expensive,
>> but still expensive.
>>
>> - 98.64% 0.00% kworker/u4:2 [kernel.kallsyms] [k] cleanup_net
>> - cleanup_net
>> - 98.54% ops_exit_list.isra.4
>> - 60.48% default_device_exit_batch
>> - 60.40% unregister_netdevice_many
>> - rollback_registered_many
>> - 59.82% netdev_unregister_kobject
>> - 20.10% device_del
>> + 19.44% kobject_uevent
>> + 0.40% device_remove_attrs
>> + 0.17% dpm_sysfs_remove
>> + 0.04% device_remove_class_symlinks
>> + 0.04% kobject_del
>> + 0.01% device_pm_remove
>> + 0.01% sysfs_remove_file_ns
>> - 19.89% netdev_queue_update_kobjects
>> + 19.81% kobject_put
>> + 0.07% sysfs_remove_group
>> - 19.79% net_rx_queue_update_kobjects
>> kobject_put
>> - kobject_release
>> + 19.77% kobject_uevent
>> + 0.02% kobject_del
>> 0.01% rx_queue_release
>> + 0.02% kset_unregister
>> 0.01% pm_runtime_set_memalloc_noio
>> 0.01% bus_remove_device
>> + 0.45% call_netdevice_notifiers_info
>> + 0.07% rtmsg_ifinfo_build_skb
>> + 0.04% rtmsg_ifinfo_send
>> 0.01% kset_unregister
>> + 0.07% rtnl_unlock
>> + 19.27% rpcsec_gss_exit_net
>> + 5.45% tcp_net_metrics_exit
>> + 5.31% sunrpc_exit_net
>> + 3.18% ip6addrlbl_net_exit
>>
>>
>> So after removing kobject_uevent, cleanup_net becomes more than two times faster:
>>
>> 1000 namespaces are cleaned up for 2.8 seconds with uevents, and 1.2 senconds
>> without uevents. I do this experiments with max_cpus=1 to exclude synchronize_rcu.
>>
>> As a summary we can skip generating uevents, but it doesn't solve the original
>> problem. If we want to avoid the limit introduced in this patch, we have
>> to reduce the time for destroing net namespace in dozen times, don't
>> we?
>
> It definitely looks like optimizing kobject_uevent for this case is
> worth while.
>
> I would not mind getting the raw cost of network namespace cleanups
> below 2.8ms or with uevent cleanups 1.2ms. There is just a lot going on
> for a lot of good reasons in the networking stack so that can be tricky.
>
> The larger issue is that there is a trade off between latency and
> throughput in network namespace destruction. Consider the case of
> vsftpd. Which creates a new network namespace for every connection.
> Something like that can wind up with a huge backlog of network
> namespaces to clean up while continually creating more. The system will
> go OOM if we don't stop and cleanup what we have.
>
> And the batching is very very important for throughput. So the smallest
> batch size we could really accept is a batch size that does not hurt
> throughput when destroying network namespaces. Otherwise we will have a
> growing backlog of network namespaces to cleanup and a system that
> eventuallys stops being usable at all. In that context I think a long
> hold time on net_mutex is preferable to a system that does not work at
> all.
>
> Now I would love to make both the throughput and the latency better I
> would be all in favor of that, but that requires some deep changes to
> the network namespace initialization and cleanup. Unfortunately I
> haven't stared at the problem enough to know what those changes would
> need to be. But something where we would not need to serialize network
> namespace cleanup between different network namespaces. And ideally
> something we could implement incrementally as there is so much
> networking code I don't expect we could verify and change verything
> overnight.
Eric, I get your point. All these sounds reasonable.
And here is another idea about net_mutex.
The longer I look at net_mutex the more it looks like that it can be replaced
on a read-write lock. It protects per-namespace lists of operations, which are
modified only when modules are loaded or unloaded. And the kernel reads
these lists to create or destroy a new network namespace.
Eric and David, what do you think about this idea? Do you have any ideas
why it will not work.
I don't know this code so well to not skip something obvious. The attached
patch shows how it looks like.
If it will works we will be able to create and destroy net namespaces
concurrently.
And even call cleanup_net() from a few threads if we have a big
backlog. It is only
one of steps which may be useful to fix this problem.
>
> That plus in practice the bottleneck has always been the synchronize_rcu
> calls which tend to take at least a millisecond a piece. Being able
> overlap those synchronize_rcu calls in the common case has reduced
> the time to run the network stack cleanup code by very dramatic amounts.
>
> Right now I am very happy that the network namespace cleanup code is
> working properly. When I started the network stack cleanup code to
> cleanup network namespaces I found actual functional bugs. I will be
> even happier if we can figure out how to make it all run fast.
>
> But ultimately we have the net_mutex and the rtnl_lock that serialize
> things on the setup and cleanup paths and to allow creation to proceed
> while cleanup is ongoing we need to find a way to avoid serialization by
> either of those, and I have honestly drawn a blank.
>
> So right now my best suggestion for making things better is to find and
> fix each little piece we can fix. Until the things are working as best
> we can make them work. It is not sexy or glamorous or fast but it makes
> things better and is the best that I can see to do.
>
> Eric
>
>
>> Here is a perf report after skipping generating uevents:
>> - 93.27% 0.00% kworker/u4:1 [kernel.kallsyms] [k] cleanup_net
>> - cleanup_net
>> - 92.97% ops_exit_list.isra.4
>> - 35.14% rpcsec_gss_exit_net
>> - gss_svc_shutdown_net
>> - 17.40% rsc_cache_destroy_net
>> + 8.64% cache_unregister_net
>> + 8.52% cache_purge
>> + 0.22% cache_destroy_net
>> + 9.00% cache_unregister_net
>> + 8.49% cache_purge
>> + 0.15% destroy_use_gss_proxy_proc_entry
>> + 0.10% cache_destroy_net
>> - 14.35% tcp_net_metrics_exit
>> - 7.32% tcp_metrics_flush_all
>> + 4.86% _raw_spin_unlock_bh
>> 0.59% __local_bh_enable_ip
>> 6.12% _raw_spin_lock_bh
>> 0.90% _raw_spin_unlock_bh
>> - 13.08% sunrpc_exit_net
>> - 6.91% ip_map_cache_destroy
>> + 3.90% cache_unregister_net
>> + 2.86% cache_purge
>> + 0.15% cache_destroy_net
>> + 5.95% unix_gid_cache_destroy
>> + 0.12% rpc_pipefs_exit_net
>> + 0.10% rpc_proc_exit
>> - 7.35% ip6addrlbl_net_exit
>> + call_rcu_sched
>> + 3.34% xfrm_net_exit
>> + 1.22% ipv6_frags_exit_net
>> + 1.17% ipv4_frags_exit_net
>> + 0.78% fib_net_exit
>> + 0.76% inet6_net_exit
>> + 0.76% devinet_exit_net
>> + 0.68% addrconf_exit_net
>> + 0.63% igmp6_net_exit
>> + 0.59% ipv4_mib_exit_net
>> + 0.59% uevent_net_exit
>>
>>> Eric
> _______________________________________________
> Containers mailing list
> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linuxfoundation.org/mailman/listinfo/containers
[-- Attachment #2: 0001-RFC-net-convert-net_mutex-into-a-read-write-lock.patch --]
[-- Type: text/x-patch, Size: 5405 bytes --]
From 6fb255bed1c82a24931595502a8e393200c7dd52 Mon Sep 17 00:00:00 2001
From: Andrei Vagin <avagin@openvz.org>
Date: Sun, 16 Oct 2016 17:18:43 -0700
Subject: [PATCH] [RFC] net: convert net_mutex into a read-write lock
It protects per-namespace lists of operations, which are modified only
when modules are loaded or unloaded.
And the kernel reads these lists to create or destroy a new network
namespace.
Signed-off-by: Andrei Vagin <avagin@openvz.org>
---
include/linux/rtnetlink.h | 2 +-
net/core/net_namespace.c | 32 ++++++++++++++++----------------
net/core/rtnetlink.c | 4 ++--
3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 57e5484..1a780a3 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -30,7 +30,7 @@ extern int rtnl_trylock(void);
extern int rtnl_is_locked(void);
extern wait_queue_head_t netdev_unregistering_wq;
-extern struct mutex net_mutex;
+extern struct rw_semaphore net_mutex;
#ifdef CONFIG_PROVE_LOCKING
extern bool lockdep_rtnl_is_held(void);
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 989434f..81dafce 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -27,7 +27,7 @@
static LIST_HEAD(pernet_list);
static struct list_head *first_device = &pernet_list;
-DEFINE_MUTEX(net_mutex);
+DECLARE_RWSEM(net_mutex);
LIST_HEAD(net_namespace_list);
EXPORT_SYMBOL_GPL(net_namespace_list);
@@ -59,7 +59,7 @@ static int net_assign_generic(struct net *net, int id, void *data)
{
struct net_generic *ng, *old_ng;
- BUG_ON(!mutex_is_locked(&net_mutex));
+ BUG_ON(!rwsem_is_locked(&net_mutex));
BUG_ON(id == 0);
old_ng = rcu_dereference_protected(net->gen,
@@ -379,7 +379,7 @@ struct net *copy_net_ns(unsigned long flags,
get_user_ns(user_ns);
- mutex_lock(&net_mutex);
+ down_read(&net_mutex);
net->ucounts = ucounts;
rv = setup_net(net, user_ns);
if (rv == 0) {
@@ -387,7 +387,7 @@ struct net *copy_net_ns(unsigned long flags,
list_add_tail_rcu(&net->list, &net_namespace_list);
rtnl_unlock();
}
- mutex_unlock(&net_mutex);
+ up_read(&net_mutex);
if (rv < 0) {
dec_net_namespaces(ucounts);
put_user_ns(user_ns);
@@ -412,7 +412,7 @@ static void cleanup_net(struct work_struct *work)
list_replace_init(&cleanup_list, &net_kill_list);
spin_unlock_irq(&cleanup_list_lock);
- mutex_lock(&net_mutex);
+ down_read(&net_mutex);
/* Don't let anyone else find us. */
rtnl_lock();
@@ -452,7 +452,7 @@ static void cleanup_net(struct work_struct *work)
list_for_each_entry_reverse(ops, &pernet_list, list)
ops_free_list(ops, &net_exit_list);
- mutex_unlock(&net_mutex);
+ up_read(&net_mutex);
/* Ensure there are no outstanding rcu callbacks using this
* network namespace.
@@ -763,7 +763,7 @@ static int __init net_ns_init(void)
rcu_assign_pointer(init_net.gen, ng);
- mutex_lock(&net_mutex);
+ down_read(&net_mutex);
if (setup_net(&init_net, &init_user_ns))
panic("Could not setup the initial network namespace");
@@ -773,7 +773,7 @@ static int __init net_ns_init(void)
list_add_tail_rcu(&init_net.list, &net_namespace_list);
rtnl_unlock();
- mutex_unlock(&net_mutex);
+ up_read(&net_mutex);
register_pernet_subsys(&net_ns_ops);
@@ -912,9 +912,9 @@ static void unregister_pernet_operations(struct pernet_operations *ops)
int register_pernet_subsys(struct pernet_operations *ops)
{
int error;
- mutex_lock(&net_mutex);
+ down_write(&net_mutex);
error = register_pernet_operations(first_device, ops);
- mutex_unlock(&net_mutex);
+ up_write(&net_mutex);
return error;
}
EXPORT_SYMBOL_GPL(register_pernet_subsys);
@@ -930,9 +930,9 @@ EXPORT_SYMBOL_GPL(register_pernet_subsys);
*/
void unregister_pernet_subsys(struct pernet_operations *ops)
{
- mutex_lock(&net_mutex);
+ down_write(&net_mutex);
unregister_pernet_operations(ops);
- mutex_unlock(&net_mutex);
+ up_write(&net_mutex);
}
EXPORT_SYMBOL_GPL(unregister_pernet_subsys);
@@ -958,11 +958,11 @@ EXPORT_SYMBOL_GPL(unregister_pernet_subsys);
int register_pernet_device(struct pernet_operations *ops)
{
int error;
- mutex_lock(&net_mutex);
+ down_write(&net_mutex);
error = register_pernet_operations(&pernet_list, ops);
if (!error && (first_device == &pernet_list))
first_device = &ops->list;
- mutex_unlock(&net_mutex);
+ up_write(&net_mutex);
return error;
}
EXPORT_SYMBOL_GPL(register_pernet_device);
@@ -978,11 +978,11 @@ EXPORT_SYMBOL_GPL(register_pernet_device);
*/
void unregister_pernet_device(struct pernet_operations *ops)
{
- mutex_lock(&net_mutex);
+ down_write(&net_mutex);
if (&ops->list == first_device)
first_device = first_device->next;
unregister_pernet_operations(ops);
- mutex_unlock(&net_mutex);
+ up_write(&net_mutex);
}
EXPORT_SYMBOL_GPL(unregister_pernet_device);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index b06d2f4..7533419 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -418,11 +418,11 @@ static void rtnl_lock_unregistering_all(void)
void rtnl_link_unregister(struct rtnl_link_ops *ops)
{
/* Close the race with cleanup_net() */
- mutex_lock(&net_mutex);
+ down_write(&net_mutex);
rtnl_lock_unregistering_all();
__rtnl_link_unregister(ops);
rtnl_unlock();
- mutex_unlock(&net_mutex);
+ up_write(&net_mutex);
}
EXPORT_SYMBOL_GPL(rtnl_link_unregister);
--
2.7.4
[-- Attachment #3: Type: text/plain, Size: 205 bytes --]
_______________________________________________
Containers mailing list
Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linuxfoundation.org/mailman/listinfo/containers
^ permalink raw reply related
* Re: [PATCH] ipv6: fix signedness of tmp_prefered_lft underflow check
From: David Miller @ 2016-10-19 18:58 UTC (permalink / raw)
To: jbohac; +Cc: julia.lawall, kuznet, jmorris, yoshfuji, kaber, netdev,
kbuild-all
In-Reply-To: <20161019131636.zhusbqh63qlbq5vy@dwarf.suse.cz>
From: Jiri Bohac <jbohac@suse.cz>
Date: Wed, 19 Oct 2016 15:16:36 +0200
> The purpose was to guard against the user updating the
> temp_prefered_lft sysctl after this:
>
> max_desync_factor = min_t(__u32,
> idev->cnf.max_desync_factor,
> idev->cnf.temp_prefered_lft - regen_advance);
>
> but before this:
>
> tmp_prefered_lft = idev->cnf.temp_prefered_lft + age -
> idev->desync_factor;
That's a different problem.
Read the sysctl values of interest into local variables using
READ_ONCE() before the calculations, that way the situation your
describe is impossible.
^ permalink raw reply
* Re: [PATCH net v2] net: add recursion limit to GRO
From: Tom Herbert @ 2016-10-19 19:00 UTC (permalink / raw)
To: Sabrina Dubroca
Cc: Linux Kernel Network Developers, Hannes Frederic Sowa, Jiri Benc,
Eric Dumazet
In-Reply-To: <7c0a636aa0cc9f4b2f796b4d18959334e14b09c3.1476894381.git.sd@queasysnail.net>
On Wed, Oct 19, 2016 at 9:29 AM, Sabrina Dubroca <sd@queasysnail.net> wrote:
> Currently, GRO can do unlimited recursion through the gro_receive
> handlers. This was fixed for tunneling protocols by limiting tunnel GRO
> to one level with encap_mark, but both VLAN and TEB still have this
> problem. Thus, the kernel is vulnerable to a stack overflow, if we
> receive a packet composed entirely of VLAN headers.
>
> This patch adds a recursion counter to the GRO layer to prevent stack
> overflow. When a gro_receive function hits the recursion limit, GRO is
> aborted for this skb and it is processed normally. This recursion
> counter is put in the GRO CB, but could be turned into a percpu counter
> if we run out of space in the CB.
>
> Thanks to Vladimír Beneš <vbenes@redhat.com> for the initial bug report.
>
> Fixes: CVE-2016-7039
> Fixes: 9b174d88c257 ("net: Add Transparent Ethernet Bridging GRO support.")
> Fixes: 66e5133f19e9 ("vlan: Add GRO support for non hardware accelerated vlan")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> Reviewed-by: Jiri Benc <jbenc@redhat.com>
> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> ---
> v2: add unlikely() annotations, suggested by Eric Dumazet
> benchmark didn't show a difference between CB and pcpu variable for
> the recursion counter, so I'm sticking with the CB
>
> drivers/net/geneve.c | 2 +-
> drivers/net/vxlan.c | 2 +-
> include/linux/netdevice.h | 24 +++++++++++++++++++++++-
> net/8021q/vlan.c | 2 +-
> net/core/dev.c | 1 +
> net/ethernet/eth.c | 2 +-
> net/ipv4/af_inet.c | 2 +-
> net/ipv4/fou.c | 4 ++--
> net/ipv4/gre_offload.c | 2 +-
> net/ipv4/udp_offload.c | 8 +++++++-
> net/ipv6/ip6_offload.c | 2 +-
> 11 files changed, 40 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
> index 3c20e87bb761..16af1ce99233 100644
> --- a/drivers/net/geneve.c
> +++ b/drivers/net/geneve.c
> @@ -453,7 +453,7 @@ static struct sk_buff **geneve_gro_receive(struct sock *sk,
>
> skb_gro_pull(skb, gh_len);
> skb_gro_postpull_rcsum(skb, gh, gh_len);
> - pp = ptype->callbacks.gro_receive(head, skb);
> + pp = call_gro_receive(ptype->callbacks.gro_receive, head, skb);
> flush = 0;
>
> out_unlock:
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index e7d16687538b..c1639a3e95a4 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -583,7 +583,7 @@ static struct sk_buff **vxlan_gro_receive(struct sock *sk,
> }
> }
>
> - pp = eth_gro_receive(head, skb);
> + pp = call_gro_receive(eth_gro_receive, head, skb);
> flush = 0;
>
> out:
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 465e128699a1..6db3cb56daab 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -2169,7 +2169,10 @@ struct napi_gro_cb {
> /* Used to determine if flush_id can be ignored */
> u8 is_atomic:1;
>
> - /* 5 bit hole */
> + /* Number of gro_receive callbacks this packet already went through */
> + u8 recursion_counter:4;
> +
> + /* 1 bit hole */
>
> /* used to support CHECKSUM_COMPLETE for tunneling protocols */
> __wsum csum;
> @@ -2180,6 +2183,25 @@ struct napi_gro_cb {
>
> #define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
>
> +#define GRO_RECURSION_LIMIT 15
> +static inline int gro_recursion_inc_test(struct sk_buff *skb)
> +{
> + return ++NAPI_GRO_CB(skb)->recursion_counter == GRO_RECURSION_LIMIT;
> +}
> +
> +typedef struct sk_buff **(*gro_receive_t)(struct sk_buff **, struct sk_buff *);
> +static inline struct sk_buff **call_gro_receive(gro_receive_t cb,
> + struct sk_buff **head,
> + struct sk_buff *skb)
> +{
> + if (unlikely(gro_recursion_inc_test(skb))) {
> + NAPI_GRO_CB(skb)->flush |= 1;
> + return NULL;
> + }
> +
> + return cb(head, skb);
> +}
> +
> struct packet_type {
> __be16 type; /* This is really htons(ether_type). */
> struct net_device *dev; /* NULL is wildcarded here */
> diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
> index 8de138d3306b..f2531ad66b68 100644
> --- a/net/8021q/vlan.c
> +++ b/net/8021q/vlan.c
> @@ -664,7 +664,7 @@ static struct sk_buff **vlan_gro_receive(struct sk_buff **head,
>
> skb_gro_pull(skb, sizeof(*vhdr));
> skb_gro_postpull_rcsum(skb, vhdr, sizeof(*vhdr));
> - pp = ptype->callbacks.gro_receive(head, skb);
> + pp = call_gro_receive(ptype->callbacks.gro_receive, head, skb);
>
> out_unlock:
> rcu_read_unlock();
> diff --git a/net/core/dev.c b/net/core/dev.c
> index b09ac57f4348..dbc871306910 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4511,6 +4511,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
> NAPI_GRO_CB(skb)->flush = 0;
> NAPI_GRO_CB(skb)->free = 0;
> NAPI_GRO_CB(skb)->encap_mark = 0;
> + NAPI_GRO_CB(skb)->recursion_counter = 0;
> NAPI_GRO_CB(skb)->is_fou = 0;
> NAPI_GRO_CB(skb)->is_atomic = 1;
> NAPI_GRO_CB(skb)->gro_remcsum_start = 0;
> diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
> index 66dff5e3d772..02acfff36028 100644
> --- a/net/ethernet/eth.c
> +++ b/net/ethernet/eth.c
> @@ -439,7 +439,7 @@ struct sk_buff **eth_gro_receive(struct sk_buff **head,
>
> skb_gro_pull(skb, sizeof(*eh));
> skb_gro_postpull_rcsum(skb, eh, sizeof(*eh));
> - pp = ptype->callbacks.gro_receive(head, skb);
> + pp = call_gro_receive(ptype->callbacks.gro_receive, head, skb);
>
> out_unlock:
> rcu_read_unlock();
> diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
> index 1effc986739e..9648c97e541f 100644
> --- a/net/ipv4/af_inet.c
> +++ b/net/ipv4/af_inet.c
> @@ -1391,7 +1391,7 @@ struct sk_buff **inet_gro_receive(struct sk_buff **head, struct sk_buff *skb)
> skb_gro_pull(skb, sizeof(*iph));
> skb_set_transport_header(skb, skb_gro_offset(skb));
>
> - pp = ops->callbacks.gro_receive(head, skb);
> + pp = call_gro_receive(ops->callbacks.gro_receive, head, skb);
>
> out_unlock:
> rcu_read_unlock();
> diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
> index cf50f7e2b012..030d1531e897 100644
> --- a/net/ipv4/fou.c
> +++ b/net/ipv4/fou.c
> @@ -249,7 +249,7 @@ static struct sk_buff **fou_gro_receive(struct sock *sk,
> if (!ops || !ops->callbacks.gro_receive)
> goto out_unlock;
>
> - pp = ops->callbacks.gro_receive(head, skb);
> + pp = call_gro_receive(ops->callbacks.gro_receive, head, skb);
>
> out_unlock:
> rcu_read_unlock();
> @@ -441,7 +441,7 @@ static struct sk_buff **gue_gro_receive(struct sock *sk,
> if (WARN_ON_ONCE(!ops || !ops->callbacks.gro_receive))
> goto out_unlock;
>
> - pp = ops->callbacks.gro_receive(head, skb);
> + pp = call_gro_receive(ops->callbacks.gro_receive, head, skb);
> flush = 0;
>
> out_unlock:
> diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
> index 96e0efecefa6..d5cac99170b1 100644
> --- a/net/ipv4/gre_offload.c
> +++ b/net/ipv4/gre_offload.c
> @@ -229,7 +229,7 @@ static struct sk_buff **gre_gro_receive(struct sk_buff **head,
> /* Adjusted NAPI_GRO_CB(skb)->csum after skb_gro_pull()*/
> skb_gro_postpull_rcsum(skb, greh, grehlen);
>
> - pp = ptype->callbacks.gro_receive(head, skb);
> + pp = call_gro_receive(ptype->callbacks.gro_receive, head, skb);
> flush = 0;
>
> out_unlock:
> diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
> index f9333c963607..cbde0bc37c02 100644
> --- a/net/ipv4/udp_offload.c
> +++ b/net/ipv4/udp_offload.c
> @@ -295,7 +295,13 @@ struct sk_buff **udp_gro_receive(struct sk_buff **head, struct sk_buff *skb,
>
> skb_gro_pull(skb, sizeof(struct udphdr)); /* pull encapsulating udp header */
> skb_gro_postpull_rcsum(skb, uh, sizeof(struct udphdr));
> - pp = udp_sk(sk)->gro_receive(sk, head, skb);
> +
> + if (unlikely(gro_recursion_inc_test(skb))) {
> + flush = 1;
> + pp = NULL;
> + } else {
> + pp = udp_sk(sk)->gro_receive(sk, head, skb);
> + }
To be symmetric, I would add call_gro_receive_sk that is
call_gro_receive but with the sock argument. That way if DCCP or some
other socket type implements GRO they can call that. It's also a nice
propery if modules only call gro_receive though call_gro_receive*
functions.
Looks great otherwise!
Tom
>
> out_unlock:
> rcu_read_unlock();
> diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
> index e7bfd55899a3..1fcf61f1cbc3 100644
> --- a/net/ipv6/ip6_offload.c
> +++ b/net/ipv6/ip6_offload.c
> @@ -246,7 +246,7 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
>
> skb_gro_postpull_rcsum(skb, iph, nlen);
>
> - pp = ops->callbacks.gro_receive(head, skb);
> + pp = call_gro_receive(ops->callbacks.gro_receive, head, skb);
>
> out_unlock:
> rcu_read_unlock();
> --
> 2.10.0
>
^ permalink raw reply
* Re: [PATCH net-next 0/6] net: use core MTU range checking everywhere
From: David Miller @ 2016-10-19 19:10 UTC (permalink / raw)
To: jarod; +Cc: linux-kernel, netdev
In-Reply-To: <20161019023333.15760-1-jarod@redhat.com>
From: Jarod Wilson <jarod@redhat.com>
Date: Tue, 18 Oct 2016 22:33:27 -0400
> This stack of patches should get absolutely everything in the kernel
> converted from doing their own MTU range checking to the core MTU range
> checking.
I'm expecting a respin of this series.
^ permalink raw reply
* Re: [PATCH (net.git)] stmmac: fix and review the ptp registration.
From: David Miller @ 2016-10-19 19:10 UTC (permalink / raw)
To: peppe.cavallaro
Cc: netdev, linux-kernel, alexandre.torgue, rayagond, dan.carpenter,
nico
In-Reply-To: <1476860801-28242-1-git-send-email-peppe.cavallaro@st.com>
From: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Date: Wed, 19 Oct 2016 09:06:41 +0200
> The commit commit 7086605a6ab5 ("stmmac: fix error check when init ptp")
> breaks the procedure added by the
> commit efee95f42b5d ("ptp_clock: future-proofing drivers against PTP
> subsystem becoming optional")
>
> So this patch tries to re-import the logic added by the latest
> commit above: it makes sense to have the stmmac_ptp_register
> as void function and, inside the main, the stmmac_init_ptp can fails
> in case of the capability cannot be supported by the HW.
>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next v2 0/2] openvswitch: remove unused code
From: David Miller @ 2016-10-19 19:12 UTC (permalink / raw)
To: jbenc-H+wXaHxf7aLQT0dZR+AlfA
Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <cover.1476869133.git.jbenc-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
From: Jiri Benc <jbenc@redhat.com>
Date: Wed, 19 Oct 2016 11:26:35 +0200
> Removed unused functions and unnecessary EXPORT_SYMBOLs from openvswitch.
Series applied, thanks.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
^ permalink raw reply
* Re: [PATCH -next] net: arc_emac: use dev_kfree_skb_any instead of dev_kfree_skb
From: David Miller @ 2016-10-19 19:16 UTC (permalink / raw)
To: weiyj.lk; +Cc: wxt, al.kochet, tremyfr, peter.chen, weiyongjun1, netdev
In-Reply-To: <1476884872-15213-1-git-send-email-weiyj.lk@gmail.com>
From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Wed, 19 Oct 2016 13:47:52 +0000
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> Replace dev_kfree_skb with dev_kfree_skb_any in arc_emac_tx()
> which can be called from hard irq context (netpoll) and from
> other contexts. arc_emac_tx() only frees skbs that it has
> dropped.
>
> This is detected by Coccinelle semantic patch.
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Applied.
^ permalink raw reply
* Re: [PATCH 0/2] Add ethtool get_ringparam and set_ringparam to cadence
From: David Miller @ 2016-10-19 19:18 UTC (permalink / raw)
To: zach.brown; +Cc: nicolas.ferre, linux-kernel, netdev
In-Reply-To: <1476889018-8357-1-git-send-email-zach.brown@ni.com>
From: Zach Brown <zach.brown@ni.com>
Date: Wed, 19 Oct 2016 09:56:56 -0500
> There are use cases like RT that would benefit from being able to tune the
> macb rx/tx ring sizes. The ethtool set_ringparam function is the standard way
> of doing so.
>
> The first patch changes the hardcoded tx/rx ring sizes to variables that are
> set to a hardcoded default.
>
> The second patch implements the get_ringparam and set_ringparam fucntions.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH net-next 0/6] net: use core MTU range checking everywhere
From: Jarod Wilson @ 2016-10-19 19:29 UTC (permalink / raw)
To: David Miller; +Cc: linux-kernel, netdev
In-Reply-To: <20161019.151005.240728702055002369.davem@davemloft.net>
On Wed, Oct 19, 2016 at 03:10:05PM -0400, David Miller wrote:
> From: Jarod Wilson <jarod@redhat.com>
> Date: Tue, 18 Oct 2016 22:33:27 -0400
>
> > This stack of patches should get absolutely everything in the kernel
> > converted from doing their own MTU range checking to the core MTU range
> > checking.
>
> I'm expecting a respin of this series.
Absolutely. Will address all review comments, and have some additional
patches to add to the series to hopefully have absolutely everything
functional, asap.
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply
* Re: [linux-next:master 1436/1582] drivers/net/ethernet/smsc/smc91x.c:2378:6: error: implicit declaration of function 'machine_is_assabet'
From: Robert Jarzmik @ 2016-10-19 19:58 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Arnd Bergmann
In-Reply-To: <201610200342.Wv4wShnU%fengguang.wu@intel.com>
Hi David,
Here is a little mess I created with my former serie :
> drivers/net/ethernet/smsc/smc91x.c: In function 'smc_drv_probe':
>>> drivers/net/ethernet/smsc/smc91x.c:2378:6: error: implicit declaration of function 'machine_is_assabet' [-Werror=implicit-function-declaration]
> if (machine_is_assabet() && machine_has_neponset())
> ^~~~~~~~~~~~~~~~~~
> cc1: some warnings being treated as errors
>
> vim +/machine_is_assabet +2378 drivers/net/ethernet/smsc/smc91x.c
The mess comes from the patch "net: smc91x: isolate u16 writes alignment
workaround", where I though I had removed all "machine_is_*()" calls, and I
didn't notice the machine_is_assabet() one.
The fix is to re-add the removed include in the wrong chunk in [1].
Now do you want :
- another apart patch to fix the faulty one
- a "fixup!" patch to fixup the commit in your next tree
- or anything else
As I didn't compile assabet, my testers have missed this one. Please tell me
which way suits you to repair this commit.
Cheers.
^ permalink raw reply
* Re: [Patch net-next 2/2] netns: avoid disabling irq for netns id
From: Cong Wang @ 2016-10-19 20:07 UTC (permalink / raw)
To: Elad Raz
Cc: Nicolas Dichtel, David Miller, Linux Netdev List, Jiri Pirko,
Ido Schimmel, Yotam Gigi
In-Reply-To: <CAA1AmC2KiuoDiuBmjFAS20UnzkfCCnvHYyXhm3MOrVBUty9EeQ@mail.gmail.com>
On Wed, Oct 19, 2016 at 8:21 AM, Elad Raz <e@eladraz.com> wrote:
> On Fri, Sep 2, 2016 at 11:12 AM, Nicolas Dichtel
> <nicolas.dichtel@6wind.com> wrote:
>> Le 02/09/2016 à 06:53, Cong Wang a écrit :
>>> We never read or change netns id in hardirq context,
>>> the only place we read netns id in softirq context
>>> is in vxlan_xmit(). So, it should be enough to just
>>> disable BH.
>>
>> Are you sure? Did you audit all part of the code?
>> peernet2id() is called from netlink core system (do_one_broadcast()). Are you
>> sure that no driver call this function from an hard irq context?
>>
>> I think that NETLINK_LISTEN_ALL_NSID is largely untested, so it will be hard to
>> detect a bug introduced in this feature.
>
> I'm seeing strange things on our systems on boot time when trying to
> mount autofs.
> I bisected and got this patch as the bad one.
> I can see that only when I'm using "debug" config file.
Yeah, I saw the same report from SELinux developers, I am working
on a fix.
Thanks.
^ permalink raw reply
* Re: [linux-next:master 1436/1582] drivers/net/ethernet/smsc/smc91x.c:2378:6: error: implicit declaration of function 'machine_is_assabet'
From: David Miller @ 2016-10-19 20:12 UTC (permalink / raw)
To: robert.jarzmik; +Cc: netdev, arnd
In-Reply-To: <87funs3ycx.fsf@belgarion.home>
From: Robert Jarzmik <robert.jarzmik@free.fr>
Date: Wed, 19 Oct 2016 21:58:06 +0200
> Hi David,
>
> Here is a little mess I created with my former serie :
>> drivers/net/ethernet/smsc/smc91x.c: In function 'smc_drv_probe':
>>>> drivers/net/ethernet/smsc/smc91x.c:2378:6: error: implicit declaration of function 'machine_is_assabet' [-Werror=implicit-function-declaration]
>> if (machine_is_assabet() && machine_has_neponset())
>> ^~~~~~~~~~~~~~~~~~
>> cc1: some warnings being treated as errors
>>
>> vim +/machine_is_assabet +2378 drivers/net/ethernet/smsc/smc91x.c
>
> The mess comes from the patch "net: smc91x: isolate u16 writes alignment
> workaround", where I though I had removed all "machine_is_*()" calls, and I
> didn't notice the machine_is_assabet() one.
>
> The fix is to re-add the removed include in the wrong chunk in [1].
>
> Now do you want :
> - another apart patch to fix the faulty one
> - a "fixup!" patch to fixup the commit in your next tree
> - or anything else
Please send me a fixup follow-on patch.
If changes are in my tree, they are part of the permanent record
and won't be rebased out.
^ permalink raw reply
* Re: [linux-next:master 1436/1582] drivers/net/ethernet/smsc/smc91x.c:2378:6: error: implicit declaration of function 'machine_is_assabet'
From: Robert Jarzmik @ 2016-10-19 20:17 UTC (permalink / raw)
To: David Miller; +Cc: netdev, arnd
In-Reply-To: <20161019.161206.1749616830232202176.davem@davemloft.net>
David Miller <davem@davemloft.net> writes:
> Please send me a fixup follow-on patch.
>
> If changes are in my tree, they are part of the permanent record
> and won't be rebased out.
Ok, understood, I'm on it.
Thanks.
--
Robert
^ permalink raw reply
* RE: [patch net-next RFC 4/6] Introduce sample tc action
From: Yotam Gigi @ 2016-10-19 8:28 UTC (permalink / raw)
To: Roopa Prabhu
Cc: Jamal Hadi Salim, Jiri Pirko, netdev@vger.kernel.org,
davem@davemloft.net, Ido Schimmel, Elad Raz, Nogah Frankel,
Or Gerlitz, geert+renesas@glider.be, stephen@networkplumber.org,
xiyou.wangcong@gmail.com, linux@roeck-us.net, Shrijeet Mukherjee,
Yotam Gigi
In-Reply-To: <580721BF.4010303@cumulusnetworks.com>
>-----Original Message-----
>From: Roopa Prabhu [mailto:roopa@cumulusnetworks.com]
>Sent: Wednesday, October 19, 2016 10:33 AM
>To: Yotam Gigi <yotamg@mellanox.com>
>Cc: Jamal Hadi Salim <jhs@mojatatu.com>; Jiri Pirko <jiri@resnulli.us>;
>netdev@vger.kernel.org; davem@davemloft.net; Ido Schimmel
><idosch@mellanox.com>; Elad Raz <eladr@mellanox.com>; Nogah Frankel
><nogahf@mellanox.com>; Or Gerlitz <ogerlitz@mellanox.com>;
>geert+renesas@glider.be; stephen@networkplumber.org;
>xiyou.wangcong@gmail.com; linux@roeck-us.net; Shrijeet Mukherjee
><shm@cumulusnetworks.com>; Yotam Gigi <yotam.gi@gmail.com>
>Subject: Re: [patch net-next RFC 4/6] Introduce sample tc action
>
>On 10/18/16, 3:58 AM, Yotam Gigi wrote:
>
>> On 16-10-15 12:34 PM, Roopa Prabhu wrote:
>[snip]
>
>>> The OVS implementation is a good example, the metadata includes all the
>>> actions applied
>>>>> to the packet in the kernel data path.
>>>>>
>>>> Again not sure what the use case would be (and why waste such space
>>>> especially when you are sending over the wire with such details).
>>> All this is being used currently.., But, this can be other api's sflow uses
>>> for monitoring.
>>> http://openvswitch.org/support/ovscon2014/17/1400-ovs-sflow.pdf
>>>
>>> Does not have to be part of the main/basic sampling api...
>>> it was just an example.
>>>
>> I guess that making the API extensible solves this, isn't it?
>
>yes, that might help...
>
>Just wanted to bring up the question/clarification on using mark again
>
>tc qdisc add dev eth1 handle ffff: ingress
>
>tc filter add dev eth1 parent ffff: \
> matchall action sample rate 12 mark 17
>
>tc filter add parent ffff: dev eth1 protocol all \
> u32 match mark 172 0xff
> action mirred egress redirect dev dummy0
>
>Like we discussed @ netdev, mark can be used by other things in the system.
>A request to sample on an interface cannot be disruptive.
>Does this require mark to be not used elsewhere in the system when sampling is
>enabled on an interface ?
I think the we can spare the usage of mark, or at least make it optional, as the user
can match on the packets according to the eth_type (as part of the IFE, the user
can set the sampled packet eth_type).
I will do that, and update the documentation as well.
^ permalink raw reply
* [PATCH net] ila: Fix tailroom allocation of lwtstate
From: Thomas Graf @ 2016-10-19 21:16 UTC (permalink / raw)
To: davem, tom; +Cc: netdev
Tailroom is supposed to be of length sizeof(struct ila_lwt) but
sizeof(struct ila_params) is currently allocated.
This leads to the dst_cache and connected member of ila_lwt being
referenced out of bounds.
struct ila_lwt {
struct ila_params p;
struct dst_cache dst_cache;
u32 connected : 1;
};
Fixes: 65d7ab8de582 ("net: Identifier Locator Addressing module")
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
---
-stable candidate
net/ipv6/ila/ila_lwt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c
index 9fafba6..c7a39d0 100644
--- a/net/ipv6/ila/ila_lwt.c
+++ b/net/ipv6/ila/ila_lwt.c
@@ -122,7 +122,7 @@ static int ila_build_state(struct net_device *dev, struct nlattr *nla,
struct ila_lwt *ilwt;
struct ila_params *p;
struct nlattr *tb[ILA_ATTR_MAX + 1];
- size_t encap_len = sizeof(*p);
+ size_t encap_len = sizeof(*ilwt);
struct lwtunnel_state *newts;
const struct fib6_config *cfg6 = cfg;
struct ila_addr *iaddr;
--
2.7.4
^ permalink raw reply related
* [PATCH] net: smc91x: fix neponset breakage by pxa u16 writes
From: Robert Jarzmik @ 2016-10-19 21:23 UTC (permalink / raw)
To: Nicolas Pitre, David S. Miller; +Cc: netdev, linux-kernel, Robert Jarzmik
The patch isolating the u16 writes for pxa assumed all machine_is_*()
calls were removed, and therefore removed the mach-types.h include which
provided them.
Unfortunately 2 machine_is_*() remained in smc91x.c file including
smc91x.h from which the include was removed, triggering the error:
drivers/net/ethernet/smsc/smc91x.c: In function ‘smc_drv_probe’:
drivers/net/ethernet/smsc/smc91x.c:2380:2: error: implicit declaration
of function ‘machine_is_assabet’
[-Werror=implicit-function-declaration]
if (machine_is_assabet() && machine_has_neponset())
This adds back the wrongly removed include.
Fixes: d09d747ae4c2 ("net: smc91x: isolate u16 writes alignment workaround")
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
drivers/net/ethernet/smsc/smc91x.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h
index 45e6b81a6a92..08b17adf0a65 100644
--- a/drivers/net/ethernet/smsc/smc91x.h
+++ b/drivers/net/ethernet/smsc/smc91x.h
@@ -63,6 +63,8 @@
#if defined(CONFIG_ARM)
+#include <asm/mach-types.h>
+
/* Now the bus width is specified in the platform data
* pretend here to support all I/O access types
*/
--
2.1.4
^ permalink raw reply related
* [RFC net 0/3] net: bridge: fast ageing on topology change
From: Vivien Didelot @ 2016-10-19 21:38 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, kernel, David S. Miller, Stephen Hemminger,
Florian Fainelli, Andrew Lunn, Ido Schimmel, Jiri Pirko,
Nikolay Aleksandrov, cphealy, bridge, Vivien Didelot
802.1D [1] specifies that the bridges in a network must use a short
value to age out dynamic entries in the Filtering Database for a period,
once a topology change has been communicated by the root bridge.
This patchset fixes this for the in-kernel STP implementation.
Once the topology change flag is set in a net_bridge instance, the
ageing time value is shorten to twice the forward delay used by the
topology.
When the topology change flag is cleared, the ageing time configured for
the bridge is restored.
To accomplish that, a new bridge_ageing_time member is added to the
net_bridge structure, to store the user configured bridge ageing time.
Two helpers are added to offload the ageing time and set the topology
change flag in the net_bridge instance. Then the required logic is added
in the topology change helper if in-kernel STP is used.
This has been tested on the following topology:
+--------------+
| root bridge |
| 1 2 3 4 |
+--+--+--+--+--+
| | | | +--------+
| | | +------| laptop |
| | | +--------+
+--+--+--+-----+
| 1 2 3 |
| slave bridge |
+--------------+
When unplugging/replugging the laptop, the slave bridge (under test)
gets the topology change flag sent by the root bridge, and fast ageing
is triggered on the bridges. Once the topology change timer of the root
bridge expires, the topology change flag is cleared and the configured
ageing time is restored on the bridges.
A similar test has been done between two bridges under test.
When changing the forward delay of the root bridge with:
# echo 3000 > /sys/class/net/br0/bridge/forward_delay
the ageing time correctly changes on both bridges from 300s to 60s while
the TOPOLOGY_CHANGE flag is present.
[1] "8.3.5 Notifying topology changes",
http://profesores.elo.utfsm.cl/~agv/elo309/doc/802.1D-1998.pdf
[ Feedbacks are needed, especially for the usage of the bridge lock and
the defered ageing time attribute. It works fine so far but might raise
concerns. ]
Vivien Didelot (3):
net: bridge: add helper to offload ageing time
net: bridge: add helper to set topology change
net: dsa: shorten ageing time on topology change
net/bridge/br_device.c | 2 +-
net/bridge/br_private.h | 4 ++-
net/bridge/br_private_stp.h | 1 +
net/bridge/br_stp.c | 65 ++++++++++++++++++++++++++++++++++++++-------
net/bridge/br_stp_if.c | 14 +++-------
net/bridge/br_stp_timer.c | 2 +-
6 files changed, 65 insertions(+), 23 deletions(-)
--
2.10.0
^ permalink raw reply
* [RFC net 1/3] net: bridge: add helper to offload ageing time
From: Vivien Didelot @ 2016-10-19 21:38 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, kernel, David S. Miller, Stephen Hemminger,
Florian Fainelli, Andrew Lunn, Ido Schimmel, Jiri Pirko,
Nikolay Aleksandrov, cphealy, bridge, Vivien Didelot
In-Reply-To: <20161019213803.22837-1-vivien.didelot@savoirfairelinux.com>
The SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME switchdev attr is actually set
when initializing a bridge port, and when configuring the bridge ageing
time from ioctl/netlink/sysfs.
Add a __set_ageing_time helper to offload the ageing time to physical
switches, and add the SWITCHDEV_F_DEFER flag since it can be called
under bridge lock.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
net/bridge/br_private.h | 1 +
net/bridge/br_stp.c | 28 ++++++++++++++++++++--------
net/bridge/br_stp_if.c | 12 +++---------
3 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 1b63177..3c294b4 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -992,6 +992,7 @@ void __br_set_forward_delay(struct net_bridge *br, unsigned long t);
int br_set_forward_delay(struct net_bridge *br, unsigned long x);
int br_set_hello_time(struct net_bridge *br, unsigned long x);
int br_set_max_age(struct net_bridge *br, unsigned long x);
+int __set_ageing_time(struct net_device *dev, unsigned long t);
int br_set_ageing_time(struct net_bridge *br, clock_t ageing_time);
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index 9258b8e..6ebe2a0 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -562,6 +562,24 @@ int br_set_max_age(struct net_bridge *br, unsigned long val)
}
+/* called under bridge lock */
+int __set_ageing_time(struct net_device *dev, unsigned long t)
+{
+ struct switchdev_attr attr = {
+ .orig_dev = dev,
+ .id = SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
+ .flags = SWITCHDEV_F_SKIP_EOPNOTSUPP | SWITCHDEV_F_DEFER,
+ .u.ageing_time = jiffies_to_clock_t(t),
+ };
+ int err;
+
+ err = switchdev_port_attr_set(dev, &attr);
+ if (err && err != -EOPNOTSUPP)
+ return err;
+
+ return 0;
+}
+
/* Set time interval that dynamic forwarding entries live
* For pure software bridge, allow values outside the 802.1
* standard specification for special cases:
@@ -572,17 +590,11 @@ int br_set_max_age(struct net_bridge *br, unsigned long val)
*/
int br_set_ageing_time(struct net_bridge *br, clock_t ageing_time)
{
- struct switchdev_attr attr = {
- .orig_dev = br->dev,
- .id = SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
- .flags = SWITCHDEV_F_SKIP_EOPNOTSUPP,
- .u.ageing_time = ageing_time,
- };
unsigned long t = clock_t_to_jiffies(ageing_time);
int err;
- err = switchdev_port_attr_set(br->dev, &attr);
- if (err && err != -EOPNOTSUPP)
+ err = __set_ageing_time(br->dev, t);
+ if (err)
return err;
br->ageing_time = t;
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index d8ad73b..2efbba5 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -36,12 +36,6 @@ static inline port_id br_make_port_id(__u8 priority, __u16 port_no)
/* called under bridge lock */
void br_init_port(struct net_bridge_port *p)
{
- struct switchdev_attr attr = {
- .orig_dev = p->dev,
- .id = SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
- .flags = SWITCHDEV_F_SKIP_EOPNOTSUPP | SWITCHDEV_F_DEFER,
- .u.ageing_time = jiffies_to_clock_t(p->br->ageing_time),
- };
int err;
p->port_id = br_make_port_id(p->priority, p->port_no);
@@ -50,9 +44,9 @@ void br_init_port(struct net_bridge_port *p)
p->topology_change_ack = 0;
p->config_pending = 0;
- err = switchdev_port_attr_set(p->dev, &attr);
- if (err && err != -EOPNOTSUPP)
- netdev_err(p->dev, "failed to set HW ageing time\n");
+ err = __set_ageing_time(p->dev, p->br->ageing_time);
+ if (err)
+ netdev_err(p->dev, "failed to offload ageing time\n");
}
/* NO locks held */
--
2.10.0
^ permalink raw reply related
* [RFC net 3/3] net: dsa: shorten ageing time on topology change
From: Vivien Didelot @ 2016-10-19 21:38 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, kernel, David S. Miller, Stephen Hemminger,
Florian Fainelli, Andrew Lunn, Ido Schimmel, Jiri Pirko,
Nikolay Aleksandrov, cphealy, bridge, Vivien Didelot
In-Reply-To: <20161019213803.22837-1-vivien.didelot@savoirfairelinux.com>
802.1D [1] specifies that the bridges must use a short value to age out
dynamic entries in the Filtering Database for a period, once a topology
change has been communicated by the root bridge.
Add a bridge_ageing_time member in the net_bridge structure to store the
bridge ageing time value configured by the user (ioctl/netlink/sysfs).
If we are using in-kernel STP, shorten the ageing time value to twice
the forward delay used by the topology when the topology change flag is
set. When the flag is cleared, restore the configured ageing time.
[1] "8.3.5 Notifying topology changes ",
http://profesores.elo.utfsm.cl/~agv/elo309/doc/802.1D-1998.pdf
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
net/bridge/br_device.c | 2 +-
net/bridge/br_private.h | 3 ++-
net/bridge/br_stp.c | 27 +++++++++++++++++++++++++++
3 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 89a687f..207318a 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -409,7 +409,7 @@ void br_dev_setup(struct net_device *dev)
br->bridge_max_age = br->max_age = 20 * HZ;
br->bridge_hello_time = br->hello_time = 2 * HZ;
br->bridge_forward_delay = br->forward_delay = 15 * HZ;
- br->ageing_time = BR_DEFAULT_AGEING_TIME;
+ br->bridge_ageing_time = br->ageing_time = BR_DEFAULT_AGEING_TIME;
br_netfilter_rtable_init(br);
br_stp_timer_init(br);
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 3c294b4..43efeb9 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -300,10 +300,11 @@ struct net_bridge
unsigned long max_age;
unsigned long hello_time;
unsigned long forward_delay;
- unsigned long bridge_max_age;
unsigned long ageing_time;
+ unsigned long bridge_max_age;
unsigned long bridge_hello_time;
unsigned long bridge_forward_delay;
+ unsigned long bridge_ageing_time;
u8 group_addr[ETH_ALEN];
bool group_addr_set;
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index 8d7b4c7..71fd1a4 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -597,7 +597,11 @@ int br_set_ageing_time(struct net_bridge *br, clock_t ageing_time)
if (err)
return err;
+ spin_lock_bh(&br->lock);
+ br->bridge_ageing_time = t;
br->ageing_time = t;
+ spin_unlock_bh(&br->lock);
+
mod_timer(&br->gc_timer, jiffies);
return 0;
@@ -606,6 +610,29 @@ int br_set_ageing_time(struct net_bridge *br, clock_t ageing_time)
/* called under bridge lock */
void __br_set_topology_change(struct net_bridge *br, unsigned char val)
{
+ unsigned long t;
+ int err;
+
+ if (br->stp_enabled == BR_KERNEL_STP && br->topology_change != val) {
+ /* On topology change, set the bridge ageing time to twice the
+ * forward delay. Otherwise, restore its default ageing time.
+ */
+
+ if (val) {
+ t = 2 * br->forward_delay;
+ br_debug(br, "decreasing ageing time to %lu\n", t);
+ } else {
+ t = br->bridge_ageing_time;
+ br_debug(br, "restoring ageing time to %lu\n", t);
+ }
+
+ err = __set_ageing_time(br->dev, t);
+ if (err)
+ br_warn(br, "error offloading ageing time\n");
+ else
+ br->ageing_time = t;
+ }
+
br->topology_change = val;
}
--
2.10.0
^ permalink raw reply related
* [RFC net 2/3] net: bridge: add helper to set topology change
From: Vivien Didelot @ 2016-10-19 21:38 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, kernel, David S. Miller, Stephen Hemminger,
Florian Fainelli, Andrew Lunn, Ido Schimmel, Jiri Pirko,
Nikolay Aleksandrov, cphealy, bridge, Vivien Didelot
In-Reply-To: <20161019213803.22837-1-vivien.didelot@savoirfairelinux.com>
Add a __br_set_topology_change helper to set the topology change value.
This can be later extended to add actions when the topology change flag
is set or cleared.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
net/bridge/br_private_stp.h | 1 +
net/bridge/br_stp.c | 10 ++++++++--
net/bridge/br_stp_if.c | 2 +-
net/bridge/br_stp_timer.c | 2 +-
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/net/bridge/br_private_stp.h b/net/bridge/br_private_stp.h
index 2fe910c..3f7543a 100644
--- a/net/bridge/br_private_stp.h
+++ b/net/bridge/br_private_stp.h
@@ -61,6 +61,7 @@ void br_received_tcn_bpdu(struct net_bridge_port *p);
void br_transmit_config(struct net_bridge_port *p);
void br_transmit_tcn(struct net_bridge *br);
void br_topology_change_detection(struct net_bridge *br);
+void __br_set_topology_change(struct net_bridge *br, unsigned char val);
/* br_stp_bpdu.c */
void br_send_config_bpdu(struct net_bridge_port *, struct br_config_bpdu *);
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index 6ebe2a0..8d7b4c7 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -234,7 +234,7 @@ static void br_record_config_timeout_values(struct net_bridge *br,
br->max_age = bpdu->max_age;
br->hello_time = bpdu->hello_time;
br->forward_delay = bpdu->forward_delay;
- br->topology_change = bpdu->topology_change;
+ __br_set_topology_change(br, bpdu->topology_change);
}
/* called under bridge lock */
@@ -344,7 +344,7 @@ void br_topology_change_detection(struct net_bridge *br)
isroot ? "propagating" : "sending tcn bpdu");
if (isroot) {
- br->topology_change = 1;
+ __br_set_topology_change(br, 1);
mod_timer(&br->topology_change_timer, jiffies
+ br->bridge_forward_delay + br->bridge_max_age);
} else if (!br->topology_change_detected) {
@@ -603,6 +603,12 @@ int br_set_ageing_time(struct net_bridge *br, clock_t ageing_time)
return 0;
}
+/* called under bridge lock */
+void __br_set_topology_change(struct net_bridge *br, unsigned char val)
+{
+ br->topology_change = val;
+}
+
void __br_set_forward_delay(struct net_bridge *br, unsigned long t)
{
br->bridge_forward_delay = t;
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 2efbba5..6c1e214 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -81,7 +81,7 @@ void br_stp_disable_bridge(struct net_bridge *br)
}
- br->topology_change = 0;
+ __br_set_topology_change(br, 0);
br->topology_change_detected = 0;
spin_unlock_bh(&br->lock);
diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c
index da058b8..7ddb38e 100644
--- a/net/bridge/br_stp_timer.c
+++ b/net/bridge/br_stp_timer.c
@@ -125,7 +125,7 @@ static void br_topology_change_timer_expired(unsigned long arg)
br_debug(br, "topo change timer expired\n");
spin_lock(&br->lock);
br->topology_change_detected = 0;
- br->topology_change = 0;
+ __br_set_topology_change(br, 0);
spin_unlock(&br->lock);
}
--
2.10.0
^ permalink raw reply related
* Re: [PATCH net-next 5/6] net: use core MTU range checking in virt drivers
From: Shrikrishna Khare @ 2016-10-19 22:21 UTC (permalink / raw)
To: Jarod Wilson
Cc: linux-kernel, netdev, virtualization, K. Y. Srinivasan,
Haiyang Zhang, Michael S. Tsirkin, Shrikrishna Khare,
VMware, Inc.
In-Reply-To: <20161019023333.15760-6-jarod@redhat.com>
On Wed, 19 Oct 2016, Jarod Wilson wrote:
> hyperv_net:
> - set min/max_mtu
>
> virtio_net:
> - set min/max_mtu
> - remove virtnet_change_mtu
>
> vmxnet3:
> - set min/max_mtu
>
> CC: netdev@vger.kernel.org
> CC: virtualization@lists.linux-foundation.org
> CC: "K. Y. Srinivasan" <kys@microsoft.com>
> CC: Haiyang Zhang <haiyangz@microsoft.com>
> CC: "Michael S. Tsirkin" <mst@redhat.com>
> CC: Shrikrishna Khare <skhare@vmware.com>
> CC: "VMware, Inc." <pv-drivers@vmware.com>
> Signed-off-by: Jarod Wilson <jarod@redhat.com>
> ---
The vmxnet3 part of the change looks good to me.
Thanks,
Shri
^ permalink raw reply
* Re: [PATCH net-next 6/6] net: use core MTU range checking in misc drivers
From: Stefan Richter @ 2016-10-19 22:38 UTC (permalink / raw)
To: Sabrina Dubroca, Jarod Wilson
Cc: linux-kernel, netdev, Faisal Latif, linux-rdma, Cliff Whickman,
Robin Holt, Jes Sorensen, Marek Lindner, Simon Wunderlich,
Antonio Quartulli
In-Reply-To: <20161019160546.GC11224@bistromath.localdomain>
On Oct 19 Sabrina Dubroca wrote:
> 2016-10-18, 22:33:33 -0400, Jarod Wilson wrote:
> [...]
> > diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
> > index 309311b..b5f125c 100644
> > --- a/drivers/firewire/net.c
> > +++ b/drivers/firewire/net.c
> > @@ -1349,15 +1349,6 @@ static netdev_tx_t fwnet_tx(struct sk_buff *skb, struct net_device *net)
> > return NETDEV_TX_OK;
> > }
> >
> > -static int fwnet_change_mtu(struct net_device *net, int new_mtu)
> > -{
> > - if (new_mtu < 68)
> > - return -EINVAL;
> > -
> > - net->mtu = new_mtu;
> > - return 0;
> > -}
> > -
>
> This doesn't do any upper bound checking.
I need to check more closely, but I think the RFC 2734 encapsulation spec
and our implementation do not impose a particular upper limit. Though I
guess it's bad to let userland set arbitrarily large values here.
> > static const struct ethtool_ops fwnet_ethtool_ops = {
> > .get_link = ethtool_op_get_link,
> > };
> > @@ -1366,7 +1357,6 @@ static const struct net_device_ops fwnet_netdev_ops = {
> > .ndo_open = fwnet_open,
> > .ndo_stop = fwnet_stop,
> > .ndo_start_xmit = fwnet_tx,
> > - .ndo_change_mtu = fwnet_change_mtu,
> > };
> >
> > static void fwnet_init_dev(struct net_device *net)
> > @@ -1481,6 +1471,8 @@ static int fwnet_probe(struct fw_unit *unit,
> > max_mtu = (1 << (card->max_receive + 1))
> > - sizeof(struct rfc2734_header) - IEEE1394_GASP_HDR_SIZE;
> > net->mtu = min(1500U, max_mtu);
> > + net->min_mtu = ETH_MIN_MTU;
> > + net->max_mtu = net->mtu;
>
> But that will now prevent increasing the MTU above the initial value?
Indeed, therefore NAK.
PS:
If the IP packet plus encapsulation header fits into IEEE 1394 packet
payload, it is transported without link fragmentation. If it does not
fit, link fragmentation occurs (which reduces bandwidth a bit and
consumes additional buffering resources at the transmitter and the
receiver).
Broadcast and multicast packets are transmitted via IEEE 1394 asynchronous
stream packets at a low bus speed (because our code does not attempt to
find the maximum speed and size that is supported by all potential
listeners). This limits the payload to 512 bytes.
Unicast packets are transmitted via IEEE 1394 asynchronous write request
packets at optimum speed. In most cases, this means that 2048 bytes
payload is possible, in some cases 4096 bytes. Many CardBus FireWire
cards support only 1024 bytes payload of these packets though.
Furthermore, some low-speed long-haul cablings may cap the bus speed and
thereby the payload size to 1024 or 512 bytes, but this is uncommon in
practice.
--
Stefan Richter
-======----- =-=- =-=--
http://arcgraph.de/sr/
^ permalink raw reply
* Re: [RFC v3 06/22] landlock: Add LSM hooks
From: Mickaël Salaün @ 2016-10-19 22:42 UTC (permalink / raw)
To: Thomas Graf
Cc: linux-kernel, Alexei Starovoitov, Andy Lutomirski, Arnd Bergmann,
Casey Schaufler, Daniel Borkmann, Daniel Mack, David Drysdale,
David S . Miller, Elena Reshetova, Eric W . Biederman,
James Morris, Kees Cook, Paul Moore, Sargun Dhillon,
Serge E . Hallyn, Tejun Heo, Will Drewry, kernel-hardening,
linux-api, linux-security-module, netdev
In-Reply-To: <20161019151906.GC22003@pox.localdomain>
[-- Attachment #1.1: Type: text/plain, Size: 1505 bytes --]
On 19/10/2016 17:19, Thomas Graf wrote:
> On 09/14/16 at 09:23am, Mickaël Salaün wrote:
>> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
>> index 9aa01d9d3d80..36c3e482239c 100644
>> --- a/include/linux/bpf.h
>> +++ b/include/linux/bpf.h
>> @@ -85,6 +85,8 @@ enum bpf_arg_type {
>>
>> ARG_PTR_TO_CTX, /* pointer to context */
>> ARG_ANYTHING, /* any (initialized) argument is ok */
>> +
>> + ARG_PTR_TO_STRUCT_FILE, /* pointer to struct file */
>
> This should go into patch 7 I guess?
Right, the ARG_PTR_* are only used by BPF helpers.
>
>> +void __init landlock_add_hooks(void)
>> +{
>> + pr_info("landlock: Becoming ready for sandboxing\n");
>> + security_add_hooks(landlock_hooks, ARRAY_SIZE(landlock_hooks));
>> +}
>
> Can we add the hooks when we load the first BPF program for a hook? That
> would also allow to not make this conditional on a new config option
> which all all distros have to enable anyway.
We could either add hook by hook or all hooks at once when loading a BPF
program for which its subtype match the hook type, but I'm not sure it
is worth it.
I'd like to enable this LSM by default but we should be able to disable
it if needed, like most kernel features.
>
> I would really like to see this patch split into the LSM part which
> allows running BPF progs at LSM and your specific sandboxing use case
> which requires the new BPF helpers, new reg type, etc.
>
I'll try to split it as much as possible.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply
* Re: [RFC 1/6] qed: Add support for hardware offloaded iSCSI.
From: Arun Easi @ 2016-10-19 22:28 UTC (permalink / raw)
To: Hannes Reinecke
Cc: manish.rangankar, lduncan, cleech, martin.petersen, jejb,
linux-scsi, netdev, Yuval.Mintz, QLogic-Storage-Upstream,
Yuval Mintz
In-Reply-To: <263515de-e1d4-ea86-644b-3f214bcff5ac@suse.de>
Thanks Hannes for the review. Please see my comments inline..
On Wed, 19 Oct 2016, 12:31am, Hannes Reinecke wrote:
> On 10/19/2016 07:01 AM, manish.rangankar@cavium.com wrote:
> > From: Yuval Mintz <Yuval.Mintz@qlogic.com>
> >
> > This adds the backbone required for the various HW initalizations
> > which are necessary for the iSCSI driver (qedi) for QLogic FastLinQ
> > 4xxxx line of adapters - FW notification, resource initializations, etc.
> >
> > Signed-off-by: Arun Easi <arun.easi@cavium.com>
> > Signed-off-by: Yuval Mintz <yuval.mintz@cavium.com>
> > ---
> > drivers/net/ethernet/qlogic/Kconfig | 15 +
> > drivers/net/ethernet/qlogic/qed/Makefile | 1 +
> > drivers/net/ethernet/qlogic/qed/qed.h | 8 +-
> > drivers/net/ethernet/qlogic/qed/qed_dev.c | 15 +
> > drivers/net/ethernet/qlogic/qed/qed_int.h | 1 -
> > drivers/net/ethernet/qlogic/qed/qed_iscsi.c | 1310 ++++++++++++++++++++++++
> > drivers/net/ethernet/qlogic/qed/qed_iscsi.h | 52 +
> > drivers/net/ethernet/qlogic/qed/qed_l2.c | 1 -
> > drivers/net/ethernet/qlogic/qed/qed_ll2.c | 35 +-
> > drivers/net/ethernet/qlogic/qed/qed_main.c | 2 -
> > drivers/net/ethernet/qlogic/qed/qed_mcp.h | 6 -
> > drivers/net/ethernet/qlogic/qed/qed_reg_addr.h | 2 +
> > drivers/net/ethernet/qlogic/qed/qed_spq.c | 15 +
> > include/linux/qed/qed_if.h | 2 +
> > include/linux/qed/qed_iscsi_if.h | 249 +++++
> > 15 files changed, 1692 insertions(+), 22 deletions(-)
> > create mode 100644 drivers/net/ethernet/qlogic/qed/qed_iscsi.c
> > create mode 100644 drivers/net/ethernet/qlogic/qed/qed_iscsi.h
> > create mode 100644 include/linux/qed/qed_iscsi_if.h
> >
-- snipped --
> > diff --git a/drivers/net/ethernet/qlogic/qed/qed_iscsi.c b/drivers/net/ethernet/qlogic/qed/qed_iscsi.c
> > new file mode 100644
> > index 0000000..cb22dad
> > --- /dev/null
> > +++ b/drivers/net/ethernet/qlogic/qed/qed_iscsi.c
> > @@ -0,0 +1,1310 @@
> > +/* QLogic qed NIC Driver
>
> Shouldn't that be qedi iSCSI Driver?
Actually, this is the common module under drivers/net/, which was
submitted along with the NIC driver, qede, so the comment stayed.
In this driver architecture, for all protocols, there is this
common module, qed, as well as a protocol module (qede, qedr, qedi
etc.).
This comment needs to be changed in all files under qed/. We will submit
another patch to do that.
> > +static int qed_sp_iscsi_conn_offload(struct qed_hwfn *p_hwfn,
> > + struct qed_iscsi_conn *p_conn,
> > + enum spq_mode comp_mode,
> > + struct qed_spq_comp_cb *p_comp_addr)
> > +{
> > + struct iscsi_spe_conn_offload *p_ramrod = NULL;
> > + struct tcp_offload_params_opt2 *p_tcp2 = NULL;
> > + struct tcp_offload_params *p_tcp = NULL;
> > + struct qed_spq_entry *p_ent = NULL;
> > + struct qed_sp_init_data init_data;
> > + union qed_qm_pq_params pq_params;
> > + u16 pq0_id = 0, pq1_id = 0;
> > + dma_addr_t r2tq_pbl_addr;
> > + dma_addr_t xhq_pbl_addr;
> > + dma_addr_t uhq_pbl_addr;
> > + int rc = 0;
> > + u32 dval;
> > + u16 wval;
> > + u8 ucval;
> > + u8 i;
> > +
> > + /* Get SPQ entry */
> > + memset(&init_data, 0, sizeof(init_data));
> > + init_data.cid = p_conn->icid;
> > + init_data.opaque_fid = p_hwfn->hw_info.opaque_fid;
> > + init_data.comp_mode = comp_mode;
> > + init_data.p_comp_data = p_comp_addr;
> > +
> > + rc = qed_sp_init_request(p_hwfn, &p_ent,
> > + ISCSI_RAMROD_CMD_ID_OFFLOAD_CONN,
> > + PROTOCOLID_ISCSI, &init_data);
> > + if (rc)
> > + return rc;
> > +
> > + p_ramrod = &p_ent->ramrod.iscsi_conn_offload;
> > +
> > + /* Transmission PQ is the first of the PF */
> > + memset(&pq_params, 0, sizeof(pq_params));
> > + pq0_id = qed_get_qm_pq(p_hwfn, PROTOCOLID_ISCSI, &pq_params);
> > + p_conn->physical_q0 = cpu_to_le16(pq0_id);
> > + p_ramrod->iscsi.physical_q0 = cpu_to_le16(pq0_id);
> > +
> > + /* iSCSI Pure-ACK PQ */
> > + pq_params.iscsi.q_idx = 1;
> > + pq1_id = qed_get_qm_pq(p_hwfn, PROTOCOLID_ISCSI, &pq_params);
> > + p_conn->physical_q1 = cpu_to_le16(pq1_id);
> > + p_ramrod->iscsi.physical_q1 = cpu_to_le16(pq1_id);
> > +
> > + p_ramrod->hdr.op_code = ISCSI_RAMROD_CMD_ID_OFFLOAD_CONN;
> > + SET_FIELD(p_ramrod->hdr.flags, ISCSI_SLOW_PATH_HDR_LAYER_CODE,
> > + p_conn->layer_code);
> > +
> > + p_ramrod->conn_id = cpu_to_le16(p_conn->conn_id);
> > + p_ramrod->fw_cid = cpu_to_le32(p_conn->icid);
> > +
> > + DMA_REGPAIR_LE(p_ramrod->iscsi.sq_pbl_addr, p_conn->sq_pbl_addr);
> > +
> > + r2tq_pbl_addr = qed_chain_get_pbl_phys(&p_conn->r2tq);
> > + DMA_REGPAIR_LE(p_ramrod->iscsi.r2tq_pbl_addr, r2tq_pbl_addr);
> > +
> > + xhq_pbl_addr = qed_chain_get_pbl_phys(&p_conn->xhq);
> > + DMA_REGPAIR_LE(p_ramrod->iscsi.xhq_pbl_addr, xhq_pbl_addr);
> > +
> > + uhq_pbl_addr = qed_chain_get_pbl_phys(&p_conn->uhq);
> > + DMA_REGPAIR_LE(p_ramrod->iscsi.uhq_pbl_addr, uhq_pbl_addr);
> > +
> > + p_ramrod->iscsi.initial_ack = cpu_to_le32(p_conn->initial_ack);
> > + p_ramrod->iscsi.flags = p_conn->offl_flags;
> > + p_ramrod->iscsi.default_cq = p_conn->default_cq;
> > + p_ramrod->iscsi.stat_sn = cpu_to_le32(p_conn->stat_sn);
> > +
> > + if (!GET_FIELD(p_ramrod->iscsi.flags,
> > + ISCSI_CONN_OFFLOAD_PARAMS_TCP_ON_CHIP_1B)) {
> > + p_tcp = &p_ramrod->tcp;
> > + ucval = p_conn->local_mac[1];
> > + ((u8 *)(&p_tcp->local_mac_addr_hi))[0] = ucval;
> > + ucval = p_conn->local_mac[0];
> > + ((u8 *)(&p_tcp->local_mac_addr_hi))[1] = ucval;
> > + ucval = p_conn->local_mac[3];
> > + ((u8 *)(&p_tcp->local_mac_addr_mid))[0] = ucval;
> > + ucval = p_conn->local_mac[2];
> > + ((u8 *)(&p_tcp->local_mac_addr_mid))[1] = ucval;
> > + ucval = p_conn->local_mac[5];
> > + ((u8 *)(&p_tcp->local_mac_addr_lo))[0] = ucval;
> > + ucval = p_conn->local_mac[4];
> > + ((u8 *)(&p_tcp->local_mac_addr_lo))[1] = ucval;
> > + ucval = p_conn->remote_mac[1];
> > + ((u8 *)(&p_tcp->remote_mac_addr_hi))[0] = ucval;
> > + ucval = p_conn->remote_mac[0];
> > + ((u8 *)(&p_tcp->remote_mac_addr_hi))[1] = ucval;
> > + ucval = p_conn->remote_mac[3];
> > + ((u8 *)(&p_tcp->remote_mac_addr_mid))[0] = ucval;
> > + ucval = p_conn->remote_mac[2];
> > + ((u8 *)(&p_tcp->remote_mac_addr_mid))[1] = ucval;
> > + ucval = p_conn->remote_mac[5];
> > + ((u8 *)(&p_tcp->remote_mac_addr_lo))[0] = ucval;
> > + ucval = p_conn->remote_mac[4];
> > + ((u8 *)(&p_tcp->remote_mac_addr_lo))[1] = ucval;
> > +
> This looks terribly like endianness swapping. You sure this is
> applicable for all architecture and endianness settings?
> And wouldn't it be better to use one of the get_unaligned_XXX functions
> here?
The mac address in the p_tcp structure takes mac in the reverse order as
in p_conn. A for loop, or 3 swab16p for each copy would also do, will make
that change.
>
> > + p_tcp->vlan_id = cpu_to_le16(p_conn->vlan_id);
> > +
> > + p_tcp->flags = p_conn->tcp_flags;
> > + p_tcp->ip_version = p_conn->ip_version;
> > + for (i = 0; i < 4; i++) {
> > + dval = p_conn->remote_ip[i];
> > + p_tcp->remote_ip[i] = cpu_to_le32(dval);
> > + dval = p_conn->local_ip[i];
> > + p_tcp->local_ip[i] = cpu_to_le32(dval);
> > + }
> > + p_tcp->ka_max_probe_cnt = p_conn->ka_max_probe_cnt;
> > + p_tcp->dup_ack_theshold = p_conn->dup_ack_theshold;
> > +
> > + p_tcp->rcv_next = cpu_to_le32(p_conn->rcv_next);
> > + p_tcp->snd_una = cpu_to_le32(p_conn->snd_una);
> > + p_tcp->snd_next = cpu_to_le32(p_conn->snd_next);
> > + p_tcp->snd_max = cpu_to_le32(p_conn->snd_max);
> > + p_tcp->snd_wnd = cpu_to_le32(p_conn->snd_wnd);
> > + p_tcp->rcv_wnd = cpu_to_le32(p_conn->rcv_wnd);
> > + p_tcp->snd_wl1 = cpu_to_le32(p_conn->snd_wl1);
> > + p_tcp->cwnd = cpu_to_le32(p_conn->cwnd);
> > + p_tcp->ss_thresh = cpu_to_le32(p_conn->ss_thresh);
> > + p_tcp->srtt = cpu_to_le16(p_conn->srtt);
> > + p_tcp->rtt_var = cpu_to_le16(p_conn->rtt_var);
> > + p_tcp->ts_time = cpu_to_le32(p_conn->ts_time);
> > + p_tcp->ts_recent = cpu_to_le32(p_conn->ts_recent);
> > + p_tcp->ts_recent_age = cpu_to_le32(p_conn->ts_recent_age);
> > + p_tcp->total_rt = cpu_to_le32(p_conn->total_rt);
> > + dval = p_conn->ka_timeout_delta;
> > + p_tcp->ka_timeout_delta = cpu_to_le32(dval);
> > + dval = p_conn->rt_timeout_delta;
> > + p_tcp->rt_timeout_delta = cpu_to_le32(dval);
> > + p_tcp->dup_ack_cnt = p_conn->dup_ack_cnt;
> > + p_tcp->snd_wnd_probe_cnt = p_conn->snd_wnd_probe_cnt;
> > + p_tcp->ka_probe_cnt = p_conn->ka_probe_cnt;
> > + p_tcp->rt_cnt = p_conn->rt_cnt;
> > + p_tcp->flow_label = cpu_to_le32(p_conn->flow_label);
> > + p_tcp->ka_timeout = cpu_to_le32(p_conn->ka_timeout);
> > + p_tcp->ka_interval = cpu_to_le32(p_conn->ka_interval);
> > + p_tcp->max_rt_time = cpu_to_le32(p_conn->max_rt_time);
> > + dval = p_conn->initial_rcv_wnd;
> > + p_tcp->initial_rcv_wnd = cpu_to_le32(dval);
> > + p_tcp->ttl = p_conn->ttl;
> > + p_tcp->tos_or_tc = p_conn->tos_or_tc;
> > + p_tcp->remote_port = cpu_to_le16(p_conn->remote_port);
> > + p_tcp->local_port = cpu_to_le16(p_conn->local_port);
> > + p_tcp->mss = cpu_to_le16(p_conn->mss);
> > + p_tcp->snd_wnd_scale = p_conn->snd_wnd_scale;
> > + p_tcp->rcv_wnd_scale = p_conn->rcv_wnd_scale;
> > + dval = p_conn->ts_ticks_per_second;
> > + p_tcp->ts_ticks_per_second = cpu_to_le32(dval);
> > + wval = p_conn->da_timeout_value;
> > + p_tcp->da_timeout_value = cpu_to_le16(wval);
> > + p_tcp->ack_frequency = p_conn->ack_frequency;
> > + p_tcp->connect_mode = p_conn->connect_mode;
> > + } else {
> > + p_tcp2 =
> > + &((struct iscsi_spe_conn_offload_option2 *)p_ramrod)->tcp;
> > + ucval = p_conn->local_mac[1];
> > + ((u8 *)(&p_tcp2->local_mac_addr_hi))[0] = ucval;
> > + ucval = p_conn->local_mac[0];
> > + ((u8 *)(&p_tcp2->local_mac_addr_hi))[1] = ucval;
> > + ucval = p_conn->local_mac[3];
> > + ((u8 *)(&p_tcp2->local_mac_addr_mid))[0] = ucval;
> > + ucval = p_conn->local_mac[2];
> > + ((u8 *)(&p_tcp2->local_mac_addr_mid))[1] = ucval;
> > + ucval = p_conn->local_mac[5];
> > + ((u8 *)(&p_tcp2->local_mac_addr_lo))[0] = ucval;
> > + ucval = p_conn->local_mac[4];
> > + ((u8 *)(&p_tcp2->local_mac_addr_lo))[1] = ucval;
> > +
> > + ucval = p_conn->remote_mac[1];
> > + ((u8 *)(&p_tcp2->remote_mac_addr_hi))[0] = ucval;
> > + ucval = p_conn->remote_mac[0];
> > + ((u8 *)(&p_tcp2->remote_mac_addr_hi))[1] = ucval;
> > + ucval = p_conn->remote_mac[3];
> > + ((u8 *)(&p_tcp2->remote_mac_addr_mid))[0] = ucval;
> > + ucval = p_conn->remote_mac[2];
> > + ((u8 *)(&p_tcp2->remote_mac_addr_mid))[1] = ucval;
> > + ucval = p_conn->remote_mac[5];
> > + ((u8 *)(&p_tcp2->remote_mac_addr_lo))[0] = ucval;
> > + ucval = p_conn->remote_mac[4];
> > + ((u8 *)(&p_tcp2->remote_mac_addr_lo))[1] = ucval;
> > +
> Same here.
Noted.
>
> > + p_tcp2->vlan_id = cpu_to_le16(p_conn->vlan_id);
-- snip --
> > diff --git a/drivers/net/ethernet/qlogic/qed/qed_iscsi.h b/drivers/net/ethernet/qlogic/qed/qed_iscsi.h
> > new file mode 100644
> > index 0000000..269848c
> > --- /dev/null
> > +++ b/drivers/net/ethernet/qlogic/qed/qed_iscsi.h
> > @@ -0,0 +1,52 @@
> > +/* QLogic qed NIC Driver
> > + * Copyright (c) 2015 QLogic Corporation
> > + *
> > + * This software is available under the terms of the GNU General Public License
> > + * (GPL) Version 2, available from the file COPYING in the main directory of
> > + * this source tree.
> > + */
> > +
> > +#ifndef _QED_ISCSI_H
> > +#define _QED_ISCSI_H
> > +#include <linux/types.h>
> > +#include <linux/list.h>
> > +#include <linux/slab.h>
> > +#include <linux/spinlock.h>
> > +#include <linux/qed/tcp_common.h>
> > +#include <linux/qed/qed_iscsi_if.h>
> > +#include <linux/qed/qed_chain.h>
> > +#include "qed.h"
> > +#include "qed_hsi.h"
> > +#include "qed_mcp.h"
> > +#include "qed_sp.h"
> > +
> > +struct qed_iscsi_info {
> > + spinlock_t lock;
> > + struct list_head free_list;
> > + u16 max_num_outstanding_tasks;
> > + void *event_context;
> > + iscsi_event_cb_t event_cb;
> > +};
> > +
> > +#ifdef CONFIG_QED_LL2
> > +extern const struct qed_ll2_ops qed_ll2_ops_pass;
> > +#endif
> > +
> > +#if IS_ENABLED(CONFIG_QEDI)
> > +struct qed_iscsi_info *qed_iscsi_alloc(struct qed_hwfn *p_hwfn);
> > +
> > +void qed_iscsi_setup(struct qed_hwfn *p_hwfn,
> > + struct qed_iscsi_info *p_iscsi_info);
> > +
> > +void qed_iscsi_free(struct qed_hwfn *p_hwfn,
> > + struct qed_iscsi_info *p_iscsi_info);
> > +#else /* IS_ENABLED(CONFIG_QEDI) */
> > +static inline struct qed_iscsi_info *qed_iscsi_alloc(
> > + struct qed_hwfn *p_hwfn) { return NULL; }
> > +static inline void qed_iscsi_setup(struct qed_hwfn *p_hwfn,
> > + struct qed_iscsi_info *p_iscsi_info) {}
> > +static inline void qed_iscsi_free(struct qed_hwfn *p_hwfn,
> > + struct qed_iscsi_info *p_iscsi_info) {}
> > +#endif /* IS_ENABLED(CONFIG_QEDI) */
> > +
> > +#endif
> > diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c
> > index ddd410a..07e2f77 100644
> > --- a/drivers/net/ethernet/qlogic/qed/qed_l2.c
> > +++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c
> > @@ -2187,6 +2187,5 @@ const struct qed_eth_ops *qed_get_eth_ops(void)
> >
> > void qed_put_eth_ops(void)
> > {
> > - /* TODO - reference count for module? */
> > }
> > EXPORT_SYMBOL(qed_put_eth_ops);
> >
> > diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
> > index a6db107..e67f3c9 100644
> > --- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
> > +++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
> > @@ -299,6 +299,7 @@ static void qed_ll2_txq_flush(struct qed_hwfn *p_hwfn, u8 connection_handle)
> > p_tx->cur_completing_bd_idx = 1;
> > b_last_frag = p_tx->cur_completing_bd_idx == p_pkt->bd_used;
> > tx_frag = p_pkt->bds_set[0].tx_frag;
> > +#if IS_ENABLED(CONFIG_INFINIBAND_QEDR)
> > if (p_ll2_conn->gsi_enable)
> > qed_ll2b_release_tx_gsi_packet(p_hwfn,
> > p_ll2_conn->my_id,
> > @@ -307,6 +308,7 @@ static void qed_ll2_txq_flush(struct qed_hwfn *p_hwfn, u8 connection_handle)
> > b_last_frag,
> > b_last_packet);
> > else
> > +#endif
> > qed_ll2b_complete_tx_packet(p_hwfn,
> > p_ll2_conn->my_id,
> > p_pkt->cookie,
> Huh? What is that doing here?
>
This is the infiniband part of the common module. The "#if" was to
prevent a compile error when infiniband part was not used (like
for this, iSCSI).
BTW, there is another patch that was submitted by Yuval M. to fix
that, this RFC just came in between. We will be pulling in that
change for the next series.
> > @@ -367,6 +369,7 @@ static int qed_ll2_txq_completion(struct qed_hwfn *p_hwfn, void *p_cookie)
> >
> > spin_unlock_irqrestore(&p_tx->lock, flags);
> > tx_frag = p_pkt->bds_set[0].tx_frag;
> > +#if IS_ENABLED(CONFIG_INFINIBAND_QEDR)
> > if (p_ll2_conn->gsi_enable)
> > qed_ll2b_complete_tx_gsi_packet(p_hwfn,
> > p_ll2_conn->my_id,
> > @@ -374,6 +377,7 @@ static int qed_ll2_txq_completion(struct qed_hwfn *p_hwfn, void *p_cookie)
> > tx_frag,
> > b_last_frag, !num_bds);
> > else
> > +#endif
> > qed_ll2b_complete_tx_packet(p_hwfn,
> > p_ll2_conn->my_id,
> > p_pkt->cookie,
> > @@ -421,6 +425,7 @@ static int qed_ll2_txq_completion(struct qed_hwfn *p_hwfn, void *p_cookie)
> > "Mismatch between active_descq and the LL2 Rx chain\n");
> > list_add_tail(&p_pkt->list_entry, &p_rx->free_descq);
> >
> > +#if IS_ENABLED(CONFIG_INFINIBAND_QEDR)
> > spin_unlock_irqrestore(&p_rx->lock, lock_flags);
> > qed_ll2b_complete_rx_gsi_packet(p_hwfn,
> > p_ll2_info->my_id,
> > @@ -433,6 +438,7 @@ static int qed_ll2_txq_completion(struct qed_hwfn *p_hwfn, void *p_cookie)
> > src_mac_addrhi,
> > src_mac_addrlo, b_last_cqe);
> > spin_lock_irqsave(&p_rx->lock, lock_flags);
> > +#endif
> >
> > return 0;
> > }
> > @@ -1516,11 +1522,12 @@ static void qed_ll2_register_cb_ops(struct qed_dev *cdev,
> >
> > static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
> > {
> > - struct qed_ll2_info ll2_info;
> > + struct qed_ll2_info *ll2_info;
> > struct qed_ll2_buffer *buffer;
> > enum qed_ll2_conn_type conn_type;
> > struct qed_ptt *p_ptt;
> > int rc, i;
> > + u8 gsi_enable = 1;
> >
> > /* Initialize LL2 locks & lists */
> > INIT_LIST_HEAD(&cdev->ll2->list);
> > @@ -1552,6 +1559,7 @@ static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
> > switch (QED_LEADING_HWFN(cdev)->hw_info.personality) {
> > case QED_PCI_ISCSI:
> > conn_type = QED_LL2_TYPE_ISCSI;
> > + gsi_enable = 0;
> > break;
> > case QED_PCI_ETH_ROCE:
> > conn_type = QED_LL2_TYPE_ROCE;
> > @@ -1561,18 +1569,23 @@ static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
> > }
> >
> > /* Prepare the temporary ll2 information */
> > - memset(&ll2_info, 0, sizeof(ll2_info));
> > - ll2_info.conn_type = conn_type;
> > - ll2_info.mtu = params->mtu;
> > - ll2_info.rx_drop_ttl0_flg = params->drop_ttl0_packets;
> > - ll2_info.rx_vlan_removal_en = params->rx_vlan_stripping;
> > - ll2_info.tx_tc = 0;
> > - ll2_info.tx_dest = CORE_TX_DEST_NW;
> > - ll2_info.gsi_enable = 1;
> > -
> > - rc = qed_ll2_acquire_connection(QED_LEADING_HWFN(cdev), &ll2_info,
> > + ll2_info = kzalloc(sizeof(*ll2_info), GFP_KERNEL);
> > + if (!ll2_info) {
> > + DP_INFO(cdev, "Failed to allocate LL2 info buffer\n");
> > + goto fail;
> > + }
> > + ll2_info->conn_type = conn_type;
> > + ll2_info->mtu = params->mtu;
> > + ll2_info->rx_drop_ttl0_flg = params->drop_ttl0_packets;
> > + ll2_info->rx_vlan_removal_en = params->rx_vlan_stripping;
> > + ll2_info->tx_tc = 0;
> > + ll2_info->tx_dest = CORE_TX_DEST_NW;
> > + ll2_info->gsi_enable = gsi_enable;
> > +
> > + rc = qed_ll2_acquire_connection(QED_LEADING_HWFN(cdev), ll2_info,
> > QED_LL2_RX_SIZE, QED_LL2_TX_SIZE,
> > &cdev->ll2->handle);
> > + kfree(ll2_info);
> > if (rc) {
> > DP_INFO(cdev, "Failed to acquire LL2 connection\n");
> > goto fail;
> Where is the benefit of this hunk? And is it related to iSCSI?
This hunk was to prevent a large stack warning (was present with
gcc 4.8.3). This is a common function applicable to iSCSI as well.
>
> > diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c
> > index 4ee3151..a01ad9d 100644
> > --- a/drivers/net/ethernet/qlogic/qed/qed_main.c
> > +++ b/drivers/net/ethernet/qlogic/qed/qed_main.c
> > @@ -1239,7 +1239,6 @@ static void qed_fill_link(struct qed_hwfn *hwfn,
> > if (link.link_up)
> > if_link->link_up = true;
> >
> > - /* TODO - at the moment assume supported and advertised speed equal */
> > if_link->supported_caps = QED_LM_FIBRE_BIT;
> > if (params.speed.autoneg)
> > if_link->supported_caps |= QED_LM_Autoneg_BIT;
> > @@ -1294,7 +1293,6 @@ static void qed_fill_link(struct qed_hwfn *hwfn,
> > if (link.link_up)
> > if_link->speed = link.speed;
> >
> > - /* TODO - fill duplex properly */
> > if_link->duplex = DUPLEX_FULL;
> > qed_mcp_get_media_type(hwfn->cdev, &media_type);
> > if_link->port = qed_get_port_type(media_type);
> > diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.h b/drivers/net/ethernet/qlogic/qed/qed_mcp.h
> > index dff520e..2e5f51b 100644
> > --- a/drivers/net/ethernet/qlogic/qed/qed_mcp.h
> > +++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.h
> > @@ -314,9 +314,6 @@ int qed_mcp_bist_clock_test(struct qed_hwfn *p_hwfn,
> >
> > /* Using hwfn number (and not pf_num) is required since in CMT mode,
> > * same pf_num may be used by two different hwfn
> > - * TODO - this shouldn't really be in .h file, but until all fields
> > - * required during hw-init will be placed in their correct place in shmem
> > - * we need it in qed_dev.c [for readin the nvram reflection in shmem].
> > */
> > #define MCP_PF_ID_BY_REL(p_hwfn, rel_pfid) (QED_IS_BB((p_hwfn)->cdev) ? \
> > ((rel_pfid) | \
> > @@ -324,9 +321,6 @@ int qed_mcp_bist_clock_test(struct qed_hwfn *p_hwfn,
> > rel_pfid)
> > #define MCP_PF_ID(p_hwfn) MCP_PF_ID_BY_REL(p_hwfn, (p_hwfn)->rel_pf_id)
> >
> > -/* TODO - this is only correct as long as only BB is supported, and
> > - * no port-swapping is implemented; Afterwards we'll need to fix it.
> > - */
> > #define MFW_PORT(_p_hwfn) ((_p_hwfn)->abs_pf_id % \
> > ((_p_hwfn)->cdev->num_ports_in_engines * 2))
> > struct qed_mcp_info {
> Please split off the patch and use a separate one to remove all the TODO
> entries. They do not relate to the iSCSI offload bit.
>
Will do.
> > diff --git a/drivers/net/ethernet/qlogic/qed/qed_reg_addr.h b/drivers/net/ethernet/qlogic/qed/qed_reg_addr.h
> > index b414a05..9754420 100644
> > --- a/drivers/net/ethernet/qlogic/qed/qed_reg_addr.h
> > +++ b/drivers/net/ethernet/qlogic/qed/qed_reg_addr.h
> > @@ -82,6 +82,8 @@
> > 0x1c80000UL
> > #define BAR0_MAP_REG_XSDM_RAM \
> > 0x1e00000UL
> > +#define BAR0_MAP_REG_YSDM_RAM \
> > + 0x1e80000UL
> > #define NIG_REG_RX_LLH_BRB_GATE_DNTFWD_PERPF \
> > 0x5011f4UL
> > #define PRS_REG_SEARCH_TCP \
> > diff --git a/drivers/net/ethernet/qlogic/qed/qed_spq.c b/drivers/net/ethernet/qlogic/qed/qed_spq.c
> > index caff415..d3fa578 100644
> > --- a/drivers/net/ethernet/qlogic/qed/qed_spq.c
> > +++ b/drivers/net/ethernet/qlogic/qed/qed_spq.c
> > @@ -24,6 +24,7 @@
> > #include "qed_hsi.h"
> > #include "qed_hw.h"
> > #include "qed_int.h"
> > +#include "qed_iscsi.h"
> > #include "qed_mcp.h"
> > #include "qed_reg_addr.h"
> > #include "qed_sp.h"
> > @@ -249,6 +250,20 @@ static int qed_spq_hw_post(struct qed_hwfn *p_hwfn,
> > return qed_sriov_eqe_event(p_hwfn,
> > p_eqe->opcode,
> > p_eqe->echo, &p_eqe->data);
> > + case PROTOCOLID_ISCSI:
> > + if (!IS_ENABLED(CONFIG_QEDI))
> > + return -EINVAL;
> > +
> > + if (p_hwfn->p_iscsi_info->event_cb) {
> > + struct qed_iscsi_info *p_iscsi = p_hwfn->p_iscsi_info;
> > +
> > + return p_iscsi->event_cb(p_iscsi->event_context,
> > + p_eqe->opcode, &p_eqe->data);
> > + } else {
> > + DP_NOTICE(p_hwfn,
> > + "iSCSI async completion is not set\n");
> > + return -EINVAL;
> > + }
> > default:
> > DP_NOTICE(p_hwfn,
> > "Unknown Async completion for protocol: %d\n",
> > diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h
> > index f9ae903..c0c9fa8 100644
> > --- a/include/linux/qed/qed_if.h
> > +++ b/include/linux/qed/qed_if.h
> > @@ -165,6 +165,7 @@ struct qed_iscsi_pf_params {
> > u32 max_cwnd;
> > u16 cq_num_entries;
> > u16 cmdq_num_entries;
> > + u32 two_msl_timer;
> > u16 dup_ack_threshold;
> > u16 tx_sws_timer;
> > u16 min_rto;
> > @@ -271,6 +272,7 @@ struct qed_dev_info {
> > enum qed_sb_type {
> > QED_SB_TYPE_L2_QUEUE,
> > QED_SB_TYPE_CNQ,
> > + QED_SB_TYPE_STORAGE,
> > };
> >
> > enum qed_protocol {
> > diff --git a/include/linux/qed/qed_iscsi_if.h b/include/linux/qed/qed_iscsi_if.h
> > new file mode 100644
> > index 0000000..6735ee5
> > --- /dev/null
> > +++ b/include/linux/qed/qed_iscsi_if.h
> > @@ -0,0 +1,249 @@
> > +/* QLogic qed NIC Driver
> Again, this is the iSCSI driver, is it not?
>
> > + * Copyright (c) 2015 QLogic Corporation
> > + *
> And you _might_ want to check the copyright, seeing that it's being
> posted from the cavium.com domain ...
>
Yes, rest of the files (already existing) for qed has the same
copyright, so this patch did not modify it. qedi, OTOH, has all
new files and are using the updated ones. A new patch will be
posted to update the qed files.
Regards,
-Arun
^ 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