* Re: [PATCH net 0/2] netns: audit netdevice creation with IFLA_NET_NS_[PID|FD]
From: David Miller @ 2015-01-29 22:20 UTC (permalink / raw)
To: nicolas.dichtel
Cc: netdev, dmitry.tarnyagin, arvid.brodin, alex.aring, linux-wpan
In-Reply-To: <1422307694-10079-1-git-send-email-nicolas.dichtel@6wind.com>
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Mon, 26 Jan 2015 22:28:12 +0100
> When one of these attributes is set, the netdevice is created into the netns
> pointed by IFLA_NET_NS_[PID|FD] (see the call to rtnl_create_link() in
> rtnl_newlink()). Let's call this netns the dest_net. After this creation, if the
> newlink handler exists, it is called with a netns argument that points to the
> netns where the netlink message has been received (called src_net in the code)
> which is the link netns.
> Hence, with one of these attributes, it's possible to create a x-netns
> netdevice.
Series applied, thanks.
^ permalink raw reply
* Re: Altera TSE (altera_tse) - tx_fifo_depth init bug
From: David Miller @ 2015-01-29 22:22 UTC (permalink / raw)
To: setka; +Cc: vbridger, netdev, rfi
In-Reply-To: <54C8026B.9070607@vsis.cz>
Your patch was corrupted by your email client, in particular TAB
characters were transformed into a series of SPACE characters.
You must fix your outgoing emails so that this doesn't happen,
and you should send a test email to yourself and make sure that
you yourself can apply successfully the patch in that email
before trying to resend it here.
Thank you.
^ permalink raw reply
* Re: [PATCHv2 net] sunvnet: set queue mapping when doing packet copies
From: Eric Dumazet @ 2015-01-29 22:22 UTC (permalink / raw)
To: David L Stevens; +Cc: David Miller, netdev, Sowmini Varadhan
In-Reply-To: <1422569982.21689.36.camel@edumazet-glaptop2.roam.corp.google.com>
On Thu, 2015-01-29 at 14:19 -0800, Eric Dumazet wrote:
> I guess you can extend the test to sock_wfree and tcp_wfree, but :
>
> You have to EXPORT_SYMBOL(tcp_wfree)
>
> Add an #ifdef CONFIG_INET (take a look at skb_orphan_partial())
Or even better, add a new helper in the same spirit than
skb_orphan_partial() : You would EXPORT_SYMBOL() it and leave
tcp_wfree() as non exported.
^ permalink raw reply
* Re: [PATCH net-next v2] rtnetlink: pass link_net to the newlink handler
From: David Miller @ 2015-01-29 22:23 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: netdev
In-Reply-To: <1422353588-4830-1-git-send-email-nicolas.dichtel@6wind.com>
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Tue, 27 Jan 2015 11:13:08 +0100
> When IFLA_LINK_NETNSID is used, the netdevice should be built in this link netns
> and moved at the end to another netns (pointed by the socket netns or
> IFLA_NET_NS_[PID|FD]).
>
> Existing user of the newlink handler will use the netns argument (src_net) to
> find a link netdevice or to check some other information into the link netns.
> For example, to find a netdevice, two information are required: an ifindex
> (usually from IFLA_LINK) and a netns (this link netns).
>
> Note: when using IFLA_LINK_NETNSID and IFLA_NET_NS_[PID|FD], a user may create a
> netdevice that stands in netnsX and with its link part in netnsY, by sending a
> rtnl message from netnsZ.
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH 1/2] rhashtable: Introduce rhashtable_walk_*
From: Thomas Graf @ 2015-01-29 22:26 UTC (permalink / raw)
To: Herbert Xu; +Cc: Ying Xue, davem, kaber, paulmck, netdev, netfilter-devel
In-Reply-To: <E1YGFRA-0002yN-I0@gondolin.me.apana.org.au>
On 01/28/15 at 10:20am, Herbert Xu wrote:
> Some existing rhashtable users get too intimate with it by walking
> the buckets directly. This prevents us from easily changing the
> internals of rhashtable.
>
> This patch adds the helpers rhashtable_walk_init/next/end which
> will replace these custom walkers.
>
> They are meant to be usable for both procfs seq_file walks as well
> as walking by a netlink dump. The iterator structure should fit
> inside a netlink dump cb structure, with at least one element to
> spare.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Thomas Graf <tgraf@suug.ch>
^ permalink raw reply
* Re: [PATCH net] netlink: fix wrong subscription bitmask to group mapping in
From: Ivan Delalande @ 2015-01-29 22:27 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netdev, davem, andre
In-Reply-To: <1422525113-5698-1-git-send-email-pablo@netfilter.org>
On Thu, Jan 29, 2015 at 10:51:53AM +0100, Pablo Neira Ayuso wrote:
> The subscription bitmask passed via struct sockaddr_nl is converted to
> the group number when calling the netlink_bind() and netlink_unbind()
> callbacks.
>
> The conversion is however incorrect since bitmask (1 << 0) needs to be
> mapped to group number 1. Note that you cannot specify the group number 0
> (usually known as _NONE) from setsockopt() using NETLINK_ADD_MEMBERSHIP
> since this is rejected through -EINVAL.
>
> This problem became noticeable since 97840cb ("netfilter: nfnetlink:
> fix insufficient validation in nfnetlink_bind") when binding to bitmask
> (1 << 0) in ctnetlink.
>
> Reported-by: Andre Tomt <andre@tomt.net>
> Reported-by: Ivan Delalande <colona@arista.com>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Thanks a lot for this fix!
> ---
> v2: Rebased upon current net tree. Previous patch:
>
> http://patchwork.ozlabs.org/patch/426205/
>
> did not apply cleanly.
>
> net/netlink/af_netlink.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
> index 02fdde2..75532ef 100644
> --- a/net/netlink/af_netlink.c
> +++ b/net/netlink/af_netlink.c
> @@ -1438,7 +1438,7 @@ static void netlink_undo_bind(int group, long unsigned int groups,
>
> for (undo = 0; undo < group; undo++)
> if (test_bit(undo, &groups))
> - nlk->netlink_unbind(sock_net(sk), undo);
> + nlk->netlink_unbind(sock_net(sk), undo + 1);
> }
>
> static int netlink_bind(struct socket *sock, struct sockaddr *addr,
> @@ -1476,7 +1476,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
> for (group = 0; group < nlk->ngroups; group++) {
> if (!test_bit(group, &groups))
> continue;
> - err = nlk->netlink_bind(net, group);
> + err = nlk->netlink_bind(net, group + 1);
> if (!err)
> continue;
> netlink_undo_bind(group, groups, sk);
I guess this should also be group + 1 there:
netlink_undo_bind(group + 1, groups, sk);
--
Ivan "Colona" Delalande
Arista Networks
^ permalink raw reply
* Re: [PATCH 2/2] netlink: Use rhashtable walk iterator
From: Thomas Graf @ 2015-01-29 22:27 UTC (permalink / raw)
To: Herbert Xu; +Cc: Ying Xue, davem, kaber, paulmck, netdev, netfilter-devel
In-Reply-To: <E1YGFRB-0002yg-Ry@gondolin.me.apana.org.au>
On 01/28/15 at 10:20am, Herbert Xu wrote:
> This patch gets rid of the manual rhashtable walk in netlink
> which touches rhashtable internals that should not be exposed.
> It does so by using the rhashtable iterator primitives.
>
> In fact the existing code was very buggy. Some sockets weren't
> shown at all while others were shown more than once.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Thomas Graf <tgraf@suug.ch>
^ permalink raw reply
* Re: [PATCHv2 net] sunvnet: set queue mapping when doing packet copies
From: Eric Dumazet @ 2015-01-29 22:30 UTC (permalink / raw)
To: David Miller; +Cc: david.stevens, netdev, sowmini.varadhan
In-Reply-To: <20150129.141558.2191091565448535105.davem@davemloft.net>
On Thu, 2015-01-29 at 14:15 -0800, David Miller wrote:
> Then we need to fix skb_segment() too.
My concern was that skb_segment() could be used in rx paths, with quite
different destructor semantics.
While from ndo_start_xmit(), I believe sane destructors should not
depend on skb being invariant, sk 'refcount' must be using
skb->truesize.
^ permalink raw reply
* Re: [PATCH 1/2] driver core: add device_poll interface
From: David Miller @ 2015-01-29 22:32 UTC (permalink / raw)
To: xander.huff
Cc: gregkh, jeff.westfahl, netdev, linux-kernel, jaeden.amero,
ben.shelton, brad.mouring, rich.tollerton
In-Reply-To: <1422312393-61485-1-git-send-email-xander.huff@ni.com>
From: Xander Huff <xander.huff@ni.com>
Date: Mon, 26 Jan 2015 16:46:32 -0600
> From: Jeff Westfahl <jeff.westfahl@ni.com>
>
> Add the device_poll interface to the driver core. This is a generic
> interface that any struct device can take advantage of to dynamically
> switch between using interrupts and polling. Many drivers can be easily
> modified to take advantage of this feature if desired.
>
> This interface is most likely to be used along with the RT patch. It has
> only been used thus far on Ethernet interfaces. Even with the standard
> RT change to threaded interrupts for all devices, some RT applications
> can be sensitive to even the minimal hardware interrupt that still occurs
> with threaded interrupt handlers. The device_poll interface can be used
> to completely eliminate all hardware interrupts for a device and the
> associated jitter.
>
> This is a standalone feature that should be submitted for review and
> possible inclusion in mainline, or maybe in the RT patch.
>
> Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
There is no reason any device driver needs to explicitly add support
for a feature like this.
Implement this at the IRQ handler level, and run the IRQ handler
itself from the poll thread.
No driver changes at all.
Sorry, I'm not applying this series, drivers already have to implement
too many things explicitly these days.
^ permalink raw reply
* [PATCH v2] drivers: net: xgene: fix: Out of order descriptor bytes read
From: Iyappan Subramanian @ 2015-01-29 22:38 UTC (permalink / raw)
To: davem, netdev
Cc: linux-kernel, linux-arm-kernel, mlangsdo, patches, eric.dumazet,
Iyappan Subramanian, Keyur Chudgar
This patch fixes the following kernel crash,
WARNING: CPU: 2 PID: 0 at net/ipv4/tcp_input.c:3079 tcp_clean_rtx_queue+0x658/0x80c()
Call trace:
[<fffffe0000096b7c>] dump_backtrace+0x0/0x184
[<fffffe0000096d10>] show_stack+0x10/0x1c
[<fffffe0000685ea0>] dump_stack+0x74/0x98
[<fffffe00000b44e0>] warn_slowpath_common+0x88/0xb0
[<fffffe00000b461c>] warn_slowpath_null+0x14/0x20
[<fffffe00005b5c1c>] tcp_clean_rtx_queue+0x654/0x80c
[<fffffe00005b6228>] tcp_ack+0x454/0x688
[<fffffe00005b6ca8>] tcp_rcv_established+0x4a4/0x62c
[<fffffe00005bf4b4>] tcp_v4_do_rcv+0x16c/0x350
[<fffffe00005c225c>] tcp_v4_rcv+0x8e8/0x904
[<fffffe000059d470>] ip_local_deliver_finish+0x100/0x26c
[<fffffe000059dad8>] ip_local_deliver+0xac/0xc4
[<fffffe000059d6c4>] ip_rcv_finish+0xe8/0x328
[<fffffe000059dd3c>] ip_rcv+0x24c/0x38c
[<fffffe0000563950>] __netif_receive_skb_core+0x29c/0x7c8
[<fffffe0000563ea4>] __netif_receive_skb+0x28/0x7c
[<fffffe0000563f54>] netif_receive_skb_internal+0x5c/0xe0
[<fffffe0000564810>] napi_gro_receive+0xb4/0x110
[<fffffe0000482a2c>] xgene_enet_process_ring+0x144/0x338
[<fffffe0000482d18>] xgene_enet_napi+0x1c/0x50
[<fffffe0000565454>] net_rx_action+0x154/0x228
[<fffffe00000b804c>] __do_softirq+0x110/0x28c
[<fffffe00000b8424>] irq_exit+0x8c/0xc0
[<fffffe0000093898>] handle_IRQ+0x44/0xa8
[<fffffe000009032c>] gic_handle_irq+0x38/0x7c
[...]
Software writes poison data into the descriptor bytes[15:8] and upon
receiving the interrupt, if those bytes are overwritten by the hardware with
the valid data, software also reads bytes[7:0] and executes receive/tx
completion logic.
If the CPU executes the above two reads in out of order fashion, then the
bytes[7:0] will have older data and causing the kernel panic. We have to
force the order of the reads and thus this patch introduces read memory
barrier between these reads.
Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Signed-off-by: Keyur Chudgar <kchudgar@apm.com>
---
v2: Address comments from v1
* replaced smp_rmb() with dma_rmb()
---
drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 83a5028..793f3b7 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -369,6 +369,8 @@ static int xgene_enet_process_ring(struct xgene_enet_desc_ring *ring,
if (unlikely(xgene_enet_is_desc_slot_empty(raw_desc)))
break;
+ /* read fpqnum field after dataaddr field */
+ dma_rmb();
if (is_rx_desc(raw_desc))
ret = xgene_enet_rx_frame(ring, raw_desc);
else
--
1.9.1
^ permalink raw reply related
* Re: [PATCH net-next V2 1/1] dev: add per net_device packet type chains
From: David Miller @ 2015-01-29 22:42 UTC (permalink / raw)
To: noureddine; +Cc: edumazet, therbert, jiri, vyasevic, netdev, ebiederm
In-Reply-To: <1422387348-10885-1-git-send-email-noureddine@arista.com>
From: Salam Noureddine <noureddine@arista.com>
Date: Tue, 27 Jan 2015 11:35:48 -0800
> When many pf_packet listeners are created on a lot of interfaces the
> current implementation using global packet type lists scales poorly.
> This patch adds per net_device packet type lists to fix this problem.
>
> The patch was originally written by Eric Biederman for linux-2.6.29.
> Tested on linux-3.16.
>
> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
> Signed-off-by: Salam Noureddine <noureddine@arista.com>
This looks fine, applied, thanks.
^ permalink raw reply
* Re: [PATCH 0/2] rhashtable: Add walk iterator primitives and use them in netlink
From: David Miller @ 2015-01-29 22:42 UTC (permalink / raw)
To: herbert; +Cc: tgraf, ying.xue, kaber, paulmck, netdev, netfilter-devel
In-Reply-To: <20150127231950.GA11374@gondor.apana.org.au>
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 28 Jan 2015 10:19:50 +1100
> On Mon, Jan 26, 2015 at 10:20:40AM +1100, Herbert Xu wrote:
>>
>> Here are the first two patches, one to add the primitives and one
>> to demonstrate its use in netlink. In fact while testing this I
>> found that the existing netlink walking code is totally broken.
>
> So this is a repost of the same thing. These lockless iterators
> won't be usable by netfilter as it stands because it wants to do
> nested walks and also isn't currently lockless.
>
> However, I'll wait for Patrick to post his pending patches to see
> what exactly he needs before implementing helpers for that case.
I'm holding off on this series for now.
Let me know if you want me to do something different.
Thanks.
^ permalink raw reply
* Re: [PATCH net] ppp: deflate: never return len larger than output buffer
From: David Miller @ 2015-01-29 22:50 UTC (permalink / raw)
To: fw; +Cc: netdev
In-Reply-To: <1422438964-7937-1-git-send-email-fw@strlen.de>
From: Florian Westphal <fw@strlen.de>
Date: Wed, 28 Jan 2015 10:56:04 +0100
> When we've run out of space in the output buffer to store more data, we
> will call zlib_deflate with a NULL output buffer until we've consumed
> remaining input.
>
> When this happens, olen contains the size the output buffer would have
> consumed iff we'd have had enough room.
>
> This can later cause skb_over_panic when ppp_generic skb_put()s
> the returned length.
>
> Reported-by: Iain Douglas <centos@1n6.org.uk>
> Signed-off-by: Florian Westphal <fw@strlen.de>
Applied and queued up for -stable, thanks Florian.
^ permalink raw reply
* Re: [PATCH net-next] net: gianfar: remove the unneeded check of disabled device
From: David Miller @ 2015-01-29 22:51 UTC (permalink / raw)
To: haokexin; +Cc: netdev, claudiu.manoil
In-Reply-To: <1422446808-16460-1-git-send-email-haokexin@gmail.com>
From: Kevin Hao <haokexin@gmail.com>
Date: Wed, 28 Jan 2015 20:06:48 +0800
> Since commit cd1e65044d44 ("of/device: Don't register disabled
> devices"), the disabled device will not be registered at all. So we
> don't need to do the check again in the platform device driver.
>
> Signed-off-by: Kevin Hao <haokexin@gmail.com>
Applied, thanks.
^ permalink raw reply
* Re: pull-request: can-next 2015-28-01
From: David Miller @ 2015-01-29 22:55 UTC (permalink / raw)
To: mkl; +Cc: netdev, kernel, linux-can
In-Reply-To: <54C8EB12.9030100@pengutronix.de>
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Wed, 28 Jan 2015 14:58:42 +0100
> this is a pull request of 12 patches for net-next/master.
>
> There are 3 patches by Ahmed S. Darwish, which update the kvaser_usb
> driver and add support for the USBcan-II based adapters. Stéphane
> Grosjean contributes 7 patches for the peak_usb driver, which add
> support for the CANFD USB adapters. I contribute 2 patches which clean
> up the peak_usb driver structure a bit.
Pulled, thanks Marc.
^ permalink raw reply
* Re: [PATCH 0/4] net: driver fixes from arm randconfig builds
From: David Miller @ 2015-01-29 23:08 UTC (permalink / raw)
To: arnd; +Cc: netdev, linux-arm-kernel, linux-pcmcia, kas, jeffrey.t.kirsher
In-Reply-To: <1422454504-439085-1-git-send-email-arnd@arndb.de>
From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 28 Jan 2015 15:15:00 +0100
> These four patches are fallout from test builds on ARM. I have a
> few more of them in my backlog but have not yet confirmed them
> to still be valid.
>
> The first three patches are about incomplete dependencies on
> old drivers. One could backport them to the beginning of time
> in theory, but there is little value since nobody would run into
> these problems.
>
> The final patch is one I had submitted before together with the
> respective pcmcia patch but forgot to follow up on that. It's
> still a valid but relatively theoretical bug, because the previous
> behavior of the driver was just as broken as what we have in
> mainline.
Series applied, thanks Arnd.
^ permalink raw reply
* Re: [PATCH] cxgb4: Remove preprocessor check for CONFIG_CXGB4_DCB
From: David Miller @ 2015-01-29 23:10 UTC (permalink / raw)
To: hariprasad; +Cc: netdev, leedom, anish, nirranjan, praveenm
In-Reply-To: <1422461991-20684-1-git-send-email-hariprasad@chelsio.com>
From: Hariprasad Shenai <hariprasad@chelsio.com>
Date: Wed, 28 Jan 2015 21:49:51 +0530
> In commit dc9daab226aa ("cxgb4: Added support in debugfs to dump
> sge_qinfo") a preprocessor check for CONFIG_CXGB4_DCB got added, which should
> have been CONFIG_CHELSIO_T4_DCB.
>
> Reported-by: Paul Bolle <pebolle@tiscal.nl>
> Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
That's not all this patch is doing:
> +static inline struct port_info *ethqset2pinfo(struct adapter *adap, int qset)
You need to explain why this function needs to be added in the
commit message.
I can see myself that the build fails without it because you
forgot to add it in the original commit, or someone removed
it meanwhile, but you have to say so in the commit message
so everyone can understand.
^ permalink raw reply
* [PATCH 0/3] crypto: algif - change algif_skcipher to be asynchronous
From: Tadeusz Struk @ 2015-01-29 23:13 UTC (permalink / raw)
To: herbert; +Cc: linux-crypto, netdev, davem, qat-linux, linux-kernel
The way the algif_skcipher works currently is that on sendmsg/sendpage it
builds an sgl for the input data and then on read/recvmsg it sends the job
for encryption putting the user to sleep till the data is processed.
This way it can only handle one job at a given time.
To be able to fuly utilize the potential of existing crypto hardware
accelerators it is required to submit multiple jobs in asynchronously.
First patch enables asynchronous read and write on socket.
Second patch enables af_alg sgl to be linked.
Third patch implement asynch read for skcipher.
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
---
Tadeusz Struk (3):
net: socket: enable async read and write
crypto: af_alg - Allow to link sgl
crypto: algif - change algif_skcipher to be asynchronous
crypto/af_alg.c | 16 ++
crypto/algif_skcipher.c | 315 ++++++++++++++++++++++++++++++++++++++++++++++-
include/crypto/if_alg.h | 4 -
include/net/sock.h | 2
net/socket.c | 48 ++++++-
5 files changed, 364 insertions(+), 21 deletions(-)
^ permalink raw reply
* [PATCH 1/3] net: socket: enable async read and write
From: Tadeusz Struk @ 2015-01-29 23:13 UTC (permalink / raw)
To: herbert; +Cc: linux-crypto, netdev, davem, qat-linux, linux-kernel
In-Reply-To: <20150129231338.25156.65450.stgit@tstruk-mobl1>
AIO read or write are not currently supported on sockets.
This patch enables real socket async read/write.
Please note - this patch is generated against cryptodev.
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
---
include/net/sock.h | 2 ++
net/socket.c | 48 ++++++++++++++++++++++++++++++++++++++----------
2 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 2210fec..2c7d160 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1397,6 +1397,8 @@ static inline struct kiocb *siocb_to_kiocb(struct sock_iocb *si)
return si->kiocb;
}
+void sock_aio_complete(struct kiocb *iocb, long res, long res2);
+
struct socket_alloc {
struct socket socket;
struct inode vfs_inode;
diff --git a/net/socket.c b/net/socket.c
index a2c33a4..368fa9f 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -866,14 +866,25 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
return sock->ops->splice_read(sock, ppos, pipe, len, flags);
}
+void sock_aio_complete(struct kiocb *iocb, long res, long res2)
+{
+ struct sock_iocb *siocb = kiocb_to_siocb(iocb);
+
+ kfree(siocb);
+ aio_complete(iocb, res, res2);
+}
+EXPORT_SYMBOL(sock_aio_complete);
+
static struct sock_iocb *alloc_sock_iocb(struct kiocb *iocb,
struct sock_iocb *siocb)
{
- if (!is_sync_kiocb(iocb))
- BUG();
+ if (!siocb)
+ siocb = kmalloc(sizeof(*siocb), GFP_KERNEL);
- siocb->kiocb = iocb;
- iocb->private = siocb;
+ if (siocb) {
+ siocb->kiocb = iocb;
+ iocb->private = siocb;
+ }
return siocb;
}
@@ -901,7 +912,8 @@ static ssize_t do_sock_read(struct msghdr *msg, struct kiocb *iocb,
static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
- struct sock_iocb siocb, *x;
+ struct sock_iocb siocb, *x = NULL;
+ int ret;
if (pos != 0)
return -ESPIPE;
@@ -909,11 +921,18 @@ static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov,
if (iocb->ki_nbytes == 0) /* Match SYS5 behaviour */
return 0;
+ if (is_sync_kiocb(iocb))
+ x = &siocb;
- x = alloc_sock_iocb(iocb, &siocb);
+ x = alloc_sock_iocb(iocb, x);
if (!x)
return -ENOMEM;
- return do_sock_read(&x->async_msg, iocb, iocb->ki_filp, iov, nr_segs);
+ ret = do_sock_read(&x->async_msg, iocb, iocb->ki_filp, iov, nr_segs);
+
+ if (!is_sync_kiocb(iocb) && ret != -EIOCBQUEUED)
+ kfree(x);
+
+ return ret;
}
static ssize_t do_sock_write(struct msghdr *msg, struct kiocb *iocb,
@@ -942,16 +961,25 @@ static ssize_t do_sock_write(struct msghdr *msg, struct kiocb *iocb,
static ssize_t sock_aio_write(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
- struct sock_iocb siocb, *x;
+ struct sock_iocb siocb, *x = NULL;
+ int ret;
if (pos != 0)
return -ESPIPE;
- x = alloc_sock_iocb(iocb, &siocb);
+ if (is_sync_kiocb(iocb))
+ x = &siocb;
+
+ x = alloc_sock_iocb(iocb, x);
if (!x)
return -ENOMEM;
- return do_sock_write(&x->async_msg, iocb, iocb->ki_filp, iov, nr_segs);
+ ret = do_sock_write(&x->async_msg, iocb, iocb->ki_filp, iov, nr_segs);
+
+ if (!is_sync_kiocb(iocb) && ret != -EIOCBQUEUED)
+ kfree(x);
+
+ return ret;
}
/*
^ permalink raw reply related
* [PATCH 2/3] crypto: af_alg - Allow to link sgl
From: Tadeusz Struk @ 2015-01-29 23:13 UTC (permalink / raw)
To: herbert; +Cc: linux-crypto, netdev, davem, qat-linux, linux-kernel
In-Reply-To: <20150129231338.25156.65450.stgit@tstruk-mobl1>
Allow to link af_alg sgls.
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
---
crypto/af_alg.c | 16 ++++++++++++----
include/crypto/if_alg.h | 4 +++-
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 76d739d..99608f2 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -374,7 +374,8 @@ int af_alg_make_sg(struct af_alg_sgl *sgl, void __user *addr, int len,
err = 0;
- sg_init_table(sgl->sg, npages);
+ /* Add one extra for linking */
+ sg_init_table(sgl->sg, npages + 1);
for (i = 0; i < npages; i++) {
int plen = min_t(int, len, PAGE_SIZE - off);
@@ -385,20 +386,27 @@ int af_alg_make_sg(struct af_alg_sgl *sgl, void __user *addr, int len,
len -= plen;
err += plen;
}
+ sg_mark_end(sgl->sg + npages - 1);
+ sgl->npages = npages;
out:
return err;
}
EXPORT_SYMBOL_GPL(af_alg_make_sg);
+void af_alg_link_sg(struct af_alg_sgl *sgl_prev, struct af_alg_sgl *sgl_new)
+{
+ sg_unmark_end(sgl_prev->sg + sgl_prev->npages - 1);
+ sg_chain(sgl_prev->sg, sgl_prev->npages + 1, sgl_new->sg);
+}
+EXPORT_SYMBOL(af_alg_link_sg);
+
void af_alg_free_sg(struct af_alg_sgl *sgl)
{
int i;
- i = 0;
- do {
+ for (i = 0; i < sgl->npages; i++)
put_page(sgl->pages[i]);
- } while (!sg_is_last(sgl->sg + (i++)));
}
EXPORT_SYMBOL_GPL(af_alg_free_sg);
diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h
index 5c7b6c5..0908050 100644
--- a/include/crypto/if_alg.h
+++ b/include/crypto/if_alg.h
@@ -58,8 +58,9 @@ struct af_alg_type {
};
struct af_alg_sgl {
- struct scatterlist sg[ALG_MAX_PAGES];
+ struct scatterlist sg[ALG_MAX_PAGES + 1];
struct page *pages[ALG_MAX_PAGES];
+ unsigned int npages;
};
int af_alg_register_type(const struct af_alg_type *type);
@@ -71,6 +72,7 @@ int af_alg_accept(struct sock *sk, struct socket *newsock);
int af_alg_make_sg(struct af_alg_sgl *sgl, void __user *addr, int len,
int write);
void af_alg_free_sg(struct af_alg_sgl *sgl);
+void af_alg_link_sg(struct af_alg_sgl *sgl_prev, struct af_alg_sgl *sgl_new);
int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con);
^ permalink raw reply related
* [PATCH 3/3] crypto: algif - change algif_skcipher to be asynchronous
From: Tadeusz Struk @ 2015-01-29 23:13 UTC (permalink / raw)
To: herbert; +Cc: linux-crypto, netdev, davem, qat-linux, linux-kernel
In-Reply-To: <20150129231338.25156.65450.stgit@tstruk-mobl1>
The way the algif_skcipher works currently is that on sendmsg/sendpage it
builds an sgl for the input data and then on read/recvmsg it sends the job
for encryption putting the user to sleep till the data is processed.
This way it can only handle one job at a given time.
This patch changes it to be asynchronous by adding AIO support.
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
---
crypto/algif_skcipher.c | 315 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 309 insertions(+), 6 deletions(-)
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index 38a6757..c953200 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -19,9 +19,11 @@
#include <linux/list.h>
#include <linux/kernel.h>
#include <linux/mm.h>
+#include <linux/mempool.h>
#include <linux/module.h>
#include <linux/net.h>
#include <net/sock.h>
+#include <linux/aio.h>
struct skcipher_sg_list {
struct list_head list;
@@ -39,6 +41,9 @@ struct skcipher_ctx {
struct af_alg_completion completion;
+ struct kmem_cache *cache;
+ mempool_t *pool;
+ atomic_t inflight;
unsigned used;
unsigned int len;
@@ -49,9 +54,135 @@ struct skcipher_ctx {
struct ablkcipher_request req;
};
+struct skcipher_async_rsgl {
+ struct af_alg_sgl sgl;
+ struct list_head list;
+};
+
+struct skcipher_async_req {
+ struct kiocb *iocb;
+ struct skcipher_async_rsgl first_sgl;
+ struct list_head list;
+ struct scatterlist *tsg;
+ char iv[];
+};
+
+#define GET_SREQ(areq, ctx) (struct skcipher_async_req *)((char *)areq + \
+ crypto_ablkcipher_reqsize(crypto_ablkcipher_reqtfm(&ctx->req)))
+
+#define GET_REQ_SIZE(ctx) \
+ crypto_ablkcipher_reqsize(crypto_ablkcipher_reqtfm(&ctx->req))
+
+#define GET_IV_SIZE(ctx) \
+ crypto_ablkcipher_ivsize(crypto_ablkcipher_reqtfm(&ctx->req))
+
#define MAX_SGL_ENTS ((4096 - sizeof(struct skcipher_sg_list)) / \
sizeof(struct scatterlist) - 1)
+static void skcipher_free_async_sgls(struct skcipher_async_req *sreq)
+{
+ struct skcipher_async_rsgl *rsgl;
+ struct scatterlist *sgl;
+ struct scatterlist *sg;
+ int i, n;
+
+ list_for_each_entry(rsgl, &sreq->list, list) {
+ af_alg_free_sg(&rsgl->sgl);
+ if (rsgl != &sreq->first_sgl)
+ kfree(rsgl);
+ }
+ sgl = sreq->tsg;
+ n = sg_nents(sgl);
+ for_each_sg(sgl, sg, n, i)
+ put_page(sg_page(sg));
+
+ kfree(sreq->tsg);
+}
+
+static void skcipher_async_cb(struct crypto_async_request *req, int err)
+{
+ struct sock *sk = req->data;
+ struct alg_sock *ask = alg_sk(sk);
+ struct skcipher_ctx *ctx = ask->private;
+ struct skcipher_async_req *sreq = GET_SREQ(req, ctx);
+ struct kiocb *iocb = sreq->iocb;
+
+ atomic_dec(&ctx->inflight);
+ skcipher_free_async_sgls(sreq);
+ mempool_free(req, ctx->pool);
+ sock_aio_complete(iocb, err, err);
+}
+
+static void skcipher_mempool_free(void *_req, void *_sk)
+{
+ struct sock *sk = _sk;
+ struct alg_sock *ask = alg_sk(sk);
+ struct skcipher_ctx *ctx = ask->private;
+ struct kmem_cache *cache = ctx->cache;
+
+ kmem_cache_free(cache, _req);
+}
+
+static void *skcipher_mempool_alloc(gfp_t gfp_mask, void *_sk)
+{
+ struct sock *sk = _sk;
+ struct alg_sock *ask = alg_sk(sk);
+ struct skcipher_ctx *ctx = ask->private;
+ struct kmem_cache *cache = ctx->cache;
+ struct ablkcipher_request *req;
+
+ req = kmem_cache_alloc(cache, gfp_mask);
+ if (req) {
+ ablkcipher_request_set_tfm(req,
+ crypto_ablkcipher_reqtfm(&ctx->req));
+ ablkcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
+ skcipher_async_cb, sk);
+ }
+ return req;
+}
+
+static void skcipher_cache_constructor(void *v)
+{
+ memset(v, 0, sizeof(struct skcipher_async_req));
+}
+
+static int skcipher_mempool_create(struct sock *sk)
+{
+ struct alg_sock *ask = alg_sk(sk);
+ struct skcipher_ctx *ctx = ask->private;
+ unsigned int len = sizeof(struct skcipher_async_req) +
+ GET_REQ_SIZE(ctx) + GET_IV_SIZE(ctx);
+ char buf[32];
+
+ snprintf(buf, sizeof(buf), "skcipher_%p", ctx);
+ ctx->cache = kmem_cache_create(buf, len, 0, SLAB_HWCACHE_ALIGN |
+ SLAB_TEMPORARY,
+ skcipher_cache_constructor);
+ if (unlikely(!ctx->cache))
+ return -ENOMEM;
+
+ ctx->pool = mempool_create(128, skcipher_mempool_alloc,
+ skcipher_mempool_free, sk);
+
+ if (unlikely(!ctx->pool)) {
+ kmem_cache_destroy(ctx->cache);
+ return -ENOMEM;
+ }
+ return 0;
+}
+
+static void skcipher_mempool_destroy(struct skcipher_ctx *ctx)
+{
+ if (ctx->pool)
+ mempool_destroy(ctx->pool);
+
+ if (ctx->cache)
+ kmem_cache_destroy(ctx->cache);
+
+ ctx->cache = NULL;
+ ctx->pool = NULL;
+}
+
static inline int skcipher_sndbuf(struct sock *sk)
{
struct alg_sock *ask = alg_sk(sk);
@@ -96,7 +227,7 @@ static int skcipher_alloc_sgl(struct sock *sk)
return 0;
}
-static void skcipher_pull_sgl(struct sock *sk, int used)
+static void skcipher_pull_sgl(struct sock *sk, int used, int put)
{
struct alg_sock *ask = alg_sk(sk);
struct skcipher_ctx *ctx = ask->private;
@@ -124,7 +255,8 @@ static void skcipher_pull_sgl(struct sock *sk, int used)
if (sg[i].length)
return;
- put_page(sg_page(sg + i));
+ if (put)
+ put_page(sg_page(sg + i));
sg_assign_page(sg + i, NULL);
}
@@ -143,7 +275,7 @@ static void skcipher_free_sgl(struct sock *sk)
struct alg_sock *ask = alg_sk(sk);
struct skcipher_ctx *ctx = ask->private;
- skcipher_pull_sgl(sk, ctx->used);
+ skcipher_pull_sgl(sk, ctx->used, 1);
}
static int skcipher_wait_for_wmem(struct sock *sk, unsigned flags)
@@ -424,8 +556,152 @@ unlock:
return err ?: size;
}
-static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock,
- struct msghdr *msg, size_t ignored, int flags)
+static int skcipher_all_sg_nents(struct skcipher_ctx *ctx)
+{
+ struct skcipher_sg_list *sgl;
+ struct scatterlist *sg;
+ int nents = 0;
+
+ list_for_each_entry(sgl, &ctx->tsgl, list) {
+ sg = sgl->sg;
+
+ while (!sg->length)
+ sg++;
+
+ nents += sg_nents(sg);
+ }
+ return nents;
+}
+
+static int skcipher_recvmsg_async(struct kiocb *iocb, struct socket *sock,
+ struct msghdr *msg, int flags)
+{
+ struct sock *sk = sock->sk;
+ struct alg_sock *ask = alg_sk(sk);
+ struct skcipher_ctx *ctx = ask->private;
+ const struct iovec *iov;
+ unsigned long iovlen;
+ struct skcipher_sg_list *sgl;
+ struct scatterlist *sg;
+ struct skcipher_async_req *sreq;
+ struct ablkcipher_request *req;
+ struct skcipher_async_rsgl *last_rsgl = NULL;
+ unsigned int len = 0, tx_nents = skcipher_all_sg_nents(ctx);
+ int i = 0;
+ int err = -ENOMEM;
+
+ lock_sock(sk);
+ req = mempool_alloc(ctx->pool, GFP_KERNEL);
+ if (unlikely(!req))
+ goto unlock;
+
+ sreq = GET_SREQ(req, ctx);
+ sreq->iocb = iocb;
+ INIT_LIST_HEAD(&sreq->list);
+ memcpy(sreq->iv, ctx->iv, GET_IV_SIZE(ctx));
+ sreq->tsg = kcalloc(tx_nents, sizeof(*sg), GFP_KERNEL);
+ if (!sreq->tsg) {
+ mempool_free(req, ctx->pool);
+ goto unlock;
+ }
+ sg_init_table(sreq->tsg, tx_nents);
+ for (iov = msg->msg_iter.iov, iovlen = msg->msg_iter.nr_segs;
+ iovlen > 0; iovlen--, iov++) {
+ unsigned long seglen = iov->iov_len;
+ char __user *from = iov->iov_base;
+ struct skcipher_async_rsgl *rsgl;
+
+ while (seglen) {
+ unsigned long used;
+
+ if (!ctx->used) {
+ err = skcipher_wait_for_data(sk, flags);
+ if (err)
+ goto free;
+ }
+ sgl = list_first_entry(&ctx->tsgl,
+ struct skcipher_sg_list, list);
+ sg = sgl->sg;
+
+ while (!sg->length)
+ sg++;
+
+ used = min_t(unsigned long, ctx->used, seglen);
+ used = min_t(unsigned long, used, sg->length);
+
+ if (i == tx_nents) {
+ struct scatterlist *tmp;
+ int x;
+
+ /* Ran out of tx slots in async request
+ * need to expand */
+ tmp = kcalloc(tx_nents * 2, sizeof(*tmp),
+ GFP_KERNEL);
+ if (!tmp)
+ goto free;
+
+ sg_init_table(tmp, tx_nents * 2);
+ for (x = 0; x < tx_nents; x++)
+ sg_set_page(&tmp[x],
+ sg_page(&sreq->tsg[x]),
+ sreq->tsg[x].length,
+ sreq->tsg[x].offset);
+ kfree(sreq->tsg);
+ sreq->tsg = tmp;
+ tx_nents *= 2;
+ }
+ /* Need to take over the tx sgl from ctx
+ * to the asynch req - these sgls will be freed later */
+ sg_set_page(sreq->tsg + i++, sg_page(sg), sg->length,
+ sg->offset);
+
+ if (list_empty(&sreq->list)) {
+ rsgl = &sreq->first_sgl;
+ list_add(&rsgl->list, &sreq->list);
+ } else {
+ rsgl = kzalloc(sizeof(*rsgl), GFP_KERNEL);
+ if (!rsgl) {
+ err = -ENOMEM;
+ goto free;
+ }
+ list_add(&rsgl->list, &sreq->list);
+ }
+
+ used = af_alg_make_sg(&rsgl->sgl, from, used, 1);
+ err = used;
+ if (used < 0)
+ goto free;
+ if (last_rsgl)
+ af_alg_link_sg(&last_rsgl->sgl, &rsgl->sgl);
+
+ last_rsgl = rsgl;
+ len += used;
+ from += used;
+ seglen -= used;
+ skcipher_pull_sgl(sk, used, 0);
+ }
+ }
+
+ ablkcipher_request_set_crypt(req, sreq->tsg, sreq->first_sgl.sgl.sg,
+ len, sreq->iv);
+ err = ctx->enc ? crypto_ablkcipher_encrypt(req) :
+ crypto_ablkcipher_decrypt(req);
+ if (err == -EINPROGRESS) {
+ atomic_inc(&ctx->inflight);
+ err = -EIOCBQUEUED;
+ goto unlock;
+ }
+free:
+ skcipher_free_async_sgls(sreq);
+ mempool_free(req, ctx->pool);
+unlock:
+ skcipher_wmem_wakeup(sk);
+ release_sock(sk);
+ return err;
+}
+
+static int skcipher_recvmsg_sync(struct socket *sock, struct msghdr *msg,
+ int flags)
{
struct sock *sk = sock->sk;
struct alg_sock *ask = alg_sk(sk);
@@ -493,7 +769,7 @@ free:
copied += used;
from += used;
seglen -= used;
- skcipher_pull_sgl(sk, used);
+ skcipher_pull_sgl(sk, used, 1);
}
}
@@ -506,6 +782,13 @@ unlock:
return copied ?: err;
}
+static int skcipher_recvmsg(struct kiocb *iocb, struct socket *sock,
+ struct msghdr *msg, size_t ignored, int flags)
+{
+ return is_sync_kiocb(iocb) ?
+ skcipher_recvmsg_sync(sock, msg, flags) :
+ skcipher_recvmsg_async(iocb, sock, msg, flags);
+}
static unsigned int skcipher_poll(struct file *file, struct socket *sock,
poll_table *wait)
@@ -564,12 +847,25 @@ static int skcipher_setkey(void *private, const u8 *key, unsigned int keylen)
return crypto_ablkcipher_setkey(private, key, keylen);
}
+static void skcipher_wait(struct sock *sk)
+{
+ struct alg_sock *ask = alg_sk(sk);
+ struct skcipher_ctx *ctx = ask->private;
+ int ctr = 0;
+
+ while (atomic_read(&ctx->inflight) && ctr++ < 100)
+ msleep(100);
+}
+
static void skcipher_sock_destruct(struct sock *sk)
{
struct alg_sock *ask = alg_sk(sk);
struct skcipher_ctx *ctx = ask->private;
struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(&ctx->req);
+ if (atomic_read(&ctx->inflight))
+ skcipher_wait(sk);
+ skcipher_mempool_destroy(ctx);
skcipher_free_sgl(sk);
sock_kzfree_s(sk, ctx->iv, crypto_ablkcipher_ivsize(tfm));
sock_kfree_s(sk, ctx, ctx->len);
@@ -601,6 +897,7 @@ static int skcipher_accept_parent(void *private, struct sock *sk)
ctx->more = 0;
ctx->merge = 0;
ctx->enc = 0;
+ atomic_set(&ctx->inflight, 0);
af_alg_init_completion(&ctx->completion);
ask->private = ctx;
@@ -609,6 +906,12 @@ static int skcipher_accept_parent(void *private, struct sock *sk)
ablkcipher_request_set_callback(&ctx->req, CRYPTO_TFM_REQ_MAY_BACKLOG,
af_alg_complete, &ctx->completion);
+ if (skcipher_mempool_create(sk)) {
+ sock_kzfree_s(sk, ctx->iv, crypto_ablkcipher_ivsize(private));
+ sock_kfree_s(sk, ctx, ctx->len);
+ return -ENOMEM;
+ }
+
sk->sk_destruct = skcipher_sock_destruct;
return 0;
^ permalink raw reply related
* [PATCH net-next] netcp driver fixes to build as dynamic modules
From: Murali Karicheri @ 2015-01-29 23:15 UTC (permalink / raw)
To: w-kwok2, davem, mugunthanvnm, tony, prabhakar.csengg,
grygorii.strashko, lokeshvutla, mpa, lsorense, netdev,
linux-kernel, arnd
Cc: Murali Karicheri
This patch introduce changes to netcp modules and makefile to build
the driver as dynamic modules. This also convert existing cpsw_ale.c
as a module so that it can be re-used across netcp and ti_cpsw drivers.
This also fixes the issue seen when build using arm allmodconfig
I have made an allmodconfig with this patch and the build succeeds.
make allmodconfig
make uImage LOADADDR=0x80008000; make modules
After the build all of the following .ko files are seen
Note: need to verify this on a platform with TI CPSW.
drivers/net/ethernet/ti/cpsw_ale.ko
drivers/net/ethernet/ti/davinci_cpdma.ko
drivers/net/ethernet/ti/davinci_emac.ko
drivers/net/ethernet/ti/davinci_mdio.ko
drivers/net/ethernet/ti/keystone_netcp_ethss.ko
drivers/net/ethernet/ti/keystone_netcp.ko
drivers/net/ethernet/ti/ti_cpsw.ko
drivers/net/ethernet/ti/tlan.ko
This also has dependency on the following patches for netcp :-
[1] https://lkml.org/lkml/2015/1/28/1102
[2] https://lkml.org/lkml/2015/1/29/881
[3] https://lkml.org/lkml/2015/1/29/882
Murali Karicheri (1):
drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on
Keystone
drivers/net/ethernet/ti/Kconfig | 19 +++++++++++++++++--
drivers/net/ethernet/ti/Makefile | 8 +++++---
drivers/net/ethernet/ti/cpsw_ale.c | 26 ++++++++++++++++++++++++--
drivers/net/ethernet/ti/netcp_core.c | 8 ++++++++
drivers/net/ethernet/ti/netcp_ethss.c | 5 +++++
5 files changed, 59 insertions(+), 7 deletions(-)
--
1.7.9.5
^ permalink raw reply
* [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone
From: Murali Karicheri @ 2015-01-29 23:15 UTC (permalink / raw)
To: w-kwok2, davem, mugunthanvnm, tony, prabhakar.csengg,
grygorii.strashko, lokeshvutla, mpa, lsorense, netdev,
linux-kernel, arnd
Cc: Murali Karicheri
In-Reply-To: <1422573351-5603-1-git-send-email-m-karicheri2@ti.com>
NetCP on Keystone has cpsw ale function similar to other TI SoCs
and this driver is re-used. To allow both ti cpsw and keystone netcp
to re-use the driver, convert the cpsw ale to a module and configure
it through Kconfig option CONFIG_TI_CPSW_ALE. Currently it is statically
linked to both TI CPSW and NetCP and this causes issues when the above
drivers are built as dynamic modules. This patch addresses this issue
While at it, fix the Makefile and code to build both netcp_core and
netcp_ethss as dynamic modules. This is needed to support arm allmodconfig.
This also requires exporting of API calls provided by netcp_core so that
both the above can be dynamic modules.
Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
---
drivers/net/ethernet/ti/Kconfig | 19 +++++++++++++++++--
drivers/net/ethernet/ti/Makefile | 8 +++++---
drivers/net/ethernet/ti/cpsw_ale.c | 26 ++++++++++++++++++++++++--
drivers/net/ethernet/ti/netcp_core.c | 8 ++++++++
drivers/net/ethernet/ti/netcp_ethss.c | 5 +++++
5 files changed, 59 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 4ea1663..3bc992c 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -56,12 +56,18 @@ config TI_CPSW_PHY_SEL
This driver supports configuring of the phy mode connected to
the CPSW.
+config TI_CPSW_ALE
+ tristate "TI CPSW ALE Support"
+ ---help---
+ This driver supports TI's CPSW ALE module.
+
config TI_CPSW
tristate "TI CPSW Switch Support"
depends on ARCH_DAVINCI || ARCH_OMAP2PLUS
select TI_DAVINCI_CPDMA
select TI_DAVINCI_MDIO
select TI_CPSW_PHY_SEL
+ select TI_CPSW_ALE
select MFD_SYSCON
select REGMAP
---help---
@@ -80,15 +86,24 @@ config TI_CPTS
and Layer 2 packets, and the driver offers a PTP Hardware Clock.
config TI_KEYSTONE_NETCP
- tristate "TI Keystone NETCP Ethernet subsystem Support"
+ tristate "TI Keystone NETCP Core Support"
+ select TI_CPSW_ALE
depends on OF
depends on KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS
---help---
- This driver supports TI's Keystone NETCP Ethernet subsystem.
+ This driver supports TI's Keystone NETCP Core.
To compile this driver as a module, choose M here: the module
will be called keystone_netcp.
+config TI_KEYSTONE_NETCP_ETHSS
+ depends on TI_KEYSTONE_NETCP
+ tristate "TI Keystone NETCP Ethernet subsystem Support"
+ ---help---
+
+ To compile this driver as a module, choose M here: the module
+ will be called keystone_netcp_ethss.
+
config TLAN
tristate "TI ThunderLAN support"
depends on (PCI || EISA)
diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile
index 0a9813b..02ddad5 100644
--- a/drivers/net/ethernet/ti/Makefile
+++ b/drivers/net/ethernet/ti/Makefile
@@ -8,9 +8,11 @@ obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o
obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o
obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o
obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o
+obj-$(CONFIG_TI_CPSW_ALE) += cpsw_ale.o
obj-$(CONFIG_TI_CPSW) += ti_cpsw.o
-ti_cpsw-y := cpsw_ale.o cpsw.o cpts.o
+ti_cpsw-y := cpsw.o cpts.o
obj-$(CONFIG_TI_KEYSTONE_NETCP) += keystone_netcp.o
-keystone_netcp-y := netcp_core.o netcp_ethss.o netcp_sgmii.o \
- netcp_xgbepcsr.o cpsw_ale.o
+keystone_netcp-y := netcp_core.o
+obj-$(CONFIG_TI_KEYSTONE_NETCP_ETHSS) += keystone_netcp_ethss.o
+keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o netcp_xgbepcsr.o
diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
index 5246b3a..6e927b4 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.c
+++ b/drivers/net/ethernet/ti/cpsw_ale.c
@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/
#include <linux/kernel.h>
+#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
@@ -146,7 +147,7 @@ static int cpsw_ale_write(struct cpsw_ale *ale, int idx, u32 *ale_entry)
return idx;
}
-int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid)
+static int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid)
{
u32 ale_entry[ALE_ENTRY_WORDS];
int type, idx;
@@ -167,7 +168,7 @@ int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid)
return -ENOENT;
}
-int cpsw_ale_match_vlan(struct cpsw_ale *ale, u16 vid)
+static int cpsw_ale_match_vlan(struct cpsw_ale *ale, u16 vid)
{
u32 ale_entry[ALE_ENTRY_WORDS];
int type, idx;
@@ -265,6 +266,7 @@ int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid)
}
return 0;
}
+EXPORT_SYMBOL_GPL(cpsw_ale_flush_multicast);
static void cpsw_ale_flush_ucast(struct cpsw_ale *ale, u32 *ale_entry,
int port_mask)
@@ -297,6 +299,7 @@ int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask)
}
return 0;
}
+EXPORT_SYMBOL_GPL(cpsw_ale_flush);
static inline void cpsw_ale_set_vlan_entry_type(u32 *ale_entry,
int flags, u16 vid)
@@ -334,6 +337,7 @@ int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port,
cpsw_ale_write(ale, idx, ale_entry);
return 0;
}
+EXPORT_SYMBOL_GPL(cpsw_ale_add_ucast);
int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port,
int flags, u16 vid)
@@ -349,6 +353,7 @@ int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port,
cpsw_ale_write(ale, idx, ale_entry);
return 0;
}
+EXPORT_SYMBOL_GPL(cpsw_ale_del_ucast);
int cpsw_ale_add_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
int flags, u16 vid, int mcast_state)
@@ -380,6 +385,7 @@ int cpsw_ale_add_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
cpsw_ale_write(ale, idx, ale_entry);
return 0;
}
+EXPORT_SYMBOL_GPL(cpsw_ale_add_mcast);
int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
int flags, u16 vid)
@@ -401,6 +407,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
cpsw_ale_write(ale, idx, ale_entry);
return 0;
}
+EXPORT_SYMBOL_GPL(cpsw_ale_del_mcast);
int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag,
int reg_mcast, int unreg_mcast)
@@ -430,6 +437,7 @@ int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag,
cpsw_ale_write(ale, idx, ale_entry);
return 0;
}
+EXPORT_SYMBOL_GPL(cpsw_ale_add_vlan);
int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask)
{
@@ -450,6 +458,7 @@ int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask)
cpsw_ale_write(ale, idx, ale_entry);
return 0;
}
+EXPORT_SYMBOL_GPL(cpsw_ale_del_vlan);
void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti)
{
@@ -479,6 +488,7 @@ void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti)
cpsw_ale_write(ale, idx, ale_entry);
}
}
+EXPORT_SYMBOL_GPL(cpsw_ale_set_allmulti);
struct ale_control_info {
const char *name;
@@ -704,6 +714,7 @@ int cpsw_ale_control_set(struct cpsw_ale *ale, int port, int control,
return 0;
}
+EXPORT_SYMBOL_GPL(cpsw_ale_control_set);
int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control)
{
@@ -727,6 +738,7 @@ int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control)
tmp = __raw_readl(ale->params.ale_regs + offset) >> shift;
return tmp & BITMASK(info->bits);
}
+EXPORT_SYMBOL_GPL(cpsw_ale_control_get);
static void cpsw_ale_timer(unsigned long arg)
{
@@ -750,6 +762,7 @@ int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout)
}
return 0;
}
+EXPORT_SYMBOL_GPL(cpsw_ale_set_ageout);
void cpsw_ale_start(struct cpsw_ale *ale)
{
@@ -769,11 +782,13 @@ void cpsw_ale_start(struct cpsw_ale *ale)
add_timer(&ale->timer);
}
}
+EXPORT_SYMBOL_GPL(cpsw_ale_start);
void cpsw_ale_stop(struct cpsw_ale *ale)
{
del_timer_sync(&ale->timer);
}
+EXPORT_SYMBOL_GPL(cpsw_ale_stop);
struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)
{
@@ -788,6 +803,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)
return ale;
}
+EXPORT_SYMBOL_GPL(cpsw_ale_create);
int cpsw_ale_destroy(struct cpsw_ale *ale)
{
@@ -797,6 +813,7 @@ int cpsw_ale_destroy(struct cpsw_ale *ale)
kfree(ale);
return 0;
}
+EXPORT_SYMBOL_GPL(cpsw_ale_destroy);
void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data)
{
@@ -807,3 +824,8 @@ void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data)
data += ALE_ENTRY_WORDS;
}
}
+EXPORT_SYMBOL_GPL(cpsw_ale_dump);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("TI CPSW ALE driver");
+MODULE_AUTHOR("Texas Instruments");
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index ba3002e..a31a8c3 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -354,6 +354,7 @@ fail:
netcp_unregister_module(module);
return ret;
}
+EXPORT_SYMBOL_GPL(netcp_register_module);
static void netcp_release_module(struct netcp_device *netcp_device,
struct netcp_module *module)
@@ -414,6 +415,7 @@ void netcp_unregister_module(struct netcp_module *module)
mutex_unlock(&netcp_modules_lock);
}
+EXPORT_SYMBOL_GPL(netcp_unregister_module);
void *netcp_module_get_intf_data(struct netcp_module *module,
struct netcp_intf *intf)
@@ -425,6 +427,7 @@ void *netcp_module_get_intf_data(struct netcp_module *module,
return intf_modpriv->module_priv;
return NULL;
}
+EXPORT_SYMBOL_GPL(netcp_module_get_intf_data);
/* Module TX and RX Hook management */
struct netcp_hook_list {
@@ -459,6 +462,7 @@ int netcp_register_txhook(struct netcp_intf *netcp_priv, int order,
return 0;
}
+EXPORT_SYMBOL_GPL(netcp_register_txhook);
int netcp_unregister_txhook(struct netcp_intf *netcp_priv, int order,
netcp_hook_rtn *hook_rtn, void *hook_data)
@@ -480,6 +484,7 @@ int netcp_unregister_txhook(struct netcp_intf *netcp_priv, int order,
spin_unlock_irqrestore(&netcp_priv->lock, flags);
return -ENOENT;
}
+EXPORT_SYMBOL_GPL(netcp_unregister_txhook);
int netcp_register_rxhook(struct netcp_intf *netcp_priv, int order,
netcp_hook_rtn *hook_rtn, void *hook_data)
@@ -1226,6 +1231,7 @@ int netcp_txpipe_close(struct netcp_tx_pipe *tx_pipe)
}
return 0;
}
+EXPORT_SYMBOL_GPL(netcp_txpipe_close);
int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe)
{
@@ -1267,6 +1273,7 @@ err:
tx_pipe->dma_channel = NULL;
return ret;
}
+EXPORT_SYMBOL_GPL(netcp_txpipe_open);
int netcp_txpipe_init(struct netcp_tx_pipe *tx_pipe,
struct netcp_device *netcp_device,
@@ -1278,6 +1285,7 @@ int netcp_txpipe_init(struct netcp_tx_pipe *tx_pipe,
tx_pipe->dma_queue_id = dma_queue_id;
return 0;
}
+EXPORT_SYMBOL_GPL(netcp_txpipe_init);
static struct netcp_addr *netcp_addr_find(struct netcp_intf *netcp,
const u8 *addr,
diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
index fa1041a..345cd25 100644
--- a/drivers/net/ethernet/ti/netcp_ethss.c
+++ b/drivers/net/ethernet/ti/netcp_ethss.c
@@ -19,6 +19,7 @@
*/
#include <linux/io.h>
+#include <linux/module.h>
#include <linux/of_mdio.h>
#include <linux/of_address.h>
#include <linux/if_vlan.h>
@@ -2154,3 +2155,7 @@ static void __exit keystone_gbe_exit(void)
netcp_unregister_module(&xgbe_module);
}
module_exit(keystone_gbe_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("TI NETCP ETHSS driver for Keystone SOCs");
+MODULE_AUTHOR("Sandeep Nair <sandeep_n@ti.com");
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH net-next v8 0/4] net: Add Keystone NetCP ethernet driver support
From: Murali Karicheri @ 2015-01-29 23:20 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Balbi, Felipe, mugunthanvnm-l0cyMroinI0, David Miller,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <15828198.gHAJTouZOU@wuerfel>
On 01/29/2015 05:00 PM, Arnd Bergmann wrote:
> On Thursday 29 January 2015 12:21:36 Murali Karicheri wrote:
>>
>> I think the solution is to make the cpsw_ale as a module and configured
>> through a Kconfig option. I am working on a fix for this now.
>>
>> Similar fix is required for cpts.o. Currently we are not using this
>> module for Netcp, but soon this will be re-used. I have send a patch
>> that is already applied to net-next removing cpts.o for Netcp.
>>
>
> Great, thanks a lot for the follow-up.
>
> Arnd
Arnd,
I have just posted a patch to nedev list to address this issue. Please
review and let me know your comments. This also require some additional
fixes in drivers/soc/ti/ to build them as modules as well. Santosh has
queued them against next merge window.
Felipe, Mugunthan,
As the patch touches ti_cpsw as well, please review and provide your
comments. It will be great if you can apply this patch on net-next
branch and test it on ti platform using ti_cpsw driver.
--
Murali Karicheri
Linux Kernel, Texas Instruments
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] stmmac: DMA threshold mode or SF mode can be different among multiple device instance
From: David Miller @ 2015-01-29 23:28 UTC (permalink / raw)
To: sonic.adi; +Cc: peppe.cavallaro, netdev, adi-buildroot-devel, sonic.zhang
In-Reply-To: <1422521699-14096-1-git-send-email-sonic.adi@gmail.com>
From: Sonic Zhang <sonic.adi@gmail.com>
Date: Thu, 29 Jan 2015 16:54:59 +0800
> /* Try to bump up the dma threshold on this failure */
> - if (unlikely(tc != SF_DMA_MODE) && (tc <= 256)) {
> + if (unlikely(priv->xstats.threshold != SF_DMA_MODE) &&
> + (tc <= 256)) {
This is not indented properly. The second line of the conditional
should start precisely at the first column after the openning
parenthesis of the if() statement.
^ 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