* [PATCH] fec: Fix the build as module
From: Fabio Estevam @ 2013-03-20 18:19 UTC (permalink / raw)
To: davem; +Cc: Frank.Li, u.kleine-koenig, netdev, Fabio Estevam
From: Fabio Estevam <fabio.estevam@freescale.com>
Since commit ff43da86c69 (NET: FEC: dynamtic check DMA desc buff type) the
following build error happens when CONFIG_FEC=m
ERROR: "fec_ptp_init" [drivers/net/ethernet/freescale/fec.ko] undefined!
ERROR: "fec_ptp_ioctl" [drivers/net/ethernet/freescale/fec.ko] undefined!
ERROR: "fec_ptp_start_cyclecounter" [drivers/net/ethernet/freescale/fec.ko] undefined!
Fix it by exporting the required fec_ptp symbols.
Reported-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/net/ethernet/freescale/fec_ptp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
index 1f17ca0..0d8df40 100644
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -128,6 +128,7 @@ void fec_ptp_start_cyclecounter(struct net_device *ndev)
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
}
+EXPORT_SYMBOL(fec_ptp_start_cyclecounter);
/**
* fec_ptp_adjfreq - adjust ptp cycle frequency
@@ -318,6 +319,7 @@ int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
-EFAULT : 0;
}
+EXPORT_SYMBOL(fec_ptp_ioctl);
/**
* fec_time_keep - call timecounter_read every second to avoid timer overrun
@@ -383,3 +385,4 @@ void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev)
pr_info("registered PHC device on %s\n", ndev->name);
}
}
+EXPORT_SYMBOL(fec_ptp_init);
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 2/2] sh_eth: check TSU registers ioremap() error
From: Denis Kirjanov @ 2013-03-20 18:20 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: David Miller, netdev, nobuhiro.iwamatsu.yj
In-Reply-To: <514A0B15.7000900@cogentembedded.com>
It doesn't make sense to worry about branch misprediction during probe() :)
On 3/20/13, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
> On 03/20/2013 10:04 PM, Sergei Shtylyov wrote:
>
>>
>>>
>>>> One must check the result of ioremap() -- in this case it prevents
>>>> potential
>>>> kernel oops when initializing TSU registers further on...
>>>>
>>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>> Applied and queued up for -stable.
>>
>> Thanks. However, do you really think it's needed in stable? It's
>> only error path, after all...
>
> I forgot to add "unlikely" to the "error path". I usually don't mark
> such patches for stable, when I'm not in a hurry. :-)
>
> WBR, Sergei
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: How to assign sockaddr_nl->nl_groups when using connector
From: Evgeniy Polyakov @ 2013-03-20 18:29 UTC (permalink / raw)
To: vaughan; +Cc: netdev, KY Srinivasan, devel@linuxdriverproject.org
In-Reply-To: <5147CA4F.5050801@oracle.com>
Hi
On Tue, Mar 19, 2013 at 10:15:43AM +0800, vaughan (vaughan.cao@oracle.com) wrote:
> I am not quite sure how to assign nl_groups when using connector. You
> Documentation/connector/connector.txt don't explain it very clearly. I
> thought it's a bitmask representing only 32 groups.
> If I just want to subscribe only one group such as CN_KVP_IDX, what
> shall I do? Which one below is correct?
> a) l_local.nl_groups = CN_KVP_IDX;
> Or
> b) l_local.nl_groups = 1 << (CN_KVP_IDX -1)
> and bind with bind(s, (struct sockaddr *)&l_local, sizeof(struct
> sockaddr_nl)).
Iirc, first groups, created before bitmap-to-number conversion were
actually bitmaps, but then broadcast interface was obsoleted.
One should use NETLINK_ADD_MEMBERSHIP interface and specify gruop number
directly.
> I ran your example in Documentation/connector/. 'l_local.nl_groups = -1'
> in ucon.c seems subscribe all channels, because if I start cgred
> service, ucon will receive messages with idx=1.
>
> And it seems setsockopt is not needed now, for it is done by
> netlink_autobind? You even comment it out using '#if 0' in
> Documentation/connector/ucon.c.
>
> Could you do me a favor to check
> http://driverdev.linuxdriverproject.org/pipermail/devel/2013-March/036306.html
> to see if my understanding is correct or not? Thanks.
Yes, you are right.
--
Evgeniy Polyakov
^ permalink raw reply
* [PATCH] chelsio: use netdev_alloc_skb
From: Stephen Hemminger @ 2013-03-20 18:30 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
In-Reply-To: <1363797199.3333.18.camel@edumazet-glaptop>
This extends on Eric's patch. It uses netdev_alloc_skb which fixes a couple of
other issues.
* driver was never setting skb->dev on the received buffer
* copybreak allocation wasn't padding buffer
* copybreak assumed that ip alignment padding was always 2 (it is platform dependent)
Compile tested only, don't have this hardware.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
--- a/drivers/net/ethernet/chelsio/cxgb/sge.c 2013-03-20 11:13:47.950986878 -0700
+++ b/drivers/net/ethernet/chelsio/cxgb/sge.c 2013-03-20 11:24:26.942722757 -0700
@@ -835,7 +835,7 @@ static void refill_free_list(struct sge
struct sk_buff *skb;
dma_addr_t mapping;
- skb = dev_alloc_skb(q->rx_buffer_size);
+ skb = netdev_alloc_skb(sge->netdev, q->rx_buffer_size);
if (!skb)
break;
@@ -1039,18 +1039,18 @@ MODULE_PARM_DESC(copybreak, "Receive cop
* threshold and the packet is too big to copy, or (b) the packet should
* be copied but there is no memory for the copy.
*/
-static inline struct sk_buff *get_packet(struct pci_dev *pdev,
+static inline struct sk_buff *get_packet(struct net_device *netdev,
+ struct pci_dev *pdev,
struct freelQ *fl, unsigned int len)
{
struct sk_buff *skb;
const struct freelQ_ce *ce = &fl->centries[fl->cidx];
if (len < copybreak) {
- skb = alloc_skb(len + 2, GFP_ATOMIC);
+ skb = netdev_alloc_skb_ip_align(netdev, len + 2);
if (!skb)
goto use_orig_buf;
- skb_reserve(skb, 2); /* align IP header */
skb_put(skb, len);
pci_dma_sync_single_for_cpu(pdev,
dma_unmap_addr(ce, dma_addr),
@@ -1360,7 +1360,7 @@ static void sge_rx(struct sge *sge, stru
struct sge_port_stats *st;
struct net_device *dev;
- skb = get_packet(adapter->pdev, fl, len - sge->rx_pkt_pad);
+ skb = get_packet(sge->netdev, adapter->pdev, fl, len - sge->rx_pkt_pad);
if (unlikely(!skb)) {
sge->stats.rx_drops++;
return;
^ permalink raw reply
* Re: [PATCH] chelsio: use netdev_alloc_skb
From: Eric Dumazet @ 2013-03-20 18:42 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20130320113024.00377b99@nehalam.linuxnetplumber.net>
On Wed, 2013-03-20 at 11:30 -0700, Stephen Hemminger wrote:
> This extends on Eric's patch. It uses netdev_alloc_skb which fixes a couple of
> other issues.
> * driver was never setting skb->dev on the received buffer
> * copybreak allocation wasn't padding buffer
> * copybreak assumed that ip alignment padding was always 2 (it is platform dependent)
>
> Compile tested only, don't have this hardware.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>
>
> --- a/drivers/net/ethernet/chelsio/cxgb/sge.c 2013-03-20 11:13:47.950986878 -0700
> +++ b/drivers/net/ethernet/chelsio/cxgb/sge.c 2013-03-20 11:24:26.942722757 -0700
> @@ -835,7 +835,7 @@ static void refill_free_list(struct sge
> struct sk_buff *skb;
> dma_addr_t mapping;
>
> - skb = dev_alloc_skb(q->rx_buffer_size);
> + skb = netdev_alloc_skb(sge->netdev, q->rx_buffer_size);
> if (!skb)
> break;
Well, this (skb->dev = dev) is done in eth_type_trans()
Many drivers use dev_alloc_skb(), I am not sure we really want to change
them.
^ permalink raw reply
* Re: [PATCH 2/2] sh_eth: check TSU registers ioremap() error
From: Sergei Shtylyov @ 2013-03-20 19:45 UTC (permalink / raw)
To: Denis Kirjanov; +Cc: David Miller, netdev, nobuhiro.iwamatsu.yj
In-Reply-To: <CAOJe8K2aoQLi0B4SaHEv0GPMe2g0YvuRQc1vwBZhLVJPZLsYCQ@mail.gmail.com>
Hello.
On 03/20/2013 09:20 PM, Denis Kirjanov wrote:
> It doesn't make sense to worry about branch misprediction during probe() :)
You misunderstood. I didn't mean using unlikely() at all, just that
the ioremap() failure is unlikely.
PS: Please, don't top post.
> On 3/20/13, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
>> On 03/20/2013 10:04 PM, Sergei Shtylyov wrote:
>>
>>>>> One must check the result of ioremap() -- in this case it prevents
>>>>> potential
>>>>> kernel oops when initializing TSU registers further on...
>>>>>
>>>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>>> Applied and queued up for -stable.
>>> Thanks. However, do you really think it's needed in stable? It's
>>> only error path, after all...
>> I forgot to add "unlikely" to the "error path". I usually don't mark
>> such patches for stable, when I'm not in a hurry. :-)
>>
WBR, Sergei
^ permalink raw reply
* Re: [PATCH] chelsio: use netdev_alloc_skb
From: Eric Dumazet @ 2013-03-20 18:44 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20130320113024.00377b99@nehalam.linuxnetplumber.net>
On Wed, 2013-03-20 at 11:30 -0700, Stephen Hemminger wrote:
> - skb = alloc_skb(len + 2, GFP_ATOMIC);
> + skb = netdev_alloc_skb_ip_align(netdev, len + 2);
> if (!skb)
> goto use_orig_buf;
>
If you use the helper, no need for 'len + 2' but :
netdev_alloc_skb_ip_align(netdev, len);
^ permalink raw reply
* Re: [PATCH] fec: Fix the build as module
From: David Miller @ 2013-03-20 18:46 UTC (permalink / raw)
To: festevam; +Cc: Frank.Li, u.kleine-koenig, netdev, fabio.estevam
In-Reply-To: <1363803572-17039-1-git-send-email-festevam@gmail.com>
From: Fabio Estevam <festevam@gmail.com>
Date: Wed, 20 Mar 2013 15:19:32 -0300
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Since commit ff43da86c69 (NET: FEC: dynamtic check DMA desc buff type) the
> following build error happens when CONFIG_FEC=m
>
> ERROR: "fec_ptp_init" [drivers/net/ethernet/freescale/fec.ko] undefined!
> ERROR: "fec_ptp_ioctl" [drivers/net/ethernet/freescale/fec.ko] undefined!
> ERROR: "fec_ptp_start_cyclecounter" [drivers/net/ethernet/freescale/fec.ko] undefined!
>
> Fix it by exporting the required fec_ptp symbols.
>
> Reported-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Applied and queued up for -stable.
^ permalink raw reply
* Re: [PATCH v3 net-next 4/4] filter: add minimal BPF JIT emitted image disassembler
From: Daniel Borkmann @ 2013-03-20 18:57 UTC (permalink / raw)
To: David Miller; +Cc: netdev, eric.dumazet
In-Reply-To: <20130320.131713.988538863586629681.davem@davemloft.net>
On 03/20/2013 06:17 PM, David Miller wrote:
> From: Daniel Borkmann <dborkman@redhat.com>
> Date: Tue, 19 Mar 2013 17:39:32 +0100
>
>> This is a minimal stand-alone user space helper, that allows for debugging or
>> verification of emitted BPF JIT images.
>
> As Ben Hutchings suggested, please respin this such that the tool
> goes somewhere under tools/
>
> Creating a tools/net/ subdirectory for small programs like this is
> fine.
Thanks, I'll do that!
^ permalink raw reply
* [PATCH v2] chelsio: use netdev_alloc_skb_ip_align
From: Stephen Hemminger @ 2013-03-20 19:02 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
In-Reply-To: <1363804952.3333.29.camel@edumazet-glaptop>
Use netdev_alloc_sk_ip_align in the case where packet is copied.
This handles case where NET_IP_ALIGN == 0 as well as adding required header
padding.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
--- a/drivers/net/ethernet/chelsio/cxgb/sge.c 2013-03-20 11:13:47.950986878 -0700
+++ b/drivers/net/ethernet/chelsio/cxgb/sge.c 2013-03-20 12:00:01.551115729 -0700
@@ -1046,11 +1046,10 @@ static inline struct sk_buff *get_packet
const struct freelQ_ce *ce = &fl->centries[fl->cidx];
if (len < copybreak) {
- skb = alloc_skb(len + 2, GFP_ATOMIC);
+ skb = netdev_alloc_skb_ip_align(NULL, len);
if (!skb)
goto use_orig_buf;
- skb_reserve(skb, 2); /* align IP header */
skb_put(skb, len);
pci_dma_sync_single_for_cpu(pdev,
dma_unmap_addr(ce, dma_addr),
^ permalink raw reply
* Re: [PATCH v3 1/1 net-next] NET: FEC: dynamtic check DMA desc buff type
From: Ben Hutchings @ 2013-03-20 19:09 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Frank Li, lznuaa, davem, s.hauer, netdev, shawn.guo,
linux-arm-kernel, kernel
In-Reply-To: <1363800515.2677.13.camel@bwh-desktop.uk.solarflarecom.com>
On Wed, 2013-03-20 at 17:28 +0000, Ben Hutchings wrote:
> On Wed, 2013-03-20 at 17:04 +0100, Uwe Kleine-König wrote:
> > Hello,
> >
> > On Fri, Jan 04, 2013 at 10:04:23AM +0800, Frank Li wrote:
> > > MX6 and mx28 support enhanced DMA descriptor buff to support 1588
> > > ptp. But MX25, MX3x, MX5x can't support enhanced DMA descriptor buff.
> > > Check fec type and choose correct DMA descriptor buff type.
> > >
> > > Remove static config CONFIG_FEC_PTP.
> > > ptp function will be auto detected.
> > Your patch (now as ff43da86c69d76a726ffe7d1666148960dc1d108 in v3.9-rc1)
> > breaks building with CONFIG_FEC=m:
> >
> > ERROR: "fec_ptp_init" [drivers/net/ethernet/freescale/fec.ko] undefined!
> > ERROR: "fec_ptp_ioctl" [drivers/net/ethernet/freescale/fec.ko] undefined!
> > ERROR: "fec_ptp_start_cyclecounter" [drivers/net/ethernet/freescale/fec.ko] undefined!
> >
> > IMHO you should build fec.o and fec_ptp.o into the same module as they
> > cannot live without each other anyhow.
>
> They are in the same module. So I don't see how that error is possible.
Sorry, I misread the Makefile. They are either both built as modules or
both built-in, but they are separate modules.
Ben.
> > Having said I wonder if it would be worthwile to support FEC without
> > PTP_1588_CLOCK. For example make the above three functions static
> > inlines if CONFIG_PTP_1588_CLOCK=n and drop the select on the latter.
>
> See previous discussions:
> <http://thread.gmane.org/gmane.linux.kernel/1363200/focus=1376659>,
> <http://thread.gmane.org/gmane.linux.network/247963>,
> <http://thread.gmane.org/gmane.linux.network/247823/focus=248173>
>
> Ben.
>
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH] net: Add socket() system call self test.
From: David Miller @ 2013-03-20 19:10 UTC (permalink / raw)
To: daniel.baluta; +Cc: netdev, netfilter-devel, linux-wireless
In-Reply-To: <CAEnQRZDOwE592qXK0h-u1B7R-9oWP1CZ2rbt197QTn4oagdwgw@mail.gmail.com>
From: Daniel Baluta <daniel.baluta@gmail.com>
Date: Wed, 20 Mar 2013 00:14:05 +0200
> I think it's better to have a selftests/net directory dedicated for
> networking tests. Over time
> the number of net-{x} directories may become very large.
Good idea, here's what I've done for now:
====================
net: Move selftests to common net/ subdirectory.
Suggested-by: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
tools/testing/selftests/Makefile | 3 +--
tools/testing/selftests/net-socket/Makefile | 16 ----------------
tools/testing/selftests/{net-afpacket => net}/Makefile | 9 +++++----
.../selftests/{net-afpacket => net}/psock_fanout.c | 0
.../selftests/{net-afpacket => net}/run_afpackettests | 0
.../selftests/{net-socket => net}/run_netsocktests | 0
tools/testing/selftests/{net-socket => net}/socket.c | 0
7 files changed, 6 insertions(+), 22 deletions(-)
delete mode 100644 tools/testing/selftests/net-socket/Makefile
rename tools/testing/selftests/{net-afpacket => net}/Makefile (55%)
rename tools/testing/selftests/{net-afpacket => net}/psock_fanout.c (100%)
rename tools/testing/selftests/{net-afpacket => net}/run_afpackettests (100%)
rename tools/testing/selftests/{net-socket => net}/run_netsocktests (100%)
rename tools/testing/selftests/{net-socket => net}/socket.c (100%)
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 7f50078..a480593 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -5,8 +5,7 @@ TARGETS += vm
TARGETS += cpu-hotplug
TARGETS += memory-hotplug
TARGETS += efivarfs
-TARGETS += net-socket
-TARGETS += net-afpacket
+TARGETS += net
all:
for TARGET in $(TARGETS); do \
diff --git a/tools/testing/selftests/net-socket/Makefile b/tools/testing/selftests/net-socket/Makefile
deleted file mode 100644
index 2450fd8..0000000
--- a/tools/testing/selftests/net-socket/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-# Makefile for net-socket selftests
-
-CC = $(CROSS_COMPILE)gcc
-CFLAGS = -Wall
-
-NET_SOCK_PROGS = socket
-
-all: $(NET_SOCK_PROGS)
-%: %.c
- $(CC) $(CFLAGS) -o $@ $^
-
-run_tests: all
- @/bin/sh ./run_netsocktests || echo "sockettests: [FAIL]"
-
-clean:
- $(RM) $(NET_SOCK_PROGS)
diff --git a/tools/testing/selftests/net-afpacket/Makefile b/tools/testing/selftests/net/Makefile
similarity index 55%
rename from tools/testing/selftests/net-afpacket/Makefile
rename to tools/testing/selftests/net/Makefile
index 45f2ffb..bd6e272 100644
--- a/tools/testing/selftests/net-afpacket/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -1,18 +1,19 @@
-# Makefile for net-socket selftests
+# Makefile for net selftests
CC = $(CROSS_COMPILE)gcc
CFLAGS = -Wall
CFLAGS += -I../../../../usr/include/
-AF_PACKET_PROGS = psock_fanout
+NET_PROGS = socket psock_fanout
-all: $(AF_PACKET_PROGS)
+all: $(NET_PROGS)
%: %.c
$(CC) $(CFLAGS) -o $@ $^
run_tests: all
+ @/bin/sh ./run_netsocktests || echo "sockettests: [FAIL]"
@/bin/sh ./run_afpackettests || echo "afpackettests: [FAIL]"
clean:
- $(RM) $(AF_PACKET_PROGS)
+ $(RM) $(NET_PROGS)
diff --git a/tools/testing/selftests/net-afpacket/psock_fanout.c b/tools/testing/selftests/net/psock_fanout.c
similarity index 100%
rename from tools/testing/selftests/net-afpacket/psock_fanout.c
rename to tools/testing/selftests/net/psock_fanout.c
diff --git a/tools/testing/selftests/net-afpacket/run_afpackettests b/tools/testing/selftests/net/run_afpackettests
similarity index 100%
rename from tools/testing/selftests/net-afpacket/run_afpackettests
rename to tools/testing/selftests/net/run_afpackettests
diff --git a/tools/testing/selftests/net-socket/run_netsocktests b/tools/testing/selftests/net/run_netsocktests
similarity index 100%
rename from tools/testing/selftests/net-socket/run_netsocktests
rename to tools/testing/selftests/net/run_netsocktests
diff --git a/tools/testing/selftests/net-socket/socket.c b/tools/testing/selftests/net/socket.c
similarity index 100%
rename from tools/testing/selftests/net-socket/socket.c
rename to tools/testing/selftests/net/socket.c
--
1.7.11.7
^ permalink raw reply related
* pull request: wireless 2013-03-20
From: John W. Linville @ 2013-03-20 19:11 UTC (permalink / raw)
To: davem; +Cc: linux-wireless, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 16112 bytes --]
Dave,
I present to you another batch of fixes intended for the 3.9 stream...
On the bluetooth bits, Gustavo says:
"I put together 3 fixes intended for 3.9, there are support for two
new devices and a NULL dereference fix in the SCO code."
Amitkumar Karwar fixes a command queueing race in mwifiex.
Bing Zhao provides a pair of mwifiex related to cleaning-up before
a shutdown.
Felix Fietkau provides an ath9k fix for a regression caused by an
earlier calibration fix, and another ath9k fix to avoid race conditions
that unnecessarily lead to chip resets.
Jussi Kivilinna prevents and skbuff leak in rtlwifi.
Stanislaw Gruszka corrects a length paramater for a DMA buffer mapping
operation in iwlegacy.
Please let me know if there are problems!
John
---
The following changes since commit da2191e31409d1058dcbed44e8f53e39a40e86b3:
net: fec: Define indexes as 'unsigned int' (2013-03-20 12:28:59 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git for-davem
for you to fetch changes up to b9d5319041999401d29e7efcd5d15664edfaad2e:
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless into for-davem (2013-03-20 14:26:37 -0400)
----------------------------------------------------------------
Amitkumar Karwar (1):
mwifiex: fix race when queuing commands
Bing Zhao (2):
mwifiex: skip pending commands after function shutdown
mwifiex: cancel cmd timer and free curr_cmd in shutdown process
Felix Fietkau (2):
ath9k_hw: revert chainmask to user configuration after calibration
ath9k: limit tx path hang check to normal data queues
John W. Linville (2):
Merge branch 'master' of git://git.kernel.org/.../bluetooth/bluetooth
Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem
Jussi Kivilinna (1):
rtlwifi: usb: add missing freeing of skbuff
Ming Lei (2):
Bluetooth: Add support for Dell[QCA 0cf3:0036]
Bluetooth: Add support for Dell[QCA 0cf3:817a]
Stanislaw Gruszka (1):
iwl3945: fix length of dma buffers
Vinicius Costa Gomes (1):
Bluetooth: Fix not closing SCO sockets in the BT_CONNECT2 state
drivers/bluetooth/ath3k.c | 4 ++++
drivers/bluetooth/btusb.c | 2 ++
drivers/net/wireless/ath/ath9k/ar9003_calib.c | 4 ++++
drivers/net/wireless/ath/ath9k/link.c | 26 +++++++++++++-------------
drivers/net/wireless/iwlegacy/3945-mac.c | 22 ++++++++++++----------
drivers/net/wireless/mwifiex/cmdevt.c | 22 ++++++++++++++++------
drivers/net/wireless/mwifiex/init.c | 8 ++++++++
drivers/net/wireless/mwifiex/main.h | 4 ++--
drivers/net/wireless/mwifiex/scan.c | 8 ++++----
drivers/net/wireless/mwifiex/sta_ioctl.c | 10 ++--------
drivers/net/wireless/rtlwifi/usb.c | 1 +
net/bluetooth/sco.c | 1 +
12 files changed, 69 insertions(+), 43 deletions(-)
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index b282af1..6aab00e 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -73,9 +73,11 @@ static struct usb_device_id ath3k_table[] = {
{ USB_DEVICE(0x03F0, 0x311D) },
/* Atheros AR3012 with sflash firmware*/
+ { USB_DEVICE(0x0CF3, 0x0036) },
{ USB_DEVICE(0x0CF3, 0x3004) },
{ USB_DEVICE(0x0CF3, 0x3008) },
{ USB_DEVICE(0x0CF3, 0x311D) },
+ { USB_DEVICE(0x0CF3, 0x817a) },
{ USB_DEVICE(0x13d3, 0x3375) },
{ USB_DEVICE(0x04CA, 0x3004) },
{ USB_DEVICE(0x04CA, 0x3005) },
@@ -107,9 +109,11 @@ MODULE_DEVICE_TABLE(usb, ath3k_table);
static struct usb_device_id ath3k_blist_tbl[] = {
/* Atheros AR3012 with sflash firmware*/
+ { USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 },
+ { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index e547851..2cc5f77 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -131,9 +131,11 @@ static struct usb_device_id blacklist_table[] = {
{ USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE },
/* Atheros 3012 with sflash firmware */
+ { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 },
+ { USB_DEVICE(0x0cf3, 0x817a), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 4cc1394..f76c3ca 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -1023,6 +1023,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
AR_PHY_AGC_CONTROL_FLTR_CAL |
AR_PHY_AGC_CONTROL_PKDET_CAL;
+ /* Use chip chainmask only for calibration */
ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask);
if (rtt) {
@@ -1150,6 +1151,9 @@ skip_tx_iqcal:
ar9003_hw_rtt_disable(ah);
}
+ /* Revert chainmask to runtime parameters */
+ ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
+
/* Initialize list pointers */
ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c
index ade3afb..39c84ec 100644
--- a/drivers/net/wireless/ath/ath9k/link.c
+++ b/drivers/net/wireless/ath/ath9k/link.c
@@ -28,21 +28,21 @@ void ath_tx_complete_poll_work(struct work_struct *work)
int i;
bool needreset = false;
- for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
- if (ATH_TXQ_SETUP(sc, i)) {
- txq = &sc->tx.txq[i];
- ath_txq_lock(sc, txq);
- if (txq->axq_depth) {
- if (txq->axq_tx_inprogress) {
- needreset = true;
- ath_txq_unlock(sc, txq);
- break;
- } else {
- txq->axq_tx_inprogress = true;
- }
+ for (i = 0; i < IEEE80211_NUM_ACS; i++) {
+ txq = sc->tx.txq_map[i];
+
+ ath_txq_lock(sc, txq);
+ if (txq->axq_depth) {
+ if (txq->axq_tx_inprogress) {
+ needreset = true;
+ ath_txq_unlock(sc, txq);
+ break;
+ } else {
+ txq->axq_tx_inprogress = true;
}
- ath_txq_unlock_complete(sc, txq);
}
+ ath_txq_unlock_complete(sc, txq);
+ }
if (needreset) {
ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index 3630a41..c353b5f 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -475,6 +475,7 @@ il3945_tx_skb(struct il_priv *il,
dma_addr_t txcmd_phys;
int txq_id = skb_get_queue_mapping(skb);
u16 len, idx, hdr_len;
+ u16 firstlen, secondlen;
u8 id;
u8 unicast;
u8 sta_id;
@@ -589,21 +590,22 @@ il3945_tx_skb(struct il_priv *il,
len =
sizeof(struct il3945_tx_cmd) + sizeof(struct il_cmd_header) +
hdr_len;
- len = (len + 3) & ~3;
+ firstlen = (len + 3) & ~3;
/* Physical address of this Tx command's header (not MAC header!),
* within command buffer array. */
txcmd_phys =
- pci_map_single(il->pci_dev, &out_cmd->hdr, len, PCI_DMA_TODEVICE);
+ pci_map_single(il->pci_dev, &out_cmd->hdr, firstlen,
+ PCI_DMA_TODEVICE);
if (unlikely(pci_dma_mapping_error(il->pci_dev, txcmd_phys)))
goto drop_unlock;
/* Set up TFD's 2nd entry to point directly to remainder of skb,
* if any (802.11 null frames have no payload). */
- len = skb->len - hdr_len;
- if (len) {
+ secondlen = skb->len - hdr_len;
+ if (secondlen > 0) {
phys_addr =
- pci_map_single(il->pci_dev, skb->data + hdr_len, len,
+ pci_map_single(il->pci_dev, skb->data + hdr_len, secondlen,
PCI_DMA_TODEVICE);
if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr)))
goto drop_unlock;
@@ -611,12 +613,12 @@ il3945_tx_skb(struct il_priv *il,
/* Add buffer containing Tx command and MAC(!) header to TFD's
* first entry */
- il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, len, 1, 0);
+ il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, firstlen, 1, 0);
dma_unmap_addr_set(out_meta, mapping, txcmd_phys);
- dma_unmap_len_set(out_meta, len, len);
- if (len)
- il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, len, 0,
- U32_PAD(len));
+ dma_unmap_len_set(out_meta, len, firstlen);
+ if (secondlen > 0)
+ il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, secondlen, 0,
+ U32_PAD(secondlen));
if (!ieee80211_has_morefrags(hdr->frame_control)) {
txq->need_update = 1;
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index 20a6c55..b5c8b96 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -157,6 +157,20 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
return -1;
}
+ cmd_code = le16_to_cpu(host_cmd->command);
+ cmd_size = le16_to_cpu(host_cmd->size);
+
+ if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET &&
+ cmd_code != HostCmd_CMD_FUNC_SHUTDOWN &&
+ cmd_code != HostCmd_CMD_FUNC_INIT) {
+ dev_err(adapter->dev,
+ "DNLD_CMD: FW in reset state, ignore cmd %#x\n",
+ cmd_code);
+ mwifiex_complete_cmd(adapter, cmd_node);
+ mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
+ return -1;
+ }
+
/* Set command sequence number */
adapter->seq_num++;
host_cmd->seq_num = cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO
@@ -168,9 +182,6 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
adapter->curr_cmd = cmd_node;
spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
- cmd_code = le16_to_cpu(host_cmd->command);
- cmd_size = le16_to_cpu(host_cmd->size);
-
/* Adjust skb length */
if (cmd_node->cmd_skb->len > cmd_size)
/*
@@ -484,8 +495,6 @@ int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no,
ret = mwifiex_send_cmd_async(priv, cmd_no, cmd_action, cmd_oid,
data_buf);
- if (!ret)
- ret = mwifiex_wait_queue_complete(adapter);
return ret;
}
@@ -588,9 +597,10 @@ int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no,
if (cmd_no == HostCmd_CMD_802_11_SCAN) {
mwifiex_queue_scan_cmd(priv, cmd_node);
} else {
- adapter->cmd_queued = cmd_node;
mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true);
queue_work(adapter->workqueue, &adapter->main_work);
+ if (cmd_node->wait_q_enabled)
+ ret = mwifiex_wait_queue_complete(adapter, cmd_node);
}
return ret;
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c
index e38aa9b..0ff4c37 100644
--- a/drivers/net/wireless/mwifiex/init.c
+++ b/drivers/net/wireless/mwifiex/init.c
@@ -709,6 +709,14 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
return ret;
}
+ /* cancel current command */
+ if (adapter->curr_cmd) {
+ dev_warn(adapter->dev, "curr_cmd is still in processing\n");
+ del_timer(&adapter->cmd_timer);
+ mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd);
+ adapter->curr_cmd = NULL;
+ }
+
/* shut down mwifiex */
dev_dbg(adapter->dev, "info: shutdown mwifiex...\n");
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 553adfb..7035ade 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -723,7 +723,6 @@ struct mwifiex_adapter {
u16 cmd_wait_q_required;
struct mwifiex_wait_queue cmd_wait_q;
u8 scan_wait_q_woken;
- struct cmd_ctrl_node *cmd_queued;
spinlock_t queue_lock; /* lock for tx queues */
struct completion fw_load;
u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
@@ -1018,7 +1017,8 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv,
struct mwifiex_multicast_list *mcast_list);
int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist,
struct net_device *dev);
-int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter);
+int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter,
+ struct cmd_ctrl_node *cmd_queued);
int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
struct cfg80211_ssid *req_ssid);
int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type);
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index bb60c27..d215b4d 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1388,10 +1388,13 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
list_del(&cmd_node->list);
spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
flags);
- adapter->cmd_queued = cmd_node;
mwifiex_insert_cmd_to_pending_q(adapter, cmd_node,
true);
queue_work(adapter->workqueue, &adapter->main_work);
+
+ /* Perform internal scan synchronously */
+ if (!priv->scan_request)
+ mwifiex_wait_queue_complete(adapter, cmd_node);
} else {
spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
flags);
@@ -1946,9 +1949,6 @@ int mwifiex_request_scan(struct mwifiex_private *priv,
/* Normal scan */
ret = mwifiex_scan_networks(priv, NULL);
- if (!ret)
- ret = mwifiex_wait_queue_complete(priv->adapter);
-
up(&priv->async_sem);
return ret;
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 9f33c92..13100f8 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -54,16 +54,10 @@ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist,
* This function waits on a cmd wait queue. It also cancels the pending
* request after waking up, in case of errors.
*/
-int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter)
+int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter,
+ struct cmd_ctrl_node *cmd_queued)
{
int status;
- struct cmd_ctrl_node *cmd_queued;
-
- if (!adapter->cmd_queued)
- return 0;
-
- cmd_queued = adapter->cmd_queued;
- adapter->cmd_queued = NULL;
dev_dbg(adapter->dev, "cmd pending\n");
atomic_inc(&adapter->cmd_pending);
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index 156b527..5847d6d 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -851,6 +851,7 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb,
if (unlikely(!_urb)) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"Can't allocate urb. Drop skb!\n");
+ kfree_skb(skb);
return;
}
_rtl_submit_tx_urb(hw, _urb);
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 79d87d8..fad0302 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -359,6 +359,7 @@ static void __sco_sock_close(struct sock *sk)
sco_chan_del(sk, ECONNRESET);
break;
+ case BT_CONNECT2:
case BT_CONNECT:
case BT_DISCONN:
sco_chan_del(sk, ECONNRESET);
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply related
* Re: [PATCH] igb: fix PHC stopping on max freq
From: Jiri Benc @ 2013-03-20 19:11 UTC (permalink / raw)
To: Vick, Matthew
Cc: netdev@vger.kernel.org, e1000-devel@lists.sourceforge.net,
Kirsher, Jeffrey T, Stefan Assmann, Miroslav Lichvar
In-Reply-To: <CD6E221E.1657D%matthew.vick@intel.com>
On Tue, 19 Mar 2013 21:17:25 +0000, Vick, Matthew wrote:
> Good catch on this, Jiri! I know the math works out the same, but I'd
> prefer it if you changed the max_adj value to 999999999, since that is
> technically what we can accept before we have any issues. If you re-submit
> with this change, I'll add my ACK and we can run it through our internal
> testing. Thanks!
But the real maximum value is actually 999999881, as anything higher
than that would be capped to 999999881 by the driver. I don't think the
driver should advertise higher max_adj than it is able to fulfill,
otherwise there would be no need for the field.
Jiri
--
Jiri Benc
^ permalink raw reply
* Re: [PATCH] fec: Fix the build as module
From: Uwe Kleine-König @ 2013-03-20 19:16 UTC (permalink / raw)
To: Fabio Estevam; +Cc: davem, Frank.Li, netdev, Fabio Estevam
In-Reply-To: <1363803572-17039-1-git-send-email-festevam@gmail.com>
Hello,
On Wed, Mar 20, 2013 at 03:19:32PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Since commit ff43da86c69 (NET: FEC: dynamtic check DMA desc buff type) the
> following build error happens when CONFIG_FEC=m
>
> ERROR: "fec_ptp_init" [drivers/net/ethernet/freescale/fec.ko] undefined!
> ERROR: "fec_ptp_ioctl" [drivers/net/ethernet/freescale/fec.ko] undefined!
> ERROR: "fec_ptp_start_cyclecounter" [drivers/net/ethernet/freescale/fec.ko] undefined!
>
> Fix it by exporting the required fec_ptp symbols.
IMHO this is not sensible. There is no need to make the fec driver 2
modules. Just loading one is impossible (fec.ko) or useless
(fec_ptp.ko). That's why I suggested to make them a single module.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply
* Re: pull request: wireless 2013-03-20
From: David Miller @ 2013-03-20 19:21 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <20130320191107.GA9978@tuxdriver.com>
From: "John W. Linville" <linville@tuxdriver.com>
Date: Wed, 20 Mar 2013 15:11:08 -0400
> I present to you another batch of fixes intended for the 3.9 stream...
>
> On the bluetooth bits, Gustavo says:
>
> "I put together 3 fixes intended for 3.9, there are support for two
> new devices and a NULL dereference fix in the SCO code."
>
> Amitkumar Karwar fixes a command queueing race in mwifiex.
>
> Bing Zhao provides a pair of mwifiex related to cleaning-up before
> a shutdown.
>
> Felix Fietkau provides an ath9k fix for a regression caused by an
> earlier calibration fix, and another ath9k fix to avoid race conditions
> that unnecessarily lead to chip resets.
>
> Jussi Kivilinna prevents and skbuff leak in rtlwifi.
>
> Stanislaw Gruszka corrects a length paramater for a DMA buffer mapping
> operation in iwlegacy.
Pulled, thanks John!
^ permalink raw reply
* Re: [PATCH v2] chelsio: use netdev_alloc_skb_ip_align
From: David Miller @ 2013-03-20 19:25 UTC (permalink / raw)
To: stephen; +Cc: eric.dumazet, netdev
In-Reply-To: <20130320120241.19314ab6@nehalam.linuxnetplumber.net>
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Wed, 20 Mar 2013 12:02:41 -0700
> Use netdev_alloc_sk_ip_align in the case where packet is copied.
> This handles case where NET_IP_ALIGN == 0 as well as adding required header
> padding.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Applied, thanks Stephen.
^ permalink raw reply
* sfc fixes for stable (retry)
From: Ben Hutchings @ 2013-03-20 19:26 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, scrum-linux
[-- Attachment #1: Type: text/plain, Size: 2208 bytes --]
David,
Please consider the attached patchsets for 3.0.y, 3.2.y, 3.4.y and 3.8.y
respectively.
They contain backports of the following fixes, respectively:
3.0 4017dbdc14af sfc: Fix loop condition for efx_filter_search() when !for_insert
3.0 a659b2a94d87 sfc: Fix Siena mac statistics on big endian platforms
3.0 3.2 3.4 3dca9d2dc285 sfc: Do not attempt to flush queues if DMA is disabled
3.0 3.2 3.4 bfeed902946a sfc: Convert firmware subtypes to native byte order in efx_mcdi_get_board_cfg()
3.4 9724a8504c87 sfc: Add parentheses around use of bitfield macro arguments
3.4 0a6e5008a9df sfc: Fix MCDI structure field lookup
3.0 3.2 a606f4325dca sfc: Disable flow control during flushes
3.0 3.2 3.4 d5e8cc6c946e sfc: Really disable flow control while flushing
3.0 3.2 3.4 525d9e824018 sfc: Work-around flush timeout when flushes have completed
3.0 3.2 3.4 c2f3b8e3a44b sfc: lock TX queues when calling netif_device_detach()
3.0 3.2 3.4 ebf98e797b4e sfc: Fix timekeeping in efx_mcdi_poll()
3.4 d4f2cecce138 sfc: Disable VF queues during register self-test
3.4 450783747f42 sfc: Avoid generating over-length MC_CMD_FLUSH_RX_QUEUES request
3.4 ef492f11efed sfc: Correctly initialise reset_method in siena_test_chip()
3.8 56567c6f8751 drivers/net/ethernet/sfc/ptp.c: adjust duplicate test
3.0 3.2 3.4 3.8 3a68f19d7afb sfc: Properly sync RX DMA buffer when it is not the last in the page
3.0 3.2 3.4 3.8 b590ace09d51 sfc: Fix efx_rx_buf_offset() in the presence of swiotlb
3.0 3.2 3.4 3.8 c73e787a8db9 sfc: Correct efx_rx_buffer::page_offset when EFX_PAGE_IP_ALIGN != 0
3.0 3.2 3.4 3.8 29c69a488264 sfc: Detach net device when stopping queues for reconfiguration
3.0 3.2 3.4 3.8 35205b211c8d sfc: Disable soft interrupt handling during efx_device_detach_sync()
3.0 3.2 3.4 3.8 fae8563b25f7 sfc: Only use TX push if a single descriptor is to be written
All of these are now in Linus's tree.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
[-- Attachment #2: sfc_3.0.mbox --]
[-- Type: application/mbox, Size: 35238 bytes --]
[-- Attachment #3: sfc_3.2.mbox --]
[-- Type: application/mbox, Size: 31246 bytes --]
[-- Attachment #4: sfc_3.4.mbox --]
[-- Type: application/mbox, Size: 51892 bytes --]
[-- Attachment #5: sfc_3.8.mbox --]
[-- Type: application/mbox, Size: 13636 bytes --]
^ permalink raw reply
* Re: [PATCH] fec: Fix the build as module
From: Fabio Estevam @ 2013-03-20 19:27 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: davem, Frank.Li, netdev, Fabio Estevam
In-Reply-To: <20130320191630.GJ20530@pengutronix.de>
On Wed, Mar 20, 2013 at 4:16 PM, Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> Hello,
>
> On Wed, Mar 20, 2013 at 03:19:32PM -0300, Fabio Estevam wrote:
>> From: Fabio Estevam <fabio.estevam@freescale.com>
>>
>> Since commit ff43da86c69 (NET: FEC: dynamtic check DMA desc buff type) the
>> following build error happens when CONFIG_FEC=m
>>
>> ERROR: "fec_ptp_init" [drivers/net/ethernet/freescale/fec.ko] undefined!
>> ERROR: "fec_ptp_ioctl" [drivers/net/ethernet/freescale/fec.ko] undefined!
>> ERROR: "fec_ptp_start_cyclecounter" [drivers/net/ethernet/freescale/fec.ko] undefined!
>>
>> Fix it by exporting the required fec_ptp symbols.
> IMHO this is not sensible. There is no need to make the fec driver 2
> modules. Just loading one is impossible (fec.ko) or useless
> (fec_ptp.ko). That's why I suggested to make them a single module.
Ok, I wil do as you suggested on a subsequent patch.
Regards,
Fabio Estevam
^ permalink raw reply
* Re: [PATCH] net: Add socket() system call self test.
From: Daniel Baluta @ 2013-03-20 19:29 UTC (permalink / raw)
To: David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA, Alexandru Copot
In-Reply-To: <20130320.151055.2179062291630664090.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
On Wed, Mar 20, 2013 at 9:10 PM, David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> wrote:
> From: Daniel Baluta <daniel.baluta-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Date: Wed, 20 Mar 2013 00:14:05 +0200
>
>> I think it's better to have a selftests/net directory dedicated for
>> networking tests. Over time
>> the number of net-{x} directories may become very large.
>
> Good idea, here's what I've done for now:
>
> ====================
> net: Move selftests to common net/ subdirectory.
>
> Suggested-by: Daniel Baluta <daniel.baluta-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> ---
> tools/testing/selftests/Makefile | 3 +--
> tools/testing/selftests/net-socket/Makefile | 16 ----------------
> tools/testing/selftests/{net-afpacket => net}/Makefile | 9 +++++----
> .../selftests/{net-afpacket => net}/psock_fanout.c | 0
> .../selftests/{net-afpacket => net}/run_afpackettests | 0
> .../selftests/{net-socket => net}/run_netsocktests | 0
> tools/testing/selftests/{net-socket => net}/socket.c | 0
> 7 files changed, 6 insertions(+), 22 deletions(-)
> delete mode 100644 tools/testing/selftests/net-socket/Makefile
> rename tools/testing/selftests/{net-afpacket => net}/Makefile (55%)
> rename tools/testing/selftests/{net-afpacket => net}/psock_fanout.c (100%)
> rename tools/testing/selftests/{net-afpacket => net}/run_afpackettests (100%)
> rename tools/testing/selftests/{net-socket => net}/run_netsocktests (100%)
> rename tools/testing/selftests/{net-socket => net}/socket.c (100%)
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 7f50078..a480593 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -5,8 +5,7 @@ TARGETS += vm
> TARGETS += cpu-hotplug
> TARGETS += memory-hotplug
> TARGETS += efivarfs
> -TARGETS += net-socket
> -TARGETS += net-afpacket
> +TARGETS += net
>
> all:
> for TARGET in $(TARGETS); do \
> diff --git a/tools/testing/selftests/net-socket/Makefile b/tools/testing/selftests/net-socket/Makefile
> deleted file mode 100644
> index 2450fd8..0000000
> --- a/tools/testing/selftests/net-socket/Makefile
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -# Makefile for net-socket selftests
> -
> -CC = $(CROSS_COMPILE)gcc
> -CFLAGS = -Wall
> -
> -NET_SOCK_PROGS = socket
> -
> -all: $(NET_SOCK_PROGS)
> -%: %.c
> - $(CC) $(CFLAGS) -o $@ $^
> -
> -run_tests: all
> - @/bin/sh ./run_netsocktests || echo "sockettests: [FAIL]"
> -
> -clean:
> - $(RM) $(NET_SOCK_PROGS)
> diff --git a/tools/testing/selftests/net-afpacket/Makefile b/tools/testing/selftests/net/Makefile
> similarity index 55%
> rename from tools/testing/selftests/net-afpacket/Makefile
> rename to tools/testing/selftests/net/Makefile
> index 45f2ffb..bd6e272 100644
> --- a/tools/testing/selftests/net-afpacket/Makefile
> +++ b/tools/testing/selftests/net/Makefile
> @@ -1,18 +1,19 @@
> -# Makefile for net-socket selftests
> +# Makefile for net selftests
>
> CC = $(CROSS_COMPILE)gcc
> CFLAGS = -Wall
>
> CFLAGS += -I../../../../usr/include/
>
> -AF_PACKET_PROGS = psock_fanout
> +NET_PROGS = socket psock_fanout
>
> -all: $(AF_PACKET_PROGS)
> +all: $(NET_PROGS)
> %: %.c
> $(CC) $(CFLAGS) -o $@ $^
>
> run_tests: all
> + @/bin/sh ./run_netsocktests || echo "sockettests: [FAIL]"
> @/bin/sh ./run_afpackettests || echo "afpackettests: [FAIL]"
>
> clean:
> - $(RM) $(AF_PACKET_PROGS)
> + $(RM) $(NET_PROGS)
> diff --git a/tools/testing/selftests/net-afpacket/psock_fanout.c b/tools/testing/selftests/net/psock_fanout.c
> similarity index 100%
> rename from tools/testing/selftests/net-afpacket/psock_fanout.c
> rename to tools/testing/selftests/net/psock_fanout.c
> diff --git a/tools/testing/selftests/net-afpacket/run_afpackettests b/tools/testing/selftests/net/run_afpackettests
> similarity index 100%
> rename from tools/testing/selftests/net-afpacket/run_afpackettests
> rename to tools/testing/selftests/net/run_afpackettests
> diff --git a/tools/testing/selftests/net-socket/run_netsocktests b/tools/testing/selftests/net/run_netsocktests
> similarity index 100%
> rename from tools/testing/selftests/net-socket/run_netsocktests
> rename to tools/testing/selftests/net/run_netsocktests
> diff --git a/tools/testing/selftests/net-socket/socket.c b/tools/testing/selftests/net/socket.c
> similarity index 100%
> rename from tools/testing/selftests/net-socket/socket.c
> rename to tools/testing/selftests/net/socket.c
> --
> 1.7.11.7
>
Looks good. Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" 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
* [PATCH net-next] filter: add minimal BPF JIT image disassembler
From: Daniel Borkmann @ 2013-03-20 19:31 UTC (permalink / raw)
To: davem; +Cc: netdev, Eric Dumazet
This is a minimal stand-alone user space helper, that allows for debugging or
verification of emitted BPF JIT images. This is in particular useful for
emitted opcode debugging, since minor bugs in the JIT compiler can be fatal.
The disassembler is architecture generic and uses libopcodes and libbfd.
How to get to the disassembly, example:
1) `echo 2 > /proc/sys/net/core/bpf_jit_enable`
2) Load a BPF filter (e.g. `tcpdump -p -n -s 0 -i eth1 host 192.168.20.0/24`)
3) Run e.g. `bpf_jit_disasm -o` to disassemble the most recent JIT code output
`bpf_jit_disasm -o` will display the related opcodes to a particular instruction
as well. Example for x86_64:
$./bpf_jit_disasm
94 bytes emitted from JIT compiler (pass:3, flen:9)
ffffffffa0356000 + <x>:
0: push %rbp
1: mov %rsp,%rbp
4: sub $0x60,%rsp
8: mov %rbx,-0x8(%rbp)
c: mov 0x68(%rdi),%r9d
10: sub 0x6c(%rdi),%r9d
14: mov 0xe0(%rdi),%r8
1b: mov $0xc,%esi
20: callq 0xffffffffe0d01b71
25: cmp $0x86dd,%eax
2a: jne 0x000000000000003d
2c: mov $0x14,%esi
31: callq 0xffffffffe0d01b8d
36: cmp $0x6,%eax
[...]
5c: leaveq
5d: retq
$ ./bpf_jit_disasm -o
94 bytes emitted from JIT compiler (pass:3, flen:9)
ffffffffa0356000 + <x>:
0: push %rbp
55
1: mov %rsp,%rbp
48 89 e5
4: sub $0x60,%rsp
48 83 ec 60
8: mov %rbx,-0x8(%rbp)
48 89 5d f8
c: mov 0x68(%rdi),%r9d
44 8b 4f 68
10: sub 0x6c(%rdi),%r9d
44 2b 4f 6c
[...]
5c: leaveq
c9
5d: retq
c3
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Eric Dumazet <edumazet@google.com>
---
I have added Eric's Acked-by, since nothing in the code has changed, only the
location that we agreed upon, namely tools/net/. I hope that's okay.
v1 -> v2: change location of file from scripts/ to tools/net/
tools/net/bpf_jit_disasm.c | 216 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 216 insertions(+)
create mode 100644 tools/net/bpf_jit_disasm.c
diff --git a/tools/net/bpf_jit_disasm.c b/tools/net/bpf_jit_disasm.c
new file mode 100644
index 0000000..1fe9fb5
--- /dev/null
+++ b/tools/net/bpf_jit_disasm.c
@@ -0,0 +1,216 @@
+/*
+ * Minimal BPF JIT image disassembler
+ *
+ * Disassembles BPF JIT compiler emitted opcodes back to asm insn's for
+ * debugging or verification purposes.
+ *
+ * There is no Makefile. Compile with
+ *
+ * `gcc -Wall -O2 bpf_jit_disasm.c -o bpf_jit_disasm -lopcodes -lbfd -ldl`
+ *
+ * or similar.
+ *
+ * To get the disassembly of the JIT code, do the following:
+ *
+ * 1) `echo 2 > /proc/sys/net/core/bpf_jit_enable`
+ * 2) Load a BPF filter (e.g. `tcpdump -p -n -s 0 -i eth1 host 192.168.20.0/24`)
+ * 3) Run e.g. `./bpf_jit_disasm -o` to read out the last JIT code
+ *
+ * Copyright 2013 Daniel Borkmann <borkmann@redhat.com>
+ * Licensed under the GNU General Public License, version 2.0 (GPLv2)
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <unistd.h>
+#include <string.h>
+#include <bfd.h>
+#include <dis-asm.h>
+#include <sys/klog.h>
+#include <sys/types.h>
+#include <regex.h>
+
+#define VERSION_STRING "1.0"
+
+static void get_exec_path(char *tpath, size_t size)
+{
+ char *path;
+ ssize_t len;
+
+ snprintf(tpath, size, "/proc/%d/exe", (int) getpid());
+ tpath[size - 1] = 0;
+
+ path = strdup(tpath);
+ assert(path);
+
+ len = readlink(path, tpath, size);
+ tpath[len] = 0;
+
+ free(path);
+}
+
+static void get_asm_insns(uint8_t *image, size_t len, unsigned long base,
+ int opcodes)
+{
+ int count, i, pc = 0;
+ char tpath[256];
+ struct disassemble_info info;
+ disassembler_ftype disassemble;
+ bfd *bfdf;
+
+ memset(tpath, 0, sizeof(tpath));
+ get_exec_path(tpath, sizeof(tpath));
+
+ bfdf = bfd_openr(tpath, NULL);
+ assert(bfdf);
+ assert(bfd_check_format(bfdf, bfd_object));
+
+ init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf);
+ info.arch = bfd_get_arch(bfdf);
+ info.mach = bfd_get_mach(bfdf);
+ info.buffer = image;
+ info.buffer_length = len;
+
+ disassemble_init_for_target(&info);
+
+ disassemble = disassembler(bfdf);
+ assert(disassemble);
+
+ do {
+ printf("%4x:\t", pc);
+
+ count = disassemble(pc, &info);
+
+ if (opcodes) {
+ printf("\n\t");
+ for (i = 0; i < count; ++i)
+ printf("%02x ", (uint8_t) image[pc + i]);
+ }
+ printf("\n");
+
+ pc += count;
+ } while(count > 0 && pc < len);
+
+ bfd_close(bfdf);
+}
+
+static char *get_klog_buff(int *klen)
+{
+ int ret, len = klogctl(10, NULL, 0);
+ char *buff = malloc(len);
+
+ assert(buff && klen);
+ ret = klogctl(3, buff, len);
+ assert(ret >= 0);
+ *klen = ret;
+
+ return buff;
+}
+
+static void put_klog_buff(char *buff)
+{
+ free(buff);
+}
+
+static int get_last_jit_image(char *haystack, size_t hlen,
+ uint8_t *image, size_t ilen,
+ unsigned long *base)
+{
+ char *ptr, *pptr, *tmp;
+ off_t off = 0;
+ int ret, flen, proglen, pass, ulen = 0;
+ regmatch_t pmatch[1];
+ regex_t regex;
+
+ if (hlen == 0)
+ return 0;
+
+ ret = regcomp(®ex, "flen=[[:alnum:]]+ proglen=[[:digit:]]+ "
+ "pass=[[:digit:]]+ image=[[:xdigit:]]+", REG_EXTENDED);
+ assert(ret == 0);
+
+ ptr = haystack;
+ while (1) {
+ ret = regexec(®ex, ptr, 1, pmatch, 0);
+ if (ret == 0) {
+ ptr += pmatch[0].rm_eo;
+ off += pmatch[0].rm_eo;
+ assert(off < hlen);
+ } else
+ break;
+ }
+
+ ptr = haystack + off - (pmatch[0].rm_eo - pmatch[0].rm_so);
+ ret = sscanf(ptr, "flen=%d proglen=%d pass=%d image=%lx",
+ &flen, &proglen, &pass, base);
+ if (ret != 4)
+ return 0;
+
+ tmp = ptr = haystack + off;
+ while ((ptr = strtok(tmp, "\n")) != NULL && ulen < ilen) {
+ tmp = NULL;
+ if (!strstr(ptr, "JIT code"))
+ continue;
+ pptr = ptr;
+ while ((ptr = strstr(pptr, ":")))
+ pptr = ptr + 1;
+ ptr = pptr;
+ do {
+ image[ulen++] = (uint8_t) strtoul(pptr, &pptr, 16);
+ if (ptr == pptr || ulen >= ilen) {
+ ulen--;
+ break;
+ }
+ ptr = pptr;
+ } while (1);
+ }
+
+ assert(ulen == proglen);
+ printf("%d bytes emitted from JIT compiler (pass:%d, flen:%d)\n",
+ proglen, pass, flen);
+ printf("%lx + <x>:\n", *base);
+
+ regfree(®ex);
+ return ulen;
+}
+
+static void help(void)
+{
+ printf("Usage: bpf_jit_disasm [-ohv]\n");
+ printf("Version %s, written by Daniel Borkmann <borkmann@redhat.com>\n",
+ VERSION_STRING);
+ printf(" -o Include opcodes in output\n");
+ printf(" -h|-v Show help/version\n");
+ exit(0);
+}
+
+int main(int argc, char **argv)
+{
+ int len, klen, opcodes = 0;
+ char *kbuff;
+ unsigned long base;
+ uint8_t image[4096];
+
+ if (argc > 1) {
+ if (!strncmp("-o", argv[argc - 1], 2))
+ opcodes = 1;
+ if (!strncmp("-h", argv[argc - 1], 2) ||
+ !strncmp("-v", argv[argc - 1], 2))
+ help();
+ }
+
+ bfd_init();
+ memset(image, 0, sizeof(image));
+
+ kbuff = get_klog_buff(&klen);
+
+ len = get_last_jit_image(kbuff, klen, image, sizeof(image), &base);
+ if (len > 0 && base > 0)
+ get_asm_insns(image, len, base, opcodes);
+
+ put_klog_buff(kbuff);
+
+ return 0;
+}
--
1.7.11.7
^ permalink raw reply related
* Re: [PATCH net-next] filter: add minimal BPF JIT image disassembler
From: David Miller @ 2013-03-20 19:42 UTC (permalink / raw)
To: dborkman; +Cc: netdev, edumazet
In-Reply-To: <1363807913-4725-1-git-send-email-dborkman@redhat.com>
From: Daniel Borkmann <dborkman@redhat.com>
Date: Wed, 20 Mar 2013 20:31:53 +0100
> This is a minimal stand-alone user space helper, that allows for debugging or
> verification of emitted BPF JIT images.
What makefile target will build this tool?
^ permalink raw reply
* Re: sfc fixes for stable (retry)
From: David Miller @ 2013-03-20 19:43 UTC (permalink / raw)
To: bhutchings; +Cc: netdev, linux-net-drivers, scrum-linux
In-Reply-To: <1363807614.2677.22.camel@bwh-desktop.uk.solarflarecom.com>
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Wed, 20 Mar 2013 19:26:54 +0000
> Please consider the attached patchsets for 3.0.y, 3.2.y, 3.4.y and 3.8.y
> respectively.
>
> They contain backports of the following fixes, respectively:
...
> All of these are now in Linus's tree.
Ok, will queue them up into my next -stable submission.
Thanks for doing all of this work Ben.
^ permalink raw reply
* Re: [Xen-devel] [PATCH 2/4] xen-netfront: drop skb when skb->len > 65535
From: David Vrabel @ 2013-03-20 20:02 UTC (permalink / raw)
To: David Vrabel
Cc: Ian Campbell, netdev@vger.kernel.org, annie.li@oracle.com,
konrad.wilk@oracle.com, Wei Liu, xen-devel@lists.xen.org
In-Reply-To: <51471DE0.9060506@citrix.com>
On 18/03/13 14:00, David Vrabel wrote:
> On 18/03/13 13:48, Ian Campbell wrote:
>> On Mon, 2013-03-18 at 13:46 +0000, David Vrabel wrote:
>>> On 18/03/13 10:35, Wei Liu wrote:
>>>> The `size' field of Xen network wire format is uint16_t, anything bigger than
>>>> 65535 will cause overflow.
>>>
>>> The backend needs to be able to handle these bad packets without
>>> disconnecting the VIF -- we can't fix all the frontend drivers.
>>
>> Agreed, although that doesn't imply that we shouldn't fix the frontend
>> where we can -- such as upstream as Wei does here.
>
> Yes, frontends should be fixed where possible.
>
> This is what I came up with for the backend. I don't have time to look
> into it further but, Wei, feel free to use it as a starting point.
Got some time to test this (or more correctly, something similar with
XCP's kernel) and some fixes to the suggested patch are needed. See below.
> diff --git a/drivers/net/xen-netback/netback.c
> b/drivers/net/xen-netback/netback.c
> index cd49ba9..18e2671 100644
> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -899,10 +899,11 @@ static void netbk_fatal_tx_err(struct xenvif *vif)
> static int netbk_count_requests(struct xenvif *vif,
> struct xen_netif_tx_request *first,
> struct xen_netif_tx_request *txp,
> - int work_to_do)
> + int work_to_do, int idx)
idx should be of RING_IDX type.
> {
> RING_IDX cons = vif->tx.req_cons;
> int frags = 0;
> + bool drop = false;
>
> if (!(first->flags & XEN_NETTXF_more_data))
> return 0;
> @@ -922,10 +923,20 @@ static int netbk_count_requests(struct xenvif *vif,
>
> memcpy(txp, RING_GET_REQUEST(&vif->tx, cons + frags),
> sizeof(*txp));
> - if (txp->size > first->size) {
> - netdev_err(vif->dev, "Frag is bigger than frame.\n");
> - netbk_fatal_tx_err(vif);
> - return -EIO;
> +
> + /*
> + * If the guest submitted a frame >= 64 KiB then
> + * first->size overflowed and following frags will
> + * appear to be larger than the frame.
> + *
> + * This cannot be a fatal error as there are buggy
> + * frontends that do this.
> + *
> + * Consume all the frags and drop the packet.
> + */
> + if (!drop && txp->size > first->size) {
> + netdev_dbg(vif->dev, "Frag is bigger than frame.\n");
> + drop = true;
> }
>
> first->size -= txp->size;
> @@ -938,6 +949,12 @@ static int netbk_count_requests(struct xenvif *vif,
> return -EINVAL;
> }
> } while ((txp++)->flags & XEN_NETTXF_more_data);
> +
> + if (drop) {
> + netbk_tx_err(vif, txp, idx + frags);
This needs to be netbk_tx_err(vif, first, idx + frags) or the guest will
crash as we push a bunch of invalid responses.
David
> + return -EIO;
> + }
> +
> return frags;
> }
>
> @@ -1327,7 +1344,7 @@ static unsigned xen_netbk_tx_build_gops(struct
> xen_netbk *netbk)
> continue;
> }
>
> - ret = netbk_count_requests(vif, &txreq, txfrags, work_to_do);
> + ret = netbk_count_requests(vif, &txreq, txfrags, work_to_do, idx);
> if (unlikely(ret < 0))
> continue;
^ permalink raw reply
* [PATCH] fec: Unify fec_ptp.c and fec.c
From: Fabio Estevam @ 2013-03-20 20:11 UTC (permalink / raw)
To: davem; +Cc: Frank.Li, u.kleine-koenig, netdev, Fabio Estevam
From: Fabio Estevam <fabio.estevam@freescale.com>
Currently CONFIG_FEC=y generates two separate modules: fec_ptp.ko and fec.ko.
These modules cannot be used independently, so it is better to unify them.
Move fec_ptp.c code into fec.c and its definitions into fec.h.
Suggested-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/net/ethernet/freescale/Makefile | 2 +-
drivers/net/ethernet/freescale/fec.c | 315 ++++++++++++++++++++++++
drivers/net/ethernet/freescale/fec.h | 23 ++
drivers/net/ethernet/freescale/fec_ptp.c | 388 ------------------------------
4 files changed, 339 insertions(+), 389 deletions(-)
delete mode 100644 drivers/net/ethernet/freescale/fec_ptp.c
diff --git a/drivers/net/ethernet/freescale/Makefile b/drivers/net/ethernet/freescale/Makefile
index b7d58fe..3d1839a 100644
--- a/drivers/net/ethernet/freescale/Makefile
+++ b/drivers/net/ethernet/freescale/Makefile
@@ -2,7 +2,7 @@
# Makefile for the Freescale network device drivers.
#
-obj-$(CONFIG_FEC) += fec.o fec_ptp.o
+obj-$(CONFIG_FEC) += fec.o
obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx.o
ifeq ($(CONFIG_FEC_MPC52xx_MDIO),y)
obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx_phy.o
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 8ca2cf6..d5bea99 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -1586,6 +1586,321 @@ static const struct net_device_ops fec_netdev_ops = {
#endif
};
+/**
+ * fec_ptp_read - read raw cycle counter (to be used by time counter)
+ * @cc: the cyclecounter structure
+ *
+ * this function reads the cyclecounter registers and is called by the
+ * cyclecounter structure used to construct a ns counter from the
+ * arbitrary fixed point registers
+ */
+static cycle_t fec_ptp_read(const struct cyclecounter *cc)
+{
+ struct fec_enet_private *fep =
+ container_of(cc, struct fec_enet_private, cc);
+ u32 tempval;
+
+ tempval = readl(fep->hwp + FEC_ATIME_CTRL);
+ tempval |= FEC_T_CTRL_CAPTURE;
+ writel(tempval, fep->hwp + FEC_ATIME_CTRL);
+
+ return readl(fep->hwp + FEC_ATIME);
+}
+
+/**
+ * fec_ptp_start_cyclecounter - create the cycle counter from hw
+ * @ndev: network device
+ *
+ * this function initializes the timecounter and cyclecounter
+ * structures for use in generated a ns counter from the arbitrary
+ * fixed point cycles registers in the hardware.
+ */
+void fec_ptp_start_cyclecounter(struct net_device *ndev)
+{
+ struct fec_enet_private *fep = netdev_priv(ndev);
+ unsigned long flags;
+ int inc;
+
+ inc = 1000000000 / fep->cycle_speed;
+
+ /* grab the ptp lock */
+ spin_lock_irqsave(&fep->tmreg_lock, flags);
+
+ /* 1ns counter */
+ writel(inc << FEC_T_INC_OFFSET, fep->hwp + FEC_ATIME_INC);
+
+ /* use free running count */
+ writel(0, fep->hwp + FEC_ATIME_EVT_PERIOD);
+
+ writel(FEC_T_CTRL_ENABLE, fep->hwp + FEC_ATIME_CTRL);
+
+ memset(&fep->cc, 0, sizeof(fep->cc));
+ fep->cc.read = fec_ptp_read;
+ fep->cc.mask = CLOCKSOURCE_MASK(32);
+ fep->cc.shift = 31;
+ fep->cc.mult = FEC_CC_MULT;
+
+ /* reset the ns time counter */
+ timecounter_init(&fep->tc, &fep->cc, ktime_to_ns(ktime_get_real()));
+
+ spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+}
+
+/**
+ * fec_ptp_adjfreq - adjust ptp cycle frequency
+ * @ptp: the ptp clock structure
+ * @ppb: parts per billion adjustment from base
+ *
+ * Adjust the frequency of the ptp cycle counter by the
+ * indicated ppb from the base frequency.
+ *
+ * Because ENET hardware frequency adjust is complex,
+ * using software method to do that.
+ */
+static int fec_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
+{
+ u64 diff;
+ unsigned long flags;
+ int neg_adj = 0;
+ u32 mult = FEC_CC_MULT;
+
+ struct fec_enet_private *fep =
+ container_of(ptp, struct fec_enet_private, ptp_caps);
+
+ if (ppb < 0) {
+ ppb = -ppb;
+ neg_adj = 1;
+ }
+
+ diff = mult;
+ diff *= ppb;
+ diff = div_u64(diff, 1000000000ULL);
+
+ spin_lock_irqsave(&fep->tmreg_lock, flags);
+ /*
+ * dummy read to set cycle_last in tc to now.
+ * So use adjusted mult to calculate when next call
+ * timercounter_read.
+ */
+ timecounter_read(&fep->tc);
+
+ fep->cc.mult = neg_adj ? mult - diff : mult + diff;
+
+ spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+
+ return 0;
+}
+
+/**
+ * fec_ptp_adjtime
+ * @ptp: the ptp clock structure
+ * @delta: offset to adjust the cycle counter by
+ *
+ * adjust the timer by resetting the timecounter structure.
+ */
+static int fec_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
+{
+ struct fec_enet_private *fep =
+ container_of(ptp, struct fec_enet_private, ptp_caps);
+ unsigned long flags;
+ u64 now;
+
+ spin_lock_irqsave(&fep->tmreg_lock, flags);
+
+ now = timecounter_read(&fep->tc);
+ now += delta;
+
+ /* reset the timecounter */
+ timecounter_init(&fep->tc, &fep->cc, now);
+
+ spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+
+ return 0;
+}
+
+/**
+ * fec_ptp_gettime
+ * @ptp: the ptp clock structure
+ * @ts: timespec structure to hold the current time value
+ *
+ * read the timecounter and return the correct value on ns,
+ * after converting it into a struct timespec.
+ */
+static int fec_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
+{
+ struct fec_enet_private *adapter =
+ container_of(ptp, struct fec_enet_private, ptp_caps);
+ u64 ns;
+ u32 remainder;
+ unsigned long flags;
+
+ spin_lock_irqsave(&adapter->tmreg_lock, flags);
+ ns = timecounter_read(&adapter->tc);
+ spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
+
+ ts->tv_sec = div_u64_rem(ns, 1000000000ULL, &remainder);
+ ts->tv_nsec = remainder;
+
+ return 0;
+}
+
+/**
+ * fec_ptp_settime
+ * @ptp: the ptp clock structure
+ * @ts: the timespec containing the new time for the cycle counter
+ *
+ * reset the timecounter to use a new base value instead of the kernel
+ * wall timer value.
+ */
+static int fec_ptp_settime(struct ptp_clock_info *ptp,
+ const struct timespec *ts)
+{
+ struct fec_enet_private *fep =
+ container_of(ptp, struct fec_enet_private, ptp_caps);
+
+ u64 ns;
+ unsigned long flags;
+
+ ns = ts->tv_sec * 1000000000ULL;
+ ns += ts->tv_nsec;
+
+ spin_lock_irqsave(&fep->tmreg_lock, flags);
+ timecounter_init(&fep->tc, &fep->cc, ns);
+ spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+ return 0;
+}
+
+/**
+ * fec_ptp_enable
+ * @ptp: the ptp clock structure
+ * @rq: the requested feature to change
+ * @on: whether to enable or disable the feature
+ *
+ */
+static int fec_ptp_enable(struct ptp_clock_info *ptp,
+ struct ptp_clock_request *rq, int on)
+{
+ return -EOPNOTSUPP;
+}
+
+/**
+ * fec_ptp_hwtstamp_ioctl - control hardware time stamping
+ * @ndev: pointer to net_device
+ * @ifreq: ioctl data
+ * @cmd: particular ioctl requested
+ */
+int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
+{
+ struct fec_enet_private *fep = netdev_priv(ndev);
+
+ struct hwtstamp_config config;
+
+ if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
+ return -EFAULT;
+
+ /* reserved for future extensions */
+ if (config.flags)
+ return -EINVAL;
+
+ switch (config.tx_type) {
+ case HWTSTAMP_TX_OFF:
+ fep->hwts_tx_en = 0;
+ break;
+ case HWTSTAMP_TX_ON:
+ fep->hwts_tx_en = 1;
+ break;
+ default:
+ return -ERANGE;
+ }
+
+ switch (config.rx_filter) {
+ case HWTSTAMP_FILTER_NONE:
+ if (fep->hwts_rx_en)
+ fep->hwts_rx_en = 0;
+ config.rx_filter = HWTSTAMP_FILTER_NONE;
+ break;
+
+ default:
+ /*
+ * register RXMTRL must be set in order to do V1 packets,
+ * therefore it is not possible to time stamp both V1 Sync and
+ * Delay_Req messages and hardware does not support
+ * timestamping all packets => return error
+ */
+ fep->hwts_rx_en = 1;
+ config.rx_filter = HWTSTAMP_FILTER_ALL;
+ break;
+ }
+
+ return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
+ -EFAULT : 0;
+}
+
+/**
+ * fec_time_keep - call timecounter_read every second to avoid timer overrun
+ * because ENET just support 32bit counter, will timeout in 4s
+ */
+static void fec_time_keep(unsigned long _data)
+{
+ struct fec_enet_private *fep = (struct fec_enet_private *)_data;
+ u64 ns;
+ unsigned long flags;
+
+ spin_lock_irqsave(&fep->tmreg_lock, flags);
+ ns = timecounter_read(&fep->tc);
+ spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+
+ mod_timer(&fep->time_keep, jiffies + HZ);
+}
+
+/**
+ * fec_ptp_init
+ * @ndev: The FEC network adapter
+ *
+ * This function performs the required steps for enabling ptp
+ * support. If ptp support has already been loaded it simply calls the
+ * cyclecounter init routine and exits.
+ */
+
+void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev)
+{
+ struct fec_enet_private *fep = netdev_priv(ndev);
+
+ fep->ptp_caps.owner = THIS_MODULE;
+ snprintf(fep->ptp_caps.name, 16, "fec ptp");
+
+ fep->ptp_caps.max_adj = 250000000;
+ fep->ptp_caps.n_alarm = 0;
+ fep->ptp_caps.n_ext_ts = 0;
+ fep->ptp_caps.n_per_out = 0;
+ fep->ptp_caps.pps = 0;
+ fep->ptp_caps.adjfreq = fec_ptp_adjfreq;
+ fep->ptp_caps.adjtime = fec_ptp_adjtime;
+ fep->ptp_caps.gettime = fec_ptp_gettime;
+ fep->ptp_caps.settime = fec_ptp_settime;
+ fep->ptp_caps.enable = fec_ptp_enable;
+
+ fep->cycle_speed = clk_get_rate(fep->clk_ptp);
+
+ spin_lock_init(&fep->tmreg_lock);
+
+ fec_ptp_start_cyclecounter(ndev);
+
+ init_timer(&fep->time_keep);
+ fep->time_keep.data = (unsigned long)fep;
+ fep->time_keep.function = fec_time_keep;
+ fep->time_keep.expires = jiffies + HZ;
+ add_timer(&fep->time_keep);
+
+ fep->ptp_clock = ptp_clock_register(&fep->ptp_caps, &pdev->dev);
+ if (IS_ERR(fep->ptp_clock)) {
+ fep->ptp_clock = NULL;
+ pr_err("ptp_clock_register failed\n");
+ } else {
+ pr_info("registered PHC device on %s\n", ndev->name);
+ }
+}
+
/*
* XXX: We need to clean up on failure exits here.
*
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index eb43729..2a01f79 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -191,6 +191,29 @@ struct bufdesc_ex {
#define BD_ENET_RX_INT 0x00800000
#define BD_ENET_RX_PTP ((ushort)0x0400)
+/* FEC 1588 register bits */
+#define FEC_T_CTRL_SLAVE 0x00002000
+#define FEC_T_CTRL_CAPTURE 0x00000800
+#define FEC_T_CTRL_RESTART 0x00000200
+#define FEC_T_CTRL_PERIOD_RST 0x00000030
+#define FEC_T_CTRL_PERIOD_EN 0x00000010
+#define FEC_T_CTRL_ENABLE 0x00000001
+
+#define FEC_T_INC_MASK 0x0000007f
+#define FEC_T_INC_OFFSET 0
+#define FEC_T_INC_CORR_MASK 0x00007f00
+#define FEC_T_INC_CORR_OFFSET 8
+
+#define FEC_ATIME_CTRL 0x400
+#define FEC_ATIME 0x404
+#define FEC_ATIME_EVT_OFFSET 0x408
+#define FEC_ATIME_EVT_PERIOD 0x40c
+#define FEC_ATIME_CORR 0x410
+#define FEC_ATIME_INC 0x414
+#define FEC_TS_TIMESTAMP 0x418
+
+#define FEC_CC_MULT (1 << 31)
+
/* The FEC buffer descriptors track the ring buffers. The rx_bd_base and
* tx_bd_base always point to the base of the buffer descriptors. The
* cur_rx and cur_tx point to the currently available buffer.
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
deleted file mode 100644
index 0d8df40..0000000
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * Fast Ethernet Controller (ENET) PTP driver for MX6x.
- *
- * Copyright (C) 2012 Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/ptrace.h>
-#include <linux/errno.h>
-#include <linux/ioport.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/pci.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/spinlock.h>
-#include <linux/workqueue.h>
-#include <linux/bitops.h>
-#include <linux/io.h>
-#include <linux/irq.h>
-#include <linux/clk.h>
-#include <linux/platform_device.h>
-#include <linux/phy.h>
-#include <linux/fec.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
-#include <linux/of_gpio.h>
-#include <linux/of_net.h>
-
-#include "fec.h"
-
-/* FEC 1588 register bits */
-#define FEC_T_CTRL_SLAVE 0x00002000
-#define FEC_T_CTRL_CAPTURE 0x00000800
-#define FEC_T_CTRL_RESTART 0x00000200
-#define FEC_T_CTRL_PERIOD_RST 0x00000030
-#define FEC_T_CTRL_PERIOD_EN 0x00000010
-#define FEC_T_CTRL_ENABLE 0x00000001
-
-#define FEC_T_INC_MASK 0x0000007f
-#define FEC_T_INC_OFFSET 0
-#define FEC_T_INC_CORR_MASK 0x00007f00
-#define FEC_T_INC_CORR_OFFSET 8
-
-#define FEC_ATIME_CTRL 0x400
-#define FEC_ATIME 0x404
-#define FEC_ATIME_EVT_OFFSET 0x408
-#define FEC_ATIME_EVT_PERIOD 0x40c
-#define FEC_ATIME_CORR 0x410
-#define FEC_ATIME_INC 0x414
-#define FEC_TS_TIMESTAMP 0x418
-
-#define FEC_CC_MULT (1 << 31)
-/**
- * fec_ptp_read - read raw cycle counter (to be used by time counter)
- * @cc: the cyclecounter structure
- *
- * this function reads the cyclecounter registers and is called by the
- * cyclecounter structure used to construct a ns counter from the
- * arbitrary fixed point registers
- */
-static cycle_t fec_ptp_read(const struct cyclecounter *cc)
-{
- struct fec_enet_private *fep =
- container_of(cc, struct fec_enet_private, cc);
- u32 tempval;
-
- tempval = readl(fep->hwp + FEC_ATIME_CTRL);
- tempval |= FEC_T_CTRL_CAPTURE;
- writel(tempval, fep->hwp + FEC_ATIME_CTRL);
-
- return readl(fep->hwp + FEC_ATIME);
-}
-
-/**
- * fec_ptp_start_cyclecounter - create the cycle counter from hw
- * @ndev: network device
- *
- * this function initializes the timecounter and cyclecounter
- * structures for use in generated a ns counter from the arbitrary
- * fixed point cycles registers in the hardware.
- */
-void fec_ptp_start_cyclecounter(struct net_device *ndev)
-{
- struct fec_enet_private *fep = netdev_priv(ndev);
- unsigned long flags;
- int inc;
-
- inc = 1000000000 / fep->cycle_speed;
-
- /* grab the ptp lock */
- spin_lock_irqsave(&fep->tmreg_lock, flags);
-
- /* 1ns counter */
- writel(inc << FEC_T_INC_OFFSET, fep->hwp + FEC_ATIME_INC);
-
- /* use free running count */
- writel(0, fep->hwp + FEC_ATIME_EVT_PERIOD);
-
- writel(FEC_T_CTRL_ENABLE, fep->hwp + FEC_ATIME_CTRL);
-
- memset(&fep->cc, 0, sizeof(fep->cc));
- fep->cc.read = fec_ptp_read;
- fep->cc.mask = CLOCKSOURCE_MASK(32);
- fep->cc.shift = 31;
- fep->cc.mult = FEC_CC_MULT;
-
- /* reset the ns time counter */
- timecounter_init(&fep->tc, &fep->cc, ktime_to_ns(ktime_get_real()));
-
- spin_unlock_irqrestore(&fep->tmreg_lock, flags);
-}
-EXPORT_SYMBOL(fec_ptp_start_cyclecounter);
-
-/**
- * fec_ptp_adjfreq - adjust ptp cycle frequency
- * @ptp: the ptp clock structure
- * @ppb: parts per billion adjustment from base
- *
- * Adjust the frequency of the ptp cycle counter by the
- * indicated ppb from the base frequency.
- *
- * Because ENET hardware frequency adjust is complex,
- * using software method to do that.
- */
-static int fec_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
-{
- u64 diff;
- unsigned long flags;
- int neg_adj = 0;
- u32 mult = FEC_CC_MULT;
-
- struct fec_enet_private *fep =
- container_of(ptp, struct fec_enet_private, ptp_caps);
-
- if (ppb < 0) {
- ppb = -ppb;
- neg_adj = 1;
- }
-
- diff = mult;
- diff *= ppb;
- diff = div_u64(diff, 1000000000ULL);
-
- spin_lock_irqsave(&fep->tmreg_lock, flags);
- /*
- * dummy read to set cycle_last in tc to now.
- * So use adjusted mult to calculate when next call
- * timercounter_read.
- */
- timecounter_read(&fep->tc);
-
- fep->cc.mult = neg_adj ? mult - diff : mult + diff;
-
- spin_unlock_irqrestore(&fep->tmreg_lock, flags);
-
- return 0;
-}
-
-/**
- * fec_ptp_adjtime
- * @ptp: the ptp clock structure
- * @delta: offset to adjust the cycle counter by
- *
- * adjust the timer by resetting the timecounter structure.
- */
-static int fec_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
-{
- struct fec_enet_private *fep =
- container_of(ptp, struct fec_enet_private, ptp_caps);
- unsigned long flags;
- u64 now;
-
- spin_lock_irqsave(&fep->tmreg_lock, flags);
-
- now = timecounter_read(&fep->tc);
- now += delta;
-
- /* reset the timecounter */
- timecounter_init(&fep->tc, &fep->cc, now);
-
- spin_unlock_irqrestore(&fep->tmreg_lock, flags);
-
- return 0;
-}
-
-/**
- * fec_ptp_gettime
- * @ptp: the ptp clock structure
- * @ts: timespec structure to hold the current time value
- *
- * read the timecounter and return the correct value on ns,
- * after converting it into a struct timespec.
- */
-static int fec_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
-{
- struct fec_enet_private *adapter =
- container_of(ptp, struct fec_enet_private, ptp_caps);
- u64 ns;
- u32 remainder;
- unsigned long flags;
-
- spin_lock_irqsave(&adapter->tmreg_lock, flags);
- ns = timecounter_read(&adapter->tc);
- spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
-
- ts->tv_sec = div_u64_rem(ns, 1000000000ULL, &remainder);
- ts->tv_nsec = remainder;
-
- return 0;
-}
-
-/**
- * fec_ptp_settime
- * @ptp: the ptp clock structure
- * @ts: the timespec containing the new time for the cycle counter
- *
- * reset the timecounter to use a new base value instead of the kernel
- * wall timer value.
- */
-static int fec_ptp_settime(struct ptp_clock_info *ptp,
- const struct timespec *ts)
-{
- struct fec_enet_private *fep =
- container_of(ptp, struct fec_enet_private, ptp_caps);
-
- u64 ns;
- unsigned long flags;
-
- ns = ts->tv_sec * 1000000000ULL;
- ns += ts->tv_nsec;
-
- spin_lock_irqsave(&fep->tmreg_lock, flags);
- timecounter_init(&fep->tc, &fep->cc, ns);
- spin_unlock_irqrestore(&fep->tmreg_lock, flags);
- return 0;
-}
-
-/**
- * fec_ptp_enable
- * @ptp: the ptp clock structure
- * @rq: the requested feature to change
- * @on: whether to enable or disable the feature
- *
- */
-static int fec_ptp_enable(struct ptp_clock_info *ptp,
- struct ptp_clock_request *rq, int on)
-{
- return -EOPNOTSUPP;
-}
-
-/**
- * fec_ptp_hwtstamp_ioctl - control hardware time stamping
- * @ndev: pointer to net_device
- * @ifreq: ioctl data
- * @cmd: particular ioctl requested
- */
-int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
-{
- struct fec_enet_private *fep = netdev_priv(ndev);
-
- struct hwtstamp_config config;
-
- if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
- return -EFAULT;
-
- /* reserved for future extensions */
- if (config.flags)
- return -EINVAL;
-
- switch (config.tx_type) {
- case HWTSTAMP_TX_OFF:
- fep->hwts_tx_en = 0;
- break;
- case HWTSTAMP_TX_ON:
- fep->hwts_tx_en = 1;
- break;
- default:
- return -ERANGE;
- }
-
- switch (config.rx_filter) {
- case HWTSTAMP_FILTER_NONE:
- if (fep->hwts_rx_en)
- fep->hwts_rx_en = 0;
- config.rx_filter = HWTSTAMP_FILTER_NONE;
- break;
-
- default:
- /*
- * register RXMTRL must be set in order to do V1 packets,
- * therefore it is not possible to time stamp both V1 Sync and
- * Delay_Req messages and hardware does not support
- * timestamping all packets => return error
- */
- fep->hwts_rx_en = 1;
- config.rx_filter = HWTSTAMP_FILTER_ALL;
- break;
- }
-
- return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
- -EFAULT : 0;
-}
-EXPORT_SYMBOL(fec_ptp_ioctl);
-
-/**
- * fec_time_keep - call timecounter_read every second to avoid timer overrun
- * because ENET just support 32bit counter, will timeout in 4s
- */
-static void fec_time_keep(unsigned long _data)
-{
- struct fec_enet_private *fep = (struct fec_enet_private *)_data;
- u64 ns;
- unsigned long flags;
-
- spin_lock_irqsave(&fep->tmreg_lock, flags);
- ns = timecounter_read(&fep->tc);
- spin_unlock_irqrestore(&fep->tmreg_lock, flags);
-
- mod_timer(&fep->time_keep, jiffies + HZ);
-}
-
-/**
- * fec_ptp_init
- * @ndev: The FEC network adapter
- *
- * This function performs the required steps for enabling ptp
- * support. If ptp support has already been loaded it simply calls the
- * cyclecounter init routine and exits.
- */
-
-void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev)
-{
- struct fec_enet_private *fep = netdev_priv(ndev);
-
- fep->ptp_caps.owner = THIS_MODULE;
- snprintf(fep->ptp_caps.name, 16, "fec ptp");
-
- fep->ptp_caps.max_adj = 250000000;
- fep->ptp_caps.n_alarm = 0;
- fep->ptp_caps.n_ext_ts = 0;
- fep->ptp_caps.n_per_out = 0;
- fep->ptp_caps.pps = 0;
- fep->ptp_caps.adjfreq = fec_ptp_adjfreq;
- fep->ptp_caps.adjtime = fec_ptp_adjtime;
- fep->ptp_caps.gettime = fec_ptp_gettime;
- fep->ptp_caps.settime = fec_ptp_settime;
- fep->ptp_caps.enable = fec_ptp_enable;
-
- fep->cycle_speed = clk_get_rate(fep->clk_ptp);
-
- spin_lock_init(&fep->tmreg_lock);
-
- fec_ptp_start_cyclecounter(ndev);
-
- init_timer(&fep->time_keep);
- fep->time_keep.data = (unsigned long)fep;
- fep->time_keep.function = fec_time_keep;
- fep->time_keep.expires = jiffies + HZ;
- add_timer(&fep->time_keep);
-
- fep->ptp_clock = ptp_clock_register(&fep->ptp_caps, &pdev->dev);
- if (IS_ERR(fep->ptp_clock)) {
- fep->ptp_clock = NULL;
- pr_err("ptp_clock_register failed\n");
- } else {
- pr_info("registered PHC device on %s\n", ndev->name);
- }
-}
-EXPORT_SYMBOL(fec_ptp_init);
--
1.7.9.5
^ permalink raw reply related
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