* [PATCH v6 2/7] can: kvaser_usb: Send correct context to URB completion
From: Ahmed S. Darwish @ 2015-01-26 5:22 UTC (permalink / raw)
To: Olivier Sobrie, Oliver Hartkopp, Wolfgang Grandegger,
Marc Kleine-Budde, Andri Yngvason
Cc: Linux-CAN, netdev, LKML
In-Reply-To: <20150126052039.GB3014@Darwish.PC>
From: Ahmed S. Darwish <ahmed.darwish@valeo.com>
Send expected argument to the URB completion hander: a CAN
netdevice instead of the network interface private context
`kvaser_usb_net_priv'.
This was discovered by having some garbage in the kernel
log in place of the netdevice names: can0 and can1.
Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
---
drivers/net/can/usb/kvaser_usb.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 978a25e..f0c6207 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -587,7 +587,7 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv,
usb_sndbulkpipe(dev->udev,
dev->bulk_out->bEndpointAddress),
buf, msg->len,
- kvaser_usb_simple_msg_callback, priv);
+ kvaser_usb_simple_msg_callback, netdev);
usb_anchor_urb(urb, &priv->tx_submitted);
err = usb_submit_urb(urb, GFP_ATOMIC);
--
1.7.7.6
^ permalink raw reply related
* [PATCH v6 1/7] can: kvaser_usb: Do not sleep in atomic context
From: Ahmed S. Darwish @ 2015-01-26 5:20 UTC (permalink / raw)
To: Olivier Sobrie, Oliver Hartkopp, Wolfgang Grandegger,
Marc Kleine-Budde, Andri Yngvason
Cc: Linux-CAN, netdev, LKML
In-Reply-To: <20150126051755.GA3014@Darwish.PC>
From: Ahmed S. Darwish <ahmed.darwish@valeo.com>
Upon receiving a hardware event with the BUS_RESET flag set,
the driver kills all of its anchored URBs and resets all of
its transmit URB contexts.
Unfortunately it does so under the context of URB completion
handler `kvaser_usb_read_bulk_callback()', which is often
called in an atomic context.
While the device is flooded with many received error packets,
usb_kill_urb() typically sleeps/reschedules till the transfer
request of each killed URB in question completes, leading to
the sleep in atomic bug. [3]
In v2 submission of the original driver patch [1], it was
stated that the URBs kill and tx contexts reset was needed
since we don't receive any tx acknowledgments later and thus
such resources will be locked down forever. Fortunately this
is no longer needed since an earlier bugfix in this patch
series is now applied: all tx URB contexts are reset upon CAN
channel close. [2]
Moreover, a BUS_RESET is now treated _exactly_ like a BUS_OFF
event, which is the recommended handling method advised by
the device manufacturer.
[1] http://article.gmane.org/gmane.linux.network/239442
http://www.webcitation.org/6Vr2yagAQ
[2] can: kvaser_usb: Reset all URB tx contexts upon channel close
889b77f7fd2bcc922493d73a4c51d8a851505815
[3] Stacktrace:
<IRQ> [<ffffffff8158de87>] dump_stack+0x45/0x57
[<ffffffff8158b60c>] __schedule_bug+0x41/0x4f
[<ffffffff815904b1>] __schedule+0x5f1/0x700
[<ffffffff8159360a>] ? _raw_spin_unlock_irqrestore+0xa/0x10
[<ffffffff81590684>] schedule+0x24/0x70
[<ffffffff8147d0a5>] usb_kill_urb+0x65/0xa0
[<ffffffff81077970>] ? prepare_to_wait_event+0x110/0x110
[<ffffffff8147d7d8>] usb_kill_anchored_urbs+0x48/0x80
[<ffffffffa01f4028>] kvaser_usb_unlink_tx_urbs+0x18/0x50 [kvaser_usb]
[<ffffffffa01f45d0>] kvaser_usb_rx_error+0xc0/0x400 [kvaser_usb]
[<ffffffff8108b14a>] ? vprintk_default+0x1a/0x20
[<ffffffffa01f5241>] kvaser_usb_read_bulk_callback+0x4c1/0x5f0 [kvaser_usb]
[<ffffffff8147a73e>] __usb_hcd_giveback_urb+0x5e/0xc0
[<ffffffff8147a8a1>] usb_hcd_giveback_urb+0x41/0x110
[<ffffffffa0008748>] finish_urb+0x98/0x180 [ohci_hcd]
[<ffffffff810cd1a7>] ? acct_account_cputime+0x17/0x20
[<ffffffff81069f65>] ? local_clock+0x15/0x30
[<ffffffffa000a36b>] ohci_work+0x1fb/0x5a0 [ohci_hcd]
[<ffffffff814fbb31>] ? process_backlog+0xb1/0x130
[<ffffffffa000cd5b>] ohci_irq+0xeb/0x270 [ohci_hcd]
[<ffffffff81479fc1>] usb_hcd_irq+0x21/0x30
[<ffffffff8108bfd3>] handle_irq_event_percpu+0x43/0x120
[<ffffffff8108c0ed>] handle_irq_event+0x3d/0x60
[<ffffffff8108ec84>] handle_fasteoi_irq+0x74/0x110
[<ffffffff81004dfd>] handle_irq+0x1d/0x30
[<ffffffff81004727>] do_IRQ+0x57/0x100
[<ffffffff8159482a>] common_interrupt+0x6a/0x6a
Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
---
drivers/net/can/usb/kvaser_usb.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index c32cd61..978a25e 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -662,11 +662,6 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev,
priv = dev->nets[channel];
stats = &priv->netdev->stats;
- if (status & M16C_STATE_BUS_RESET) {
- kvaser_usb_unlink_tx_urbs(priv);
- return;
- }
-
skb = alloc_can_err_skb(priv->netdev, &cf);
if (!skb) {
stats->rx_dropped++;
@@ -677,7 +672,7 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev,
netdev_dbg(priv->netdev, "Error status: 0x%02x\n", status);
- if (status & M16C_STATE_BUS_OFF) {
+ if (status & (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) {
cf->can_id |= CAN_ERR_BUSOFF;
priv->can.can_stats.bus_off++;
--
1.7.7.6
^ permalink raw reply related
* Re: [PATCH net-next v3 2/2] iproute2: bridge vlan show new option to print ranges
From: roopa @ 2015-01-26 5:18 UTC (permalink / raw)
To: Scott Feldman; +Cc: Netdev, shemminger, vyasevic@redhat.com, Wilson Kok
In-Reply-To: <CAE4R7bCR6YSK9J+OV+04w_UXWoSu56xSvHXkYkDzqP4Qudn76Q@mail.gmail.com>
On 1/25/15, 8:35 PM, Scott Feldman wrote:
>> diff --git a/bridge/bridge.c b/bridge/bridge.c
>> index 5fcc552..88469ca 100644
>> --- a/bridge/bridge.c
>> +++ b/bridge/bridge.c
>> @@ -21,6 +21,7 @@ int resolve_hosts;
>> int oneline = 0;
>> int show_stats;
>> int show_details;
>> +int compress_vlans;
>> int timestamp;
>> char * _SL_ = NULL;
>>
>> @@ -32,7 +33,8 @@ static void usage(void)
>> "Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n"
>> "where OBJECT := { link | fdb | mdb | vlan | monitor }\n"
>> " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |\n"
>> -" -o[neline] | -t[imestamp] | -n[etns] name }\n");
>> +" -o[neline] | -t[imestamp] | -n[etns] name |\n"
>> +" -c[ompressvlans] }\n");
> This option is awkward at this level since it's specific to bridge vlan cmd.
>
> Is it even necessary? The real user of compressed vlans isn't the
> "bridge show" cmd; just keep "bridge show" simple, listing each vlan
> per line.
without ranges it does get a bit difficult (or rather long) to read if
there are many vlans (it was also a comment I received on v2).
All the available options whether they apply to the immediate
sub-command or not are at the toplevel command today.
Hence the position (Not a big fan of the current name. suggestions welcome).
I would have loved to have the default output print ranges, If that is
acceptable. But, that can break new iproute2 on older kernels (If that
is something we should care about).
other option is keyword argument like maybe 'bridge vlan show
compressed' or 'bridge vlan show ranges'
Thanks,
Roopa
^ permalink raw reply
* [PATCH v6 0/7] can: kvaser_usb: Leaf bugfixes and USBCan-II support
From: Ahmed S. Darwish @ 2015-01-26 5:17 UTC (permalink / raw)
To: Olivier Sobrie, Oliver Hartkopp, Wolfgang Grandegger,
Marc Kleine-Budde, Andri Yngvason
Cc: Linux-CAN, netdev, LKML
In-Reply-To: <20141223154654.GB6460@vivalin-002>
Hi!
This is an updated patch series for the Kvaser CAN/USB devices:
1- Extra patches are now added to the series. Most importantly
patch #1 which fixes a critical `sleep in atomic context' bug
in the current upstream driver. Patch #2 fixes a corruption in
the kernel logs, also affecting current upstream driver. Patch
#4 was originally USBCan-II only, but since it's a generic fix,
it's now retrofitted to the Leaf-only upstream driver first.
2- The series has been re-organized so that patches #1 -> #4
inclusive can go to linux-can/origin, while the rest can move
to -next.
3- There are some important updates regarding the USBCan-II
error counters, and how really erratic their heaviour is. All
the new details are covered at the bottom of this URL:
http://article.gmane.org/gmane.linux.can/7481
4- Attached below is the new candump traces. Now
`back-to-error-active' states appear _if_ the hardware was
kind enough and decreased the error counters appropriately.
The earlier code did not recognize the error counters going
down, thus the `back-to-error-active' transitions did not
appear.
###########################################################
* Bus-off scenario (with transitions active -> passive -> back-to-active):
(000.000000) can0 20000080 [8] 00 00 00 00 00 00 30 00 ERRORFRAME
bus-error
error-counter-tx-rx{{48}{0}}
(000.000011) can0 20000084 [8] 00 20 00 00 00 00 88 00 ERRORFRAME
controller-problem{tx-error-passive}
bus-error
error-counter-tx-rx{{136}{0}}
(000.000001) can0 20000080 [8] 00 00 00 00 00 00 88 00 ERRORFRAME
bus-error
error-counter-tx-rx{{136}{0}}
(000.000987) can0 20000080 [8] 00 00 00 00 00 00 98 00 ERRORFRAME
bus-error
error-counter-tx-rx{{152}{0}}
(000.002011) can0 20000084 [8] 00 40 00 00 00 00 30 00 ERRORFRAME
controller-problem{back-to-error-active}
bus-error
error-counter-tx-rx{{48}{0}}
(000.000004) can0 20000084 [8] 00 20 00 00 00 00 78 00 ERRORFRAME
controller-problem{tx-error-passive}
bus-error
error-counter-tx-rx{{120}{0}}
(000.000002) can0 20000080 [8] 00 00 00 00 00 00 88 00 ERRORFRAME
bus-error
error-counter-tx-rx{{136}{0}}
(000.000005) can0 20000080 [8] 00 00 00 00 00 00 90 00 ERRORFRAME
bus-error
error-counter-tx-rx{{144}{0}}
(000.000002) can0 20000080 [8] 00 00 00 00 00 00 98 00 ERRORFRAME
bus-error
error-counter-tx-rx{{152}{0}}
(000.000001) can0 20000080 [8] 00 00 00 00 00 00 A0 00 ERRORFRAME
bus-error
error-counter-tx-rx{{160}{0}}
(000.000966) can0 20000080 [8] 00 00 00 00 00 00 A8 00 ERRORFRAME
bus-error
error-counter-tx-rx{{168}{0}}
(000.002998) can0 20000084 [8] 00 40 00 00 00 00 30 00 ERRORFRAME
controller-problem{back-to-error-active}
bus-error
error-counter-tx-rx{{48}{0}}
(000.000004) can0 20000084 [8] 00 20 00 00 00 00 80 00 ERRORFRAME
controller-problem{tx-error-passive}
bus-error
error-counter-tx-rx{{128}{0}}
(000.000002) can0 20000080 [8] 00 00 00 00 00 00 88 00 ERRORFRAME
bus-error
error-counter-tx-rx{{136}{0}}
(001.031035) can0 200000C0 [8] 00 00 00 00 00 00 00 29 ERRORFRAME
bus-off
bus-error
error-counter-tx-rx{{0}{41}}
###########################################################
Regular sending, unpluggng CAN connector, then plugging again:
(with transitions active -> warning -> passive)
[ As stated earlier, the counters don't get decreased upon CAN
replug, even if they were constantly polled. ]
(000.011001) can0 2A1 [1] E5
(000.010001) can0 50E [8] E6 05 00 00 00 00 00 00
(000.009999) can0 009 [1] E7
(000.011000) can0 6E2 [8] E8 05 00 00 00 00 00 00
(000.009999) can0 314 [2] E9 05
(000.010001) can0 708 [6] EA 05 00 00 00 00
(000.010991) can0 20000080 [8] 00 00 00 00 00 00 00 09 ERRORFRAME
bus-error
error-counter-tx-rx{{0}{9}}
(000.000002) can0 20000080 [8] 00 00 00 00 00 00 00 0A ERRORFRAME
bus-error
error-counter-tx-rx{{0}{10}}
(000.000007) can0 20000080 [8] 00 00 00 00 00 00 00 2E ERRORFRAME
bus-error
error-counter-tx-rx{{0}{46}}
(000.000003) can0 20000080 [8] 00 00 00 00 00 00 00 37 ERRORFRAME
bus-error
error-counter-tx-rx{{0}{55}}
(000.000002) can0 20000080 [8] 00 00 00 00 00 00 00 40 ERRORFRAME
bus-error
error-counter-tx-rx{{0}{64}}
(000.000993) can0 20000080 [8] 00 00 00 00 00 00 00 49 ERRORFRAME
bus-error
error-counter-tx-rx{{0}{73}}
(000.000002) can0 20000080 [8] 00 00 00 00 00 00 00 52 ERRORFRAME
bus-error
error-counter-tx-rx{{0}{82}}
(000.000001) can0 20000080 [8] 00 00 00 00 00 00 00 5B ERRORFRAME
bus-error
error-counter-tx-rx{{0}{91}}
(000.000028) can0 20000084 [8] 00 04 00 00 00 00 00 6C ERRORFRAME
controller-problem{rx-error-warning}
bus-error
error-counter-tx-rx{{0}{108}}
(000.000955) can0 20000080 [8] 00 00 00 00 00 00 00 7F ERRORFRAME
bus-error
error-counter-tx-rx{{0}{127}}
(000.000008) can0 20000084 [8] 00 10 00 00 00 00 00 87 ERRORFRAME
controller-problem{rx-error-passive}
bus-error
error-counter-tx-rx{{0}{135}}
(000.000001) can0 20000080 [8] 00 00 00 00 00 00 00 87 ERRORFRAME
bus-error
error-counter-tx-rx{{0}{135}}
(000.000004) can0 20000080 [8] 00 00 00 00 00 00 00 87 ERRORFRAME
bus-error
error-counter-tx-rx{{0}{135}}
((( Then a continous flood, exactly similar to the above packet, appears )))
(000.500004) can0 2ED [4] EB 05 00 00
(000.000006) can0 0DD [5] EC 05 00 00 00
(000.000002) can0 1D3 [1] ED
(000.000988) can0 20D [8] EE 05 00 00 00 00 00 00
(000.000006) can0 04B [8] EF 05 00 00 00 00 00 00
(000.000002) can0 320 [8] F0 05 00 00 00 00 00 00
(000.000002) can0 023 [8] F1 05 00 00 00 00 00 00
(000.000989) can0 21D [8] F2 05 00 00 00 00 00 00
(000.000005) can0 17D [8] F3 05 00 00 00 00 00 00
(000.000002) can0 6DC [8] F4 05 00 00 00 00 00 00
(000.000993) can0 62D [8] F5 05 00 00 00 00 00 00
(000.000006) can0 18B [6] F6 05 00 00 00 00
(000.000001) can0 7EB [8] F7 05 00 00 00 00 00 00
(000.000001) can0 014 [8] F8 05 00 00 00 00 00 00
(000.000994) can0 52F [8] F9 05 00 00 00 00 00 00
--
Regards,
Darwish
^ permalink raw reply
* Re: [PATCH net-next v3 2/2] iproute2: bridge vlan show new option to print ranges
From: Scott Feldman @ 2015-01-26 4:35 UTC (permalink / raw)
To: Roopa Prabhu; +Cc: Netdev, shemminger, vyasevic@redhat.com, Wilson Kok
In-Reply-To: <1422239185-14054-3-git-send-email-roopa@cumulusnetworks.com>
> diff --git a/bridge/bridge.c b/bridge/bridge.c
> index 5fcc552..88469ca 100644
> --- a/bridge/bridge.c
> +++ b/bridge/bridge.c
> @@ -21,6 +21,7 @@ int resolve_hosts;
> int oneline = 0;
> int show_stats;
> int show_details;
> +int compress_vlans;
> int timestamp;
> char * _SL_ = NULL;
>
> @@ -32,7 +33,8 @@ static void usage(void)
> "Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n"
> "where OBJECT := { link | fdb | mdb | vlan | monitor }\n"
> " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |\n"
> -" -o[neline] | -t[imestamp] | -n[etns] name }\n");
> +" -o[neline] | -t[imestamp] | -n[etns] name |\n"
> +" -c[ompressvlans] }\n");
This option is awkward at this level since it's specific to bridge vlan cmd.
Is it even necessary? The real user of compressed vlans isn't the
"bridge show" cmd; just keep "bridge show" simple, listing each vlan
per line.
^ permalink raw reply
* netlink: Kill redundant net argument in netlink_insert
From: Herbert Xu @ 2015-01-26 3:02 UTC (permalink / raw)
To: netdev
The socket already carries the net namespace with it so there is
no need to be passing another net around.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 7a94185..d77b346 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -994,11 +994,10 @@ static struct sock *__netlink_lookup(struct netlink_table *table, u32 portid,
&netlink_compare, &arg);
}
-static bool __netlink_insert(struct netlink_table *table, struct sock *sk,
- struct net *net)
+static bool __netlink_insert(struct netlink_table *table, struct sock *sk)
{
struct netlink_compare_arg arg = {
- .net = net,
+ .net = sock_net(sk),
.portid = nlk_sk(sk)->portid,
};
@@ -1047,7 +1046,7 @@ netlink_update_listeners(struct sock *sk)
* makes sure updates are visible before bind or setsockopt return. */
}
-static int netlink_insert(struct sock *sk, struct net *net, u32 portid)
+static int netlink_insert(struct sock *sk, u32 portid)
{
struct netlink_table *table = &nl_table[sk->sk_protocol];
int err;
@@ -1067,7 +1066,7 @@ static int netlink_insert(struct sock *sk, struct net *net, u32 portid)
sock_hold(sk);
err = 0;
- if (!__netlink_insert(table, sk, net)) {
+ if (!__netlink_insert(table, sk)) {
err = -EADDRINUSE;
sock_put(sk);
}
@@ -1289,7 +1288,7 @@ retry:
}
rcu_read_unlock();
- err = netlink_insert(sk, net, portid);
+ err = netlink_insert(sk, portid);
if (err == -EADDRINUSE)
goto retry;
@@ -1477,7 +1476,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
if (!nlk->portid) {
err = nladdr->nl_pid ?
- netlink_insert(sk, net, nladdr->nl_pid) :
+ netlink_insert(sk, nladdr->nl_pid) :
netlink_autobind(sock);
if (err) {
netlink_undo_bind(nlk->ngroups, groups, sk);
@@ -2483,7 +2482,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module,
if (cfg && cfg->input)
nlk_sk(sk)->netlink_rcv = cfg->input;
- if (netlink_insert(sk, net, 0))
+ if (netlink_insert(sk, 0))
goto out_sock_release;
nlk = nlk_sk(sk);
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply related
* Re: [PATCH v1 2/2] net: stmmac: add fixed_phy support via fixed-link DT binding
From: Andreas Färber @ 2015-01-26 3:01 UTC (permalink / raw)
To: Ming Lei, linux-arm-kernel, David S. Miller
Cc: linux-samsung-soc, Kukjin Kim, netdev, Byungho An,
Florian Fainelli
In-Reply-To: <1422239858-3452-3-git-send-email-ming.lei@canonical.com>
[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]
Am 26.01.2015 um 03:37 schrieb Ming Lei:
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 8c6b7c16..ddb4351 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -847,8 +847,11 @@ static int stmmac_init_phy(struct net_device *dev)
> * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent
> * device as well.
> * Note: phydev->phy_id is the result of reading the UID PHY registers.
> + * But phy_id returned from fixed phy is always zero, so bypass the
> + * check for fixed phy.
> */
> - if (phydev->phy_id == 0) {
> + if (phydev->phy_id == 0 && (!priv->plat->phy_bus_name ||
> + strcmp(priv->plat->phy_bus_name,"fixed"))) {
Small nit here: There's a space missing between the arguments.
Cheers,
Andreas
> phy_disconnect(phydev);
> return -ENODEV;
> }
[snip]
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* [PATCH] brcmfmac: avoid duplicated suspend/resume operation
From: Fu, Zhonghui @ 2015-01-26 2:46 UTC (permalink / raw)
To: brudley-dY08KVG/lbpWk0Htik3J/w, Arend van Spriel, Franky Lin,
meuleman-dY08KVG/lbpWk0Htik3J/w, Kalle Valo,
linville-2XuSBdqkA4R54TAoqtyWWQ, pieterpg-dY08KVG/lbpWk0Htik3J/w,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA, wens-jdAy2FN1RRM,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
brcm80211-dev-list-dY08KVG/lbpWk0Htik3J/w,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>From ff39ed4af9f1c50358fe92ec4c8eaac9db183e00 Mon Sep 17 00:00:00 2001
From: Zhonghui Fu <zhonghui.fu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Date: Mon, 26 Jan 2015 10:13:21 +0800
Subject: [PATCH] brcmfmac: avoid duplicated suspend/resume operation
WiFi chip has 2 SDIO functions, and PM core will trigger
twice suspend/resume operations for one WiFi chip to do
the same things. This patch avoid this case.
Acked-by: Arend van Spriel<arend-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Signed-off-by: Zhonghui Fu <zhonghui.fu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index 9880dae..618b545 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -1139,11 +1139,17 @@ void brcmf_sdio_wowl_config(struct device *dev, bool enabled)
static int brcmf_ops_sdio_suspend(struct device *dev)
{
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
- struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
+ struct brcmf_sdio_dev *sdiodev;
mmc_pm_flag_t sdio_flags;
+ struct sdio_func *func = dev_to_sdio_func(dev);
brcmf_dbg(SDIO, "Enter\n");
+ if (func->num == 2)
+ return 0;
+
+ sdiodev = bus_if->bus_priv.sdio;
+
atomic_set(&sdiodev->suspend, true);
if (sdiodev->wowl_enabled) {
@@ -1164,9 +1170,16 @@ static int brcmf_ops_sdio_suspend(struct device *dev)
static int brcmf_ops_sdio_resume(struct device *dev)
{
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
- struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
+ struct brcmf_sdio_dev *sdiodev;
+ struct sdio_func *func = dev_to_sdio_func(dev);
brcmf_dbg(SDIO, "Enter\n");
+
+ if (func->num == 2)
+ return 0;
+
+ sdiodev = bus_if->bus_priv.sdio;
+
if (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)
disable_irq_wake(sdiodev->pdata->oob_irq_nr);
brcmf_sdio_wd_timer(sdiodev->bus, BRCMF_WD_POLL_MS);
-- 1.7.1
--
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 related
* [PATCH v1 2/2] net: stmmac: add fixed_phy support via fixed-link DT binding
From: Ming Lei @ 2015-01-26 2:37 UTC (permalink / raw)
To: linux-arm-kernel, David S. Miller
Cc: linux-samsung-soc, Kukjin Kim, netdev, Byungho An,
Florian Fainelli, Ming Lei
In-Reply-To: <1422239858-3452-1-git-send-email-ming.lei@canonical.com>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ++++-
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 10 ++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8c6b7c16..ddb4351 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -847,8 +847,11 @@ static int stmmac_init_phy(struct net_device *dev)
* 0 rather than 0xffff. Catch this here and treat 0 as a non-existent
* device as well.
* Note: phydev->phy_id is the result of reading the UID PHY registers.
+ * But phy_id returned from fixed phy is always zero, so bypass the
+ * check for fixed phy.
*/
- if (phydev->phy_id == 0) {
+ if (phydev->phy_id == 0 && (!priv->plat->phy_bus_name ||
+ strcmp(priv->plat->phy_bus_name,"fixed"))) {
phy_disconnect(phydev);
return -ENODEV;
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 3039de2..73a3ced 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -27,6 +27,7 @@
#include <linux/of.h>
#include <linux/of_net.h>
#include <linux/of_device.h>
+#include <linux/of_mdio.h>
#include "stmmac.h"
#include "stmmac_platform.h"
@@ -216,6 +217,15 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
plat->pmt = 1;
}
+ if (of_phy_is_fixed_link(np)) {
+ int ret = of_phy_register_fixed_link(np);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to register fixed PHY\n");
+ return ret;
+ }
+ plat->phy_bus_name = "fixed";
+ }
+
if (of_device_is_compatible(np, "snps,dwmac-3.610") ||
of_device_is_compatible(np, "snps,dwmac-3.710")) {
plat->enh_desc = 1;
--
1.7.9.5
^ permalink raw reply related
* [PATCH v1 1/2] ARM: exynos5440-sd5v1: switch to fixed-link DT binding
From: Ming Lei @ 2015-01-26 2:37 UTC (permalink / raw)
To: linux-arm-kernel, David S. Miller
Cc: linux-samsung-soc, Kukjin Kim, netdev, Byungho An,
Florian Fainelli, Ming Lei
In-Reply-To: <1422239858-3452-1-git-send-email-ming.lei@canonical.com>
The previous dts property isn't standard way for fixed phy
support, and switch to the fixed-link DT binding.
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
arch/arm/boot/dts/exynos5440-sd5v1.dts | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/exynos5440-sd5v1.dts b/arch/arm/boot/dts/exynos5440-sd5v1.dts
index 268609a..ee65a5c 100644
--- a/arch/arm/boot/dts/exynos5440-sd5v1.dts
+++ b/arch/arm/boot/dts/exynos5440-sd5v1.dts
@@ -28,8 +28,10 @@
};
gmac: ethernet@00230000 {
- fixed_phy;
- phy_addr = <1>;
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
};
spi {
--
1.7.9.5
^ permalink raw reply related
* [PATCH v1 0/2] ARM EXYNOS5 & net: add fixed phy support
From: Ming Lei @ 2015-01-26 2:37 UTC (permalink / raw)
To: linux-arm-kernel, David S. Miller
Cc: linux-samsung-soc, Kukjin Kim, netdev, Byungho An,
Florian Fainelli
Hi,
These two patches adds fixed phy support using the fixed-link DT binding
for stmmac.
v1:
- bypassing check on phy id for fixed phy (patch 2/2)
Thanks,
Ming Lei
^ permalink raw reply
* [PATCH net-next v3 2/2] iproute2: bridge vlan show new option to print ranges
From: roopa @ 2015-01-26 2:26 UTC (permalink / raw)
To: netdev, shemminger, vyasevic; +Cc: wkok, sfeldma
From: Roopa Prabhu <roopa@cumulusnetworks.com>
Introduce new option -c[ompressvlans] to request
vlan ranges from kernel
(pls suggest better option names if this does not look ok)
$bridge vlan show
port vlan ids
dummy0 1 PVID Egress Untagged
dummy1 1 PVID Egress Untagged
2
3
4
5
6
7
9
10
12
br0 1 PVID Egress Untagged
$bridge help
Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }
where OBJECT := { link | fdb | mdb | vlan | monitor }
OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |
-o[neline] | -t[imestamp] | -n[etns] name |
-c[ompressvlans] }
$bridge -c vlan show
port vlan ids
dummy0 1 PVID Egress Untagged
dummy1 1 PVID Egress Untagged
2-7
9-10
12
br0 1 PVID Egress Untagged
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
bridge/br_common.h | 1 +
bridge/bridge.c | 6 +++++-
bridge/vlan.c | 11 +++++++++--
include/linux/rtnetlink.h | 1 +
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/bridge/br_common.h b/bridge/br_common.h
index 12fce3e..169a162 100644
--- a/bridge/br_common.h
+++ b/bridge/br_common.h
@@ -16,4 +16,5 @@ extern int preferred_family;
extern int show_stats;
extern int show_details;
extern int timestamp;
+extern int compress_vlans;
extern struct rtnl_handle rth;
diff --git a/bridge/bridge.c b/bridge/bridge.c
index 5fcc552..88469ca 100644
--- a/bridge/bridge.c
+++ b/bridge/bridge.c
@@ -21,6 +21,7 @@ int resolve_hosts;
int oneline = 0;
int show_stats;
int show_details;
+int compress_vlans;
int timestamp;
char * _SL_ = NULL;
@@ -32,7 +33,8 @@ static void usage(void)
"Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n"
"where OBJECT := { link | fdb | mdb | vlan | monitor }\n"
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |\n"
-" -o[neline] | -t[imestamp] | -n[etns] name }\n");
+" -o[neline] | -t[imestamp] | -n[etns] name |\n"
+" -c[ompressvlans] }\n");
exit(-1);
}
@@ -117,6 +119,8 @@ main(int argc, char **argv)
NEXT_ARG();
if (netns_switch(argv[1]))
exit(-1);
+ } else if (matches(opt, "-compressvlans") == 0) {
+ ++compress_vlans;
} else {
fprintf(stderr, "Option \"%s\" is unknown, try \"bridge help\".\n", opt);
exit(-1);
diff --git a/bridge/vlan.c b/bridge/vlan.c
index 88992e6..9f6c84e 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -182,7 +182,12 @@ static int print_vlan(const struct sockaddr_nl *who,
continue;
vinfo = RTA_DATA(i);
- fprintf(fp, "\t %hu", vinfo->vid);
+ if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END)
+ fprintf(fp, "-%hu", vinfo->vid);
+ else
+ fprintf(fp, "\t %hu", vinfo->vid);
+ if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN)
+ continue;
if (vinfo->flags & BRIDGE_VLAN_INFO_PVID)
fprintf(fp, " PVID");
if (vinfo->flags & BRIDGE_VLAN_INFO_UNTAGGED)
@@ -218,7 +223,9 @@ static int vlan_show(int argc, char **argv)
}
if (rtnl_wilddump_req_filter(&rth, PF_BRIDGE, RTM_GETLINK,
- RTEXT_FILTER_BRVLAN) < 0) {
+ (compress_vlans ?
+ RTEXT_FILTER_BRVLAN_COMPRESSED :
+ RTEXT_FILTER_BRVLAN)) < 0) {
perror("Cannont send dump request");
exit(1);
}
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 9aa5c2f..19eadb1 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -632,6 +632,7 @@ struct tcamsg {
/* New extended info filters for IFLA_EXT_MASK */
#define RTEXT_FILTER_VF (1 << 0)
#define RTEXT_FILTER_BRVLAN (1 << 1)
+#define RTEXT_FILTER_BRVLAN_COMPRESSED (1 << 2)
/* End of information exported to user level */
--
1.7.10.4
^ permalink raw reply related
* [PATCH net-next v3 1/2] iproute2: bridge: support vlan range adds
From: roopa @ 2015-01-26 2:26 UTC (permalink / raw)
To: netdev, shemminger, vyasevic; +Cc: wkok, sfeldma
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This patch adds vlan range support to bridge add command
using the newly added vinfo flags BRIDGE_VLAN_INFO_RANGE_BEGIN and
BRIDGE_VLAN_INFO_RANGE_END.
$bridge vlan show
port vlan ids
br0 1 PVID Egress Untagged
dummy0 1 PVID Egress Untagged
$bridge vlan add vid 10-15 dev dummy0
port vlan ids
br0 1 PVID Egress Untagged
dummy0 1 PVID Egress Untagged
10
11
12
13
14
15
$bridge vlan del vid 14 dev dummy0
$bridge vlan show
port vlan ids
br0 1 PVID Egress Untagged
dummy0 1 PVID Egress Untagged
10
11
12
13
15
$bridge vlan del vid 10-15 dev dummy0
$bridge vlan show
port vlan ids
br0 1 PVID Egress Untagged
dummy0 1 PVID Egress Untagged
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
---
bridge/vlan.c | 44 ++++++++++++++++++++++++++++++++++++++++----
include/linux/if_bridge.h | 2 ++
2 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/bridge/vlan.c b/bridge/vlan.c
index 3bd7b0d..88992e6 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -32,6 +32,7 @@ static int vlan_modify(int cmd, int argc, char **argv)
} req;
char *d = NULL;
short vid = -1;
+ short vid_end = -1;
struct rtattr *afspec;
struct bridge_vlan_info vinfo;
unsigned short flags = 0;
@@ -49,8 +50,18 @@ static int vlan_modify(int cmd, int argc, char **argv)
NEXT_ARG();
d = *argv;
} else if (strcmp(*argv, "vid") == 0) {
+ char *p;
NEXT_ARG();
- vid = atoi(*argv);
+ p = strchr(*argv, '-');
+ if (p) {
+ *p = '\0';
+ p++;
+ vid = atoi(*argv);
+ vid_end = atoi(p);
+ vinfo.flags |= BRIDGE_VLAN_INFO_RANGE_BEGIN;
+ } else {
+ vid = atoi(*argv);
+ }
} else if (strcmp(*argv, "self") == 0) {
flags |= BRIDGE_FLAGS_SELF;
} else if (strcmp(*argv, "master") == 0) {
@@ -83,15 +94,40 @@ static int vlan_modify(int cmd, int argc, char **argv)
return -1;
}
- vinfo.vid = vid;
+ if (vinfo.flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) {
+ if (vid_end == -1 || vid_end >= 4096 || vid >= vid_end) {
+ fprintf(stderr, "Invalid VLAN range \"%hu-%hu\"\n",
+ vid, vid_end);
+ return -1;
+ }
+ if (vinfo.flags & BRIDGE_VLAN_INFO_PVID) {
+ fprintf(stderr,
+ "pvid cannot be configured for a vlan range\n");
+ return -1;
+ }
+ }
afspec = addattr_nest(&req.n, sizeof(req), IFLA_AF_SPEC);
if (flags)
addattr16(&req.n, sizeof(req), IFLA_BRIDGE_FLAGS, flags);
- addattr_l(&req.n, sizeof(req), IFLA_BRIDGE_VLAN_INFO, &vinfo,
- sizeof(vinfo));
+ vinfo.vid = vid;
+ if (vid_end != -1) {
+ /* send vlan range start */
+ addattr_l(&req.n, sizeof(req), IFLA_BRIDGE_VLAN_INFO, &vinfo,
+ sizeof(vinfo));
+ vinfo.flags &= ~BRIDGE_VLAN_INFO_RANGE_BEGIN;
+
+ /* Now send the vlan range end */
+ vinfo.flags |= BRIDGE_VLAN_INFO_RANGE_END;
+ vinfo.vid = vid_end;
+ addattr_l(&req.n, sizeof(req), IFLA_BRIDGE_VLAN_INFO, &vinfo,
+ sizeof(vinfo));
+ } else {
+ addattr_l(&req.n, sizeof(req), IFLA_BRIDGE_VLAN_INFO, &vinfo,
+ sizeof(vinfo));
+ }
addattr_nest_end(&req.n, afspec);
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 19ff22a..efa10b8 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -125,6 +125,8 @@ enum {
#define BRIDGE_VLAN_INFO_MASTER (1<<0) /* Operate on Bridge device as well */
#define BRIDGE_VLAN_INFO_PVID (1<<1) /* VLAN is PVID, ingress untagged */
#define BRIDGE_VLAN_INFO_UNTAGGED (1<<2) /* VLAN egresses untagged */
+#define BRIDGE_VLAN_INFO_RANGE_BEGIN (1<<3) /* VLAN is start of vlan range */
+#define BRIDGE_VLAN_INFO_RANGE_END (1<<4) /* VLAN is end of vlan range */
struct bridge_vlan_info {
__u16 flags;
--
1.7.10.4
^ permalink raw reply related
* [PATCH net-next v3 0/2] iproute2: bridge vlan range support
From: roopa @ 2015-01-26 2:26 UTC (permalink / raw)
To: netdev, shemminger, vyasevic; +Cc: wkok, sfeldma
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This series adds support for vlan ranges in iproute2 bridge add
and show commands.
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
Roopa Prabhu (2):
iproute2: bridge: support vlan range for adds
iproute2: bridge vlan show new option to print ranges
bridge/br_common.h | 1 +
bridge/bridge.c | 6 ++++-
bridge/vlan.c | 55 ++++++++++++++++++++++++++++++++++++++++-----
include/linux/if_bridge.h | 2 ++
include/linux/rtnetlink.h | 1 +
5 files changed, 58 insertions(+), 7 deletions(-)
--
1.7.10.4
^ permalink raw reply
* Re: Question on SCTP ABORT chunk is generated when the association_max_retrans is reached
From: Sun Paul @ 2015-01-26 1:27 UTC (permalink / raw)
To: Daniel Borkmann
Cc: Michael Tuexen, Vlad Yasevich, linux-sctp, netdev, linux-kernel
In-Reply-To: <54C29B82.7090502@redhat.com>
Hi
sorry for the late reply. I am a bit confused. when side-A sends a
request to side-B, and side-B return the response, but side-A keep
re-transmit the same request to side-B, why side-B needed to send a
ABORT to side-A?
If it is used in order to reestablish the connection, shoudn't it
should be side-A to send ABORT instead?
- PS
On Sat, Jan 24, 2015 at 3:05 AM, Daniel Borkmann <dborkman@redhat.com> wrote:
> On 01/23/2015 07:36 PM, Michael Tuexen wrote:
> ...
>>
>> Yepp. It might not reach the peer or it might. If it does it helps
>> to keep the states in sync. If it doesn't it sometimes helps in
>> analysing tracefiles. In BSD, we also send it. It is not required,
>> doesn't harm and is useful in some cases...
>
>
> Ok, as the TCB is destroyed in any case, should be fine then.
>
> Thanks,
> Daniel
^ permalink raw reply
* Re: [PATCH net-next 0/2] net: phy and dsa random fixes/cleanups
From: David Miller @ 2015-01-26 0:03 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev
In-Reply-To: <1421800920-6281-1-git-send-email-f.fainelli@gmail.com>
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue, 20 Jan 2015 16:41:58 -0800
> These two patches were already present as part of my attempt to make
> DSA modules work properly, these are the only two "valid" patches at
> this point which should not need any further rework.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH] net: dsa: set slave MII bus PHY mask
From: David Miller @ 2015-01-26 0:01 UTC (permalink / raw)
To: vivien.didelot; +Cc: netdev, f.fainelli, linux-kernel, kernel
In-Reply-To: <1421799212-2028-2-git-send-email-vivien.didelot@savoirfairelinux.com>
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Date: Tue, 20 Jan 2015 19:13:32 -0500
> When registering a mdio bus, Linux assumes than every port has a PHY and tries
> to scan it. If a switch port has no PHY registered, DSA will fail to register
> the slave MII bus. To fix this, set the slave MII bus PHY mask to the switch
> PHYs mask.
>
> As an example, if we use a Marvell MV88E6352 (which is a 7-port switch with no
> registered PHYs for port 5 and port 6), with the following declared names:
>
> static struct dsa_chip_data switch_cdata = {
> [...]
> .port_names[0] = "sw0",
> .port_names[1] = "sw1",
> .port_names[2] = "sw2",
> .port_names[3] = "sw3",
> .port_names[4] = "sw4",
> .port_names[5] = "cpu",
> };
>
> DSA will fail to create the switch instance. With the PHY mask set for the
> slave MII bus, only the PHY for ports 0-4 will be scanned and the instance will
> be successfully created.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Applied.
^ permalink raw reply
* [PATCH 1/2] rhashtable: Introduce rhashtable_walk_*
From: Herbert Xu @ 2015-01-25 23:21 UTC (permalink / raw)
To: Thomas Graf, Ying Xue, davem, kaber, paulmck, netdev,
netfilter-devel
In-Reply-To: <20150125232040.GA17936@gondor.apana.org.au>
Some existing rhashtable users get too intimate with it by walking
the buckets directly. This prevents us from easily changing the
internals of rhashtable.
This patch adds the helpers rhashtable_walk_init/next/end which
will replace these custom walkers.
They are meant to be usable for both procfs seq_file walks as well
as walking by a netlink dump. The iterator structure should fit
inside a netlink dump cb structure, with at least one element to
spare.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
include/linux/rhashtable.h | 44 +++++++++++++++++++++
lib/rhashtable.c | 91 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 135 insertions(+)
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 6d7e840..b03b375 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -18,6 +18,7 @@
#ifndef _LINUX_RHASHTABLE_H
#define _LINUX_RHASHTABLE_H
+#include <linux/compiler.h>
#include <linux/list_nulls.h>
#include <linux/workqueue.h>
#include <linux/mutex.h>
@@ -123,6 +124,22 @@ struct rhashtable {
bool being_destroyed;
};
+/**
+ * struct rhashtable_iter - Hash table iterator
+ * @ht: Table to iterate through
+ * @p: Current pointer
+ * @lock: Slot lock
+ * @slot: Current slot
+ * @skip: Number of entries to skip in slot
+ */
+struct rhashtable_iter {
+ struct rhashtable *ht;
+ struct rhash_head *p;
+ spinlock_t *lock;
+ unsigned int slot;
+ unsigned int skip;
+};
+
static inline unsigned long rht_marker(const struct rhashtable *ht, u32 hash)
{
return NULLS_MARKER(ht->p.nulls_base + hash);
@@ -178,6 +195,33 @@ bool rhashtable_lookup_compare_insert(struct rhashtable *ht,
bool (*compare)(void *, void *),
void *arg);
+/**
+ * rhashtable_walk_init - Initialise an iterator
+ * @ht: Table to walk over
+ * @iter: Hash table Iterator
+ *
+ * This function prepares a hash table walk.
+ * Note that if you restart a walk after rhashtable_walk_stop you
+ * may see the same object twice. Also, you may miss objects if
+ * there are removals in between rhashtable_walk_stop and the next
+ * call to rhashtable_walk_start.
+ *
+ * For a completely stable walk you should construct your own data
+ * structure outside the hash table.
+ */
+static inline void rhashtable_walk_init(struct rhashtable *ht,
+ struct rhashtable_iter *iter)
+{
+ iter->ht = ht;
+ iter->p = NULL;
+ iter->slot = 0;
+ iter->skip = 0;
+}
+
+int rhashtable_walk_start(struct rhashtable_iter *iter) __acquires(RCU);
+void *rhashtable_walk_next(struct rhashtable_iter *iter);
+void rhashtable_walk_stop(struct rhashtable_iter *iter) __releases(RCU);
+
void rhashtable_destroy(struct rhashtable *ht);
#define rht_dereference(p, ht) \
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 71c6aa1..d51fb06 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -813,6 +813,97 @@ exit:
}
EXPORT_SYMBOL_GPL(rhashtable_lookup_compare_insert);
+/**
+ * rhashtable_walk_start - Start a hash table walk
+ * @iter: Hash table iterator
+ *
+ * Start a hash table walk.
+ *
+ * Returns zero if successful. Returns -EINTR if we couldn't
+ * obtain the resize lock.
+ */
+int rhashtable_walk_start(struct rhashtable_iter *iter)
+{
+ struct rhashtable *ht = iter->ht;
+ int err;
+
+ err = mutex_lock_interruptible(&ht->mutex);
+ rcu_read_lock();
+
+ if (!err)
+ mutex_unlock(&ht->mutex);
+
+ return err;
+}
+EXPORT_SYMBOL_GPL(rhashtable_walk_start);
+
+/**
+ * rhashtable_walk_next - Return the next object and advance the iterator
+ * @iter: Hash table iterator
+ *
+ * Note that you must call rhashtable_walk_stop when you are finished
+ * with the walk.
+ *
+ * Returns the next object or NULL when the end of the table is reached.
+ */
+void *rhashtable_walk_next(struct rhashtable_iter *iter)
+{
+ const struct bucket_table *tbl;
+ struct rhashtable *ht = iter->ht;
+ struct rhash_head *p = iter->p;
+
+ tbl = rht_dereference_rcu(ht->tbl, ht);
+
+ if (p) {
+ p = rht_dereference_bucket(p->next, tbl, iter->slot);
+ goto next;
+ }
+
+ for (; iter->slot < tbl->size; iter->slot++) {
+ int skip = iter->skip;
+
+ iter->lock = bucket_lock(tbl, iter->slot);
+ spin_lock_bh(iter->lock);
+
+ rht_for_each(p, tbl, iter->slot) {
+ if (!skip)
+ break;
+ skip--;
+ }
+
+next:
+ if (!rht_is_a_nulls(p)) {
+ iter->skip++;
+ iter->p = p;
+ return rht_obj(ht, p);
+ }
+ spin_unlock_bh(iter->lock);
+
+ iter->skip = 0;
+ }
+
+ iter->p = NULL;
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(rhashtable_walk_next);
+
+/**
+ * rhashtable_walk_stop - Finish a hash table walk
+ * @iter: Hash table iterator
+ *
+ * Finish a hash table walk.
+ */
+void rhashtable_walk_stop(struct rhashtable_iter *iter)
+{
+ if (iter->p)
+ spin_unlock_bh(iter->lock);
+
+ rcu_read_unlock();
+
+ iter->p = NULL;
+}
+EXPORT_SYMBOL_GPL(rhashtable_walk_stop);
+
static size_t rounded_hashtable_size(struct rhashtable_params *params)
{
return max(roundup_pow_of_two(params->nelem_hint * 4 / 3),
^ permalink raw reply related
* [PATCH 2/2] netlink: Use rhashtable walk iterator
From: Herbert Xu @ 2015-01-25 23:21 UTC (permalink / raw)
To: Thomas Graf, Ying Xue, davem, kaber, paulmck, netdev,
netfilter-devel
In-Reply-To: <20150125232040.GA17936@gondor.apana.org.au>
This patch gets rid of the manual rhashtable walk in netlink
which touches rhashtable internals that should not be exposed.
It does so by using the rhashtable iterator primitives.
In fact the existing code was very buggy. Some sockets weren't
shown at all while others were shown more than once.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
net/netlink/af_netlink.c | 113 +++++++++++++++++------------------------------
1 file changed, 41 insertions(+), 72 deletions(-)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index d77b346..6f8549e 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2884,99 +2884,68 @@ EXPORT_SYMBOL(nlmsg_notify);
#ifdef CONFIG_PROC_FS
struct nl_seq_iter {
struct seq_net_private p;
+ struct rhashtable_iter hti;
int link;
- int hash_idx;
};
-static struct sock *netlink_seq_socket_idx(struct seq_file *seq, loff_t pos)
+static int netlink_walk_start(struct nl_seq_iter *iter)
{
- struct nl_seq_iter *iter = seq->private;
- int i, j;
- struct netlink_sock *nlk;
- struct sock *s;
- loff_t off = 0;
-
- for (i = 0; i < MAX_LINKS; i++) {
- struct rhashtable *ht = &nl_table[i].hash;
- const struct bucket_table *tbl = rht_dereference_rcu(ht->tbl, ht);
-
- for (j = 0; j < tbl->size; j++) {
- struct rhash_head *node;
-
- rht_for_each_entry_rcu(nlk, node, tbl, j, node) {
- s = (struct sock *)nlk;
-
- if (sock_net(s) != seq_file_net(seq))
- continue;
- if (off == pos) {
- iter->link = i;
- iter->hash_idx = j;
- return s;
- }
- ++off;
- }
- }
- }
- return NULL;
-}
-
-static void *netlink_seq_start(struct seq_file *seq, loff_t *pos)
- __acquires(RCU)
-{
- rcu_read_lock();
- return *pos ? netlink_seq_socket_idx(seq, *pos - 1) : SEQ_START_TOKEN;
+ rhashtable_walk_init(&nl_table[iter->link].hash, &iter->hti);
+ return rhashtable_walk_start(&iter->hti);
}
-static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos)
+static void *__netlink_seq_next(struct seq_file *seq)
{
- struct rhashtable *ht;
- const struct bucket_table *tbl;
- struct rhash_head *node;
+ struct nl_seq_iter *iter = seq->private;
struct netlink_sock *nlk;
- struct nl_seq_iter *iter;
- struct net *net;
- int i, j;
- ++*pos;
+ do {
+ while (!(nlk = rhashtable_walk_next(&iter->hti))) {
+ int err;
- if (v == SEQ_START_TOKEN)
- return netlink_seq_socket_idx(seq, 0);
+ rhashtable_walk_stop(&iter->hti);
+ if (++iter->link >= MAX_LINKS)
+ return NULL;
- net = seq_file_net(seq);
- iter = seq->private;
- nlk = v;
+ err = netlink_walk_start(iter);
+ if (err)
+ return ERR_PTR(err);
+ }
+ } while (sock_net(&nlk->sk) != seq_file_net(seq));
- i = iter->link;
- ht = &nl_table[i].hash;
- tbl = rht_dereference_rcu(ht->tbl, ht);
- rht_for_each_entry_rcu_continue(nlk, node, nlk->node.next, tbl, iter->hash_idx, node)
- if (net_eq(sock_net((struct sock *)nlk), net))
- return nlk;
+ return nlk;
+}
- j = iter->hash_idx + 1;
+static void *netlink_seq_start(struct seq_file *seq, loff_t *posp)
+{
+ struct nl_seq_iter *iter = seq->private;
+ void *obj = SEQ_START_TOKEN;
+ loff_t pos;
+ int err;
- do {
+ iter->link = 0;
+ err = netlink_walk_start(iter);
+ if (err)
+ return ERR_PTR(err);
- for (; j < tbl->size; j++) {
- rht_for_each_entry_rcu(nlk, node, tbl, j, node) {
- if (net_eq(sock_net((struct sock *)nlk), net)) {
- iter->link = i;
- iter->hash_idx = j;
- return nlk;
- }
- }
- }
+ for (pos = *posp; pos && obj; pos--)
+ obj = __netlink_seq_next(seq);
- j = 0;
- } while (++i < MAX_LINKS);
+ return obj;
+}
- return NULL;
+static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos)
+{
+ ++*pos;
+ return __netlink_seq_next(seq);
}
static void netlink_seq_stop(struct seq_file *seq, void *v)
- __releases(RCU)
{
- rcu_read_unlock();
+ struct nl_seq_iter *iter = seq->private;
+
+ if (iter->link < MAX_LINKS)
+ rhashtable_walk_stop(&iter->hti);
}
^ permalink raw reply related
* [PATCH 0/2] rhashtable: Add walk iterator primitives and use them in netlink
From: Herbert Xu @ 2015-01-25 23:20 UTC (permalink / raw)
To: Thomas Graf; +Cc: Ying Xue, davem, kaber, paulmck, netdev, netfilter-devel
In-Reply-To: <20150122084924.GA4720@gondor.apana.org.au>
On Thu, Jan 22, 2015 at 07:49:24PM +1100, Herbert Xu wrote:
>
> Could you hold off for a bit? I've got some changes that touch
> this area that I'd like to push out. Basically I'm trying to
> eliminate direct access of rhashtable internals from the existing
> users.
Here are the first two patches, one to add the primitives and one
to demonstrate its use in netlink. In fact while testing this I
found that the existing netlink walking code is totally broken.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [PATCH v3 net-next] net: ipv6: Add sysctl entry to disable MTU updates from RA
From: David Miller @ 2015-01-25 22:55 UTC (permalink / raw)
To: harouth; +Cc: netdev
In-Reply-To: <1421773565-5181-1-git-send-email-harouth@codeaurora.org>
From: Harout Hedeshian <harouth@codeaurora.org>
Date: Tue, 20 Jan 2015 10:06:05 -0700
> The kernel forcefully applies MTU values received in router
> advertisements provided the new MTU is less than the current. This
> behavior is undesirable when the user space is managing the MTU. Instead
> a sysctl flag 'accept_ra_mtu' is introduced such that the user space
> can control whether or not RA provided MTU updates should be applied. The
> default behavior is unchanged; user space must explicitly set this flag
> to 0 for RA MTUs to be ignored.
>
> Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] amd-xgbe: Let OS arch support adjust DMA mask as needed
From: David Miller @ 2015-01-25 22:54 UTC (permalink / raw)
To: thomas.lendacky; +Cc: netdev
In-Reply-To: <20150120204755.23431.37523.stgit@tlendack-t1.amdoffice.net>
From: Tom Lendacky <thomas.lendacky@amd.com>
Date: Tue, 20 Jan 2015 14:47:55 -0600
> Set the DMA mask to 64-bit and let the underlying arch support adjust
> it as appropriate based on device tree DMA ranges, etc.
>
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
That's not how this works.
The interface will fail if you ask for more bits than can be
supported, so you should pass in the amount of bits you actually need
but not more.
I'm not applying this.
^ permalink raw reply
* Re: [next-next PATCH 0/7] Fixes and improvements for recent fib_trie updates
From: David Miller @ 2015-01-25 22:47 UTC (permalink / raw)
To: alexander.h.duyck; +Cc: netdev
In-Reply-To: <20150122234652.5779.44251.stgit@ahduyck-vm-fedora20>
From: Alexander Duyck <alexander.h.duyck@redhat.com>
Date: Thu, 22 Jan 2015 15:51:01 -0800
> While performing testing and prepping the next round of patches I found a
> few minor issues and improvements that could be made.
>
> These changes should help to reduce the overall code size and improve the
> performance slighlty as I noticed a 20ns or so improvement in my worst-case
> testing which will likely only result in a 1ns difference with a standard
> sized trie.
Looks great, series applied, thanks Alexander.
^ permalink raw reply
* Re: [PATCH V1 net-next 0/9] mlx4: Fix and enhance the device reset flow
From: David Miller @ 2015-01-25 22:46 UTC (permalink / raw)
To: ogerlitz; +Cc: netdev, matanb, amirv, talal, roland, yishaih
In-Reply-To: <1422197983-16048-1-git-send-email-ogerlitz@mellanox.com>
From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Sun, 25 Jan 2015 16:59:34 +0200
> This series from Yishai Hadas fixes the device reset flow and adds SRIOV support.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH] net: Linn Ethernet Packet Sniffer driver
From: Joe Perches @ 2015-01-24 21:37 UTC (permalink / raw)
To: Stathis Voukelatos
Cc: netdev, linux-kernel, devicetree, Stathis Voukelatos, abrestic
In-Reply-To: <1422007621-13567-1-git-send-email-stathis.voukelatos@linn.co.uk>
On Fri, 2015-01-23 at 10:07 +0000, Stathis Voukelatos wrote:
> This patch adds support the Ethernet Packet Sniffer H/W module
> developed by Linn Products Ltd and found in the IMG Pistachio SoC.
> The module allows Ethernet packets to be parsed, matched against
> a user-defined pattern and timestamped. It sits between a 100M
> Ethernet MAC and PHY and is completely passive with respect to
> Ethernet frames.
[]
> include/linux/pkt_sniffer.h | 89 +++++
Why should this file be here?
Why not in the drivers/net/pkt-sniffer directory?
> diff --git a/drivers/net/pkt-sniffer/backends/ether/channel.c b/drivers/net/pkt-sniffer/backends/ether/channel.c
[]
> +static int esnf_start(struct snf_chan *dev);
Be nice to rearrange the code to avoid the forward declarations.
> +static int esnf_stop(struct snf_chan *dev);
> +static int esnf_set_pattern(struct snf_chan *dev, const u8 *pattern, int count);
> +static int esnf_num_recs_avail(struct snf_chan *dev);
> +static int esnf_max_ptn_entries(struct snf_chan *dev);
> +static int esnf_max_match_bytes(struct snf_chan *dev);
> +static int validate_pattern(
> + struct ether_snf_chan *ch,
> + const u8 *buf,
> + int count);
[]
> +static int validate_pattern(struct ether_snf_chan *ch, const u8 *buf, int count)
> +{
Maybe better as bool
> + int i, complete, max_copy_bytes;
[]
> + /* Check if the string was properly terminated
> + * and contained valid number of commands
> + */
> + if (complete) {
> + max_copy_bytes = ch->fifo_blk_words * 4;
> + if (ts)
> + max_copy_bytes -= 4;
> + if ((copy_before + copy_after) > max_copy_bytes)
> + return 0;
> + ch->ts_present = ts;
> + ch->nfb_before = copy_before;
> + ch->nfb_after = copy_after;
> + return 1;
> + } else {
> + return 0;
> + }
return complete;
[]
> +/* Interrupt thread function */
> +static irqreturn_t esnf_irq_thread(int irq, void *dev_id)
> +{
> + struct platform_device *pdev = (struct platform_device *)dev_id;
> + struct ether_snf *esnf = (struct ether_snf *)platform_get_drvdata(pdev);
> + u32 irq_status;
> +
> + if (unlikely(esnf->irq != irq))
> + return IRQ_NONE;
> +
> + irq_status = ioread32(esnf->regs + INTERRUPT_STATUS) &
> + ioread32(esnf->regs + INTERRUPT_ENABLE);
> +
> + dev_dbg(&pdev->dev, "irq: 0x%08x\n", irq_status);
> +
> + /* TX FIFO full */
> + if (unlikely(irq_status & TX_FULL_IRQ_BIT))
> + dev_notice(&pdev->dev, "TX FIFO full");
Missing terminating newlines
> +
> + /* RX FIFO full */
> + if (unlikely(irq_status & RX_FULL_IRQ_BIT))
> + dev_notice(&pdev->dev, "RX FIFO full");
> +
> + /* TX match data available */
> + if (irq_status & TX_DATA_IRQ_BIT) {
> + dev_dbg(&pdev->dev, "TX data");
> + channel_data_available(&esnf->txc);
> + }
> +
> + /* RX match data available */
> + if (irq_status & RX_DATA_IRQ_BIT) {
> + dev_dbg(&pdev->dev, "RX data");
> + channel_data_available(&esnf->rxc);
> + }
> diff --git a/drivers/net/pkt-sniffer/core/nl.c b/drivers/net/pkt-sniffer/core/nl.c
[]
> +int snf_netlink_init(int id, struct snf_chan *dev, const char *name)
> +{
[]
> + /* Allocate ops array and copy template data */
> + nl->ops = kmalloc(sizeof(snf_ops_tmpl), GFP_KERNEL);
> + if (!nl->ops) {
> + ret = -ENOMEM;
> + goto fail2;
> + }
> + memcpy(nl->ops, snf_ops_tmpl, sizeof(snf_ops_tmpl));
kmemdup
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox