* [PATCH 5/7] ixgbe: use pcie_capability_read_word() to simplify code
From: Yijing Wang @ 2013-09-03 7:35 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Gavin Shan, Bjorn Helgaas,
James E.J. Bottomley, David S. Miller
Cc: e1000-devel, linux-pci, Hanjun Guo, linux-kernel, netdev,
Yijing Wang
In-Reply-To: <1378193715-25328-1-git-send-email-wangyijing@huawei.com>
use pcie_capability_read_word() to simplify code.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Cc: e1000-devel@lists.sourceforge.net
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index bad8f14..bfa0b06 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -152,7 +152,6 @@ MODULE_VERSION(DRV_VERSION);
static int ixgbe_read_pci_cfg_word_parent(struct ixgbe_adapter *adapter,
u32 reg, u16 *value)
{
- int pos = 0;
struct pci_dev *parent_dev;
struct pci_bus *parent_bus;
@@ -164,11 +163,10 @@ static int ixgbe_read_pci_cfg_word_parent(struct ixgbe_adapter *adapter,
if (!parent_dev)
return -1;
- pos = pci_find_capability(parent_dev, PCI_CAP_ID_EXP);
- if (!pos)
+ if (!pci_is_pcie(parent_dev))
return -1;
- pci_read_config_word(parent_dev, pos + reg, value);
+ pcie_capability_read_word(parent_dev, reg, value);
return 0;
}
--
1.7.1
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
^ permalink raw reply related
* [PATCH net] bridge: netfiler: update find_inlist_lock_noload() more accurate
From: Ding Tianhong @ 2013-09-03 7:15 UTC (permalink / raw)
To: Bart De Schuymer, Pablo Neira Ayuso, Patrick McHardy,
Jozsef Kadlecsik, Stephen Hemminger, David S. Miller, bridge,
netfilter-devel, Netdev, Baoquan He
Baoquan He <baoquan.he@gmail.com> has report a problem which occurred by the following command:
make SUBDIRS=net/bridge/netfilter/
cp /net/bridge/netfilter/ebtables.ko
/lib/modules/3.11.0-rc7+/kernel/net/bridge/netfilter/ebtables.ko
depmod
modprobe ebtables.ko
reboot
----------------------------------------------------------------------
[ 48.895000] BUG: soft lockup - CPU#1 stuck for 22s! [ebtables:444]
[ 48.901191] Modules linked in: bnep(F) bluetooth(F) ebtables(F)
ip6table_filter(F) ip6_tables(F) rfkill(F) snd_hda_intel(F+)
snd_hda_codec(F) snd_hwdep(F) snd_seq(F) sn)
[ 48.950034] CPU: 1 PID: 444 Comm: ebtables Tainted: GF D
3.11.0-rc7+ #1
[ 48.957433] Hardware name: Hewlett-Packard HP Z420 Workstation/1589,
BIOS J61 v01.02 03/09/2012
[ 48.966131] task: ffff88040c2dc650 ti: ffff8804187d2000 task.ti:
ffff8804187d2000
[ 48.973610] RIP: 0010:[<ffffffff812e57a7>] [<ffffffff812e57a7>]
strcmp+0x27/0x40
[ 48.981119] RSP: 0018:ffff8804187d3db8 EFLAGS: 00000246
[ 48.986430] RAX: 0000000000000000 RBX: 00007fffda942730 RCX:
ffff8804187d3fd8
[ 48.993566] RDX: 0000000000000000 RSI: ffff8804187d3e01 RDI:
ffffffff81cb8a39
[ 49.000707] RBP: ffff8804187d3db8 R08: 00000000fffffff2 R09:
0000000000000000
[ 49.007841] R10: 0000000000000163 R11: 0000000000000000 R12:
ffffffff8128300c
[ 49.014972] R13: ffff8804187d3d98 R14: ffff8804187d3ef4 R15:
0000000000000004
[ 49.022112] FS: 00007faab6589740(0000) GS:ffff88042fc80000(0000)
knlGS:0000000000000000
[ 49.030194] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 49.035942] CR2: 0000003f0d810414 CR3: 000000040d2cc000 CR4:
00000000000407e0
[ 49.043077] Stack:
[ 49.045096] ffff8804187d3de8 ffffffffa0249674 0000000000000080
ffffffff81cb8180
[ 49.052559] 00007fffda942730 ffff8804187d3ef4 ffff8804187d3ea0
ffffffffa02497a9
[ 49.060020] 0000000000000000 00007265746c6966 0000003f0d7b92c0
00007fffda942850
[ 49.067487] Call Trace:
[ 49.069949] [<ffffffffa0249674>]
find_inlist_lock.constprop.16+0x54/0x100 [ebtables]
[ 49.077779] [<ffffffffa02497a9>] do_ebt_get_ctl+0x89/0x1d0 [ebtables]
[ 49.084306] [<ffffffff81551ca8>] nf_getsockopt+0x68/0x90
[ 49.089717] [<ffffffff81560d40>] ip_getsockopt+0x80/0xa0
[ 49.095113] [<ffffffff815835c5>] raw_getsockopt+0x25/0x50
[ 49.100588] [<ffffffff8150ddd4>] sock_common_getsockopt+0x14/0x20
[ 49.106766] [<ffffffff8150d208>] SyS_getsockopt+0x68/0xd0
[ 49.112257] [<ffffffff8162c682>] system_call_fastpath+0x16/0x1b
[ 49.118260] Code: 00 00 00 00 55 48 89 e5 eb 0e 66 2e 0f 1f 84 00 00
00 00 00 84 c0 74 1c 48 83 c7 01 0f b6 47 ff 48 83 c6 01 3a 46 ff 74 eb
19 c0 <83> c8 01 5d c3 0f 1
[ 76.925880] BUG: soft lockup - CPU#1 stuck for 22s! [ebtables:444]
[ 76.932069] Modules linked in: bnep(F) bluetooth(F) ebtables(F)
ip6table_filter(F) ip6_tables(F) rfkill(F) snd_hda_intel(F+)
snd_hda_codec(F) snd_hwdep(F) snd_seq(F) sn)
[ 76.980847] CPU: 1 PID: 444 Comm: ebtables Tainted: GF D
3.11.0-rc7+ #1
[ 76.988245] Hardware name: Hewlett-Packard HP Z420 Workstation/1589,
BIOS J61 v01.02 03/09/2012
[ 76.996940] task: ffff88040c2dc650 ti: ffff8804187d2000 task.ti:
ffff8804187d2000
[ 77.004426] RIP: 0010:[<ffffffff812e5784>] [<ffffffff812e5784>]
strcmp+0x4/0x40
[ 77.011849] RSP: 0018:ffff8804187d3db8 EFLAGS: 00000212
[ 77.017163] RAX: 0000000000000001 RBX: 00007fffda942730 RCX:
ffff8804187d3fd8
[ 77.024304] RDX: 0000000000000000 RSI: ffff8804187d3e00 RDI:
ffffffff81cb8a38
[ 77.031434] RBP: ffff8804187d3db8 R08: 00000000fffffff2 R09:
0000000000000000
[ 77.038566] R10: 0000000000000163 R11: 0000000000000000 R12:
ffffffff8128300c
[ 77.045699] R13: ffff8804187d3d98 R14: ffff8804187d3ef4 R15:
0000000000000004
[ 77.052842] FS: 00007faab6589740(0000) GS:ffff88042fc80000(0000)
knlGS:0000000000000000
[ 77.060934] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 77.066668] CR2: 0000003f0d810414 CR3: 000000040d2cc000 CR4:
00000000000407e0
[ 77.073799] Stack:
[ 77.075818] ffff8804187d3de8 ffffffffa0249674 0000000000000080
ffffffff81cb8180
[ 77.083287] 00007fffda942730 ffff8804187d3ef4 ffff8804187d3ea0
ffffffffa02497a9
[ 77.090749] 0000000000000000 00007265746c6966 0000003f0d7b92c0
00007fffda942850
[ 77.098215] Call Trace:
[ 77.100668] [<ffffffffa0249674>]
find_inlist_lock.constprop.16+0x54/0x100 [ebtables]
[ 77.108500] [<ffffffffa02497a9>] do_ebt_get_ctl+0x89/0x1d0 [ebtables]
[ 77.115035] [<ffffffff81551ca8>] nf_getsockopt+0x68/0x90
[ 77.120438] [<ffffffff81560d40>] ip_getsockopt+0x80/0xa0
[ 77.125845] [<ffffffff815835c5>] raw_getsockopt+0x25/0x50
[ 77.131328] [<ffffffff8150ddd4>] sock_common_getsockopt+0x14/0x20
[ 77.137515] [<ffffffff8150d208>] SyS_getsockopt+0x68/0xd0
[ 77.143011] [<ffffffff8162c682>] system_call_fastpath+0x16/0x1b
[ 77.149019] Code: 0f 1f 80 00 00 00 00 48 83 c6 01 0f b6 4e ff 48 83
c2 01 84 c9 88 4a ff 75 ed 5d c3 66 66 2e 0f 1f 84 00 00 00 00 00 55 48
89 e5 <eb> 0e 66 2e 0f 1f 8
---------------------------------------------------------------------------
The find_inlist_lock did not distinguish the error whether lock failed or
module non-existent, the imperfection processing procedure may course the
problem.
Return the correct value if mutex_lock_interruptible() failed, avoid
confusion with that the modules is not exist, and deal with the return
value in right way.
After the patch, the problem didn't happened again, so I confident the bug
was fixed.
Reported-by: Baoquan He <baoquan.he@gmail.com>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Cc: Baoquan He <baoquan.he@gmail.com>
---
net/bridge/netfilter/ebtables.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index ac78024..e7fe9f8 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -322,17 +322,14 @@ static inline void *
find_inlist_lock_noload(struct list_head *head, const char *name, int *error,
struct mutex *mutex)
{
- struct {
- struct list_head list;
- char name[EBT_FUNCTION_MAXNAMELEN];
- } *e;
+ struct ebt_table *e;
*error = mutex_lock_interruptible(mutex);
if (*error != 0)
- return NULL;
+ return ERR_PTR(-EINTR);
list_for_each_entry(e, head, list) {
- if (strcmp(e->name, name) == 0)
+ if (strcmp(e->name, name) == 0 && try_module_get(e->me))
return e;
}
*error = -ENOENT;
@@ -1005,7 +1002,7 @@ static int do_replace_finish(struct net *net, struct ebt_replace *repl,
goto free_counterstmp;
t = find_table_lock(net, repl->name, &ret, &ebt_mutex);
- if (!t) {
+ if (IS_ERR_OR_NULL(t)) {
ret = -ENOENT;
goto free_iterate;
}
@@ -1284,7 +1281,7 @@ static int do_update_counters(struct net *net, const char *name,
return -ENOMEM;
t = find_table_lock(net, name, &ret, &ebt_mutex);
- if (!t)
+ if (IS_ERR_OR_NULL(t))
goto free_tmp;
if (num_counters != t->private->nentries) {
@@ -1504,7 +1501,7 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
return -EFAULT;
t = find_table_lock(net, tmp.name, &ret, &ebt_mutex);
- if (!t)
+ if (IS_ERR_OR_NULL(t))
return ret;
switch(cmd) {
@@ -2319,7 +2316,7 @@ static int compat_do_ebt_get_ctl(struct sock *sk, int cmd,
return -EFAULT;
t = find_table_lock(net, tmp.name, &ret, &ebt_mutex);
- if (!t)
+ if (IS_ERR_OR_NULL(t))
return ret;
xt_compat_lock(NFPROTO_BRIDGE);
--
1.8.2.1
^ permalink raw reply related
* Re: BQL support in gianfar causes network hiccup
From: Claudiu Manoil @ 2013-09-03 7:06 UTC (permalink / raw)
To: Per Dalén; +Cc: netdev
In-Reply-To: <5224C1EB.3030307@appeartv.com>
On 9/2/2013 7:50 PM, Per Dalén wrote:
> On 09/02/2013 05:35 PM, Claudiu Manoil wrote:
>> On 9/2/2013 5:37 PM, Per Dalén wrote:
>>>> The proposed fix is currently under review:
>>>> http://patchwork.ozlabs.org/patch/271242/
>>>> "gianfar: Fix reported number of sent bytes to BQL"
>>>>
>>>> Does this one work for you? You might need to pull
>>>> one recent gianfar clean-up patch from net-next in order
>>>> to apply this one without incidents.
>>>>
>>>
>>> No, still the same error:
>>>
>>> NETDEV WATCHDOG: eth0 (fsl-gianfar): transmit queue 0 timed out
>>> ------------[ cut here ]------------
>>> WARNING: at net/sched/sch_generic.c:256
>>> Modules linked in:
>>> NIP: c039ce0c LR: c039ce0c CTR: c02ef578
>>> ...
>>> 4e800421 80fe0244 4bffff40 7fc3f378 4bfea9d1 7fc4f378 7c651b78 3c60c055
>>> 7fe6fb78 38635304 4cc63182 480fcddd <0fe00000> 39200001 993c0a3c
>>> 4bffffb4
>>> ---[ end trace 5f5e1e3c30024010 ]---
>>>
>>>
>>
>> Tried to reproduce the issue with a recent net-next kernel (Linux
>> p2020rdb 3.11.0-rc6) + BQL fix patch (http://patchwork.ozlabs.org/patc
>> /271242/), but the iperf test finished without incidents (see log
>> below).
>> Will try if the problem is apparent without the fix patch, on the same
>> net-next kernel (3.11.0-rc6).
>>
>
> I was able to reproduce it on our card and the P2020RDB using 3.11.0-rc7
> + David Miller's -next networking tree and your patch
> (http://patchwork.ozlabs.org/patch/271242/).
>
> root@p2020rdb:~# iperf -s
Ok, I see, iperf -s on P2020. This way I was able to get the tx timeout
too. With iperf -c on P2020 it doesn't come up. Now it'll be
interesting to find out what BQL/ BQL integration in gianfar has to do
with this.
Thanks.
claudiu
^ permalink raw reply
* Re: [PATCH] Add WLI-UC-G300HP's Product ID.
From: Kalle Valo @ 2013-09-03 6:15 UTC (permalink / raw)
To: Masami Ichikawa
Cc: IvDoorn-Re5JQEeQqe8AvxtiuMwx3w, gwingerde-Re5JQEeQqe8AvxtiuMwx3w,
helmut.schaa-gM/Ye1E23mwN+BqQ9rBEUg,
linville-2XuSBdqkA4R54TAoqtyWWQ,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
users-poMEt7QlJxcwIE2E9O76wjtx2kNaKg5H,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1377617843-28835-1-git-send-email-masami256-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Masami Ichikawa <masami256-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> Support Bufallo WLI-UC-G300HP.
>
> Signed-off-by: Masami Ichikawa <masami256-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Please add "rt2x00: " prefix to the commit title.
--
Kalle Valo
--
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] driver:stmmac: Adjust time stamp increase for 0.465 ns accurate only when Time stamp binary rollover is set.
From: Sonic Zhang @ 2013-09-03 5:55 UTC (permalink / raw)
To: Giuseppe Cavallaro, netdev; +Cc: adi-buildroot-devel, Sonic Zhang
From: Sonic Zhang <sonic.zhang@analog.com>
The synopsys spec says When TSCRLSSR is cleard, the rollover value of
sub-second register is 0x7FFFFFFF(0.465 ns per clock).
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
index def7e75..76ad214 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
@@ -45,8 +45,8 @@ static void stmmac_config_sub_second_increment(void __iomem *ioaddr)
data = (1000000000ULL / 50000000);
/* 0.465ns accuracy */
- if (value & PTP_TCR_TSCTRLSSR)
- data = (data * 100) / 465;
+ if (!(value & PTP_TCR_TSCTRLSSR))
+ data = (data * 1000) / 465;
writel(data, ioaddr + PTP_SSIR);
}
--
1.8.2.3
^ permalink raw reply related
* Re: [PATCH v4] ipv6:introduce function to find route for redirect
From: Duan Jiong @ 2013-09-03 5:37 UTC (permalink / raw)
To: hannes; +Cc: davem, netdev
In-Reply-To: <20130902195056.GA5451@order.stressinduktion.org>
于 2013年09月03日 03:50, Hannes Frederic Sowa 写道:
> On Mon, Sep 02, 2013 at 02:14:57PM +0800, Duan Jiong wrote:
>> +static struct rt6_info *__ip6_route_redirect(struct net *net,
>> + struct fib6_table *table,
>> + struct flowi6 *fl6,
>> + int flags)
>> +{
>> + struct ip6rd_flowi *rdfl = (struct ip6rd_flowi *)fl6;
>> + struct rt6_info *rt;
>> + struct fib6_node *fn;
>> +
>> + /* Get the "current" route for this destination and
>> + * check if the redirect has come from approriate router.
>> + *
>> + * RFC 4861 specifies that redirects should only be
>> + * accepted if they come from the nexthop to the target.
>> + * Due to the way the routes are chosen, this notion
>> + * is a bit fuzzy and one might need to check all possible
>> + * routes.
>> + */
>> +
>> + read_lock_bh(&table->tb6_lock);
>> + fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
>> +restart:
>> + for (rt = fn->leaf; rt; rt = rt->dst.rt6_next) {
>> + if (rt6_check_expired(rt))
>> + continue;
>> + if (rt->dst.error)
>> + continue;
>
> Sorry, I should have been more clear what I meant with failing early:
>
> I considered a setup like this:
>
> ip -6 r a default nexthop via fe80::1 dev eth0
> ip -6 r a prohibit 2002:1::/64
>
> If the kernel receives a redirect for a destination e.g. 2002:1::1 we
> would backtrack above the prohibit rule and return the dst of the default
> route and would insert a new cached route which could circumvent the
> prohibit rule. We have to try to lock down the tree below 2002:1::/64
> in that case. A possible solution for that would be to do something
> like this:
>
> /* We don't accept a redirect in case a more specific route is
> * installed with dst.error and stop backtracking.
> */
> if (rt->dst.error)
> break;
>
> Either we have to replace the rt with net->ipv6.ip6_null_entry in that
> case or check dst->error before calling rt6_do_redirect below.
>
Thanks for you comment, i understand what you mean.
>> + if (!(rt->rt6i_flags & RTF_GATEWAY))
>> + continue;
>> + if (fl6->flowi6_oif != rt->dst.dev->ifindex)
>> + continue;
>> + if (!ipv6_addr_equal(&rdfl->gateway, &rt->rt6i_gateway))
>> + continue;
>> + break;
>> + }
>> +
>> + if (!rt)
>> + rt = net->ipv6.ip6_null_entry;
>> + BACKTRACK(net, &fl6->saddr);
>> +out:
>> + dst_hold(&rt->dst);
>> +
>> + read_unlock_bh(&table->tb6_lock);
>> +
>> + return rt;
>> +};
>>
>> [...]
>>
>> @@ -1171,9 +1238,8 @@ void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark)
>> fl6.saddr = iph->saddr;
>> fl6.flowlabel = ip6_flowinfo(iph);
>>
>> - dst = ip6_route_output(net, NULL, &fl6);
>> - if (!dst->error)
>> - rt6_do_redirect(dst, NULL, skb);
>> + dst = ip6_route_redirect(net, &fl6, &ipv6_hdr(skb)->saddr);
>> + rt6_do_redirect(dst, NULL, skb);
>> dst_release(dst);
>> }
>> EXPORT_SYMBOL_GPL(ip6_redirect);
>> @@ -1193,9 +1259,8 @@ void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
>> fl6.daddr = msg->dest;
>> fl6.saddr = iph->daddr;
>>
>> - dst = ip6_route_output(net, NULL, &fl6);
>> - if (!dst->error)
>> - rt6_do_redirect(dst, NULL, skb);
>> + dst = ip6_route_redirect(net, &fl6, &iph->saddr);
>> + rt6_do_redirect(dst, NULL, skb);
>> dst_release(dst);
>> }
>
> Btw. I still think it should be possible to eliminate
> ip6_redirect_no_header:
>
> We could always use ip6_redirect_no_header and use the data of the redirected
> header option just for finding the socket to be notified. We can do the whole
> verification and route updating in ndisc layer and then just call into icmpv6
> layer if upper protocols need a notification of the redirect. But that should
> go into another patch. ;)
>
I think this is good, but i have a question below:
if the socket type is connection-based, the dst information is stored in related
sock struct, so there is no need to look up the route for redirect in ip6_redirect
or ip6_redirect_no_header, in this case, we do the verification and route
updating in the upper protocols' err_handler is better.
How do you think of this?
Thanks,
Duan
^ permalink raw reply
* Re: [PATCH net-next] net: make snmp_mib_free static inline
From: David Miller @ 2013-09-03 4:01 UTC (permalink / raw)
To: amwang; +Cc: netdev
In-Reply-To: <1378087613-15279-3-git-send-email-amwang@redhat.com>
From: Cong Wang <amwang@redhat.com>
Date: Mon, 2 Sep 2013 10:06:53 +0800
> From: Cong Wang <amwang@redhat.com>
>
> Fengguang reported:
>
> net/built-in.o: In function `in6_dev_finish_destroy':
> (.text+0x4ca7d): undefined reference to `snmp_mib_free'
>
> this is due to snmp_mib_free() is defined when CONFIG_INET is enabled,
> but in6_dev_finish_destroy() is now moved to core kernel.
>
> I think snmp_mib_free() is small enough to be inlined, so just make it
> static inline.
>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Cong Wang <amwang@redhat.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] vxlan: include net/ip6_checksum.h for csum_ipv6_magic()
From: David Miller @ 2013-09-03 4:01 UTC (permalink / raw)
To: amwang; +Cc: netdev
In-Reply-To: <1378087613-15279-2-git-send-email-amwang@redhat.com>
From: Cong Wang <amwang@redhat.com>
Date: Mon, 2 Sep 2013 10:06:52 +0800
> From: Cong Wang <amwang@redhat.com>
>
> Fengguang reported a compile warning:
>
> drivers/net/vxlan.c: In function 'vxlan6_xmit_skb':
> drivers/net/vxlan.c:1352:3: error: implicit declaration of function 'csum_ipv6_magic' [-Werror=implicit-function-declaration]
> cc1: some warnings being treated as errors
>
> this patch fixes it.
>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Cong Wang <amwang@redhat.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] vxlan: fix flowi6_proto value
From: David Miller @ 2013-09-03 4:01 UTC (permalink / raw)
To: amwang; +Cc: netdev
In-Reply-To: <1378087613-15279-1-git-send-email-amwang@redhat.com>
From: Cong Wang <amwang@redhat.com>
Date: Mon, 2 Sep 2013 10:06:51 +0800
> From: Cong Wang <amwang@redhat.com>
>
> It should be IPPROTO_UDP.
>
> Signed-off-by: Cong Wang <amwang@redhat.com>
Applied.
^ permalink raw reply
* Re: [PATCH v2 0/8] Drop support for Renesas H8/300 architecture
From: Chen Gang F T @ 2013-09-03 3:52 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-kernel, linux-ide, netdev, linux-watchdog, Wim Van Sebroeck,
David S. Miller, Yoshinori Sato, Geert Uytterhoeven, Al Viro,
Eric Paris, Greg Kroah-Hartman, Jiang Liu, David Howells,
Thomas Gleixner, Stephen Rothwell, Linus Torvalds, Andrew Morton,
Rusty Russell, Linus Walleij
In-Reply-To: <522556D8.803@roeck-us.net>
On 09/03/2013 11:26 AM, Guenter Roeck wrote:
> On 09/02/2013 07:53 PM, Chen Gang F T wrote:
>> Hello Guenter Roeck:
>>
>>
>> I don't care about whether I am in cc mailing list, but at least,
>> please help confirm 2 things:
>>
>> Is what I had done for h8300 just making wastes and noisy in kernel and related sub-system mailing list ?
>>
>> and is the disccusion about h8300 between us also wastes and noisy in kernel mailing list ?
>>
>
> It raised my awareness of the status of h8300 maintenance,
> so I would not see it as noise or waste. I might have suggested
> a different target for your efforts, but that is your choice to make,
> not mine.
>
OK, thank you for your confirmation, I plan to scan all architectures
one by one with allmodconfig.
Hmm... if suitable, next, when I focus one of architectures, I also cc
to you, if it can be removed, please let me know in time, so can avoid
sending waste mails to mailing list.
I plan to try one of architectures within arc, hexagon, and metag. I
will begin at 2013-09-20 (or later), if some (or all) of them can be
removed, please let me know, thanks.
> On the code review side, I had suggested that you should not add new
> ifdefs into code, much less unnecessary ones. Your counter-argument
> was that you wanted to follow the existing coding style in the file
> in question. To me, that argument is along the line of "the coding
> style in this file is bad, let's do more of it".
Hmm... in fact, I will not say whether the code style is good or bad. I
mainly focus on to try to avoid multiple code styles within one file.
extreme sample: let 'kernel code style' and 'gcc code style' in one file, that will make the code very ugly.
> That doesn't make much sense to me, so I did not bother to respond.
> Setting that aside, it is not up to me to approve or reject your patches.
> Whoever does that would be the one you have to convince.
>
OK, I can understand, and now it seems it can be canceled, since h8300
has been removed.
> Guenter
>
Thanks.
--
Chen Gang
^ permalink raw reply
* Re: [PATCH] net: fec: fix the error to get the previous BD entry
From: David Miller @ 2013-09-03 3:35 UTC (permalink / raw)
To: B20596; +Cc: B38611, netdev, bhutchings, stephen
In-Reply-To: <1F990F8245A4214A8CC4BFFBD9F790F908B45F9F@039-SN1MPN1-001.039d.mgd.msft.net>
From: Li Frank-B20596 <B20596@freescale.com>
Date: Tue, 3 Sep 2013 03:00:48 +0000
> Acked
This is not the correct way to ACK a patch, the correct format is:
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* [Patch iproute2] vxlan: add ipv6 support
From: Cong Wang @ 2013-09-03 3:33 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Stephen Hemminger, Cong Wang
From: Cong Wang <amwang@redhat.com>
The kernel already supports it, so add the support
to iproute2 as well.
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index d07aeca..0c37561 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -311,6 +311,8 @@ enum {
IFLA_VXLAN_L2MISS,
IFLA_VXLAN_L3MISS,
IFLA_VXLAN_PORT, /* destination port */
+ IFLA_VXLAN_GROUP6,
+ IFLA_VXLAN_LOCAL6,
__IFLA_VXLAN_MAX
};
#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 4304b0d..12e1c74 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -43,6 +43,9 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
__u32 saddr = 0;
__u32 gaddr = 0;
__u32 daddr = 0;
+ struct in6_addr saddr6 = IN6ADDR_ANY_INIT;
+ struct in6_addr gaddr6 = IN6ADDR_ANY_INIT;
+ struct in6_addr daddr6 = IN6ADDR_ANY_INIT;
unsigned link = 0;
__u8 tos = 0;
__u8 ttl = 0;
@@ -66,21 +69,36 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
vni_set = 1;
} else if (!matches(*argv, "group")) {
NEXT_ARG();
- gaddr = get_addr32(*argv);
-
- if (!IN_MULTICAST(ntohl(gaddr)))
- invarg("invalid group address", *argv);
+ if (!inet_pton(AF_INET, *argv, &gaddr)) {
+ if (!inet_pton(AF_INET6, *argv, &gaddr6)) {
+ fprintf(stderr, "Invalid address \"%s\"\n", *argv);
+ return -1;
+ } else if (!IN6_IS_ADDR_MULTICAST(&gaddr6))
+ invarg("invald group address", *argv);
+ } else if (!IN_MULTICAST(ntohl(gaddr)))
+ invarg("invald group address", *argv);
} else if (!matches(*argv, "remote")) {
NEXT_ARG();
- daddr = get_addr32(*argv);
-
- if (IN_MULTICAST(ntohl(daddr)))
- invarg("invalid remote address", *argv);
+ if (!inet_pton(AF_INET, *argv, &daddr)) {
+ if (!inet_pton(AF_INET6, *argv, &daddr6)) {
+ fprintf(stderr, "Invalid address \"%s\"\n", *argv);
+ return -1;
+ } else if (IN6_IS_ADDR_MULTICAST(&daddr6))
+ invarg("invald remote address", *argv);
+ } else if (IN_MULTICAST(ntohl(daddr)))
+ invarg("invald remote address", *argv);
} else if (!matches(*argv, "local")) {
NEXT_ARG();
- if (strcmp(*argv, "any"))
- saddr = get_addr32(*argv);
- if (IN_MULTICAST(ntohl(saddr)))
+ if (strcmp(*argv, "any")) {
+ if (!inet_pton(AF_INET, *argv, &saddr)) {
+ if (!inet_pton(AF_INET6, *argv, &saddr6)) {
+ fprintf(stderr, "Invalid address \"%s\"\n", *argv);
+ return -1;
+ }
+ }
+ }
+
+ if (IN_MULTICAST(ntohl(saddr)) || IN6_IS_ADDR_MULTICAST(&saddr6))
invarg("invalid local address", *argv);
} else if (!matches(*argv, "dev")) {
NEXT_ARG();
@@ -167,7 +185,9 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
fprintf(stderr, "vxlan: missing virtual network identifier\n");
return -1;
}
- if (gaddr && daddr) {
+ if ((gaddr && daddr) ||
+ (memcmp(&gaddr6, &in6addr_any, sizeof(gaddr6)) &&
+ memcmp(&daddr6, &in6addr_any, sizeof(daddr6)))) {
fprintf(stderr, "vxlan: both group and remote cannot be specified\n");
return -1;
}
@@ -176,8 +196,16 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
else if (daddr)
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &daddr, 4);
+ if (memcmp(&gaddr6, &in6addr_any, sizeof(gaddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &gaddr6, sizeof(struct in6_addr));
+ else if (memcmp(&daddr6, &in6addr_any, sizeof(daddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &daddr6, sizeof(struct in6_addr));
+
if (saddr)
addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
+ else if (memcmp(&saddr6, &in6addr_any, sizeof(saddr6)) != 0)
+ addattr_l(n, 1024, IFLA_VXLAN_LOCAL6, &saddr6, sizeof(struct in6_addr));
+
if (link)
addattr32(n, 1024, IFLA_VXLAN_LINK, link);
addattr8(n, 1024, IFLA_VXLAN_TTL, ttl);
@@ -229,6 +257,17 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
fprintf(f, "remote %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
}
+ } else if (tb[IFLA_VXLAN_GROUP6]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_GROUP6]), sizeof(struct in6_addr));
+ if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0) {
+ if (IN6_IS_ADDR_MULTICAST(&addr))
+ fprintf(f, "group %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
+ else
+ fprintf(f, "remote %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
+ }
}
if (tb[IFLA_VXLAN_LOCAL]) {
@@ -236,6 +275,12 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (addr)
fprintf(f, "local %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
+ } else if (tb[IFLA_VXLAN_LOCAL6]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_LOCAL6]), sizeof(struct in6_addr));
+ if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0)
+ fprintf(f, "local %s ",
+ format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1)));
}
if (tb[IFLA_VXLAN_LINK] &&
^ permalink raw reply related
* Re: [guv v2 04/31] net: Replace __get_cpu_var uses
From: David Miller @ 2013-09-03 3:33 UTC (permalink / raw)
To: dhowells; +Cc: cl, tj, akpm, netdev, linux-arch, srostedt, linux-kernel
In-Reply-To: <7435.1378157706@warthog.procyon.org.uk>
From: David Howells <dhowells@redhat.com>
Date: Mon, 02 Sep 2013 22:35:06 +0100
> Would it be possible to use __thread annotations for per-CPU
> variables, I wonder?
Paul Mackerras tried it on powerpc and you can't do it.
The problem is that there is no way to tell the compiler that sched()
and similar (potentially) change the thread pointer base.
It really will cache pre-computed __thread pointer calculations across
sched().
^ permalink raw reply
* Re: [PATCH v2 0/8] Drop support for Renesas H8/300 architecture
From: Guenter Roeck @ 2013-09-03 3:26 UTC (permalink / raw)
To: Chen Gang F T
Cc: linux-kernel, linux-ide, netdev, linux-watchdog, Wim Van Sebroeck,
David S. Miller, Yoshinori Sato, Geert Uytterhoeven, Al Viro,
Eric Paris, Greg Kroah-Hartman, Jiang Liu, David Howells,
Thomas Gleixner, Stephen Rothwell, Linus Torvalds, Andrew Morton,
Rusty Russell, Linus Walleij
In-Reply-To: <52254F11.8070601@gmail.com>
On 09/02/2013 07:53 PM, Chen Gang F T wrote:
> Hello Guenter Roeck:
>
>
> I don't care about whether I am in cc mailing list, but at least,
> please help confirm 2 things:
>
> Is what I had done for h8300 just making wastes and noisy in kernel and related sub-system mailing list ?
>
> and is the disccusion about h8300 between us also wastes and noisy in kernel mailing list ?
>
It raised my awareness of the status of h8300 maintenance,
so I would not see it as noise or waste. I might have suggested
a different target for your efforts, but that is your choice to make,
not mine.
On the code review side, I had suggested that you should not add new
ifdefs into code, much less unnecessary ones. Your counter-argument
was that you wanted to follow the existing coding style in the file
in question. To me, that argument is along the line of "the coding
style in this file is bad, let's do more of it".
That doesn't make much sense to me, so I did not bother to respond.
Setting that aside, it is not up to me to approve or reject your patches.
Whoever does that would be the one you have to convince.
Guenter
^ permalink raw reply
* RE: [PATCH] net: fec: fix the error to get the previous BD entry
From: Li Frank-B20596 @ 2013-09-03 3:00 UTC (permalink / raw)
To: Duan Fugang-B38611, davem@davemloft.net
Cc: netdev@vger.kernel.org, bhutchings@solarflare.com,
stephen@networkplumber.org
In-Reply-To: <1378176078-10380-1-git-send-email-B38611@freescale.com>
>
> Bug: error to get the previous BD entry. When the current BD is the first BD,
> the previous BD entry must be the last BD, not "bdp - 1" in current logic.
>
> V4:
> * Optimize fec_enet_get_nextdesc() for code clean.
> Replace "ex_new_bd - ring_size" with "ex_base".
> Replace "new_bd - ring_size" with "base".
>
> V3:
> * Restore the API name because David suggest to use fec_enet_
> prefix for all function in fec driver.
> So, change next_bd() -> fec_enet_get_nextdesc()
> change pre_bd() -> fec_enet_get_prevdesc()
> * Reduce the two APIs parameters for easy to call.
>
> V2:
> * Add tx_ring_size and rx_ring_size to struct fec_enet_private.
> * Replace api fec_enet_get_nextdesc() with next_bd().
> Replace api fec_enet_get_prevdesc() with pre_bd().
>
> * Move all ring size check logic to next_bd() and pre_bd(), which
> simplifies the code redundancy.
>
> V1:
> * Add BD ring size check to get the previous BD entry in correctly.
>
> Reviewed-by: Li Frank <B20596@freescale.com>
> Signed-off-by: Fugang Duan <B38611@freescale.com>
Acked
> ---
> drivers/net/ethernet/freescale/fec.h | 3 +
> drivers/net/ethernet/freescale/fec_main.c | 120 ++++++++++++++++++---------
> --
> 2 files changed, 77 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec.h
> b/drivers/net/ethernet/freescale/fec.h
> index ae23600..0120217 100644
> --- a/drivers/net/ethernet/freescale/fec.h
> +++ b/drivers/net/ethernet/freescale/fec.h
> @@ -296,6 +296,9 @@ struct fec_enet_private {
> /* The ring entries to be free()ed */
> struct bufdesc *dirty_tx;
>
> + unsigned short tx_ring_size;
> + unsigned short rx_ring_size;
> +
> struct platform_device *pdev;
>
> int opened;
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 4ea1555..1364a6f 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -239,22 +239,57 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
>
> static int mii_cnt;
>
> -static struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, int is_ex)
> +static inline
> +struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, struct
> +fec_enet_private *fep)
> {
> - struct bufdesc_ex *ex = (struct bufdesc_ex *)bdp;
> - if (is_ex)
> - return (struct bufdesc *)(ex + 1);
> + struct bufdesc *new_bd = bdp + 1;
> + struct bufdesc_ex *ex_new_bd = (struct bufdesc_ex *)bdp + 1;
> + struct bufdesc_ex *ex_base;
> + struct bufdesc *base;
> + int ring_size;
> +
> + if (bdp >= fep->tx_bd_base) {
> + base = fep->tx_bd_base;
> + ring_size = fep->tx_ring_size;
> + ex_base = (struct bufdesc_ex *)fep->tx_bd_base;
> + } else {
> + base = fep->rx_bd_base;
> + ring_size = fep->rx_ring_size;
> + ex_base = (struct bufdesc_ex *)fep->rx_bd_base;
> + }
> +
> + if (fep->bufdesc_ex)
> + return (struct bufdesc *)((ex_new_bd >= (ex_base + ring_size)) ?
> + ex_base : ex_new_bd);
> else
> - return bdp + 1;
> + return (new_bd >= (base + ring_size)) ?
> + base : new_bd;
> }
>
> -static struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp, int is_ex)
> +static inline
> +struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp, struct
> +fec_enet_private *fep)
> {
> - struct bufdesc_ex *ex = (struct bufdesc_ex *)bdp;
> - if (is_ex)
> - return (struct bufdesc *)(ex - 1);
> + struct bufdesc *new_bd = bdp - 1;
> + struct bufdesc_ex *ex_new_bd = (struct bufdesc_ex *)bdp - 1;
> + struct bufdesc_ex *ex_base;
> + struct bufdesc *base;
> + int ring_size;
> +
> + if (bdp >= fep->tx_bd_base) {
> + base = fep->tx_bd_base;
> + ring_size = fep->tx_ring_size;
> + ex_base = (struct bufdesc_ex *)fep->tx_bd_base;
> + } else {
> + base = fep->rx_bd_base;
> + ring_size = fep->rx_ring_size;
> + ex_base = (struct bufdesc_ex *)fep->rx_bd_base;
> + }
> +
> + if (fep->bufdesc_ex)
> + return (struct bufdesc *)((ex_new_bd < ex_base) ?
> + (ex_new_bd + ring_size) : ex_new_bd);
> else
> - return bdp - 1;
> + return (new_bd < base) ? (new_bd + ring_size) : new_bd;
> }
>
> static void *swap_buffer(void *bufaddr, int len) @@ -380,7 +415,7 @@
> fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> }
> }
>
> - bdp_pre = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
> + bdp_pre = fec_enet_get_prevdesc(bdp, fep);
> if ((id_entry->driver_data & FEC_QUIRK_ERR006358) &&
> !(bdp_pre->cbd_sc & BD_ENET_TX_READY)) {
> fep->delay_work.trig_tx = true;
> @@ -389,10 +424,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct
> net_device *ndev)
> }
>
> /* If this was the last BD in the ring, start at the beginning again.
> */
> - if (status & BD_ENET_TX_WRAP)
> - bdp = fep->tx_bd_base;
> - else
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
>
> fep->cur_tx = bdp;
>
> @@ -417,18 +449,18 @@ static void fec_enet_bd_init(struct net_device *dev)
>
> /* Initialize the receive buffer descriptors. */
> bdp = fep->rx_bd_base;
> - for (i = 0; i < RX_RING_SIZE; i++) {
> + for (i = 0; i < fep->rx_ring_size; i++) {
>
> /* Initialize the BD for every fragment in the page. */
> if (bdp->cbd_bufaddr)
> bdp->cbd_sc = BD_ENET_RX_EMPTY;
> else
> bdp->cbd_sc = 0;
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
> }
>
> /* Set the last buffer to wrap */
> - bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_prevdesc(bdp, fep);
> bdp->cbd_sc |= BD_SC_WRAP;
>
> fep->cur_rx = fep->rx_bd_base;
> @@ -436,7 +468,7 @@ static void fec_enet_bd_init(struct net_device *dev)
> /* ...and the same for transmit */
> bdp = fep->tx_bd_base;
> fep->cur_tx = bdp;
> - for (i = 0; i < TX_RING_SIZE; i++) {
> + for (i = 0; i < fep->tx_ring_size; i++) {
>
> /* Initialize the BD for every fragment in the page. */
> bdp->cbd_sc = 0;
> @@ -445,11 +477,11 @@ static void fec_enet_bd_init(struct net_device *dev)
> fep->tx_skbuff[i] = NULL;
> }
> bdp->cbd_bufaddr = 0;
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
> }
>
> /* Set the last buffer to wrap */
> - bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_prevdesc(bdp, fep);
> bdp->cbd_sc |= BD_SC_WRAP;
> fep->dirty_tx = bdp;
> }
> @@ -510,10 +542,10 @@ fec_restart(struct net_device *ndev, int duplex)
> writel(fep->bd_dma, fep->hwp + FEC_R_DES_START);
> if (fep->bufdesc_ex)
> writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc_ex)
> - * RX_RING_SIZE, fep->hwp + FEC_X_DES_START);
> + * fep->rx_ring_size, fep->hwp + FEC_X_DES_START);
> else
> writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc)
> - * RX_RING_SIZE, fep->hwp + FEC_X_DES_START);
> + * fep->rx_ring_size, fep->hwp + FEC_X_DES_START);
>
>
> for (i = 0; i <= TX_RING_MOD_MASK; i++) { @@ -727,10 +759,7 @@
> fec_enet_tx(struct net_device *ndev)
> bdp = fep->dirty_tx;
>
> /* get next bdp of dirty_tx */
> - if (bdp->cbd_sc & BD_ENET_TX_WRAP)
> - bdp = fep->tx_bd_base;
> - else
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
>
> while (((status = bdp->cbd_sc) & BD_ENET_TX_READY) == 0) {
>
> @@ -800,10 +829,7 @@ fec_enet_tx(struct net_device *ndev)
> fep->dirty_tx = bdp;
>
> /* Update pointer to next buffer descriptor to be transmitted */
> - if (status & BD_ENET_TX_WRAP)
> - bdp = fep->tx_bd_base;
> - else
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
>
> /* Since we have freed up a buffer, the ring is no longer full
> */
> @@ -994,10 +1020,8 @@ rx_processing_done:
> }
>
> /* Update BD pointer to next entry */
> - if (status & BD_ENET_RX_WRAP)
> - bdp = fep->rx_bd_base;
> - else
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
> +
> /* Doing this here will keep the FEC running while we process
> * incoming frames. On a heavily loaded network, we should be
> * able to keep up at the expense of system resources.
> @@ -1663,7 +1687,7 @@ static void fec_enet_free_buffers(struct net_device
> *ndev)
> struct bufdesc *bdp;
>
> bdp = fep->rx_bd_base;
> - for (i = 0; i < RX_RING_SIZE; i++) {
> + for (i = 0; i < fep->rx_ring_size; i++) {
> skb = fep->rx_skbuff[i];
>
> if (bdp->cbd_bufaddr)
> @@ -1671,11 +1695,11 @@ static void fec_enet_free_buffers(struct net_device
> *ndev)
> FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE);
> if (skb)
> dev_kfree_skb(skb);
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
> }
>
> bdp = fep->tx_bd_base;
> - for (i = 0; i < TX_RING_SIZE; i++)
> + for (i = 0; i < fep->tx_ring_size; i++)
> kfree(fep->tx_bounce[i]);
> }
>
> @@ -1687,7 +1711,7 @@ static int fec_enet_alloc_buffers(struct net_device
> *ndev)
> struct bufdesc *bdp;
>
> bdp = fep->rx_bd_base;
> - for (i = 0; i < RX_RING_SIZE; i++) {
> + for (i = 0; i < fep->rx_ring_size; i++) {
> skb = netdev_alloc_skb(ndev, FEC_ENET_RX_FRSIZE);
> if (!skb) {
> fec_enet_free_buffers(ndev);
> @@ -1704,15 +1728,15 @@ static int fec_enet_alloc_buffers(struct net_device
> *ndev)
> ebdp->cbd_esc = BD_ENET_RX_INT;
> }
>
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
> }
>
> /* Set the last buffer to wrap. */
> - bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_prevdesc(bdp, fep);
> bdp->cbd_sc |= BD_SC_WRAP;
>
> bdp = fep->tx_bd_base;
> - for (i = 0; i < TX_RING_SIZE; i++) {
> + for (i = 0; i < fep->tx_ring_size; i++) {
> fep->tx_bounce[i] = kmalloc(FEC_ENET_TX_FRSIZE, GFP_KERNEL);
>
> bdp->cbd_sc = 0;
> @@ -1723,11 +1747,11 @@ static int fec_enet_alloc_buffers(struct net_device
> *ndev)
> ebdp->cbd_esc = BD_ENET_TX_INT;
> }
>
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
> }
>
> /* Set the last buffer to wrap. */
> - bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_prevdesc(bdp, fep);
> bdp->cbd_sc |= BD_SC_WRAP;
>
> return 0;
> @@ -1967,13 +1991,17 @@ static int fec_enet_init(struct net_device *ndev)
> /* Get the Ethernet address */
> fec_get_mac(ndev);
>
> + /* init the tx & rx ring size */
> + fep->tx_ring_size = TX_RING_SIZE;
> + fep->rx_ring_size = RX_RING_SIZE;
> +
> /* Set receive and transmit descriptor base. */
> fep->rx_bd_base = cbd_base;
> if (fep->bufdesc_ex)
> fep->tx_bd_base = (struct bufdesc *)
> - (((struct bufdesc_ex *)cbd_base) + RX_RING_SIZE);
> + (((struct bufdesc_ex *)cbd_base) + fep->rx_ring_size);
> else
> - fep->tx_bd_base = cbd_base + RX_RING_SIZE;
> + fep->tx_bd_base = cbd_base + fep->rx_ring_size;
>
> /* The FEC Ethernet specific entries in the device structure */
> ndev->watchdog_timeo = TX_TIMEOUT;
> --
> 1.7.1
^ permalink raw reply
* Re: [PATCH v2 0/8] Drop support for Renesas H8/300 architecture
From: Chen Gang F T @ 2013-09-03 2:53 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-kernel, linux-ide, netdev, linux-watchdog, Wim Van Sebroeck,
David S. Miller, Yoshinori Sato, Geert Uytterhoeven, Al Viro,
Eric Paris, Greg Kroah-Hartman, Jiang Liu, David Howells,
Thomas Gleixner, Stephen Rothwell, Linus Torvalds, Andrew Morton,
Rusty Russell, Linus Walleij
In-Reply-To: <1377906694-9578-1-git-send-email-linux@roeck-us.net>
Hello Guenter Roeck:
I don't care about whether I am in cc mailing list, but at least,
please help confirm 2 things:
Is what I had done for h8300 just making wastes and noisy in kernel and related sub-system mailing list ?
and is the disccusion about h8300 between us also wastes and noisy in kernel mailing list ?
And also I have to make an apologize to kernel and other related sub
system mailing list:
some of patches about h8300 which I have sent in 2013-09-02 are really wastes (and I wasted my time resource for it, too).
the excuse (not reason) is I do not know about Guenter Roeck has sent this patch (I am not in this cc list, so I find it one day delay).
BTW: I also add some another related members in cc mailing list to let
them know about some of suspending thread about h8300 (which waiting
for allmodconfig finish) can be canceled.
Thanks.
On 08/31/2013 07:51 AM, Guenter Roeck wrote:
> H8/300 has been dead for several years, the kernel for it has
> not compiled for ages, and recent versions of gcc for it are broken.
> It is time to drop support for it.
>
> Yes, I understand it is not that simple to drop an architecture,
> and it may need some discussion, but someone has to put a stake
> into the ground. Keeping a virtually dead architecture on life support
> takes resources which are better spent elsewhere.
>
> v2:
> - s/Renesys/Renesas/g
> - Found and removed more architecture specific code in fs/minix
> and in smc9194 driver
> - Added explicit Cc: for h8300 maintainer
> - Added subsystem maintainer Acks
>
> ----------------------------------------------------------------
> Guenter Roeck (8):
> Drop support for Renesas H8/300 (h8300) architecture
> ide: Drop H8/300 driver
> net/ethernet: smsc9194: Drop conditional code for H8/300
> net/ethernet: Drop H8/300 Ethernet driver
> watchdog: Drop references to H8300 architecture
> Drop MAINTAINERS entry for H8/300
> Drop remaining references to H8/300 architecture
> fs/minix: Drop dependency on H8300
>
> Documentation/scheduler/sched-arch.txt | 5 -
> MAINTAINERS | 8 -
> arch/h8300/Kconfig | 109 ----
> arch/h8300/Kconfig.cpu | 171 ------
> arch/h8300/Kconfig.debug | 68 ---
> arch/h8300/Kconfig.ide | 44 --
> arch/h8300/Makefile | 71 ---
> arch/h8300/README | 38 --
> arch/h8300/boot/Makefile | 22 -
> arch/h8300/boot/compressed/Makefile | 37 --
> arch/h8300/boot/compressed/head.S | 47 --
> arch/h8300/boot/compressed/misc.c | 180 ------
> arch/h8300/boot/compressed/vmlinux.lds | 32 -
> arch/h8300/boot/compressed/vmlinux.scr | 9 -
> arch/h8300/defconfig | 42 --
> arch/h8300/include/asm/Kbuild | 8 -
> arch/h8300/include/asm/asm-offsets.h | 1 -
> arch/h8300/include/asm/atomic.h | 146 -----
> arch/h8300/include/asm/barrier.h | 29 -
> arch/h8300/include/asm/bitops.h | 211 -------
> arch/h8300/include/asm/bootinfo.h | 2 -
> arch/h8300/include/asm/bug.h | 12 -
> arch/h8300/include/asm/bugs.h | 16 -
> arch/h8300/include/asm/cache.h | 13 -
> arch/h8300/include/asm/cachectl.h | 14 -
> arch/h8300/include/asm/cacheflush.h | 40 --
> arch/h8300/include/asm/checksum.h | 102 ----
> arch/h8300/include/asm/cmpxchg.h | 60 --
> arch/h8300/include/asm/cputime.h | 6 -
> arch/h8300/include/asm/current.h | 25 -
> arch/h8300/include/asm/dbg.h | 2 -
> arch/h8300/include/asm/delay.h | 38 --
> arch/h8300/include/asm/device.h | 7 -
> arch/h8300/include/asm/div64.h | 1 -
> arch/h8300/include/asm/dma.h | 15 -
> arch/h8300/include/asm/elf.h | 101 ----
> arch/h8300/include/asm/emergency-restart.h | 6 -
> arch/h8300/include/asm/fb.h | 12 -
> arch/h8300/include/asm/flat.h | 26 -
> arch/h8300/include/asm/fpu.h | 1 -
> arch/h8300/include/asm/ftrace.h | 1 -
> arch/h8300/include/asm/futex.h | 6 -
> arch/h8300/include/asm/gpio-internal.h | 52 --
> arch/h8300/include/asm/hardirq.h | 19 -
> arch/h8300/include/asm/hw_irq.h | 1 -
> arch/h8300/include/asm/io.h | 358 -----------
> arch/h8300/include/asm/irq.h | 49 --
> arch/h8300/include/asm/irq_regs.h | 1 -
> arch/h8300/include/asm/irqflags.h | 43 --
> arch/h8300/include/asm/kdebug.h | 1 -
> arch/h8300/include/asm/kmap_types.h | 6 -
> arch/h8300/include/asm/local.h | 6 -
> arch/h8300/include/asm/local64.h | 1 -
> arch/h8300/include/asm/mc146818rtc.h | 9 -
> arch/h8300/include/asm/mmu_context.h | 32 -
> arch/h8300/include/asm/mutex.h | 9 -
> arch/h8300/include/asm/page.h | 78 ---
> arch/h8300/include/asm/page_offset.h | 3 -
> arch/h8300/include/asm/param.h | 9 -
> arch/h8300/include/asm/pci.h | 19 -
> arch/h8300/include/asm/percpu.h | 6 -
> arch/h8300/include/asm/pgalloc.h | 8 -
> arch/h8300/include/asm/pgtable.h | 73 ---
> arch/h8300/include/asm/processor.h | 139 -----
> arch/h8300/include/asm/ptrace.h | 33 --
> arch/h8300/include/asm/regs267x.h | 336 -----------
> arch/h8300/include/asm/regs306x.h | 212 -------
> arch/h8300/include/asm/scatterlist.h | 6 -
> arch/h8300/include/asm/sections.h | 6 -
> arch/h8300/include/asm/segment.h | 49 --
> arch/h8300/include/asm/sh_bios.h | 29 -
> arch/h8300/include/asm/shm.h | 31 -
> arch/h8300/include/asm/shmparam.h | 6 -
> arch/h8300/include/asm/signal.h | 24 -
> arch/h8300/include/asm/smp.h | 1 -
> arch/h8300/include/asm/spinlock.h | 6 -
> arch/h8300/include/asm/string.h | 44 --
> arch/h8300/include/asm/switch_to.h | 50 --
> arch/h8300/include/asm/target_time.h | 4 -
> arch/h8300/include/asm/termios.h | 50 --
> arch/h8300/include/asm/thread_info.h | 103 ----
> arch/h8300/include/asm/timer.h | 25 -
> arch/h8300/include/asm/timex.h | 19 -
> arch/h8300/include/asm/tlb.h | 8 -
> arch/h8300/include/asm/tlbflush.h | 55 --
> arch/h8300/include/asm/topology.h | 6 -
> arch/h8300/include/asm/traps.h | 37 --
> arch/h8300/include/asm/types.h | 9 -
> arch/h8300/include/asm/uaccess.h | 163 ------
> arch/h8300/include/asm/ucontext.h | 12 -
> arch/h8300/include/asm/unaligned.h | 11 -
> arch/h8300/include/asm/unistd.h | 36 --
> arch/h8300/include/asm/user.h | 75 ---
> arch/h8300/include/asm/virtconvert.h | 20 -
> arch/h8300/include/uapi/asm/Kbuild | 34 --
> arch/h8300/include/uapi/asm/auxvec.h | 4 -
> arch/h8300/include/uapi/asm/bitsperlong.h | 1 -
> arch/h8300/include/uapi/asm/byteorder.h | 6 -
> arch/h8300/include/uapi/asm/errno.h | 6 -
> arch/h8300/include/uapi/asm/fcntl.h | 11 -
> arch/h8300/include/uapi/asm/ioctl.h | 1 -
> arch/h8300/include/uapi/asm/ioctls.h | 8 -
> arch/h8300/include/uapi/asm/ipcbuf.h | 1 -
> arch/h8300/include/uapi/asm/kvm_para.h | 1 -
> arch/h8300/include/uapi/asm/mman.h | 1 -
> arch/h8300/include/uapi/asm/msgbuf.h | 31 -
> arch/h8300/include/uapi/asm/param.h | 16 -
> arch/h8300/include/uapi/asm/poll.h | 11 -
> arch/h8300/include/uapi/asm/posix_types.h | 26 -
> arch/h8300/include/uapi/asm/ptrace.h | 44 --
> arch/h8300/include/uapi/asm/resource.h | 6 -
> arch/h8300/include/uapi/asm/sembuf.h | 25 -
> arch/h8300/include/uapi/asm/setup.h | 6 -
> arch/h8300/include/uapi/asm/shmbuf.h | 42 --
> arch/h8300/include/uapi/asm/sigcontext.h | 18 -
> arch/h8300/include/uapi/asm/siginfo.h | 6 -
> arch/h8300/include/uapi/asm/signal.h | 115 ----
> arch/h8300/include/uapi/asm/socket.h | 79 ---
> arch/h8300/include/uapi/asm/sockios.h | 13 -
> arch/h8300/include/uapi/asm/stat.h | 78 ---
> arch/h8300/include/uapi/asm/statfs.h | 6 -
> arch/h8300/include/uapi/asm/swab.h | 10 -
> arch/h8300/include/uapi/asm/termbits.h | 201 -------
> arch/h8300/include/uapi/asm/termios.h | 44 --
> arch/h8300/include/uapi/asm/types.h | 1 -
> arch/h8300/include/uapi/asm/unistd.h | 330 -----------
> arch/h8300/kernel/Makefile | 12 -
> arch/h8300/kernel/asm-offsets.c | 60 --
> arch/h8300/kernel/entry.S | 402 -------------
> arch/h8300/kernel/gpio.c | 178 ------
> arch/h8300/kernel/h8300_ksyms.c | 100 ----
> arch/h8300/kernel/irq.c | 165 ------
> arch/h8300/kernel/module.c | 75 ---
> arch/h8300/kernel/process.c | 154 -----
> arch/h8300/kernel/ptrace.c | 168 ------
> arch/h8300/kernel/setup.c | 242 --------
> arch/h8300/kernel/signal.c | 444 --------------
> arch/h8300/kernel/sys_h8300.c | 48 --
> arch/h8300/kernel/syscalls.S | 338 -----------
> arch/h8300/kernel/time.c | 66 ---
> arch/h8300/kernel/timer/Makefile | 6 -
> arch/h8300/kernel/timer/itu.c | 82 ---
> arch/h8300/kernel/timer/timer16.c | 77 ---
> arch/h8300/kernel/timer/timer8.c | 102 ----
> arch/h8300/kernel/timer/tpu.c | 100 ----
> arch/h8300/kernel/traps.c | 166 ------
> arch/h8300/kernel/vmlinux.lds.S | 157 -----
> arch/h8300/lib/Makefile | 5 -
> arch/h8300/lib/abs.S | 21 -
> arch/h8300/lib/ashrdi3.c | 63 --
> arch/h8300/lib/checksum.c | 164 ------
> arch/h8300/lib/memcpy.S | 84 ---
> arch/h8300/lib/memset.S | 61 --
> arch/h8300/lib/romfs.S | 57 --
> arch/h8300/mm/Makefile | 5 -
> arch/h8300/mm/fault.c | 56 --
> arch/h8300/mm/init.c | 155 -----
> arch/h8300/mm/kmap.c | 58 --
> arch/h8300/mm/memory.c | 54 --
> arch/h8300/platform/h8300h/Makefile | 7 -
> arch/h8300/platform/h8300h/aki3068net/Makefile | 5 -
> arch/h8300/platform/h8300h/aki3068net/crt0_ram.S | 110 ----
> arch/h8300/platform/h8300h/generic/Makefile | 5 -
> arch/h8300/platform/h8300h/generic/crt0_ram.S | 107 ----
> arch/h8300/platform/h8300h/generic/crt0_rom.S | 122 ----
> arch/h8300/platform/h8300h/h8max/Makefile | 5 -
> arch/h8300/platform/h8300h/h8max/crt0_ram.S | 110 ----
> arch/h8300/platform/h8300h/irq.c | 82 ---
> arch/h8300/platform/h8300h/ptrace_h8300h.c | 284 ---------
> arch/h8300/platform/h8s/Makefile | 7 -
> arch/h8300/platform/h8s/edosk2674/Makefile | 5 -
> arch/h8300/platform/h8s/edosk2674/crt0_ram.S | 130 ----
> arch/h8300/platform/h8s/edosk2674/crt0_rom.S | 186 ------
> arch/h8300/platform/h8s/generic/Makefile | 5 -
> arch/h8300/platform/h8s/generic/crt0_ram.S | 127 ----
> arch/h8300/platform/h8s/generic/crt0_rom.S | 128 ----
> arch/h8300/platform/h8s/irq.c | 104 ----
> arch/h8300/platform/h8s/ptrace_h8s.c | 84 ---
> drivers/ide/Kconfig | 7 -
> drivers/ide/Makefile | 2 -
> drivers/ide/ide-h8300.c | 109 ----
> drivers/net/Space.c | 3 +-
> drivers/net/ethernet/8390/Kconfig | 7 -
> drivers/net/ethernet/8390/Makefile | 1 -
> drivers/net/ethernet/8390/ne-h8300.c | 684 ----------------------
> drivers/net/ethernet/smsc/smc9194.c | 24 -
> drivers/watchdog/Kconfig | 2 -
> drivers/watchdog/Makefile | 2 -
> fs/minix/Kconfig | 2 +-
> include/linux/serial_sci.h | 2 +-
> include/uapi/linux/audit.h | 1 -
> include/uapi/linux/elf-em.h | 1 -
> tools/testing/ktest/examples/crosstests.conf | 6 -
> 193 files changed, 3 insertions(+), 11742 deletions(-)
> delete mode 100644 arch/h8300/Kconfig
> delete mode 100644 arch/h8300/Kconfig.cpu
> delete mode 100644 arch/h8300/Kconfig.debug
> delete mode 100644 arch/h8300/Kconfig.ide
> delete mode 100644 arch/h8300/Makefile
> delete mode 100644 arch/h8300/README
> delete mode 100644 arch/h8300/boot/Makefile
> delete mode 100644 arch/h8300/boot/compressed/Makefile
> delete mode 100644 arch/h8300/boot/compressed/head.S
> delete mode 100644 arch/h8300/boot/compressed/misc.c
> delete mode 100644 arch/h8300/boot/compressed/vmlinux.lds
> delete mode 100644 arch/h8300/boot/compressed/vmlinux.scr
> delete mode 100644 arch/h8300/defconfig
> delete mode 100644 arch/h8300/include/asm/Kbuild
> delete mode 100644 arch/h8300/include/asm/asm-offsets.h
> delete mode 100644 arch/h8300/include/asm/atomic.h
> delete mode 100644 arch/h8300/include/asm/barrier.h
> delete mode 100644 arch/h8300/include/asm/bitops.h
> delete mode 100644 arch/h8300/include/asm/bootinfo.h
> delete mode 100644 arch/h8300/include/asm/bug.h
> delete mode 100644 arch/h8300/include/asm/bugs.h
> delete mode 100644 arch/h8300/include/asm/cache.h
> delete mode 100644 arch/h8300/include/asm/cachectl.h
> delete mode 100644 arch/h8300/include/asm/cacheflush.h
> delete mode 100644 arch/h8300/include/asm/checksum.h
> delete mode 100644 arch/h8300/include/asm/cmpxchg.h
> delete mode 100644 arch/h8300/include/asm/cputime.h
> delete mode 100644 arch/h8300/include/asm/current.h
> delete mode 100644 arch/h8300/include/asm/dbg.h
> delete mode 100644 arch/h8300/include/asm/delay.h
> delete mode 100644 arch/h8300/include/asm/device.h
> delete mode 100644 arch/h8300/include/asm/div64.h
> delete mode 100644 arch/h8300/include/asm/dma.h
> delete mode 100644 arch/h8300/include/asm/elf.h
> delete mode 100644 arch/h8300/include/asm/emergency-restart.h
> delete mode 100644 arch/h8300/include/asm/fb.h
> delete mode 100644 arch/h8300/include/asm/flat.h
> delete mode 100644 arch/h8300/include/asm/fpu.h
> delete mode 100644 arch/h8300/include/asm/ftrace.h
> delete mode 100644 arch/h8300/include/asm/futex.h
> delete mode 100644 arch/h8300/include/asm/gpio-internal.h
> delete mode 100644 arch/h8300/include/asm/hardirq.h
> delete mode 100644 arch/h8300/include/asm/hw_irq.h
> delete mode 100644 arch/h8300/include/asm/io.h
> delete mode 100644 arch/h8300/include/asm/irq.h
> delete mode 100644 arch/h8300/include/asm/irq_regs.h
> delete mode 100644 arch/h8300/include/asm/irqflags.h
> delete mode 100644 arch/h8300/include/asm/kdebug.h
> delete mode 100644 arch/h8300/include/asm/kmap_types.h
> delete mode 100644 arch/h8300/include/asm/local.h
> delete mode 100644 arch/h8300/include/asm/local64.h
> delete mode 100644 arch/h8300/include/asm/mc146818rtc.h
> delete mode 100644 arch/h8300/include/asm/mmu_context.h
> delete mode 100644 arch/h8300/include/asm/mutex.h
> delete mode 100644 arch/h8300/include/asm/page.h
> delete mode 100644 arch/h8300/include/asm/page_offset.h
> delete mode 100644 arch/h8300/include/asm/param.h
> delete mode 100644 arch/h8300/include/asm/pci.h
> delete mode 100644 arch/h8300/include/asm/percpu.h
> delete mode 100644 arch/h8300/include/asm/pgalloc.h
> delete mode 100644 arch/h8300/include/asm/pgtable.h
> delete mode 100644 arch/h8300/include/asm/processor.h
> delete mode 100644 arch/h8300/include/asm/ptrace.h
> delete mode 100644 arch/h8300/include/asm/regs267x.h
> delete mode 100644 arch/h8300/include/asm/regs306x.h
> delete mode 100644 arch/h8300/include/asm/scatterlist.h
> delete mode 100644 arch/h8300/include/asm/sections.h
> delete mode 100644 arch/h8300/include/asm/segment.h
> delete mode 100644 arch/h8300/include/asm/sh_bios.h
> delete mode 100644 arch/h8300/include/asm/shm.h
> delete mode 100644 arch/h8300/include/asm/shmparam.h
> delete mode 100644 arch/h8300/include/asm/signal.h
> delete mode 100644 arch/h8300/include/asm/smp.h
> delete mode 100644 arch/h8300/include/asm/spinlock.h
> delete mode 100644 arch/h8300/include/asm/string.h
> delete mode 100644 arch/h8300/include/asm/switch_to.h
> delete mode 100644 arch/h8300/include/asm/target_time.h
> delete mode 100644 arch/h8300/include/asm/termios.h
> delete mode 100644 arch/h8300/include/asm/thread_info.h
> delete mode 100644 arch/h8300/include/asm/timer.h
> delete mode 100644 arch/h8300/include/asm/timex.h
> delete mode 100644 arch/h8300/include/asm/tlb.h
> delete mode 100644 arch/h8300/include/asm/tlbflush.h
> delete mode 100644 arch/h8300/include/asm/topology.h
> delete mode 100644 arch/h8300/include/asm/traps.h
> delete mode 100644 arch/h8300/include/asm/types.h
> delete mode 100644 arch/h8300/include/asm/uaccess.h
> delete mode 100644 arch/h8300/include/asm/ucontext.h
> delete mode 100644 arch/h8300/include/asm/unaligned.h
> delete mode 100644 arch/h8300/include/asm/unistd.h
> delete mode 100644 arch/h8300/include/asm/user.h
> delete mode 100644 arch/h8300/include/asm/virtconvert.h
> delete mode 100644 arch/h8300/include/uapi/asm/Kbuild
> delete mode 100644 arch/h8300/include/uapi/asm/auxvec.h
> delete mode 100644 arch/h8300/include/uapi/asm/bitsperlong.h
> delete mode 100644 arch/h8300/include/uapi/asm/byteorder.h
> delete mode 100644 arch/h8300/include/uapi/asm/errno.h
> delete mode 100644 arch/h8300/include/uapi/asm/fcntl.h
> delete mode 100644 arch/h8300/include/uapi/asm/ioctl.h
> delete mode 100644 arch/h8300/include/uapi/asm/ioctls.h
> delete mode 100644 arch/h8300/include/uapi/asm/ipcbuf.h
> delete mode 100644 arch/h8300/include/uapi/asm/kvm_para.h
> delete mode 100644 arch/h8300/include/uapi/asm/mman.h
> delete mode 100644 arch/h8300/include/uapi/asm/msgbuf.h
> delete mode 100644 arch/h8300/include/uapi/asm/param.h
> delete mode 100644 arch/h8300/include/uapi/asm/poll.h
> delete mode 100644 arch/h8300/include/uapi/asm/posix_types.h
> delete mode 100644 arch/h8300/include/uapi/asm/ptrace.h
> delete mode 100644 arch/h8300/include/uapi/asm/resource.h
> delete mode 100644 arch/h8300/include/uapi/asm/sembuf.h
> delete mode 100644 arch/h8300/include/uapi/asm/setup.h
> delete mode 100644 arch/h8300/include/uapi/asm/shmbuf.h
> delete mode 100644 arch/h8300/include/uapi/asm/sigcontext.h
> delete mode 100644 arch/h8300/include/uapi/asm/siginfo.h
> delete mode 100644 arch/h8300/include/uapi/asm/signal.h
> delete mode 100644 arch/h8300/include/uapi/asm/socket.h
> delete mode 100644 arch/h8300/include/uapi/asm/sockios.h
> delete mode 100644 arch/h8300/include/uapi/asm/stat.h
> delete mode 100644 arch/h8300/include/uapi/asm/statfs.h
> delete mode 100644 arch/h8300/include/uapi/asm/swab.h
> delete mode 100644 arch/h8300/include/uapi/asm/termbits.h
> delete mode 100644 arch/h8300/include/uapi/asm/termios.h
> delete mode 100644 arch/h8300/include/uapi/asm/types.h
> delete mode 100644 arch/h8300/include/uapi/asm/unistd.h
> delete mode 100644 arch/h8300/kernel/Makefile
> delete mode 100644 arch/h8300/kernel/asm-offsets.c
> delete mode 100644 arch/h8300/kernel/entry.S
> delete mode 100644 arch/h8300/kernel/gpio.c
> delete mode 100644 arch/h8300/kernel/h8300_ksyms.c
> delete mode 100644 arch/h8300/kernel/irq.c
> delete mode 100644 arch/h8300/kernel/module.c
> delete mode 100644 arch/h8300/kernel/process.c
> delete mode 100644 arch/h8300/kernel/ptrace.c
> delete mode 100644 arch/h8300/kernel/setup.c
> delete mode 100644 arch/h8300/kernel/signal.c
> delete mode 100644 arch/h8300/kernel/sys_h8300.c
> delete mode 100644 arch/h8300/kernel/syscalls.S
> delete mode 100644 arch/h8300/kernel/time.c
> delete mode 100644 arch/h8300/kernel/timer/Makefile
> delete mode 100644 arch/h8300/kernel/timer/itu.c
> delete mode 100644 arch/h8300/kernel/timer/timer16.c
> delete mode 100644 arch/h8300/kernel/timer/timer8.c
> delete mode 100644 arch/h8300/kernel/timer/tpu.c
> delete mode 100644 arch/h8300/kernel/traps.c
> delete mode 100644 arch/h8300/kernel/vmlinux.lds.S
> delete mode 100644 arch/h8300/lib/Makefile
> delete mode 100644 arch/h8300/lib/abs.S
> delete mode 100644 arch/h8300/lib/ashrdi3.c
> delete mode 100644 arch/h8300/lib/checksum.c
> delete mode 100644 arch/h8300/lib/memcpy.S
> delete mode 100644 arch/h8300/lib/memset.S
> delete mode 100644 arch/h8300/lib/romfs.S
> delete mode 100644 arch/h8300/mm/Makefile
> delete mode 100644 arch/h8300/mm/fault.c
> delete mode 100644 arch/h8300/mm/init.c
> delete mode 100644 arch/h8300/mm/kmap.c
> delete mode 100644 arch/h8300/mm/memory.c
> delete mode 100644 arch/h8300/platform/h8300h/Makefile
> delete mode 100644 arch/h8300/platform/h8300h/aki3068net/Makefile
> delete mode 100644 arch/h8300/platform/h8300h/aki3068net/crt0_ram.S
> delete mode 100644 arch/h8300/platform/h8300h/generic/Makefile
> delete mode 100644 arch/h8300/platform/h8300h/generic/crt0_ram.S
> delete mode 100644 arch/h8300/platform/h8300h/generic/crt0_rom.S
> delete mode 100644 arch/h8300/platform/h8300h/h8max/Makefile
> delete mode 100644 arch/h8300/platform/h8300h/h8max/crt0_ram.S
> delete mode 100644 arch/h8300/platform/h8300h/irq.c
> delete mode 100644 arch/h8300/platform/h8300h/ptrace_h8300h.c
> delete mode 100644 arch/h8300/platform/h8s/Makefile
> delete mode 100644 arch/h8300/platform/h8s/edosk2674/Makefile
> delete mode 100644 arch/h8300/platform/h8s/edosk2674/crt0_ram.S
> delete mode 100644 arch/h8300/platform/h8s/edosk2674/crt0_rom.S
> delete mode 100644 arch/h8300/platform/h8s/generic/Makefile
> delete mode 100644 arch/h8300/platform/h8s/generic/crt0_ram.S
> delete mode 100644 arch/h8300/platform/h8s/generic/crt0_rom.S
> delete mode 100644 arch/h8300/platform/h8s/irq.c
> delete mode 100644 arch/h8300/platform/h8s/ptrace_h8s.c
> delete mode 100644 drivers/ide/ide-h8300.c
> delete mode 100644 drivers/net/ethernet/8390/ne-h8300.c
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
Chen Gang
^ permalink raw reply
* RE: [PATCH] net: fec: fix the error to get the previous BD entry
From: Duan Fugang-B38611 @ 2013-09-03 2:49 UTC (permalink / raw)
To: Li Frank-B20596, davem@davemloft.net
Cc: netdev@vger.kernel.org, bhutchings@solarflare.com,
stephen@networkplumber.org
In-Reply-To: <1F990F8245A4214A8CC4BFFBD9F790F908B45EA4@039-SN1MPN1-001.039d.mgd.msft.net>
From: Li Frank-B20596
Data: Tuesday, September 03, 2013 10:34 AM
> To: Duan Fugang-B38611; davem@davemloft.net
> Cc: netdev@vger.kernel.org; bhutchings@solarflare.com;
> stephen@networkplumber.org
> Subject: RE: [PATCH] net: fec: fix the error to get the previous BD entry
>
>
> > Bug: error to get the previous BD entry. When the current BD is the
> > first BD, the previous BD entry must be the last BD, not "bdp - 1" in
> current logic.
> >
> > V3:
> > * Restore the API name because David suggest to use fec_enet_
> > prefix for all function in fec driver.
> > So, change next_bd() -> fec_enet_get_nextdesc()
> > change pre_bd() -> fec_enet_get_prevdesc()
> > * Reduce the two APIs parameters for easy to call.
> >
> > V2:
> > * Add tx_ring_size and rx_ring_size to struct fec_enet_private.
> > * Replace api fec_enet_get_nextdesc() with next_bd().
> > Replace api fec_enet_get_prevdesc() with pre_bd().
> >
> > * Move all ring size check logic to next_bd() and pre_bd(), which
> > simplifies the code redundancy.
> >
> > V1:
> > * Add BD ring size check to get the previous BD entry in correctly.
> >
> > Reviewed-by: Li Frank <B20596@freescale.com>
> > Signed-off-by: Fugang Duan <B38611@freescale.com>
> > ---
> > drivers/net/ethernet/freescale/fec.h | 3 +
> > drivers/net/ethernet/freescale/fec_main.c | 120
> > ++++++++++++++++++---------
> > --
> > 2 files changed, 77 insertions(+), 46 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/fec.h
> > b/drivers/net/ethernet/freescale/fec.h
> > index ae23600..0120217 100644
> > --- a/drivers/net/ethernet/freescale/fec.h
> > +++ b/drivers/net/ethernet/freescale/fec.h
> > @@ -296,6 +296,9 @@ struct fec_enet_private {
> > /* The ring entries to be free()ed */
> > struct bufdesc *dirty_tx;
> >
> > + unsigned short tx_ring_size;
> > + unsigned short rx_ring_size;
> > +
> > struct platform_device *pdev;
> >
> > int opened;
> > diff --git a/drivers/net/ethernet/freescale/fec_main.c
> > b/drivers/net/ethernet/freescale/fec_main.c
> > index 4ea1555..d5d8984 100644
> > --- a/drivers/net/ethernet/freescale/fec_main.c
> > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > @@ -239,22 +239,57 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC
> > address");
> >
> > static int mii_cnt;
> >
> > -static struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, int
> > is_ex)
> > +static inline
> > +struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, struct
> > +fec_enet_private *fep)
> > {
> > - struct bufdesc_ex *ex = (struct bufdesc_ex *)bdp;
> > - if (is_ex)
> > - return (struct bufdesc *)(ex + 1);
> > + struct bufdesc *new_bd = bdp + 1;
> > + struct bufdesc_ex *ex_new_bd = (struct bufdesc_ex *)bdp + 1;
> > + struct bufdesc_ex *ex_base;
> > + struct bufdesc *base;
> > + int ring_size;
> > +
> > + if (bdp >= fep->tx_bd_base) {
> > + base = fep->tx_bd_base;
> > + ring_size = fep->tx_ring_size;
> > + ex_base = (struct bufdesc_ex *)fep->tx_bd_base;
> > + } else {
> > + base = fep->rx_bd_base;
> > + ring_size = fep->rx_ring_size;
> > + ex_base = (struct bufdesc_ex *)fep->rx_bd_base;
> > + }
> > +
> > + if (fep->bufdesc_ex)
> > + return (struct bufdesc *)((ex_new_bd >= (ex_base +
> ring_size)) ?
> > + (ex_new_bd - ring_size) : ex_new_bd);
>
> I think "exbase:ex_new_bd" is better
>
> > else
> > - return bdp + 1;
> > + return (new_bd >= (base + ring_size)) ?
> > + (new_bd - ring_size) : new_bd;
>
> I think "base:new_bd" is better.
>
Yes, it is more clean for code review. I have sent the V4 version.
Thanks.
^ permalink raw reply
* [PATCH] net: fec: fix the error to get the previous BD entry
From: Fugang Duan @ 2013-09-03 2:41 UTC (permalink / raw)
To: b20596, davem; +Cc: netdev, bhutchings, stephen
Bug: error to get the previous BD entry. When the current BD
is the first BD, the previous BD entry must be the last BD,
not "bdp - 1" in current logic.
V4:
* Optimize fec_enet_get_nextdesc() for code clean.
Replace "ex_new_bd - ring_size" with "ex_base".
Replace "new_bd - ring_size" with "base".
V3:
* Restore the API name because David suggest to use fec_enet_
prefix for all function in fec driver.
So, change next_bd() -> fec_enet_get_nextdesc()
change pre_bd() -> fec_enet_get_prevdesc()
* Reduce the two APIs parameters for easy to call.
V2:
* Add tx_ring_size and rx_ring_size to struct fec_enet_private.
* Replace api fec_enet_get_nextdesc() with next_bd().
Replace api fec_enet_get_prevdesc() with pre_bd().
* Move all ring size check logic to next_bd() and pre_bd(), which
simplifies the code redundancy.
V1:
* Add BD ring size check to get the previous BD entry in correctly.
Reviewed-by: Li Frank <B20596@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
---
drivers/net/ethernet/freescale/fec.h | 3 +
drivers/net/ethernet/freescale/fec_main.c | 120 ++++++++++++++++++-----------
2 files changed, 77 insertions(+), 46 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index ae23600..0120217 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -296,6 +296,9 @@ struct fec_enet_private {
/* The ring entries to be free()ed */
struct bufdesc *dirty_tx;
+ unsigned short tx_ring_size;
+ unsigned short rx_ring_size;
+
struct platform_device *pdev;
int opened;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 4ea1555..1364a6f 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -239,22 +239,57 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
static int mii_cnt;
-static struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, int is_ex)
+static inline
+struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, struct fec_enet_private *fep)
{
- struct bufdesc_ex *ex = (struct bufdesc_ex *)bdp;
- if (is_ex)
- return (struct bufdesc *)(ex + 1);
+ struct bufdesc *new_bd = bdp + 1;
+ struct bufdesc_ex *ex_new_bd = (struct bufdesc_ex *)bdp + 1;
+ struct bufdesc_ex *ex_base;
+ struct bufdesc *base;
+ int ring_size;
+
+ if (bdp >= fep->tx_bd_base) {
+ base = fep->tx_bd_base;
+ ring_size = fep->tx_ring_size;
+ ex_base = (struct bufdesc_ex *)fep->tx_bd_base;
+ } else {
+ base = fep->rx_bd_base;
+ ring_size = fep->rx_ring_size;
+ ex_base = (struct bufdesc_ex *)fep->rx_bd_base;
+ }
+
+ if (fep->bufdesc_ex)
+ return (struct bufdesc *)((ex_new_bd >= (ex_base + ring_size)) ?
+ ex_base : ex_new_bd);
else
- return bdp + 1;
+ return (new_bd >= (base + ring_size)) ?
+ base : new_bd;
}
-static struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp, int is_ex)
+static inline
+struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp, struct fec_enet_private *fep)
{
- struct bufdesc_ex *ex = (struct bufdesc_ex *)bdp;
- if (is_ex)
- return (struct bufdesc *)(ex - 1);
+ struct bufdesc *new_bd = bdp - 1;
+ struct bufdesc_ex *ex_new_bd = (struct bufdesc_ex *)bdp - 1;
+ struct bufdesc_ex *ex_base;
+ struct bufdesc *base;
+ int ring_size;
+
+ if (bdp >= fep->tx_bd_base) {
+ base = fep->tx_bd_base;
+ ring_size = fep->tx_ring_size;
+ ex_base = (struct bufdesc_ex *)fep->tx_bd_base;
+ } else {
+ base = fep->rx_bd_base;
+ ring_size = fep->rx_ring_size;
+ ex_base = (struct bufdesc_ex *)fep->rx_bd_base;
+ }
+
+ if (fep->bufdesc_ex)
+ return (struct bufdesc *)((ex_new_bd < ex_base) ?
+ (ex_new_bd + ring_size) : ex_new_bd);
else
- return bdp - 1;
+ return (new_bd < base) ? (new_bd + ring_size) : new_bd;
}
static void *swap_buffer(void *bufaddr, int len)
@@ -380,7 +415,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
}
}
- bdp_pre = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
+ bdp_pre = fec_enet_get_prevdesc(bdp, fep);
if ((id_entry->driver_data & FEC_QUIRK_ERR006358) &&
!(bdp_pre->cbd_sc & BD_ENET_TX_READY)) {
fep->delay_work.trig_tx = true;
@@ -389,10 +424,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
}
/* If this was the last BD in the ring, start at the beginning again. */
- if (status & BD_ENET_TX_WRAP)
- bdp = fep->tx_bd_base;
- else
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
fep->cur_tx = bdp;
@@ -417,18 +449,18 @@ static void fec_enet_bd_init(struct net_device *dev)
/* Initialize the receive buffer descriptors. */
bdp = fep->rx_bd_base;
- for (i = 0; i < RX_RING_SIZE; i++) {
+ for (i = 0; i < fep->rx_ring_size; i++) {
/* Initialize the BD for every fragment in the page. */
if (bdp->cbd_bufaddr)
bdp->cbd_sc = BD_ENET_RX_EMPTY;
else
bdp->cbd_sc = 0;
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
}
/* Set the last buffer to wrap */
- bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_prevdesc(bdp, fep);
bdp->cbd_sc |= BD_SC_WRAP;
fep->cur_rx = fep->rx_bd_base;
@@ -436,7 +468,7 @@ static void fec_enet_bd_init(struct net_device *dev)
/* ...and the same for transmit */
bdp = fep->tx_bd_base;
fep->cur_tx = bdp;
- for (i = 0; i < TX_RING_SIZE; i++) {
+ for (i = 0; i < fep->tx_ring_size; i++) {
/* Initialize the BD for every fragment in the page. */
bdp->cbd_sc = 0;
@@ -445,11 +477,11 @@ static void fec_enet_bd_init(struct net_device *dev)
fep->tx_skbuff[i] = NULL;
}
bdp->cbd_bufaddr = 0;
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
}
/* Set the last buffer to wrap */
- bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_prevdesc(bdp, fep);
bdp->cbd_sc |= BD_SC_WRAP;
fep->dirty_tx = bdp;
}
@@ -510,10 +542,10 @@ fec_restart(struct net_device *ndev, int duplex)
writel(fep->bd_dma, fep->hwp + FEC_R_DES_START);
if (fep->bufdesc_ex)
writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc_ex)
- * RX_RING_SIZE, fep->hwp + FEC_X_DES_START);
+ * fep->rx_ring_size, fep->hwp + FEC_X_DES_START);
else
writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc)
- * RX_RING_SIZE, fep->hwp + FEC_X_DES_START);
+ * fep->rx_ring_size, fep->hwp + FEC_X_DES_START);
for (i = 0; i <= TX_RING_MOD_MASK; i++) {
@@ -727,10 +759,7 @@ fec_enet_tx(struct net_device *ndev)
bdp = fep->dirty_tx;
/* get next bdp of dirty_tx */
- if (bdp->cbd_sc & BD_ENET_TX_WRAP)
- bdp = fep->tx_bd_base;
- else
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
while (((status = bdp->cbd_sc) & BD_ENET_TX_READY) == 0) {
@@ -800,10 +829,7 @@ fec_enet_tx(struct net_device *ndev)
fep->dirty_tx = bdp;
/* Update pointer to next buffer descriptor to be transmitted */
- if (status & BD_ENET_TX_WRAP)
- bdp = fep->tx_bd_base;
- else
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
/* Since we have freed up a buffer, the ring is no longer full
*/
@@ -994,10 +1020,8 @@ rx_processing_done:
}
/* Update BD pointer to next entry */
- if (status & BD_ENET_RX_WRAP)
- bdp = fep->rx_bd_base;
- else
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
+
/* Doing this here will keep the FEC running while we process
* incoming frames. On a heavily loaded network, we should be
* able to keep up at the expense of system resources.
@@ -1663,7 +1687,7 @@ static void fec_enet_free_buffers(struct net_device *ndev)
struct bufdesc *bdp;
bdp = fep->rx_bd_base;
- for (i = 0; i < RX_RING_SIZE; i++) {
+ for (i = 0; i < fep->rx_ring_size; i++) {
skb = fep->rx_skbuff[i];
if (bdp->cbd_bufaddr)
@@ -1671,11 +1695,11 @@ static void fec_enet_free_buffers(struct net_device *ndev)
FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE);
if (skb)
dev_kfree_skb(skb);
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
}
bdp = fep->tx_bd_base;
- for (i = 0; i < TX_RING_SIZE; i++)
+ for (i = 0; i < fep->tx_ring_size; i++)
kfree(fep->tx_bounce[i]);
}
@@ -1687,7 +1711,7 @@ static int fec_enet_alloc_buffers(struct net_device *ndev)
struct bufdesc *bdp;
bdp = fep->rx_bd_base;
- for (i = 0; i < RX_RING_SIZE; i++) {
+ for (i = 0; i < fep->rx_ring_size; i++) {
skb = netdev_alloc_skb(ndev, FEC_ENET_RX_FRSIZE);
if (!skb) {
fec_enet_free_buffers(ndev);
@@ -1704,15 +1728,15 @@ static int fec_enet_alloc_buffers(struct net_device *ndev)
ebdp->cbd_esc = BD_ENET_RX_INT;
}
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
}
/* Set the last buffer to wrap. */
- bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_prevdesc(bdp, fep);
bdp->cbd_sc |= BD_SC_WRAP;
bdp = fep->tx_bd_base;
- for (i = 0; i < TX_RING_SIZE; i++) {
+ for (i = 0; i < fep->tx_ring_size; i++) {
fep->tx_bounce[i] = kmalloc(FEC_ENET_TX_FRSIZE, GFP_KERNEL);
bdp->cbd_sc = 0;
@@ -1723,11 +1747,11 @@ static int fec_enet_alloc_buffers(struct net_device *ndev)
ebdp->cbd_esc = BD_ENET_TX_INT;
}
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
}
/* Set the last buffer to wrap. */
- bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_prevdesc(bdp, fep);
bdp->cbd_sc |= BD_SC_WRAP;
return 0;
@@ -1967,13 +1991,17 @@ static int fec_enet_init(struct net_device *ndev)
/* Get the Ethernet address */
fec_get_mac(ndev);
+ /* init the tx & rx ring size */
+ fep->tx_ring_size = TX_RING_SIZE;
+ fep->rx_ring_size = RX_RING_SIZE;
+
/* Set receive and transmit descriptor base. */
fep->rx_bd_base = cbd_base;
if (fep->bufdesc_ex)
fep->tx_bd_base = (struct bufdesc *)
- (((struct bufdesc_ex *)cbd_base) + RX_RING_SIZE);
+ (((struct bufdesc_ex *)cbd_base) + fep->rx_ring_size);
else
- fep->tx_bd_base = cbd_base + RX_RING_SIZE;
+ fep->tx_bd_base = cbd_base + fep->rx_ring_size;
/* The FEC Ethernet specific entries in the device structure */
ndev->watchdog_timeo = TX_TIMEOUT;
--
1.7.1
^ permalink raw reply related
* RE: [PATCH] net: fec: fix the error to get the previous BD entry
From: Li Frank-B20596 @ 2013-09-03 2:33 UTC (permalink / raw)
To: Duan Fugang-B38611, davem@davemloft.net
Cc: netdev@vger.kernel.org, bhutchings@solarflare.com,
stephen@networkplumber.org
In-Reply-To: <1378174690-20316-1-git-send-email-B38611@freescale.com>
> Bug: error to get the previous BD entry. When the current BD is the first BD,
> the previous BD entry must be the last BD, not "bdp - 1" in current logic.
>
> V3:
> * Restore the API name because David suggest to use fec_enet_
> prefix for all function in fec driver.
> So, change next_bd() -> fec_enet_get_nextdesc()
> change pre_bd() -> fec_enet_get_prevdesc()
> * Reduce the two APIs parameters for easy to call.
>
> V2:
> * Add tx_ring_size and rx_ring_size to struct fec_enet_private.
> * Replace api fec_enet_get_nextdesc() with next_bd().
> Replace api fec_enet_get_prevdesc() with pre_bd().
>
> * Move all ring size check logic to next_bd() and pre_bd(), which
> simplifies the code redundancy.
>
> V1:
> * Add BD ring size check to get the previous BD entry in correctly.
>
> Reviewed-by: Li Frank <B20596@freescale.com>
> Signed-off-by: Fugang Duan <B38611@freescale.com>
> ---
> drivers/net/ethernet/freescale/fec.h | 3 +
> drivers/net/ethernet/freescale/fec_main.c | 120 ++++++++++++++++++---------
> --
> 2 files changed, 77 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec.h
> b/drivers/net/ethernet/freescale/fec.h
> index ae23600..0120217 100644
> --- a/drivers/net/ethernet/freescale/fec.h
> +++ b/drivers/net/ethernet/freescale/fec.h
> @@ -296,6 +296,9 @@ struct fec_enet_private {
> /* The ring entries to be free()ed */
> struct bufdesc *dirty_tx;
>
> + unsigned short tx_ring_size;
> + unsigned short rx_ring_size;
> +
> struct platform_device *pdev;
>
> int opened;
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 4ea1555..d5d8984 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -239,22 +239,57 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
>
> static int mii_cnt;
>
> -static struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, int is_ex)
> +static inline
> +struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, struct
> +fec_enet_private *fep)
> {
> - struct bufdesc_ex *ex = (struct bufdesc_ex *)bdp;
> - if (is_ex)
> - return (struct bufdesc *)(ex + 1);
> + struct bufdesc *new_bd = bdp + 1;
> + struct bufdesc_ex *ex_new_bd = (struct bufdesc_ex *)bdp + 1;
> + struct bufdesc_ex *ex_base;
> + struct bufdesc *base;
> + int ring_size;
> +
> + if (bdp >= fep->tx_bd_base) {
> + base = fep->tx_bd_base;
> + ring_size = fep->tx_ring_size;
> + ex_base = (struct bufdesc_ex *)fep->tx_bd_base;
> + } else {
> + base = fep->rx_bd_base;
> + ring_size = fep->rx_ring_size;
> + ex_base = (struct bufdesc_ex *)fep->rx_bd_base;
> + }
> +
> + if (fep->bufdesc_ex)
> + return (struct bufdesc *)((ex_new_bd >= (ex_base + ring_size)) ?
> + (ex_new_bd - ring_size) : ex_new_bd);
I think "exbase:ex_new_bd" is better
> else
> - return bdp + 1;
> + return (new_bd >= (base + ring_size)) ?
> + (new_bd - ring_size) : new_bd;
I think "base:new_bd" is better.
> }
>
> -static struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp, int is_ex)
> +static inline
> +struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp, struct
> +fec_enet_private *fep)
> {
> - struct bufdesc_ex *ex = (struct bufdesc_ex *)bdp;
> - if (is_ex)
> - return (struct bufdesc *)(ex - 1);
> + struct bufdesc *new_bd = bdp - 1;
> + struct bufdesc_ex *ex_new_bd = (struct bufdesc_ex *)bdp - 1;
> + struct bufdesc_ex *ex_base;
> + struct bufdesc *base;
> + int ring_size;
> +
> + if (bdp >= fep->tx_bd_base) {
> + base = fep->tx_bd_base;
> + ring_size = fep->tx_ring_size;
> + ex_base = (struct bufdesc_ex *)fep->tx_bd_base;
> + } else {
> + base = fep->rx_bd_base;
> + ring_size = fep->rx_ring_size;
> + ex_base = (struct bufdesc_ex *)fep->rx_bd_base;
> + }
> +
> + if (fep->bufdesc_ex)
> + return (struct bufdesc *)((ex_new_bd < ex_base) ?
> + (ex_new_bd + ring_size) : ex_new_bd);
> else
> - return bdp - 1;
> + return (new_bd < base) ? (new_bd + ring_size) : new_bd;
> }
>
> static void *swap_buffer(void *bufaddr, int len) @@ -380,7 +415,7 @@
> fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> }
> }
>
> - bdp_pre = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
> + bdp_pre = fec_enet_get_prevdesc(bdp, fep);
> if ((id_entry->driver_data & FEC_QUIRK_ERR006358) &&
> !(bdp_pre->cbd_sc & BD_ENET_TX_READY)) {
> fep->delay_work.trig_tx = true;
> @@ -389,10 +424,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct
> net_device *ndev)
> }
>
> /* If this was the last BD in the ring, start at the beginning again.
> */
> - if (status & BD_ENET_TX_WRAP)
> - bdp = fep->tx_bd_base;
> - else
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
>
> fep->cur_tx = bdp;
>
> @@ -417,18 +449,18 @@ static void fec_enet_bd_init(struct net_device *dev)
>
> /* Initialize the receive buffer descriptors. */
> bdp = fep->rx_bd_base;
> - for (i = 0; i < RX_RING_SIZE; i++) {
> + for (i = 0; i < fep->rx_ring_size; i++) {
>
> /* Initialize the BD for every fragment in the page. */
> if (bdp->cbd_bufaddr)
> bdp->cbd_sc = BD_ENET_RX_EMPTY;
> else
> bdp->cbd_sc = 0;
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
> }
>
> /* Set the last buffer to wrap */
> - bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_prevdesc(bdp, fep);
> bdp->cbd_sc |= BD_SC_WRAP;
>
> fep->cur_rx = fep->rx_bd_base;
> @@ -436,7 +468,7 @@ static void fec_enet_bd_init(struct net_device *dev)
> /* ...and the same for transmit */
> bdp = fep->tx_bd_base;
> fep->cur_tx = bdp;
> - for (i = 0; i < TX_RING_SIZE; i++) {
> + for (i = 0; i < fep->tx_ring_size; i++) {
>
> /* Initialize the BD for every fragment in the page. */
> bdp->cbd_sc = 0;
> @@ -445,11 +477,11 @@ static void fec_enet_bd_init(struct net_device *dev)
> fep->tx_skbuff[i] = NULL;
> }
> bdp->cbd_bufaddr = 0;
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
> }
>
> /* Set the last buffer to wrap */
> - bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_prevdesc(bdp, fep);
> bdp->cbd_sc |= BD_SC_WRAP;
> fep->dirty_tx = bdp;
> }
> @@ -510,10 +542,10 @@ fec_restart(struct net_device *ndev, int duplex)
> writel(fep->bd_dma, fep->hwp + FEC_R_DES_START);
> if (fep->bufdesc_ex)
> writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc_ex)
> - * RX_RING_SIZE, fep->hwp + FEC_X_DES_START);
> + * fep->rx_ring_size, fep->hwp + FEC_X_DES_START);
> else
> writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc)
> - * RX_RING_SIZE, fep->hwp + FEC_X_DES_START);
> + * fep->rx_ring_size, fep->hwp + FEC_X_DES_START);
>
>
> for (i = 0; i <= TX_RING_MOD_MASK; i++) { @@ -727,10 +759,7 @@
> fec_enet_tx(struct net_device *ndev)
> bdp = fep->dirty_tx;
>
> /* get next bdp of dirty_tx */
> - if (bdp->cbd_sc & BD_ENET_TX_WRAP)
> - bdp = fep->tx_bd_base;
> - else
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
>
> while (((status = bdp->cbd_sc) & BD_ENET_TX_READY) == 0) {
>
> @@ -800,10 +829,7 @@ fec_enet_tx(struct net_device *ndev)
> fep->dirty_tx = bdp;
>
> /* Update pointer to next buffer descriptor to be transmitted */
> - if (status & BD_ENET_TX_WRAP)
> - bdp = fep->tx_bd_base;
> - else
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
>
> /* Since we have freed up a buffer, the ring is no longer full
> */
> @@ -994,10 +1020,8 @@ rx_processing_done:
> }
>
> /* Update BD pointer to next entry */
> - if (status & BD_ENET_RX_WRAP)
> - bdp = fep->rx_bd_base;
> - else
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
> +
> /* Doing this here will keep the FEC running while we process
> * incoming frames. On a heavily loaded network, we should be
> * able to keep up at the expense of system resources.
> @@ -1663,7 +1687,7 @@ static void fec_enet_free_buffers(struct net_device
> *ndev)
> struct bufdesc *bdp;
>
> bdp = fep->rx_bd_base;
> - for (i = 0; i < RX_RING_SIZE; i++) {
> + for (i = 0; i < fep->rx_ring_size; i++) {
> skb = fep->rx_skbuff[i];
>
> if (bdp->cbd_bufaddr)
> @@ -1671,11 +1695,11 @@ static void fec_enet_free_buffers(struct net_device
> *ndev)
> FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE);
> if (skb)
> dev_kfree_skb(skb);
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
> }
>
> bdp = fep->tx_bd_base;
> - for (i = 0; i < TX_RING_SIZE; i++)
> + for (i = 0; i < fep->tx_ring_size; i++)
> kfree(fep->tx_bounce[i]);
> }
>
> @@ -1687,7 +1711,7 @@ static int fec_enet_alloc_buffers(struct net_device
> *ndev)
> struct bufdesc *bdp;
>
> bdp = fep->rx_bd_base;
> - for (i = 0; i < RX_RING_SIZE; i++) {
> + for (i = 0; i < fep->rx_ring_size; i++) {
> skb = netdev_alloc_skb(ndev, FEC_ENET_RX_FRSIZE);
> if (!skb) {
> fec_enet_free_buffers(ndev);
> @@ -1704,15 +1728,15 @@ static int fec_enet_alloc_buffers(struct net_device
> *ndev)
> ebdp->cbd_esc = BD_ENET_RX_INT;
> }
>
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
> }
>
> /* Set the last buffer to wrap. */
> - bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_prevdesc(bdp, fep);
> bdp->cbd_sc |= BD_SC_WRAP;
>
> bdp = fep->tx_bd_base;
> - for (i = 0; i < TX_RING_SIZE; i++) {
> + for (i = 0; i < fep->tx_ring_size; i++) {
> fep->tx_bounce[i] = kmalloc(FEC_ENET_TX_FRSIZE, GFP_KERNEL);
>
> bdp->cbd_sc = 0;
> @@ -1723,11 +1747,11 @@ static int fec_enet_alloc_buffers(struct net_device
> *ndev)
> ebdp->cbd_esc = BD_ENET_TX_INT;
> }
>
> - bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_nextdesc(bdp, fep);
> }
>
> /* Set the last buffer to wrap. */
> - bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
> + bdp = fec_enet_get_prevdesc(bdp, fep);
> bdp->cbd_sc |= BD_SC_WRAP;
>
> return 0;
> @@ -1967,13 +1991,17 @@ static int fec_enet_init(struct net_device *ndev)
> /* Get the Ethernet address */
> fec_get_mac(ndev);
>
> + /* init the tx & rx ring size */
> + fep->tx_ring_size = TX_RING_SIZE;
> + fep->rx_ring_size = RX_RING_SIZE;
> +
> /* Set receive and transmit descriptor base. */
> fep->rx_bd_base = cbd_base;
> if (fep->bufdesc_ex)
> fep->tx_bd_base = (struct bufdesc *)
> - (((struct bufdesc_ex *)cbd_base) + RX_RING_SIZE);
> + (((struct bufdesc_ex *)cbd_base) + fep->rx_ring_size);
> else
> - fep->tx_bd_base = cbd_base + RX_RING_SIZE;
> + fep->tx_bd_base = cbd_base + fep->rx_ring_size;
>
> /* The FEC Ethernet specific entries in the device structure */
> ndev->watchdog_timeo = TX_TIMEOUT;
> --
> 1.7.1
^ permalink raw reply
* [PATCH] net: fec: fix the error to get the previous BD entry
From: Fugang Duan @ 2013-09-03 2:18 UTC (permalink / raw)
To: b20596, davem; +Cc: netdev, bhutchings, stephen
Bug: error to get the previous BD entry. When the current BD
is the first BD, the previous BD entry must be the last BD,
not "bdp - 1" in current logic.
V3:
* Restore the API name because David suggest to use fec_enet_
prefix for all function in fec driver.
So, change next_bd() -> fec_enet_get_nextdesc()
change pre_bd() -> fec_enet_get_prevdesc()
* Reduce the two APIs parameters for easy to call.
V2:
* Add tx_ring_size and rx_ring_size to struct fec_enet_private.
* Replace api fec_enet_get_nextdesc() with next_bd().
Replace api fec_enet_get_prevdesc() with pre_bd().
* Move all ring size check logic to next_bd() and pre_bd(), which
simplifies the code redundancy.
V1:
* Add BD ring size check to get the previous BD entry in correctly.
Reviewed-by: Li Frank <B20596@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
---
drivers/net/ethernet/freescale/fec.h | 3 +
drivers/net/ethernet/freescale/fec_main.c | 120 ++++++++++++++++++-----------
2 files changed, 77 insertions(+), 46 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index ae23600..0120217 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -296,6 +296,9 @@ struct fec_enet_private {
/* The ring entries to be free()ed */
struct bufdesc *dirty_tx;
+ unsigned short tx_ring_size;
+ unsigned short rx_ring_size;
+
struct platform_device *pdev;
int opened;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 4ea1555..d5d8984 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -239,22 +239,57 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
static int mii_cnt;
-static struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, int is_ex)
+static inline
+struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, struct fec_enet_private *fep)
{
- struct bufdesc_ex *ex = (struct bufdesc_ex *)bdp;
- if (is_ex)
- return (struct bufdesc *)(ex + 1);
+ struct bufdesc *new_bd = bdp + 1;
+ struct bufdesc_ex *ex_new_bd = (struct bufdesc_ex *)bdp + 1;
+ struct bufdesc_ex *ex_base;
+ struct bufdesc *base;
+ int ring_size;
+
+ if (bdp >= fep->tx_bd_base) {
+ base = fep->tx_bd_base;
+ ring_size = fep->tx_ring_size;
+ ex_base = (struct bufdesc_ex *)fep->tx_bd_base;
+ } else {
+ base = fep->rx_bd_base;
+ ring_size = fep->rx_ring_size;
+ ex_base = (struct bufdesc_ex *)fep->rx_bd_base;
+ }
+
+ if (fep->bufdesc_ex)
+ return (struct bufdesc *)((ex_new_bd >= (ex_base + ring_size)) ?
+ (ex_new_bd - ring_size) : ex_new_bd);
else
- return bdp + 1;
+ return (new_bd >= (base + ring_size)) ?
+ (new_bd - ring_size) : new_bd;
}
-static struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp, int is_ex)
+static inline
+struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp, struct fec_enet_private *fep)
{
- struct bufdesc_ex *ex = (struct bufdesc_ex *)bdp;
- if (is_ex)
- return (struct bufdesc *)(ex - 1);
+ struct bufdesc *new_bd = bdp - 1;
+ struct bufdesc_ex *ex_new_bd = (struct bufdesc_ex *)bdp - 1;
+ struct bufdesc_ex *ex_base;
+ struct bufdesc *base;
+ int ring_size;
+
+ if (bdp >= fep->tx_bd_base) {
+ base = fep->tx_bd_base;
+ ring_size = fep->tx_ring_size;
+ ex_base = (struct bufdesc_ex *)fep->tx_bd_base;
+ } else {
+ base = fep->rx_bd_base;
+ ring_size = fep->rx_ring_size;
+ ex_base = (struct bufdesc_ex *)fep->rx_bd_base;
+ }
+
+ if (fep->bufdesc_ex)
+ return (struct bufdesc *)((ex_new_bd < ex_base) ?
+ (ex_new_bd + ring_size) : ex_new_bd);
else
- return bdp - 1;
+ return (new_bd < base) ? (new_bd + ring_size) : new_bd;
}
static void *swap_buffer(void *bufaddr, int len)
@@ -380,7 +415,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
}
}
- bdp_pre = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
+ bdp_pre = fec_enet_get_prevdesc(bdp, fep);
if ((id_entry->driver_data & FEC_QUIRK_ERR006358) &&
!(bdp_pre->cbd_sc & BD_ENET_TX_READY)) {
fep->delay_work.trig_tx = true;
@@ -389,10 +424,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
}
/* If this was the last BD in the ring, start at the beginning again. */
- if (status & BD_ENET_TX_WRAP)
- bdp = fep->tx_bd_base;
- else
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
fep->cur_tx = bdp;
@@ -417,18 +449,18 @@ static void fec_enet_bd_init(struct net_device *dev)
/* Initialize the receive buffer descriptors. */
bdp = fep->rx_bd_base;
- for (i = 0; i < RX_RING_SIZE; i++) {
+ for (i = 0; i < fep->rx_ring_size; i++) {
/* Initialize the BD for every fragment in the page. */
if (bdp->cbd_bufaddr)
bdp->cbd_sc = BD_ENET_RX_EMPTY;
else
bdp->cbd_sc = 0;
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
}
/* Set the last buffer to wrap */
- bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_prevdesc(bdp, fep);
bdp->cbd_sc |= BD_SC_WRAP;
fep->cur_rx = fep->rx_bd_base;
@@ -436,7 +468,7 @@ static void fec_enet_bd_init(struct net_device *dev)
/* ...and the same for transmit */
bdp = fep->tx_bd_base;
fep->cur_tx = bdp;
- for (i = 0; i < TX_RING_SIZE; i++) {
+ for (i = 0; i < fep->tx_ring_size; i++) {
/* Initialize the BD for every fragment in the page. */
bdp->cbd_sc = 0;
@@ -445,11 +477,11 @@ static void fec_enet_bd_init(struct net_device *dev)
fep->tx_skbuff[i] = NULL;
}
bdp->cbd_bufaddr = 0;
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
}
/* Set the last buffer to wrap */
- bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_prevdesc(bdp, fep);
bdp->cbd_sc |= BD_SC_WRAP;
fep->dirty_tx = bdp;
}
@@ -510,10 +542,10 @@ fec_restart(struct net_device *ndev, int duplex)
writel(fep->bd_dma, fep->hwp + FEC_R_DES_START);
if (fep->bufdesc_ex)
writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc_ex)
- * RX_RING_SIZE, fep->hwp + FEC_X_DES_START);
+ * fep->rx_ring_size, fep->hwp + FEC_X_DES_START);
else
writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc)
- * RX_RING_SIZE, fep->hwp + FEC_X_DES_START);
+ * fep->rx_ring_size, fep->hwp + FEC_X_DES_START);
for (i = 0; i <= TX_RING_MOD_MASK; i++) {
@@ -727,10 +759,7 @@ fec_enet_tx(struct net_device *ndev)
bdp = fep->dirty_tx;
/* get next bdp of dirty_tx */
- if (bdp->cbd_sc & BD_ENET_TX_WRAP)
- bdp = fep->tx_bd_base;
- else
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
while (((status = bdp->cbd_sc) & BD_ENET_TX_READY) == 0) {
@@ -800,10 +829,7 @@ fec_enet_tx(struct net_device *ndev)
fep->dirty_tx = bdp;
/* Update pointer to next buffer descriptor to be transmitted */
- if (status & BD_ENET_TX_WRAP)
- bdp = fep->tx_bd_base;
- else
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
/* Since we have freed up a buffer, the ring is no longer full
*/
@@ -994,10 +1020,8 @@ rx_processing_done:
}
/* Update BD pointer to next entry */
- if (status & BD_ENET_RX_WRAP)
- bdp = fep->rx_bd_base;
- else
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
+
/* Doing this here will keep the FEC running while we process
* incoming frames. On a heavily loaded network, we should be
* able to keep up at the expense of system resources.
@@ -1663,7 +1687,7 @@ static void fec_enet_free_buffers(struct net_device *ndev)
struct bufdesc *bdp;
bdp = fep->rx_bd_base;
- for (i = 0; i < RX_RING_SIZE; i++) {
+ for (i = 0; i < fep->rx_ring_size; i++) {
skb = fep->rx_skbuff[i];
if (bdp->cbd_bufaddr)
@@ -1671,11 +1695,11 @@ static void fec_enet_free_buffers(struct net_device *ndev)
FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE);
if (skb)
dev_kfree_skb(skb);
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
}
bdp = fep->tx_bd_base;
- for (i = 0; i < TX_RING_SIZE; i++)
+ for (i = 0; i < fep->tx_ring_size; i++)
kfree(fep->tx_bounce[i]);
}
@@ -1687,7 +1711,7 @@ static int fec_enet_alloc_buffers(struct net_device *ndev)
struct bufdesc *bdp;
bdp = fep->rx_bd_base;
- for (i = 0; i < RX_RING_SIZE; i++) {
+ for (i = 0; i < fep->rx_ring_size; i++) {
skb = netdev_alloc_skb(ndev, FEC_ENET_RX_FRSIZE);
if (!skb) {
fec_enet_free_buffers(ndev);
@@ -1704,15 +1728,15 @@ static int fec_enet_alloc_buffers(struct net_device *ndev)
ebdp->cbd_esc = BD_ENET_RX_INT;
}
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
}
/* Set the last buffer to wrap. */
- bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_prevdesc(bdp, fep);
bdp->cbd_sc |= BD_SC_WRAP;
bdp = fep->tx_bd_base;
- for (i = 0; i < TX_RING_SIZE; i++) {
+ for (i = 0; i < fep->tx_ring_size; i++) {
fep->tx_bounce[i] = kmalloc(FEC_ENET_TX_FRSIZE, GFP_KERNEL);
bdp->cbd_sc = 0;
@@ -1723,11 +1747,11 @@ static int fec_enet_alloc_buffers(struct net_device *ndev)
ebdp->cbd_esc = BD_ENET_TX_INT;
}
- bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
}
/* Set the last buffer to wrap. */
- bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
+ bdp = fec_enet_get_prevdesc(bdp, fep);
bdp->cbd_sc |= BD_SC_WRAP;
return 0;
@@ -1967,13 +1991,17 @@ static int fec_enet_init(struct net_device *ndev)
/* Get the Ethernet address */
fec_get_mac(ndev);
+ /* init the tx & rx ring size */
+ fep->tx_ring_size = TX_RING_SIZE;
+ fep->rx_ring_size = RX_RING_SIZE;
+
/* Set receive and transmit descriptor base. */
fep->rx_bd_base = cbd_base;
if (fep->bufdesc_ex)
fep->tx_bd_base = (struct bufdesc *)
- (((struct bufdesc_ex *)cbd_base) + RX_RING_SIZE);
+ (((struct bufdesc_ex *)cbd_base) + fep->rx_ring_size);
else
- fep->tx_bd_base = cbd_base + RX_RING_SIZE;
+ fep->tx_bd_base = cbd_base + fep->rx_ring_size;
/* The FEC Ethernet specific entries in the device structure */
ndev->watchdog_timeo = TX_TIMEOUT;
--
1.7.1
^ permalink raw reply related
* Re: [PATCH net-next 0/5] bonding: locking simplifications and cleanup
From: Ding Tianhong @ 2013-09-03 1:48 UTC (permalink / raw)
To: Nikolay Aleksandrov; +Cc: netdev, andy, fubar, davem
In-Reply-To: <1378122702-28943-1-git-send-email-nikolay@redhat.com>
On 2013/9/2 19:51, Nikolay Aleksandrov wrote:
> Hello,
> This small patchset aims to remove some use cases of bond->lock for mutual
> exclusion which will help in the RCUfication of the function users. It also
> does some small style cleanups and fixes.
>
> Patch 01 - Drops the use of bond->lock as mutual exclusion for peer
> notification and relies on RTNL being held when send_peer_notif is modified
> Patch 02 - trivial outdated comment removal
> Patch 03 - Drops the use of bond->lock as mutual exclusion for lacp rate
> update and relies on RTNL, also fixes possible races with mode change
> Patch 04 - Drops read_lock in bond_fix_features because RTNL is held
> Patch 05 - Drops read_lock in bond_compute_features because RTNL is held
> whenever it's called
>
> Best regards,
> Nikolay Aleksandrov
>
> Nikolay Aleksandrov (5):
> bonding: simplify and fix peer notification
> bonding: trivial: remove outdated comment and braces
> bonding: simplify bond_3ad_update_lacp_rate and use RTNL for sync
> bonding: drop read_lock in bond_fix_features
> bonding: drop read_lock in bond_compute_features
>
> drivers/net/bonding/bond_3ad.c | 8 +------
> drivers/net/bonding/bond_main.c | 48 ++++++++++++----------------------------
> drivers/net/bonding/bond_sysfs.c | 7 +++++-
> 3 files changed, 21 insertions(+), 42 deletions(-)
>
Reviewed-by: Ding Tianhong <dingtianhong@huawei.com>
^ permalink raw reply
* RE: [PATCH] net: fec: fix the error to get the previous BD entry
From: Duan Fugang-B38611 @ 2013-09-03 1:39 UTC (permalink / raw)
To: Li Frank-B20596, davem@davemloft.net
Cc: netdev@vger.kernel.org, bhutchings@solarflare.com,
stephen@networkplumber.org
In-Reply-To: <1F990F8245A4214A8CC4BFFBD9F790F908B45674@039-SN1MPN1-001.039d.mgd.msft.net>
From: Li Frank-B20596
Data: Monday, September 02, 2013 10:30 PM
> To: Duan Fugang-B38611; davem@davemloft.net
> Cc: netdev@vger.kernel.org; bhutchings@solarflare.com;
> stephen@networkplumber.org
> Subject: RE: [PATCH] net: fec: fix the error to get the previous BD entry
>
>
>
> > -----Original Message-----
> > From: Duan Fugang-B38611
> > Sent: Monday, September 02, 2013 6:36 AM
> > To: Li Frank-B20596; davem@davemloft.net
> > Cc: netdev@vger.kernel.org; bhutchings@solarflare.com;
> > stephen@networkplumber.org
> > Subject: [PATCH] net: fec: fix the error to get the previous BD entry
> >
> > Bug: error to get the previous BD entry. When the current BD is the
> > first BD, the previous BD entry must be the last BD, not "bdp - 1" in
> current logic.
> >
> > V2:
> > Add tx_ring_size and rx_ring_size to struct fec_enet_private.
> > Replace api fec_enet_get_nextdesc() with next_bd().
> > Replace api fec_enet_get_prevdesc() with pre_bd().
> >
> > Move all ring size check logic to next_bd() and pre_bd, which
> > simplifies the code redundancy.
> >
> > V1:
> > Add BD ring size check to get the previous BD entry in correctly.
> >
> > Signed-off-by: Fugang Duan <B38611@freescale.com>
> > ---
> > drivers/net/ethernet/freescale/fec.h | 3 +
> > drivers/net/ethernet/freescale/fec_main.c | 94 +++++++++++++++-------
> -----
> > -
> > 2 files changed, 53 insertions(+), 44 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/fec.h
> > b/drivers/net/ethernet/freescale/fec.h
> > index ae23600..0120217 100644
> > --- a/drivers/net/ethernet/freescale/fec.h
> > +++ b/drivers/net/ethernet/freescale/fec.h
> > @@ -296,6 +296,9 @@ struct fec_enet_private {
> > /* The ring entries to be free()ed */
> > struct bufdesc *dirty_tx;
> >
> > + unsigned short tx_ring_size;
> > + unsigned short rx_ring_size;
> > +
> > struct platform_device *pdev;
> >
> > int opened;
> > diff --git a/drivers/net/ethernet/freescale/fec_main.c
> > b/drivers/net/ethernet/freescale/fec_main.c
> > index 4ea1555..9894dd3 100644
> > --- a/drivers/net/ethernet/freescale/fec_main.c
> > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > @@ -239,22 +239,35 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC
> > address");
> >
> > static int mii_cnt;
> >
> > -static struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, int
> > is_ex)
> > +static inline
> > +struct bufdesc *next_bd(struct bufdesc *bdp, struct bufdesc *base,
> > + int ring_size, int is_ex)
>
> David suggest use fec_enet_ prefix for all function in fec driver when I
> upstream it.
>
>
> How about use
> Fec_enet_next_bd(struct bufdesc *bdp, *fep)
> The parameter will become little and easy to call.
>
> > {
> > - struct bufdesc_ex *ex = (struct bufdesc_ex *)bdp;
> > + struct bufdesc *new_bd = bdp + 1;
> > + struct bufdesc_ex *ex_new_bd = (struct bufdesc_ex *)bdp + 1;
> > + struct bufdesc_ex *ex_base = (struct bufdesc_ex *)base;
> > +
>
> If pass down fep,
> If( bdp > fep->rx_base) {
> Ex_base = fep->rx_base;
> Ring_size = fep->rx_ring_size;
> }
> Else {
> Ex_base = fep->tx_base.
> Ring_size = fep->tx_ring_size;
> }
>
> Because RX always behind of TX.
>
Good idea, I will send patch V3. Thanks.
^ permalink raw reply
* Re: Is fallback vhost_net to qemu for live migrate available?
From: Qin Chuanyu @ 2013-09-03 1:28 UTC (permalink / raw)
To: Wei Liu
Cc: Anthony Liguori, Michael S. Tsirkin, jasowang, KVM list, netdev,
qianhuibin, xen-devel@lists.xen.org, wangfuhai, likunyun,
liuyongan, liuyingdong
In-Reply-To: <20130902075722.GZ15729@zion.uk.xensource.com>
On 2013/9/2 15:57, Wei Liu wrote:
> On Sat, Aug 31, 2013 at 12:45:11PM +0800, Qin Chuanyu wrote:
>> On 2013/8/30 0:08, Anthony Liguori wrote:
>>> Hi Qin,
>>
>>>> By change the memory copy and notify mechanism ,currently virtio-net with
>>>> vhost_net could run on Xen with good performance。
>>>
>>> I think the key in doing this would be to implement a property
>>> ioeventfd and irqfd interface in the driver domain kernel. Just
>>> hacking vhost_net with Xen specific knowledge would be pretty nasty
>>> IMHO.
>>>
>> Yes, I add a kernel module which persist virtio-net pio_addr and
>> msix address as what kvm module did. Guest wake up vhost thread by
>> adding a hook func in evtchn_interrupt.
>>
>>> Did you modify the front end driver to do grant table mapping or is
>>> this all being done by mapping the domain's memory?
>>>
>> There is nothing changed in front end driver. Currently I use
>> alloc_vm_area to get address space, and map the domain's memory as
>> what what qemu did.
>>
>
> You mean you're using xc_map_foreign_range and friends in the backend to
> map guest memory? That's not very desirable as it violates Xen's
> security model. It would not be too hard to pass grant references
> instead of guest physical memory address IMHO.
>
In fact, I did what virtio-net have done in Qemu. I think security
is a pseudo question because Dom0 is under control.
Host could access memory of guest in KVM much easier than Xen,
but I hadn't heard someone said KVM is un-secret.
Regards
Qin chuanyu
^ permalink raw reply
* [PATCH] ipv6: fix null pointer dereference in __ip6addrlbl_add
From: Hannes Frederic Sowa @ 2013-09-03 0:13 UTC (permalink / raw)
To: Michele Baldessari
Cc: netdev, Hideaki YOSHIFUJI, David S. Miller, Sasha Levin
In-Reply-To: <20130902213128.GB14301@marquez.int.rhx>
Hi!
On Mon, Sep 02, 2013 at 10:31:28PM +0100, Michele Baldessari wrote:
> with the latest linux master git tree from Linus
> (248d296d6d9df384996c2ed95676b367d876d48c - 2 Sep) I can reproduceably oops
> the kernel with the following commands:
> ip addrlabel flush
> ip addrlabel add prefix ::1/128 label 0
> ip addrlabel add prefix ::/0 label 1
Thanks for the report! This patch should fix this issue:
[PATCH] ipv6: fix null pointer dereference in __ip6addrlbl_add
Commit b67bfe0d42cac56c512dd5da4b1b347a23f4b70a ("hlist: drop
the node parameter from iterators") changed the behavior of
hlist_for_each_entry_safe to leave the p argument NULL.
Fix this up by tracking the last argument.
Reported-by: Michele Baldessari <michele@acksyn.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
net/ipv6/addrlabel.c | 48 +++++++++++++++++++++++-------------------------
1 file changed, 23 insertions(+), 25 deletions(-)
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
index f083a58..b30ad37 100644
--- a/net/ipv6/addrlabel.c
+++ b/net/ipv6/addrlabel.c
@@ -251,38 +251,36 @@ static struct ip6addrlbl_entry *ip6addrlbl_alloc(struct net *net,
/* add a label */
static int __ip6addrlbl_add(struct ip6addrlbl_entry *newp, int replace)
{
+ struct hlist_node *n;
+ struct ip6addrlbl_entry *last = NULL, *p = NULL;
int ret = 0;
- ADDRLABEL(KERN_DEBUG "%s(newp=%p, replace=%d)\n",
- __func__,
- newp, replace);
+ ADDRLABEL(KERN_DEBUG "%s(newp=%p, replace=%d)\n", __func__, newp,
+ replace);
- if (hlist_empty(&ip6addrlbl_table.head)) {
- hlist_add_head_rcu(&newp->list, &ip6addrlbl_table.head);
- } else {
- struct hlist_node *n;
- struct ip6addrlbl_entry *p = NULL;
- hlist_for_each_entry_safe(p, n,
- &ip6addrlbl_table.head, list) {
- if (p->prefixlen == newp->prefixlen &&
- net_eq(ip6addrlbl_net(p), ip6addrlbl_net(newp)) &&
- p->ifindex == newp->ifindex &&
- ipv6_addr_equal(&p->prefix, &newp->prefix)) {
- if (!replace) {
- ret = -EEXIST;
- goto out;
- }
- hlist_replace_rcu(&p->list, &newp->list);
- ip6addrlbl_put(p);
- goto out;
- } else if ((p->prefixlen == newp->prefixlen && !p->ifindex) ||
- (p->prefixlen < newp->prefixlen)) {
- hlist_add_before_rcu(&newp->list, &p->list);
+ hlist_for_each_entry_safe(p, n, &ip6addrlbl_table.head, list) {
+ if (p->prefixlen == newp->prefixlen &&
+ net_eq(ip6addrlbl_net(p), ip6addrlbl_net(newp)) &&
+ p->ifindex == newp->ifindex &&
+ ipv6_addr_equal(&p->prefix, &newp->prefix)) {
+ if (!replace) {
+ ret = -EEXIST;
goto out;
}
+ hlist_replace_rcu(&p->list, &newp->list);
+ ip6addrlbl_put(p);
+ goto out;
+ } else if ((p->prefixlen == newp->prefixlen && !p->ifindex) ||
+ (p->prefixlen < newp->prefixlen)) {
+ hlist_add_before_rcu(&newp->list, &p->list);
+ goto out;
}
- hlist_add_after_rcu(&p->list, &newp->list);
+ last = p;
}
+ if (last)
+ hlist_add_after_rcu(&last->list, &newp->list);
+ else
+ hlist_add_head_rcu(&newp->list, &ip6addrlbl_table.head);
out:
if (!ret)
ip6addrlbl_table.seq++;
--
1.8.3.1
^ permalink raw reply related
* [PATCH] ibmveth: Fix little endian issues
From: Anton Blanchard @ 2013-09-02 23:55 UTC (permalink / raw)
To: santil, netdev
The hypervisor is big endian, so little endian kernel builds need
to byteswap.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 70fd559..5d41aee 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -106,7 +106,7 @@ struct ibmveth_stat ibmveth_stats[] = {
/* simple methods of getting data from the current rxq entry */
static inline u32 ibmveth_rxq_flags(struct ibmveth_adapter *adapter)
{
- return adapter->rx_queue.queue_addr[adapter->rx_queue.index].flags_off;
+ return be32_to_cpu(adapter->rx_queue.queue_addr[adapter->rx_queue.index].flags_off);
}
static inline int ibmveth_rxq_toggle(struct ibmveth_adapter *adapter)
@@ -132,7 +132,7 @@ static inline int ibmveth_rxq_frame_offset(struct ibmveth_adapter *adapter)
static inline int ibmveth_rxq_frame_length(struct ibmveth_adapter *adapter)
{
- return adapter->rx_queue.queue_addr[adapter->rx_queue.index].length;
+ return be32_to_cpu(adapter->rx_queue.queue_addr[adapter->rx_queue.index].length);
}
static inline int ibmveth_rxq_csum_good(struct ibmveth_adapter *adapter)
diff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h
index 43a794f..84066ba 100644
--- a/drivers/net/ethernet/ibm/ibmveth.h
+++ b/drivers/net/ethernet/ibm/ibmveth.h
@@ -164,14 +164,26 @@ struct ibmveth_adapter {
u64 tx_send_failed;
};
+/*
+ * We pass struct ibmveth_buf_desc_fields to the hypervisor in registers,
+ * so we don't need to byteswap the two elements. However since we use
+ * a union (ibmveth_buf_desc) to convert from the struct to a u64 we
+ * do end up with endian specific ordering of the elements and that
+ * needs correcting.
+ */
struct ibmveth_buf_desc_fields {
+#ifdef __BIG_ENDIAN
+ u32 flags_len;
+ u32 address;
+#else
+ u32 address;
u32 flags_len;
+#endif
#define IBMVETH_BUF_VALID 0x80000000
#define IBMVETH_BUF_TOGGLE 0x40000000
#define IBMVETH_BUF_NO_CSUM 0x02000000
#define IBMVETH_BUF_CSUM_GOOD 0x01000000
#define IBMVETH_BUF_LEN_MASK 0x00FFFFFF
- u32 address;
};
union ibmveth_buf_desc {
@@ -180,7 +192,7 @@ union ibmveth_buf_desc {
};
struct ibmveth_rx_q_entry {
- u32 flags_off;
+ __be32 flags_off;
#define IBMVETH_RXQ_TOGGLE 0x80000000
#define IBMVETH_RXQ_TOGGLE_SHIFT 31
#define IBMVETH_RXQ_VALID 0x40000000
@@ -188,7 +200,8 @@ struct ibmveth_rx_q_entry {
#define IBMVETH_RXQ_CSUM_GOOD 0x01000000
#define IBMVETH_RXQ_OFF_MASK 0x0000FFFF
- u32 length;
+ __be32 length;
+ /* correlator is only used by the OS, no need to byte swap */
u64 correlator;
};
^ 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