* Re: [PATCH 03/15] net: bcm63xx_enet: Utilize phy_ethtool_nway_reset
From: Heinrich Schuchardt @ 2016-11-15 19:59 UTC (permalink / raw)
To: Florian Fainelli, netdev
Cc: davem, andrew, tremyfr,
maintainer:BROADCOM BCM63XX ARM ARCHITECTURE, Arnd Bergmann,
xypron.glpk@gmx.de, Jarod Wilson, Thierry Reding,
moderated list:BROADCOM BCM63XX ARM ARCHITECTURE, open list
In-Reply-To: <20161115180644.3941-4-f.fainelli@gmail.com>
On 11/15/2016 07:06 PM, Florian Fainelli wrote:
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Each patch of your patch series should have a commit message.
You can add the missing commit messages with
git rebase -i HEAD~15
choosing reword.
Please, add a cover letter message describing the patch series using
git format-patch -ns --cover-letter HEAD~15..HEAD
and provide a summary in the 0/15 message.
The cover letter and all patches should be in one mails thhread.
If you put all messages into one directory you can send the series as
one mail thread with
git send-email <directory>
> ---
> drivers/net/ethernet/broadcom/bcm63xx_enet.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
> index 5c7acef1de2e..a43ab90c051e 100644
> --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
> +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
> @@ -1434,11 +1434,8 @@ static int bcm_enet_nway_reset(struct net_device *dev)
> struct bcm_enet_priv *priv;
>
> priv = netdev_priv(dev);
> - if (priv->has_phy) {
> - if (!dev->phydev)
> - return -ENODEV;
> - return genphy_restart_aneg(dev->phydev);
> - }
> + if (priv->has_phy)
> + return phy_ethtool_nway_reset(dev),
>
> return -EOPNOTSUPP;
> }
>
^ permalink raw reply
* Re: [PATCH 03/15] net: bcm63xx_enet: Utilize phy_ethtool_nway_reset
From: Florian Fainelli @ 2016-11-15 20:15 UTC (permalink / raw)
To: Heinrich Schuchardt, netdev
Cc: davem, andrew, tremyfr,
maintainer:BROADCOM BCM63XX ARM ARCHITECTURE, Arnd Bergmann,
xypron.glpk@gmx.de, Jarod Wilson, Thierry Reding,
moderated list:BROADCOM BCM63XX ARM ARCHITECTURE, open list
In-Reply-To: <3dc4471a-1afd-0e28-1de9-60558cece143@gmx.de>
On 11/15/2016 11:59 AM, Heinrich Schuchardt wrote:
> On 11/15/2016 07:06 PM, Florian Fainelli wrote:
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>
> Each patch of your patch series should have a commit message.
It's pretty obvious what this does, really.
>
> You can add the missing commit messages with
> git rebase -i HEAD~15
> choosing reword.
>
> Please, add a cover letter message describing the patch series using
>
> git format-patch -ns --cover-letter HEAD~15..HEAD
>
> and provide a summary in the 0/15 message.
I did:
https://www.mail-archive.com/netdev@vger.kernel.org/maillist.html
and that is also apparent from:
In-Reply-To: <20161115180644.3941-1-f.fainelli@gmail.com>
References: <20161115180644.3941-1-f.fainelli@gmail.com>
And what I also did is to intentionally make sure that for each patch,
there would not be 50+ people CC'd, but just the relevant people for
each driver, which is exactly how cc-cmd=scripts/get_maintainer.pl work,
making my life simpler honestly.
It's not nearly my first patch submission, but I admit I have been semi
intentionally lazy with this patch set considering the number of patches.
Anyway, enough time wasted on this.
--
Florian
^ permalink raw reply
* Re: [net PATCH 1/2] ipv4: Restore fib_trie_flush_external function and fix call ordering
From: Duyck, Alexander H @ 2016-11-15 20:29 UTC (permalink / raw)
To: jiri@resnulli.us
Cc: netdev@vger.kernel.org, jiri@mellanox.com, davem@davemloft.net,
edumazet@google.com
In-Reply-To: <20161115195107.GB1783@nanopsycho.orion>
On Tue, 2016-11-15 at 20:51 +0100, Jiri Pirko wrote:
> Tue, Nov 15, 2016 at 11:46:06AM CET, alexander.h.duyck@intel.com wrote:
> >
> > The patch that removed the FIB offload infrastructure was a bit too
> > aggressive and also removed code needed to clean up us splitting the table
> > if additional rules were added. Specifically the function
> > fib_trie_flush_external was called at the end of a new rule being added to
> > flush the foreign trie entries from the main trie.
> >
> > I updated the code so that we only call fib_trie_flush_external on the main
> > table so that we flush the entries for local from main. This way we don't
> > call it for every rule change which is what was happening previously.
>
> Well, the function was introduced by:
>
> commit 104616e74e0b464d449fdd2ee2f547d2fad71610
> Author: Scott Feldman <sfeldma@gmail.com>
> Date: Thu Mar 5 21:21:16 2015 -0800
>
> switchdev: don't support custom ip rules, for now
>
> Keep switchdev FIB offload model simple for now and don't allow custom ip
> rules.
>
> Why this was not needed before? What changed in between:
> 104616e74e0b464d449fdd2ee2f547d2fad71610 ("switchdev: don't support custom ip rules, for now")
> and
> 347e3b28c1ba2 ("switchdev: remove FIB offload infrastructure")
We collapsed the two tables into one in commit 0ddcf43d5d4a ("ipv4: FIB
Local/MAIN table collapse") which was submitted the next day. Scott
and I were working on things at the same time and the
fib_table_flush_external function was something we had worked out that
would allow him to take care of his use case and me to take care of
cleaning up the tables after unmerging.
- Alex
^ permalink raw reply
* Re: [net PATCH 1/2] ipv4: Restore fib_trie_flush_external function and fix call ordering
From: Jiri Pirko @ 2016-11-15 20:31 UTC (permalink / raw)
To: Duyck, Alexander H
Cc: netdev@vger.kernel.org, jiri@mellanox.com, davem@davemloft.net,
edumazet@google.com
In-Reply-To: <1479241747.681.105.camel@intel.com>
Tue, Nov 15, 2016 at 09:29:09PM CET, alexander.h.duyck@intel.com wrote:
>On Tue, 2016-11-15 at 20:51 +0100, Jiri Pirko wrote:
>> Tue, Nov 15, 2016 at 11:46:06AM CET, alexander.h.duyck@intel.com wrote:
>> >
>> > The patch that removed the FIB offload infrastructure was a bit too
>> > aggressive and also removed code needed to clean up us splitting the table
>> > if additional rules were added. Specifically the function
>> > fib_trie_flush_external was called at the end of a new rule being added to
>> > flush the foreign trie entries from the main trie.
>> >
>> > I updated the code so that we only call fib_trie_flush_external on the main
>> > table so that we flush the entries for local from main. This way we don't
>> > call it for every rule change which is what was happening previously.
>>
>> Well, the function was introduced by:
>>
>> commit 104616e74e0b464d449fdd2ee2f547d2fad71610
>> Author: Scott Feldman <sfeldma@gmail.com>
>> Date: Thu Mar 5 21:21:16 2015 -0800
>>
>> switchdev: don't support custom ip rules, for now
>>
>> Keep switchdev FIB offload model simple for now and don't allow custom ip
>> rules.
>>
>> Why this was not needed before? What changed in between:
>> 104616e74e0b464d449fdd2ee2f547d2fad71610 ("switchdev: don't support custom ip rules, for now")
>> and
>> 347e3b28c1ba2 ("switchdev: remove FIB offload infrastructure")
>
>We collapsed the two tables into one in commit 0ddcf43d5d4a ("ipv4: FIB
>Local/MAIN table collapse") which was submitted the next day. Scott
>and I were working on things at the same time and the
>fib_table_flush_external function was something we had worked out that
>would allow him to take care of his use case and me to take care of
>cleaning up the tables after unmerging.
Okay. But please name the fuction differently, as it does not flush
external. Thanks!
^ permalink raw reply
* Re: [net-next 1/2] net: ethernet: slicoss: add slicoss gigabit ethernet driver
From: Lino Sanfilippo @ 2016-11-15 20:46 UTC (permalink / raw)
To: Andrew Lunn; +Cc: davem, charrer, liodot, gregkh, devel, linux-kernel, netdev
In-Reply-To: <20161113195544.GA18258@lunn.ch>
Hi,
On 13.11.2016 20:55, Andrew Lunn wrote:
>> +static const char slic_stats_strings[][ETH_GSTRING_LEN] = {
>> + "rx_packets ",
>> + "rx_bytes ",
>> + "rx_multicasts ",
>> + "rx_errors ",
>> + "rx_buff_miss ",
>> + "rx_tp_csum ",
>> + "rx_tp_oflow ",
>> + "rx_tp_hlen ",
>> + "rx_ip_csum ",
>> + "rx_ip_len ",
>
> Are there any other drivers which pad the statistics strings?
>
First off, thank you for the review!
I took a look into a few drivers and most of them do not pad the statistic strings.
Actually there are some that do (e.g. the chelsio drivers cxgb4, cxgb3, xcgb4v),
but this seems to be rather the minority, so I will remove it. Thank you for the hint.
>> +static void slic_set_link_autoneg(struct slic_device *sdev)
>> +{
>> + unsigned int subid = sdev->pdev->subsystem_device;
>> + u32 val;
>> +
>> + if (sdev->is_fiber) {
>> + /* We've got a fiber gigabit interface, and register 4 is
>> + * different in fiber mode than in copper mode.
>> + */
>> + /* advertise FD only @1000 Mb */
>> + val = MII_ADVERTISE << 16 | SLIC_PAR_ADV1000XFD |
>> + SLIC_PAR_ASYMPAUSE_FIBER;
>> + /* enable PAUSE frames */
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> + /* reset phy, enable auto-neg */
>> + val = MII_BMCR << 16 | SLIC_PCR_RESET | SLIC_PCR_AUTONEG |
>> + SLIC_PCR_AUTONEG_RST;
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> + } else { /* copper gigabit */
>> + /* We've got a copper gigabit interface, and register 4 is
>> + * different in copper mode than in fiber mode.
>> + */
>> + /* advertise 10/100 Mb modes */
>> + val = MII_ADVERTISE << 16 | SLIC_PAR_ADV100FD |
>> + SLIC_PAR_ADV100HD | SLIC_PAR_ADV10FD | SLIC_PAR_ADV10HD;
>> + /* enable PAUSE frames */
>> + val |= SLIC_PAR_ASYMPAUSE;
>> + /* required by the Cicada PHY */
>> + val |= SLIC_PAR_802_3;
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> +
>> + /* advertise FD only @1000 Mb */
>> + val = MII_CTRL1000 << 16 | SLIC_PGC_ADV1000FD;
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> +
>> + if (subid != PCI_SUBDEVICE_ID_ALACRITECH_CICADA) {
>> + /* if a Marvell PHY enable auto crossover */
>> + val = SLIC_MIICR_REG_16 | SLIC_MRV_REG16_XOVERON;
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> +
>> + /* reset phy, enable auto-neg */
>> + val = MII_BMCR << 16 | SLIC_PCR_RESET |
>> + SLIC_PCR_AUTONEG | SLIC_PCR_AUTONEG_RST;
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> + } else {
>> + /* enable and restart auto-neg (don't reset) */
>> + val = MII_BMCR << 16 | SLIC_PCR_AUTONEG |
>> + SLIC_PCR_AUTONEG_RST;
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> + }
>> + }
>> + sdev->autoneg = true;
>> +}
>
> Could this be pulled out into a standard PHY driver? All the SLIC
> SLIC_PCR_ defines seems to be the same as those in mii.h. This could
> be a standard PHY hidden behind a single register.
>
> Andrew
You are right, the driver should really use the defines in mii.h. I will fix this in
a v2.
Concerning the use of the PHY API: What would be the advantage of using it? Note that the
phy is always internal and not interchangeable. Is not the interchangeability of PHYs
the main reason for using this API?
Regards,
Lino
^ permalink raw reply
* Re: linux-next: net->netns_ids is used after calling idr_destroy for it
From: Andrei Vagin @ 2016-11-15 20:48 UTC (permalink / raw)
To: Cong Wang; +Cc: Nicolas Dichtel, Linux Kernel Network Developers
In-Reply-To: <CAM_iQpU=DXKEboYHi4yO3m6VuUm1RoDRD26ZK-pVY--yUE0wNA@mail.gmail.com>
On Tue, Nov 15, 2016 at 10:50 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> On Tue, Nov 15, 2016 at 10:04 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> On Mon, Nov 14, 2016 at 10:23 PM, Andrei Vagin <avagin@gmail.com> wrote:
>>> Hi Nicolas,
>>>
>>> cleanup_net() calls idr_destroy(net->netns_ids) for network namespaces
>>> and then it calls unregister_netdevice_many() which calls
>>> idr_alloc(net0>netns_ids). It looks wrong, doesn't it?
>>>
>>
>> netns id is designed to allocate lazily, but yeah it makes no sense
>> to allocate id for the netns being destroyed, not to mention idr is freed.
>>
>> I will send a patch.
>
> Could you try the attached patch? I just did some quick netns creation/destroy
> tests.
Here is another fail:
unreferenced object 0xffff94153912a0c0 (size 2096):
comm "ip", pid 29175, jiffies 4294954213 (age 137.624s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 b2 3b 1d 15 94 ff ff ..........;.....
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffffac865c1a>] kmemleak_alloc+0x4a/0xa0
[<ffffffffac243b38>] kmem_cache_alloc+0x128/0x280
[<ffffffffac42f5ab>] idr_layer_alloc+0x2b/0x90
[<ffffffffac42f9cd>] idr_get_empty_slot+0x34d/0x370
[<ffffffffac42fa4e>] idr_alloc+0x5e/0x110
[<ffffffffac70ac3d>] __peernet2id_alloc+0x6d/0x90
[<ffffffffac70bda5>] peernet2id_alloc+0x55/0xb0
[<ffffffffac731246>] rtnl_fill_ifinfo+0xaa6/0x10a0
[<ffffffffac7330a3>] rtmsg_ifinfo_build_skb+0x73/0xd0
[<ffffffffac7125e1>] rollback_registered_many+0x2a1/0x3a0
[<ffffffffac712779>] __unregister_netdevice_many+0x29/0x80
[<ffffffffac7127e3>] unregister_netdevice_many+0x13/0x20
[<ffffffffc02dc4ce>] macvlan_device_event+0x13e/0x235 [macvlan]
[<ffffffffac0bef2a>] notifier_call_chain+0x4a/0x70
[<ffffffffac0bf066>] raw_notifier_call_chain+0x16/0x20
[<ffffffffac710205>] call_netdevice_notifiers_info+0x35/0x60
What do you think about calling idr_destroy() at the final step in
cleanup_net()? In this case we can avoid this sort of problems in a
future.
@@ -422,21 +425,6 @@ static void cleanup_net(struct work_struct *work)
list_for_each_entry(net, &net_kill_list, cleanup_list) {
list_del_rcu(&net->list);
list_add_tail(&net->exit_list, &net_exit_list);
- for_each_net(tmp) {
- int id;
-
- spin_lock_irq(&tmp->nsid_lock);
- id = __peernet2id(tmp, net);
- if (id >= 0)
- idr_remove(&tmp->netns_ids, id);
- spin_unlock_irq(&tmp->nsid_lock);
- if (id >= 0)
- rtnl_net_notifyid(tmp, RTM_DELNSID, id);
- }
- spin_lock_irq(&net->nsid_lock);
- idr_destroy(&net->netns_ids);
- spin_unlock_irq(&net->nsid_lock);
-
}
rtnl_unlock();
@@ -464,6 +452,22 @@ static void cleanup_net(struct work_struct *work)
/* Finally it is safe to free my network namespace structure */
list_for_each_entry_safe(net, tmp, &net_exit_list, exit_list) {
+ rtnl_lock();
+ for_each_net(tmp) {
+ int id;
+
+ spin_lock_irq(&tmp->nsid_lock);
+ id = __peernet2id(tmp, net);
+ if (id >= 0)
+ idr_remove(&tmp->netns_ids, id);
+ spin_unlock_irq(&tmp->nsid_lock);
+ if (id >= 0)
+ rtnl_net_notifyid(tmp, RTM_DELNSID, id);
+ }
+ rtnl_unlock();
+
+ idr_destroy(&net->netns_ids);
+
list_del_init(&net->exit_list);
dec_net_namespaces(net->ucounts);
put_user_ns(net->user_ns);
>
> Thanks!
^ permalink raw reply
* Re: [net PATCH 1/2] ipv4: Restore fib_trie_flush_external function and fix call ordering
From: Duyck, Alexander H @ 2016-11-15 20:49 UTC (permalink / raw)
To: jiri@resnulli.us
Cc: netdev@vger.kernel.org, jiri@mellanox.com, davem@davemloft.net,
edumazet@google.com
In-Reply-To: <20161115203140.GC1783@nanopsycho.orion>
On Tue, 2016-11-15 at 21:31 +0100, Jiri Pirko wrote:
> Tue, Nov 15, 2016 at 09:29:09PM CET, alexander.h.duyck@intel.com wrote:
> >
> > On Tue, 2016-11-15 at 20:51 +0100, Jiri Pirko wrote:
> > >
> > > Tue, Nov 15, 2016 at 11:46:06AM CET, alexander.h.duyck@intel.com wrote:
> > > >
> > > >
> > > > The patch that removed the FIB offload infrastructure was a bit too
> > > > aggressive and also removed code needed to clean up us splitting the table
> > > > if additional rules were added. Specifically the function
> > > > fib_trie_flush_external was called at the end of a new rule being added to
> > > > flush the foreign trie entries from the main trie.
> > > >
> > > > I updated the code so that we only call fib_trie_flush_external on the main
> > > > table so that we flush the entries for local from main. This way we don't
> > > > call it for every rule change which is what was happening previously.
> > >
> > > Well, the function was introduced by:
> > >
> > > commit 104616e74e0b464d449fdd2ee2f547d2fad71610
> > > Author: Scott Feldman <sfeldma@gmail.com>
> > > Date: Thu Mar 5 21:21:16 2015 -0800
> > >
> > > switchdev: don't support custom ip rules, for now
> > >
> > > Keep switchdev FIB offload model simple for now and don't allow custom ip
> > > rules.
> > >
> > > Why this was not needed before? What changed in between:
> > > 104616e74e0b464d449fdd2ee2f547d2fad71610 ("switchdev: don't support custom ip rules, for now")
> > > and
> > > 347e3b28c1ba2 ("switchdev: remove FIB offload infrastructure")
> >
> > We collapsed the two tables into one in commit 0ddcf43d5d4a ("ipv4: FIB
> > Local/MAIN table collapse") which was submitted the next day. Scott
> > and I were working on things at the same time and the
> > fib_table_flush_external function was something we had worked out that
> > would allow him to take care of his use case and me to take care of
> > cleaning up the tables after unmerging.
>
> Okay. But please name the fuction differently, as it does not flush
> external. Thanks!
You and I have different meanings for "external".
In my case I am flushing entries that belong to a foreign "external"
table from the table specified. So by "external" I am referring to
entries that don't actually live in main, but actually reside in local.
If you take a look at fib_table_flush that gets rid of all entries,
fib_table_flush_external simply clears the foreign ones.
Also I'd rather maintain naming since it makes it easier if we need to
backport fixes.
Finally, the flag RTNH_F_EXTERNAL was renamed over a year ago in commit
36583eb54d46c ("rename RTNH_F_EXTERNAL to RTNH_F_OFFLOAD") so there
isn't too much likelihood of this being confused for something that
handles offloaded entries. If you take a look in net/ipv4/* after your
patch there isn't actually anything that references the word external
so the likelihood for any confusion is extremely low.
- Alex
^ permalink raw reply
* [PATCH net-next] tcp: enhance tcp_collapse_retrans() with skb_shift()
From: Eric Dumazet @ 2016-11-15 20:51 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Neal Cardwell, Yuchung Cheng
From: Eric Dumazet <edumazet@google.com>
In commit 2331ccc5b323 ("tcp: enhance tcp collapsing"),
we made a first step allowing copying right skb to left skb head.
Since all skbs in socket write queue are headless (but possibly the very
first one), this strategy often does not work.
This patch extends tcp_collapse_retrans() to perform frag shifting,
thanks to skb_shift() helper.
This helper needs to not BUG on non headless skbs, as callers are ok
with that.
Tested:
Following packetdrill test now passes :
0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
+0 < S 0:0(0) win 32792 <mss 1460,sackOK,nop,nop,nop,wscale 8>
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+.100 < . 1:1(0) ack 1 win 257
+0 accept(3, ..., ...) = 4
+0 setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0
+0 write(4, ..., 200) = 200
+0 > P. 1:201(200) ack 1
+.001 write(4, ..., 200) = 200
+0 > P. 201:401(200) ack 1
+.001 write(4, ..., 200) = 200
+0 > P. 401:601(200) ack 1
+.001 write(4, ..., 200) = 200
+0 > P. 601:801(200) ack 1
+.001 write(4, ..., 200) = 200
+0 > P. 801:1001(200) ack 1
+.001 write(4, ..., 100) = 100
+0 > P. 1001:1101(100) ack 1
+.001 write(4, ..., 100) = 100
+0 > P. 1101:1201(100) ack 1
+.001 write(4, ..., 100) = 100
+0 > P. 1201:1301(100) ack 1
+.001 write(4, ..., 100) = 100
+0 > P. 1301:1401(100) ack 1
+.099 < . 1:1(0) ack 201 win 257
+.001 < . 1:1(0) ack 201 win 257 <nop,nop,sack 1001:1401>
+0 > P. 201:1001(800) ack 1
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
---
net/core/skbuff.c | 4 +++-
net/ipv4/tcp_output.c | 22 +++++++++++-----------
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 0b2a6e94af2de73ed638634c47a0fb71e2cbc1cb..a9cb81a10c4ba895587727aa4cf098e9a38424ea 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2656,7 +2656,9 @@ int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen)
struct skb_frag_struct *fragfrom, *fragto;
BUG_ON(shiftlen > skb->len);
- BUG_ON(skb_headlen(skb)); /* Would corrupt stream */
+
+ if (skb_headlen(skb))
+ return 0;
todo = shiftlen;
from = 0;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index f57b5aa51b59cf0a58975fe34a7dcdb886ea8c50..19105b46a30436ebb85fe97ee43089e77aa028bb 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2514,7 +2514,7 @@ void tcp_skb_collapse_tstamp(struct sk_buff *skb,
}
/* Collapses two adjacent SKB's during retransmission. */
-static void tcp_collapse_retrans(struct sock *sk, struct sk_buff *skb)
+static bool tcp_collapse_retrans(struct sock *sk, struct sk_buff *skb)
{
struct tcp_sock *tp = tcp_sk(sk);
struct sk_buff *next_skb = tcp_write_queue_next(sk, skb);
@@ -2525,14 +2525,17 @@ static void tcp_collapse_retrans(struct sock *sk, struct sk_buff *skb)
BUG_ON(tcp_skb_pcount(skb) != 1 || tcp_skb_pcount(next_skb) != 1);
+ if (next_skb_size) {
+ if (next_skb_size <= skb_availroom(skb))
+ skb_copy_bits(next_skb, 0, skb_put(skb, next_skb_size),
+ next_skb_size);
+ else if (!skb_shift(skb, next_skb, next_skb_size))
+ return false;
+ }
tcp_highest_sack_combine(sk, next_skb, skb);
tcp_unlink_write_queue(next_skb, sk);
- if (next_skb_size)
- skb_copy_bits(next_skb, 0, skb_put(skb, next_skb_size),
- next_skb_size);
-
if (next_skb->ip_summed == CHECKSUM_PARTIAL)
skb->ip_summed = CHECKSUM_PARTIAL;
@@ -2561,6 +2564,7 @@ static void tcp_collapse_retrans(struct sock *sk, struct sk_buff *skb)
tcp_skb_collapse_tstamp(skb, next_skb);
sk_wmem_free_skb(sk, next_skb);
+ return true;
}
/* Check if coalescing SKBs is legal. */
@@ -2610,16 +2614,12 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *to,
if (space < 0)
break;
- /* Punt if not enough space exists in the first SKB for
- * the data in the second
- */
- if (skb->len > skb_availroom(to))
- break;
if (after(TCP_SKB_CB(skb)->end_seq, tcp_wnd_end(tp)))
break;
- tcp_collapse_retrans(sk, to);
+ if (!tcp_collapse_retrans(sk, to))
+ break;
}
}
^ permalink raw reply related
* Re: [net PATCH 1/2] ipv4: Restore fib_trie_flush_external function and fix call ordering
From: Jiri Pirko @ 2016-11-15 20:52 UTC (permalink / raw)
To: Duyck, Alexander H
Cc: netdev@vger.kernel.org, jiri@mellanox.com, davem@davemloft.net,
edumazet@google.com
In-Reply-To: <1479242939.681.117.camel@intel.com>
Tue, Nov 15, 2016 at 09:49:02PM CET, alexander.h.duyck@intel.com wrote:
>On Tue, 2016-11-15 at 21:31 +0100, Jiri Pirko wrote:
>> Tue, Nov 15, 2016 at 09:29:09PM CET, alexander.h.duyck@intel.com wrote:
>> >
>> > On Tue, 2016-11-15 at 20:51 +0100, Jiri Pirko wrote:
>> > >
>> > > Tue, Nov 15, 2016 at 11:46:06AM CET, alexander.h.duyck@intel.com wrote:
>> > > >
>> > > >
>> > > > The patch that removed the FIB offload infrastructure was a bit too
>> > > > aggressive and also removed code needed to clean up us splitting the table
>> > > > if additional rules were added. Specifically the function
>> > > > fib_trie_flush_external was called at the end of a new rule being added to
>> > > > flush the foreign trie entries from the main trie.
>> > > >
>> > > > I updated the code so that we only call fib_trie_flush_external on the main
>> > > > table so that we flush the entries for local from main. This way we don't
>> > > > call it for every rule change which is what was happening previously.
>> > >
>> > > Well, the function was introduced by:
>> > >
>> > > commit 104616e74e0b464d449fdd2ee2f547d2fad71610
>> > > Author: Scott Feldman <sfeldma@gmail.com>
>> > > Date: Thu Mar 5 21:21:16 2015 -0800
>> > >
>> > > switchdev: don't support custom ip rules, for now
>> > >
>> > > Keep switchdev FIB offload model simple for now and don't allow custom ip
>> > > rules.
>> > >
>> > > Why this was not needed before? What changed in between:
>> > > 104616e74e0b464d449fdd2ee2f547d2fad71610 ("switchdev: don't support custom ip rules, for now")
>> > > and
>> > > 347e3b28c1ba2 ("switchdev: remove FIB offload infrastructure")
>> >
>> > We collapsed the two tables into one in commit 0ddcf43d5d4a ("ipv4: FIB
>> > Local/MAIN table collapse") which was submitted the next day. Scott
>> > and I were working on things at the same time and the
>> > fib_table_flush_external function was something we had worked out that
>> > would allow him to take care of his use case and me to take care of
>> > cleaning up the tables after unmerging.
>>
>> Okay. But please name the fuction differently, as it does not flush
>> external. Thanks!
>
>You and I have different meanings for "external".
>
>In my case I am flushing entries that belong to a foreign "external"
>table from the table specified. So by "external" I am referring to
>entries that don't actually live in main, but actually reside in local.
>If you take a look at fib_table_flush that gets rid of all entries,
>fib_table_flush_external simply clears the foreign ones.
>
>Also I'd rather maintain naming since it makes it easier if we need to
>backport fixes.
>
>Finally, the flag RTNH_F_EXTERNAL was renamed over a year ago in commit
>36583eb54d46c ("rename RTNH_F_EXTERNAL to RTNH_F_OFFLOAD") so there
>isn't too much likelihood of this being confused for something that
>handles offloaded entries. If you take a look in net/ipv4/* after your
>patch there isn't actually anything that references the word external
>so the likelihood for any confusion is extremely low.
Okay. But if you can, please put a comment to this function in order to
prevent future confusion. Thanks!
^ permalink raw reply
* Re: [net-next 1/2] net: ethernet: slicoss: add slicoss gigabit ethernet driver
From: Florian Fainelli @ 2016-11-15 20:54 UTC (permalink / raw)
To: Lino Sanfilippo, Andrew Lunn
Cc: devel, gregkh, linux-kernel, liodot, netdev, davem
In-Reply-To: <69558f55-824a-7063-d9b3-ccc0a6113b87@gmx.de>
On 11/15/2016 12:46 PM, Lino Sanfilippo wrote:
>> Could this be pulled out into a standard PHY driver? All the SLIC
>> SLIC_PCR_ defines seems to be the same as those in mii.h. This could
>> be a standard PHY hidden behind a single register.
>>
>> Andrew
>
> You are right, the driver should really use the defines in mii.h. I will fix this in
> a v2.
>
> Concerning the use of the PHY API: What would be the advantage of using it? Note that the
> phy is always internal and not interchangeable. Is not the interchangeability of PHYs
> the main reason for using this API?
Not reinventing the wheel primarily, while PHYLIB also solves the plug &
play aspect of external PHYs, it also solves the basic link management,
and consistent and reasonably well defined interface to user-space and
drivers (statistics reporting, link, auto-negotiation, EEE etc.).
--
Florian
^ permalink raw reply
* Re: [net PATCH 1/2] ipv4: Restore fib_trie_flush_external function and fix call ordering
From: Duyck, Alexander H @ 2016-11-15 21:01 UTC (permalink / raw)
To: jiri@resnulli.us
Cc: netdev@vger.kernel.org, jiri@mellanox.com, davem@davemloft.net,
edumazet@google.com
In-Reply-To: <20161115205233.GD1783@nanopsycho.orion>
On Tue, 2016-11-15 at 21:52 +0100, Jiri Pirko wrote:
> Tue, Nov 15, 2016 at 09:49:02PM CET, alexander.h.duyck@intel.com wrote:
> >
> > On Tue, 2016-11-15 at 21:31 +0100, Jiri Pirko wrote:
> > >
> > > Tue, Nov 15, 2016 at 09:29:09PM CET, alexander.h.duyck@intel.com wrote:
> > > >
> > > >
> > > > On Tue, 2016-11-15 at 20:51 +0100, Jiri Pirko wrote:
> > > > >
> > > > >
> > > > > Tue, Nov 15, 2016 at 11:46:06AM CET, alexander.h.duyck@intel.com wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > The patch that removed the FIB offload infrastructure was a bit too
> > > > > > aggressive and also removed code needed to clean up us splitting the table
> > > > > > if additional rules were added. Specifically the function
> > > > > > fib_trie_flush_external was called at the end of a new rule being added to
> > > > > > flush the foreign trie entries from the main trie.
> > > > > >
> > > > > > I updated the code so that we only call fib_trie_flush_external on the main
> > > > > > table so that we flush the entries for local from main. This way we don't
> > > > > > call it for every rule change which is what was happening previously.
> > > > >
> > > > > Well, the function was introduced by:
> > > > >
> > > > > commit 104616e74e0b464d449fdd2ee2f547d2fad71610
> > > > > Author: Scott Feldman <sfeldma@gmail.com>
> > > > > Date: Thu Mar 5 21:21:16 2015 -0800
> > > > >
> > > > > switchdev: don't support custom ip rules, for now
> > > > >
> > > > > Keep switchdev FIB offload model simple for now and don't allow custom ip
> > > > > rules.
> > > > >
> > > > > Why this was not needed before? What changed in between:
> > > > > 104616e74e0b464d449fdd2ee2f547d2fad71610 ("switchdev: don't support custom ip rules, for now")
> > > > > and
> > > > > 347e3b28c1ba2 ("switchdev: remove FIB offload infrastructure")
> > > >
> > > > We collapsed the two tables into one in commit 0ddcf43d5d4a ("ipv4: FIB
> > > > Local/MAIN table collapse") which was submitted the next day. Scott
> > > > and I were working on things at the same time and the
> > > > fib_table_flush_external function was something we had worked out that
> > > > would allow him to take care of his use case and me to take care of
> > > > cleaning up the tables after unmerging.
> > >
> > > Okay. But please name the fuction differently, as it does not flush
> > > external. Thanks!
> >
> > You and I have different meanings for "external".
> >
> > In my case I am flushing entries that belong to a foreign "external"
> > table from the table specified. So by "external" I am referring to
> > entries that don't actually live in main, but actually reside in local.
> > If you take a look at fib_table_flush that gets rid of all entries,
> > fib_table_flush_external simply clears the foreign ones.
> >
> > Also I'd rather maintain naming since it makes it easier if we need to
> > backport fixes.
> >
> > Finally, the flag RTNH_F_EXTERNAL was renamed over a year ago in commit
> > 36583eb54d46c ("rename RTNH_F_EXTERNAL to RTNH_F_OFFLOAD") so there
> > isn't too much likelihood of this being confused for something that
> > handles offloaded entries. If you take a look in net/ipv4/* after your
> > patch there isn't actually anything that references the word external
> > so the likelihood for any confusion is extremely low.
>
> Okay. But if you can, please put a comment to this function in order to
> prevent future confusion. Thanks!
I'm not sure there is much left to confuse at this point. The function
has gone from multi-purpose to single purpose so anyone that is messing
with this should only be doing so if they are messing with the unmerge
functionality.
If anything it would be more confusing to refer to functionality that
this function doesn't support in the comments. All this function does
is flush foreign/external objects from the tree.
I'm willing to review a patch if you have a suggestion for a comment
that would work. I just want to avoid confusing people by referring to
code and functionality that is no longer relevent.
- Alex
^ permalink raw reply
* Re: linux-next: net->netns_ids is used after calling idr_destroy for it
From: Cong Wang @ 2016-11-15 21:07 UTC (permalink / raw)
To: Andrei Vagin; +Cc: Nicolas Dichtel, Linux Kernel Network Developers
In-Reply-To: <CANaxB-ysMU+QG=warwiQdC5pfXRjrSY7WOqJk0fcj-UMpipSZQ@mail.gmail.com>
On Tue, Nov 15, 2016 at 12:48 PM, Andrei Vagin <avagin@gmail.com> wrote:
> On Tue, Nov 15, 2016 at 10:50 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> On Tue, Nov 15, 2016 at 10:04 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>>> On Mon, Nov 14, 2016 at 10:23 PM, Andrei Vagin <avagin@gmail.com> wrote:
>>>> Hi Nicolas,
>>>>
>>>> cleanup_net() calls idr_destroy(net->netns_ids) for network namespaces
>>>> and then it calls unregister_netdevice_many() which calls
>>>> idr_alloc(net0>netns_ids). It looks wrong, doesn't it?
>>>>
>>>
>>> netns id is designed to allocate lazily, but yeah it makes no sense
>>> to allocate id for the netns being destroyed, not to mention idr is freed.
>>>
>>> I will send a patch.
>>
>> Could you try the attached patch? I just did some quick netns creation/destroy
>> tests.
>
> Here is another fail:
>
> unreferenced object 0xffff94153912a0c0 (size 2096):
> comm "ip", pid 29175, jiffies 4294954213 (age 137.624s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 00 b2 3b 1d 15 94 ff ff ..........;.....
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> backtrace:
> [<ffffffffac865c1a>] kmemleak_alloc+0x4a/0xa0
> [<ffffffffac243b38>] kmem_cache_alloc+0x128/0x280
> [<ffffffffac42f5ab>] idr_layer_alloc+0x2b/0x90
> [<ffffffffac42f9cd>] idr_get_empty_slot+0x34d/0x370
> [<ffffffffac42fa4e>] idr_alloc+0x5e/0x110
> [<ffffffffac70ac3d>] __peernet2id_alloc+0x6d/0x90
> [<ffffffffac70bda5>] peernet2id_alloc+0x55/0xb0
> [<ffffffffac731246>] rtnl_fill_ifinfo+0xaa6/0x10a0
> [<ffffffffac7330a3>] rtmsg_ifinfo_build_skb+0x73/0xd0
> [<ffffffffac7125e1>] rollback_registered_many+0x2a1/0x3a0
> [<ffffffffac712779>] __unregister_netdevice_many+0x29/0x80
> [<ffffffffac7127e3>] unregister_netdevice_many+0x13/0x20
> [<ffffffffc02dc4ce>] macvlan_device_event+0x13e/0x235 [macvlan]
> [<ffffffffac0bef2a>] notifier_call_chain+0x4a/0x70
> [<ffffffffac0bf066>] raw_notifier_call_chain+0x16/0x20
> [<ffffffffac710205>] call_netdevice_notifiers_info+0x35/0x60
>
Oh, drivers send rtmsg in notifiers too, hmm.
>
> What do you think about calling idr_destroy() at the final step in
> cleanup_net()? In this case we can avoid this sort of problems in a
> future.
This was my first idea too, but it looks more risky than my approach.
Also, rtmsg is really not needed because the netns is being destroyed,
no one cares about it here.
^ permalink raw reply
* Re: [net PATCH 1/2] ipv4: Restore fib_trie_flush_external function and fix call ordering
From: Jiri Pirko @ 2016-11-15 21:07 UTC (permalink / raw)
To: Duyck, Alexander H
Cc: netdev@vger.kernel.org, jiri@mellanox.com, davem@davemloft.net,
edumazet@google.com
In-Reply-To: <1479243657.681.125.camel@intel.com>
Tue, Nov 15, 2016 at 10:01:03PM CET, alexander.h.duyck@intel.com wrote:
>On Tue, 2016-11-15 at 21:52 +0100, Jiri Pirko wrote:
>> Tue, Nov 15, 2016 at 09:49:02PM CET, alexander.h.duyck@intel.com wrote:
>> >
>> > On Tue, 2016-11-15 at 21:31 +0100, Jiri Pirko wrote:
>> > >
>> > > Tue, Nov 15, 2016 at 09:29:09PM CET, alexander.h.duyck@intel.com wrote:
>> > > >
>> > > >
>> > > > On Tue, 2016-11-15 at 20:51 +0100, Jiri Pirko wrote:
>> > > > >
>> > > > >
>> > > > > Tue, Nov 15, 2016 at 11:46:06AM CET, alexander.h.duyck@intel.com wrote:
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > The patch that removed the FIB offload infrastructure was a bit too
>> > > > > > aggressive and also removed code needed to clean up us splitting the table
>> > > > > > if additional rules were added. Specifically the function
>> > > > > > fib_trie_flush_external was called at the end of a new rule being added to
>> > > > > > flush the foreign trie entries from the main trie.
>> > > > > >
>> > > > > > I updated the code so that we only call fib_trie_flush_external on the main
>> > > > > > table so that we flush the entries for local from main. This way we don't
>> > > > > > call it for every rule change which is what was happening previously.
>> > > > >
>> > > > > Well, the function was introduced by:
>> > > > >
>> > > > > commit 104616e74e0b464d449fdd2ee2f547d2fad71610
>> > > > > Author: Scott Feldman <sfeldma@gmail.com>
>> > > > > Date: Thu Mar 5 21:21:16 2015 -0800
>> > > > >
>> > > > > switchdev: don't support custom ip rules, for now
>> > > > >
>> > > > > Keep switchdev FIB offload model simple for now and don't allow custom ip
>> > > > > rules.
>> > > > >
>> > > > > Why this was not needed before? What changed in between:
>> > > > > 104616e74e0b464d449fdd2ee2f547d2fad71610 ("switchdev: don't support custom ip rules, for now")
>> > > > > and
>> > > > > 347e3b28c1ba2 ("switchdev: remove FIB offload infrastructure")
>> > > >
>> > > > We collapsed the two tables into one in commit 0ddcf43d5d4a ("ipv4: FIB
>> > > > Local/MAIN table collapse") which was submitted the next day. Scott
>> > > > and I were working on things at the same time and the
>> > > > fib_table_flush_external function was something we had worked out that
>> > > > would allow him to take care of his use case and me to take care of
>> > > > cleaning up the tables after unmerging.
>> > >
>> > > Okay. But please name the fuction differently, as it does not flush
>> > > external. Thanks!
>> >
>> > You and I have different meanings for "external".
>> >
>> > In my case I am flushing entries that belong to a foreign "external"
>> > table from the table specified. So by "external" I am referring to
>> > entries that don't actually live in main, but actually reside in local.
>> > If you take a look at fib_table_flush that gets rid of all entries,
>> > fib_table_flush_external simply clears the foreign ones.
>> >
>> > Also I'd rather maintain naming since it makes it easier if we need to
>> > backport fixes.
>> >
>> > Finally, the flag RTNH_F_EXTERNAL was renamed over a year ago in commit
>> > 36583eb54d46c ("rename RTNH_F_EXTERNAL to RTNH_F_OFFLOAD") so there
>> > isn't too much likelihood of this being confused for something that
>> > handles offloaded entries. If you take a look in net/ipv4/* after your
>> > patch there isn't actually anything that references the word external
>> > so the likelihood for any confusion is extremely low.
>>
>> Okay. But if you can, please put a comment to this function in order to
>> prevent future confusion. Thanks!
>
>I'm not sure there is much left to confuse at this point. The function
>has gone from multi-purpose to single purpose so anyone that is messing
>with this should only be doing so if they are messing with the unmerge
>functionality.
>
>If anything it would be more confusing to refer to functionality that
>this function doesn't support in the comments. All this function does
>is flush foreign/external objects from the tree.
>
>I'm willing to review a patch if you have a suggestion for a comment
>that would work. I just want to avoid confusing people by referring to
>code and functionality that is no longer relevent.
Perhaps I was the only one confused. Fair enough. Thanks Alex.
^ permalink raw reply
* Re: [net PATCH 1/2] ipv4: Restore fib_trie_flush_external function and fix call ordering
From: Duyck, Alexander H @ 2016-11-15 21:11 UTC (permalink / raw)
To: jiri@resnulli.us
Cc: netdev@vger.kernel.org, jiri@mellanox.com, davem@davemloft.net,
edumazet@google.com
In-Reply-To: <20161115210754.GE1783@nanopsycho.orion>
On Tue, 2016-11-15 at 22:07 +0100, Jiri Pirko wrote:
> Tue, Nov 15, 2016 at 10:01:03PM CET, alexander.h.duyck@intel.com wrote:
> >
> > On Tue, 2016-11-15 at 21:52 +0100, Jiri Pirko wrote:
> > >
> > > Tue, Nov 15, 2016 at 09:49:02PM CET, alexander.h.duyck@intel.com wrote:
> > > >
> > > >
> > > > On Tue, 2016-11-15 at 21:31 +0100, Jiri Pirko wrote:
> > > > >
> > > > >
> > > > > Tue, Nov 15, 2016 at 09:29:09PM CET, alexander.h.duyck@intel.com wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Tue, 2016-11-15 at 20:51 +0100, Jiri Pirko wrote:
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Tue, Nov 15, 2016 at 11:46:06AM CET, alexander.h.duyck@intel.com wrote:
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > The patch that removed the FIB offload infrastructure was a bit too
> > > > > > > > aggressive and also removed code needed to clean up us splitting the table
> > > > > > > > if additional rules were added. Specifically the function
> > > > > > > > fib_trie_flush_external was called at the end of a new rule being added to
> > > > > > > > flush the foreign trie entries from the main trie.
> > > > > > > >
> > > > > > > > I updated the code so that we only call fib_trie_flush_external on the main
> > > > > > > > table so that we flush the entries for local from main. This way we don't
> > > > > > > > call it for every rule change which is what was happening previously.
> > > > > > >
> > > > > > > Well, the function was introduced by:
> > > > > > >
> > > > > > > commit 104616e74e0b464d449fdd2ee2f547d2fad71610
> > > > > > > Author: Scott Feldman <sfeldma@gmail.com>
> > > > > > > Date: Thu Mar 5 21:21:16 2015 -0800
> > > > > > >
> > > > > > > switchdev: don't support custom ip rules, for now
> > > > > > >
> > > > > > > Keep switchdev FIB offload model simple for now and don't allow custom ip
> > > > > > > rules.
> > > > > > >
> > > > > > > Why this was not needed before? What changed in between:
> > > > > > > 104616e74e0b464d449fdd2ee2f547d2fad71610 ("switchdev: don't support custom ip rules, for now")
> > > > > > > and
> > > > > > > 347e3b28c1ba2 ("switchdev: remove FIB offload infrastructure")
> > > > > >
> > > > > > We collapsed the two tables into one in commit 0ddcf43d5d4a ("ipv4: FIB
> > > > > > Local/MAIN table collapse") which was submitted the next day. Scott
> > > > > > and I were working on things at the same time and the
> > > > > > fib_table_flush_external function was something we had worked out that
> > > > > > would allow him to take care of his use case and me to take care of
> > > > > > cleaning up the tables after unmerging.
> > > > >
> > > > > Okay. But please name the fuction differently, as it does not flush
> > > > > external. Thanks!
> > > >
> > > > You and I have different meanings for "external".
> > > >
> > > > In my case I am flushing entries that belong to a foreign "external"
> > > > table from the table specified. So by "external" I am referring to
> > > > entries that don't actually live in main, but actually reside in local.
> > > > If you take a look at fib_table_flush that gets rid of all entries,
> > > > fib_table_flush_external simply clears the foreign ones.
> > > >
> > > > Also I'd rather maintain naming since it makes it easier if we need to
> > > > backport fixes.
> > > >
> > > > Finally, the flag RTNH_F_EXTERNAL was renamed over a year ago in commit
> > > > 36583eb54d46c ("rename RTNH_F_EXTERNAL to RTNH_F_OFFLOAD") so there
> > > > isn't too much likelihood of this being confused for something that
> > > > handles offloaded entries. If you take a look in net/ipv4/* after your
> > > > patch there isn't actually anything that references the word external
> > > > so the likelihood for any confusion is extremely low.
> > >
> > > Okay. But if you can, please put a comment to this function in order to
> > > prevent future confusion. Thanks!
> >
> > I'm not sure there is much left to confuse at this point. The function
> > has gone from multi-purpose to single purpose so anyone that is messing
> > with this should only be doing so if they are messing with the unmerge
> > functionality.
> >
> > If anything it would be more confusing to refer to functionality that
> > this function doesn't support in the comments. All this function does
> > is flush foreign/external objects from the tree.
> >
> > I'm willing to review a patch if you have a suggestion for a comment
> > that would work. I just want to avoid confusing people by referring to
> > code and functionality that is no longer relevent.
>
> Perhaps I was the only one confused. Fair enough. Thanks Alex.
No, I would agree the original sharing of the function was a bit
confusing, and that was mostly due to the timeline of things with both
Scott and I rebasing our code on top of each other.
With you removing the FIB offload pieces it simplified it quite a bit
so with this fix we should be back to 100% functionality with the code
much more simplified.
Thanks.
- Alex
^ permalink raw reply
* RE: [PATCH 13/15] net: ethernet: lantiq_etop: Utilize phy_ethtool_nway_reset
From: Langer, Thomas @ 2016-11-15 21:14 UTC (permalink / raw)
To: Florian Fainelli, netdev@vger.kernel.org
Cc: davem@davemloft.net, andrew@lunn.ch, tremyfr@gmail.com,
Florian Westphal, Jarod Wilson, open list
In-Reply-To: <20161115180644.3941-14-f.fainelli@gmail.com>
> Subject: [PATCH 13/15] net: ethernet: lantiq_etop: Utilize
> phy_ethtool_nway_reset
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> drivers/net/ethernet/lantiq_etop.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
Reviewed-by: Thomas Langer <Thomas.langer@intel.com>
^ permalink raw reply
* Re: [net-next 1/2] net: ethernet: slicoss: add slicoss gigabit ethernet driver
From: Lino Sanfilippo @ 2016-11-15 21:24 UTC (permalink / raw)
To: Florian Fainelli, Andrew Lunn
Cc: davem, charrer, liodot, gregkh, devel, linux-kernel, netdev
In-Reply-To: <4450caf4-e1cf-5187-1337-c46b81b08708@gmail.com>
Hi,
On 15.11.2016 21:54, Florian Fainelli wrote:
> On 11/15/2016 12:46 PM, Lino Sanfilippo wrote:
>>> Could this be pulled out into a standard PHY driver? All the SLIC
>>> SLIC_PCR_ defines seems to be the same as those in mii.h. This could
>>> be a standard PHY hidden behind a single register.
>>>
>>> Andrew
>>
>> You are right, the driver should really use the defines in mii.h. I will fix this in
>> a v2.
>>
>> Concerning the use of the PHY API: What would be the advantage of using it? Note that the
>> phy is always internal and not interchangeable. Is not the interchangeability of PHYs
>> the main reason for using this API?
>
> Not reinventing the wheel primarily, while PHYLIB also solves the plug &
> play aspect of external PHYs, it also solves the basic link management,
> and consistent and reasonably well defined interface to user-space and
> drivers (statistics reporting, link, auto-negotiation, EEE etc.).
>
Sure I see this point. But currently all the driver does concerning the phy is to
configure it for auto negotiation when the interface is brought up, nothing else.
The link state is retrieved by a command to the application processor that is running
on the network card. Also the register to set the phy configuration is write-only, so
it is not even possible to do the usual mdio bit-banging in the Phy read() and write()
functions (however there seems to be another application processor command reserved
for retrieving the PHY settings, but I have not tried it yet).
Please also note that I do not have any datasheets or other documentation for the hardware,
all I have as a reference is the driver code in staging. So I do not know which
PHYs are actually used (the comments in the code mention Marvell and Cicada but this is
not very specific).
Regards,
Lino
^ permalink raw reply
* [PATCH net-next 0/8] Mellanox 100G mlx5 update 2016-11-15
From: Saeed Mahameed @ 2016-11-15 21:29 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Saeed Mahameed
Hi Dave,
This series contains four humble mlx5 features.
from Gal,
- Add the support for PCIe statistics and expose them in ethtool
from Huy,
- Add the support for port module events reporting and statistics
- Add the support for driver version setting into FW (for display purposes only)
>From Mohamad,
- Extended the command interface cache flexibility
This series was generated against commit
c915fe13cbaa ("udplite: fix NULL pointer dereference")
Thanks,
Saeed.
Gal Pressman (2):
net/mlx5: Add MPCNT register infrastructure
net/mlx5e: Expose PCIe statistics to ethtool
Huy Nguyen (4):
net/mlx5: Port module event hardware structures
net/mlx5: Add handling for port module event
net/mlx5e: Add port module event counters to ethtool stats
net/mlx5: Set driver version into firmware
Mohamad Haj Yahia (1):
net/mlx5: Make the command interface cache more flexible
Saeed Mahameed (1):
net/mlx5: Set driver version infrastructure
drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 145 ++++++++++-----------
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 40 +++++-
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 24 ++++
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 49 ++++++-
drivers/net/ethernet/mellanox/mlx5/core/eq.c | 12 ++
drivers/net/ethernet/mellanox/mlx5/core/main.c | 37 ++++++
.../net/ethernet/mellanox/mlx5/core/mlx5_core.h | 1 +
drivers/net/ethernet/mellanox/mlx5/core/port.c | 57 ++++++++
include/linux/mlx5/device.h | 16 +++
include/linux/mlx5/driver.h | 42 +++++-
include/linux/mlx5/mlx5_ifc.h | 118 ++++++++++++++++-
include/linux/mlx5/port.h | 3 +
12 files changed, 457 insertions(+), 87 deletions(-)
--
2.7.4
^ permalink raw reply
* [PATCH net-next 1/8] net/mlx5: Make the command interface cache more flexible
From: Saeed Mahameed @ 2016-11-15 21:30 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Mohamad Haj Yahia, Saeed Mahameed
In-Reply-To: <1479245407-6884-1-git-send-email-saeedm@mellanox.com>
From: Mohamad Haj Yahia <mohamad@mellanox.com>
Add more cache command size sets and more entries for each set based on
the current commands set different sizes and commands frequency.
Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Mohamad Haj Yahia <mohamad@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 145 ++++++++++++--------------
include/linux/mlx5/driver.h | 14 +--
2 files changed, 76 insertions(+), 83 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index 8561102..0fe7a60 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -54,14 +54,6 @@ enum {
};
enum {
- NUM_LONG_LISTS = 2,
- NUM_MED_LISTS = 64,
- LONG_LIST_SIZE = (2ULL * 1024 * 1024 * 1024 / PAGE_SIZE) * 8 + 16 +
- MLX5_CMD_DATA_BLOCK_SIZE,
- MED_LIST_SIZE = 16 + MLX5_CMD_DATA_BLOCK_SIZE,
-};
-
-enum {
MLX5_CMD_DELIVERY_STAT_OK = 0x0,
MLX5_CMD_DELIVERY_STAT_SIGNAT_ERR = 0x1,
MLX5_CMD_DELIVERY_STAT_TOK_ERR = 0x2,
@@ -1372,10 +1364,10 @@ static void free_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg)
{
unsigned long flags;
- if (msg->cache) {
- spin_lock_irqsave(&msg->cache->lock, flags);
- list_add_tail(&msg->list, &msg->cache->head);
- spin_unlock_irqrestore(&msg->cache->lock, flags);
+ if (msg->parent) {
+ spin_lock_irqsave(&msg->parent->lock, flags);
+ list_add_tail(&msg->list, &msg->parent->head);
+ spin_unlock_irqrestore(&msg->parent->lock, flags);
} else {
mlx5_free_cmd_msg(dev, msg);
}
@@ -1472,30 +1464,37 @@ static struct mlx5_cmd_msg *alloc_msg(struct mlx5_core_dev *dev, int in_size,
gfp_t gfp)
{
struct mlx5_cmd_msg *msg = ERR_PTR(-ENOMEM);
+ struct cmd_msg_cache *ch = NULL;
struct mlx5_cmd *cmd = &dev->cmd;
- struct cache_ent *ent = NULL;
-
- if (in_size > MED_LIST_SIZE && in_size <= LONG_LIST_SIZE)
- ent = &cmd->cache.large;
- else if (in_size > 16 && in_size <= MED_LIST_SIZE)
- ent = &cmd->cache.med;
-
- if (ent) {
- spin_lock_irq(&ent->lock);
- if (!list_empty(&ent->head)) {
- msg = list_entry(ent->head.next, typeof(*msg), list);
- /* For cached lists, we must explicitly state what is
- * the real size
- */
- msg->len = in_size;
- list_del(&msg->list);
+ int i;
+
+ if (in_size <= 16)
+ goto cache_miss;
+
+ for (i = 0; i < MLX5_NUM_COMMAND_CACHES; i++) {
+ ch = &cmd->cache[i];
+ if (in_size > ch->max_inbox_size)
+ continue;
+ spin_lock_irq(&ch->lock);
+ if (list_empty(&ch->head)) {
+ spin_unlock_irq(&ch->lock);
+ continue;
}
- spin_unlock_irq(&ent->lock);
+ msg = list_entry(ch->head.next, typeof(*msg), list);
+ /* For cached lists, we must explicitly state what is
+ * the real size
+ */
+ msg->len = in_size;
+ list_del(&msg->list);
+ spin_unlock_irq(&ch->lock);
+ break;
}
- if (IS_ERR(msg))
- msg = mlx5_alloc_cmd_msg(dev, gfp, in_size, 0);
+ if (!IS_ERR(msg))
+ return msg;
+cache_miss:
+ msg = mlx5_alloc_cmd_msg(dev, gfp, in_size, 0);
return msg;
}
@@ -1593,58 +1592,56 @@ EXPORT_SYMBOL(mlx5_cmd_exec_cb);
static void destroy_msg_cache(struct mlx5_core_dev *dev)
{
- struct mlx5_cmd *cmd = &dev->cmd;
+ struct cmd_msg_cache *ch;
struct mlx5_cmd_msg *msg;
struct mlx5_cmd_msg *n;
+ int i;
- list_for_each_entry_safe(msg, n, &cmd->cache.large.head, list) {
- list_del(&msg->list);
- mlx5_free_cmd_msg(dev, msg);
- }
-
- list_for_each_entry_safe(msg, n, &cmd->cache.med.head, list) {
- list_del(&msg->list);
- mlx5_free_cmd_msg(dev, msg);
+ for (i = 0; i < MLX5_NUM_COMMAND_CACHES; i++) {
+ ch = &dev->cmd.cache[i];
+ list_for_each_entry_safe(msg, n, &ch->head, list) {
+ list_del(&msg->list);
+ mlx5_free_cmd_msg(dev, msg);
+ }
}
}
-static int create_msg_cache(struct mlx5_core_dev *dev)
+static unsigned cmd_cache_num_ent[MLX5_NUM_COMMAND_CACHES] = {
+ 512, 32, 16, 8, 2
+};
+
+static unsigned cmd_cache_ent_size[MLX5_NUM_COMMAND_CACHES] = {
+ 16 + MLX5_CMD_DATA_BLOCK_SIZE,
+ 16 + MLX5_CMD_DATA_BLOCK_SIZE * 2,
+ 16 + MLX5_CMD_DATA_BLOCK_SIZE * 16,
+ 16 + MLX5_CMD_DATA_BLOCK_SIZE * 256,
+ 16 + MLX5_CMD_DATA_BLOCK_SIZE * 512,
+};
+
+static void create_msg_cache(struct mlx5_core_dev *dev)
{
struct mlx5_cmd *cmd = &dev->cmd;
+ struct cmd_msg_cache *ch;
struct mlx5_cmd_msg *msg;
- int err;
int i;
-
- spin_lock_init(&cmd->cache.large.lock);
- INIT_LIST_HEAD(&cmd->cache.large.head);
- spin_lock_init(&cmd->cache.med.lock);
- INIT_LIST_HEAD(&cmd->cache.med.head);
-
- for (i = 0; i < NUM_LONG_LISTS; i++) {
- msg = mlx5_alloc_cmd_msg(dev, GFP_KERNEL, LONG_LIST_SIZE, 0);
- if (IS_ERR(msg)) {
- err = PTR_ERR(msg);
- goto ex_err;
- }
- msg->cache = &cmd->cache.large;
- list_add_tail(&msg->list, &cmd->cache.large.head);
- }
-
- for (i = 0; i < NUM_MED_LISTS; i++) {
- msg = mlx5_alloc_cmd_msg(dev, GFP_KERNEL, MED_LIST_SIZE, 0);
- if (IS_ERR(msg)) {
- err = PTR_ERR(msg);
- goto ex_err;
+ int k;
+
+ /* Initialize and fill the caches with initial entries */
+ for (k = 0; k < MLX5_NUM_COMMAND_CACHES; k++) {
+ ch = &cmd->cache[k];
+ spin_lock_init(&ch->lock);
+ INIT_LIST_HEAD(&ch->head);
+ ch->num_ent = cmd_cache_num_ent[k];
+ ch->max_inbox_size = cmd_cache_ent_size[k];
+ for (i = 0; i < ch->num_ent; i++) {
+ msg = mlx5_alloc_cmd_msg(dev, GFP_KERNEL | __GFP_NOWARN,
+ ch->max_inbox_size, 0);
+ if (IS_ERR(msg))
+ break;
+ msg->parent = ch;
+ list_add_tail(&msg->list, &ch->head);
}
- msg->cache = &cmd->cache.med;
- list_add_tail(&msg->list, &cmd->cache.med.head);
}
-
- return 0;
-
-ex_err:
- destroy_msg_cache(dev);
- return err;
}
static int alloc_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd)
@@ -1767,11 +1764,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev)
cmd->mode = CMD_MODE_POLLING;
- err = create_msg_cache(dev);
- if (err) {
- dev_err(&dev->pdev->dev, "failed to create command cache\n");
- goto err_free_page;
- }
+ create_msg_cache(dev);
set_wqname(dev);
cmd->wq = create_singlethread_workqueue(cmd->wq_name);
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index ecc451d..1eb08d3 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -208,7 +208,7 @@ struct mlx5_cmd_first {
struct mlx5_cmd_msg {
struct list_head list;
- struct cache_ent *cache;
+ struct cmd_msg_cache *parent;
u32 len;
struct mlx5_cmd_first first;
struct mlx5_cmd_mailbox *next;
@@ -228,17 +228,17 @@ struct mlx5_cmd_debug {
u16 outlen;
};
-struct cache_ent {
+struct cmd_msg_cache {
/* protect block chain allocations
*/
spinlock_t lock;
struct list_head head;
+ unsigned max_inbox_size;
+ unsigned num_ent;
};
-struct cmd_msg_cache {
- struct cache_ent large;
- struct cache_ent med;
-
+enum {
+ MLX5_NUM_COMMAND_CACHES = 5,
};
struct mlx5_cmd_stats {
@@ -281,7 +281,7 @@ struct mlx5_cmd {
struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS];
struct pci_pool *pool;
struct mlx5_cmd_debug dbg;
- struct cmd_msg_cache cache;
+ struct cmd_msg_cache cache[MLX5_NUM_COMMAND_CACHES];
int checksum_disabled;
struct mlx5_cmd_stats stats[MLX5_CMD_OP_MAX];
};
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 3/8] net/mlx5: Add handling for port module event
From: Saeed Mahameed @ 2016-11-15 21:30 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Huy Nguyen, Saeed Mahameed
In-Reply-To: <1479245407-6884-1-git-send-email-saeedm@mellanox.com>
From: Huy Nguyen <huyn@mellanox.com>
For each asynchronous port module event:
1. print with ratelimit to the dmesg log
2. increment the corresponding event counter
Signed-off-by: Huy Nguyen <huyn@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/eq.c | 12 +++++
.../net/ethernet/mellanox/mlx5/core/mlx5_core.h | 1 +
drivers/net/ethernet/mellanox/mlx5/core/port.c | 57 ++++++++++++++++++++++
include/linux/mlx5/driver.h | 27 ++++++++++
4 files changed, 97 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index e74a73b..8ffcc88 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -139,6 +139,8 @@ static const char *eqe_type_str(u8 type)
return "MLX5_EVENT_TYPE_PORT_CHANGE";
case MLX5_EVENT_TYPE_GPIO_EVENT:
return "MLX5_EVENT_TYPE_GPIO_EVENT";
+ case MLX5_EVENT_TYPE_PORT_MODULE_EVENT:
+ return "MLX5_EVENT_TYPE_PORT_MODULE_EVENT";
case MLX5_EVENT_TYPE_REMOTE_CONFIG:
return "MLX5_EVENT_TYPE_REMOTE_CONFIG";
case MLX5_EVENT_TYPE_DB_BF_CONGESTION:
@@ -285,6 +287,11 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq)
mlx5_eswitch_vport_event(dev->priv.eswitch, eqe);
break;
#endif
+
+ case MLX5_EVENT_TYPE_PORT_MODULE_EVENT:
+ mlx5_port_module_event(dev, eqe);
+ break;
+
default:
mlx5_core_warn(dev, "Unhandled event 0x%x on EQ 0x%x\n",
eqe->type, eq->eqn);
@@ -480,6 +487,11 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev)
mlx5_core_is_pf(dev))
async_event_mask |= (1ull << MLX5_EVENT_TYPE_NIC_VPORT_CHANGE);
+ if (MLX5_CAP_GEN(dev, port_module_event))
+ async_event_mask |= (1ull << MLX5_EVENT_TYPE_PORT_MODULE_EVENT);
+ else
+ mlx5_core_dbg(dev, "port_module_event is not set\n");
+
err = mlx5_create_map_eq(dev, &table->cmd_eq, MLX5_EQ_VEC_CMD,
MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD,
"mlx5_cmd_eq", &dev->priv.uuari.uars[0]);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
index 4762bb9..7e635eb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
@@ -81,6 +81,7 @@ int mlx5_cmd_init_hca(struct mlx5_core_dev *dev);
int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev);
void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event,
unsigned long param);
+void mlx5_port_module_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe);
void mlx5_enter_error_state(struct mlx5_core_dev *dev);
void mlx5_disable_device(struct mlx5_core_dev *dev);
void mlx5_recover_device(struct mlx5_core_dev *dev);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c
index 34e7184..b77928f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/port.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c
@@ -746,3 +746,60 @@ void mlx5_query_port_fcs(struct mlx5_core_dev *mdev, bool *supported,
*supported = !!(MLX5_GET(pcmr_reg, out, fcs_cap));
*enabled = !!(MLX5_GET(pcmr_reg, out, fcs_chk));
}
+
+static const char *mlx5_pme_status[MLX5_MODULE_STATUS_NUM] = {
+ "Cable plugged", /* MLX5_MODULE_STATUS_PLUGGED = 0x1 */
+ "Cable unplugged", /* MLX5_MODULE_STATUS_UNPLUGGED = 0x2 */
+ "Cable error", /* MLX5_MODULE_STATUS_ERROR = 0x3 */
+};
+
+static const char *mlx5_pme_error[MLX5_MODULE_EVENT_ERROR_NUM] = {
+ "Power budget exceeded",
+ "Long Range for non MLNX cable",
+ "Bus stuck(I2C or data shorted)",
+ "No EEPROM/retry timeout",
+ "Enforce part number list",
+ "Unknown identifier",
+ "High Temperature",
+ "Bad or shorted cable/module",
+ "Unknown status",
+};
+
+void mlx5_port_module_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe)
+{
+ enum port_module_event_status_type module_status;
+ enum port_module_event_error_type error_type;
+ struct mlx5_eqe_port_module *module_event_eqe;
+ struct mlx5_priv *priv = &dev->priv;
+ u8 module_num;
+
+ module_event_eqe = &eqe->data.port_module;
+ module_num = module_event_eqe->module;
+ module_status = module_event_eqe->module_status &
+ PORT_MODULE_EVENT_MODULE_STATUS_MASK;
+ error_type = module_event_eqe->error_type &
+ PORT_MODULE_EVENT_ERROR_TYPE_MASK;
+
+ if (module_status < MLX5_MODULE_STATUS_ERROR) {
+ priv->pme_stats.status_counters[module_status - 1]++;
+ } else if (module_status == MLX5_MODULE_STATUS_ERROR) {
+ if (error_type >= MLX5_MODULE_EVENT_ERROR_UNKNOWN)
+ /* Unknown error type */
+ error_type = MLX5_MODULE_EVENT_ERROR_UNKNOWN;
+ priv->pme_stats.error_counters[error_type]++;
+ }
+
+ if (!printk_ratelimit())
+ return;
+
+ if (module_status < MLX5_MODULE_STATUS_ERROR)
+ mlx5_core_info(dev,
+ "Port module event: module %u, %s\n",
+ module_num, mlx5_pme_status[module_status - 1]);
+
+ else if (module_status == MLX5_MODULE_STATUS_ERROR)
+ mlx5_core_info(dev,
+ "Port module event[error]: module %u, %s, %s\n",
+ module_num, mlx5_pme_status[module_status - 1],
+ mlx5_pme_error[error_type]);
+}
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 1eb08d3..243b538 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -498,6 +498,31 @@ struct mlx5_rl_table {
struct mlx5_rl_entry *rl_entry;
};
+enum port_module_event_status_type {
+ MLX5_MODULE_STATUS_PLUGGED = 0x1,
+ MLX5_MODULE_STATUS_UNPLUGGED = 0x2,
+ MLX5_MODULE_STATUS_ERROR = 0x3,
+ MLX5_MODULE_STATUS_NUM = 0x3,
+};
+
+enum port_module_event_error_type {
+ MLX5_MODULE_EVENT_ERROR_POWER_BUDGET_EXCEEDED,
+ MLX5_MODULE_EVENT_ERROR_LONG_RANGE_FOR_NON_MLNX_CABLE_MODULE,
+ MLX5_MODULE_EVENT_ERROR_BUS_STUCK,
+ MLX5_MODULE_EVENT_ERROR_NO_EEPROM_RETRY_TIMEOUT,
+ MLX5_MODULE_EVENT_ERROR_ENFORCE_PART_NUMBER_LIST,
+ MLX5_MODULE_EVENT_ERROR_UNKNOWN_IDENTIFIER,
+ MLX5_MODULE_EVENT_ERROR_HIGH_TEMPERATURE,
+ MLX5_MODULE_EVENT_ERROR_BAD_CABLE,
+ MLX5_MODULE_EVENT_ERROR_UNKNOWN,
+ MLX5_MODULE_EVENT_ERROR_NUM,
+};
+
+struct mlx5_port_module_event_stats {
+ u64 status_counters[MLX5_MODULE_STATUS_NUM];
+ u64 error_counters[MLX5_MODULE_EVENT_ERROR_NUM];
+};
+
struct mlx5_priv {
char name[MLX5_MAX_NAME_LEN];
struct mlx5_eq_table eq_table;
@@ -559,6 +584,8 @@ struct mlx5_priv {
unsigned long pci_dev_data;
struct mlx5_fc_stats fc_stats;
struct mlx5_rl_table rl_table;
+
+ struct mlx5_port_module_event_stats pme_stats;
};
enum mlx5_device_state {
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 5/8] net/mlx5: Set driver version infrastructure
From: Saeed Mahameed @ 2016-11-15 21:30 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Saeed Mahameed, Huy Nguyen, Leon Romanovsky
In-Reply-To: <1479245407-6884-1-git-send-email-saeedm@mellanox.com>
Add driver_version capability bit is enabled, and set driver
version command in mlx5_ifc firmware header. The only purpose
of this command is to store a driver version/OS string in FW
to be reported and displayed in various management systems,
such as IPMI/BMC.
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Huy Nguyen <huyn@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
include/linux/mlx5/mlx5_ifc.h | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index cd1d530..f08a0624 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -83,6 +83,7 @@ enum {
MLX5_CMD_OP_SET_HCA_CAP = 0x109,
MLX5_CMD_OP_QUERY_ISSI = 0x10a,
MLX5_CMD_OP_SET_ISSI = 0x10b,
+ MLX5_CMD_OP_SET_DRIVER_VERSION = 0x10d,
MLX5_CMD_OP_CREATE_MKEY = 0x200,
MLX5_CMD_OP_QUERY_MKEY = 0x201,
MLX5_CMD_OP_DESTROY_MKEY = 0x202,
@@ -909,7 +910,7 @@ struct mlx5_ifc_cmd_hca_cap_bits {
u8 log_pg_sz[0x8];
u8 bf[0x1];
- u8 reserved_at_261[0x1];
+ u8 driver_version[0x1];
u8 pad_tx_eth_packet[0x1];
u8 reserved_at_263[0x8];
u8 log_bf_reg_size[0x5];
@@ -4005,6 +4006,25 @@ struct mlx5_ifc_query_issi_in_bits {
u8 reserved_at_40[0x40];
};
+struct mlx5_ifc_set_driver_version_out_bits {
+ u8 status[0x8];
+ u8 reserved_0[0x18];
+
+ u8 syndrome[0x20];
+ u8 reserved_1[0x40];
+};
+
+struct mlx5_ifc_set_driver_version_in_bits {
+ u8 opcode[0x10];
+ u8 reserved_0[0x10];
+
+ u8 reserved_1[0x10];
+ u8 op_mod[0x10];
+
+ u8 reserved_2[0x40];
+ u8 driver_version[64][0x8];
+};
+
struct mlx5_ifc_query_hca_vport_pkey_out_bits {
u8 status[0x8];
u8 reserved_at_8[0x18];
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 7/8] net/mlx5: Add MPCNT register infrastructure
From: Saeed Mahameed @ 2016-11-15 21:30 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Gal Pressman, Saeed Mahameed
In-Reply-To: <1479245407-6884-1-git-send-email-saeedm@mellanox.com>
From: Gal Pressman <galp@mellanox.com>
Add the needed infrastructure for future use of MPCNT register.
Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
include/linux/mlx5/device.h | 5 +++
include/linux/mlx5/driver.h | 1 +
include/linux/mlx5/mlx5_ifc.h | 93 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 99 insertions(+)
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 52b4374..9f48936 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -1071,6 +1071,11 @@ enum {
MLX5_INFINIBAND_PORT_COUNTERS_GROUP = 0x20,
};
+enum {
+ MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP = 0x0,
+ MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP = 0x2,
+};
+
static inline u16 mlx5_to_sw_pkey_sz(int pkey_sz)
{
if (pkey_sz > MLX5_MAX_LOG_PKEY_TABLE)
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 243b538..571feab 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -121,6 +121,7 @@ enum {
MLX5_REG_HOST_ENDIANNESS = 0x7004,
MLX5_REG_MCIA = 0x9014,
MLX5_REG_MLCR = 0x902b,
+ MLX5_REG_MPCNT = 0x9051,
};
enum {
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index f08a0624..a5f0fbe 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -1757,6 +1757,80 @@ struct mlx5_ifc_eth_802_3_cntrs_grp_data_layout_bits {
u8 reserved_at_4c0[0x300];
};
+struct mlx5_ifc_pcie_perf_cntrs_grp_data_layout_bits {
+ u8 life_time_counter_high[0x20];
+
+ u8 life_time_counter_low[0x20];
+
+ u8 rx_errors[0x20];
+
+ u8 tx_errors[0x20];
+
+ u8 l0_to_recovery_eieos[0x20];
+
+ u8 l0_to_recovery_ts[0x20];
+
+ u8 l0_to_recovery_framing[0x20];
+
+ u8 l0_to_recovery_retrain[0x20];
+
+ u8 crc_error_dllp[0x20];
+
+ u8 crc_error_tlp[0x20];
+
+ u8 reserved_at_140[0x680];
+};
+
+struct mlx5_ifc_pcie_tas_cntrs_grp_data_layout_bits {
+ u8 life_time_counter_high[0x20];
+
+ u8 life_time_counter_low[0x20];
+
+ u8 time_to_boot_image_start[0x20];
+
+ u8 time_to_link_image[0x20];
+
+ u8 calibration_time[0x20];
+
+ u8 time_to_first_perst[0x20];
+
+ u8 time_to_detect_state[0x20];
+
+ u8 time_to_l0[0x20];
+
+ u8 time_to_crs_en[0x20];
+
+ u8 time_to_plastic_image_start[0x20];
+
+ u8 time_to_iron_image_start[0x20];
+
+ u8 perst_handler[0x20];
+
+ u8 times_in_l1[0x20];
+
+ u8 times_in_l23[0x20];
+
+ u8 dl_down[0x20];
+
+ u8 config_cycle1usec[0x20];
+
+ u8 config_cycle2to7usec[0x20];
+
+ u8 config_cycle_8to15usec[0x20];
+
+ u8 config_cycle_16_to_63usec[0x20];
+
+ u8 config_cycle_64usec[0x20];
+
+ u8 correctable_err_msg_sent[0x20];
+
+ u8 non_fatal_err_msg_sent[0x20];
+
+ u8 fatal_err_msg_sent[0x20];
+
+ u8 reserved_at_2e0[0x4e0];
+};
+
struct mlx5_ifc_cmd_inter_comp_event_bits {
u8 command_completion_vector[0x20];
@@ -2921,6 +2995,12 @@ union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits {
u8 reserved_at_0[0x7c0];
};
+union mlx5_ifc_pcie_cntrs_grp_data_layout_auto_bits {
+ struct mlx5_ifc_pcie_perf_cntrs_grp_data_layout_bits pcie_perf_cntrs_grp_data_layout;
+ struct mlx5_ifc_pcie_tas_cntrs_grp_data_layout_bits pcie_tas_cntrs_grp_data_layout;
+ u8 reserved_at_0[0x7c0];
+};
+
union mlx5_ifc_event_auto_bits {
struct mlx5_ifc_comp_event_bits comp_event;
struct mlx5_ifc_dct_events_bits dct_events;
@@ -7240,6 +7320,18 @@ struct mlx5_ifc_ppcnt_reg_bits {
union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set;
};
+struct mlx5_ifc_mpcnt_reg_bits {
+ u8 reserved_at_0[0x8];
+ u8 pcie_index[0x8];
+ u8 reserved_at_10[0xa];
+ u8 grp[0x6];
+
+ u8 clr[0x1];
+ u8 reserved_at_21[0x1f];
+
+ union mlx5_ifc_pcie_cntrs_grp_data_layout_auto_bits counter_set;
+};
+
struct mlx5_ifc_ppad_reg_bits {
u8 reserved_at_0[0x3];
u8 single_mac[0x1];
@@ -7845,6 +7937,7 @@ union mlx5_ifc_ports_control_registers_document_bits {
struct mlx5_ifc_pmtu_reg_bits pmtu_reg;
struct mlx5_ifc_ppad_reg_bits ppad_reg;
struct mlx5_ifc_ppcnt_reg_bits ppcnt_reg;
+ struct mlx5_ifc_mpcnt_reg_bits mpcnt_reg;
struct mlx5_ifc_pplm_reg_bits pplm_reg;
struct mlx5_ifc_pplr_reg_bits pplr_reg;
struct mlx5_ifc_ppsc_reg_bits ppsc_reg;
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 8/8] net/mlx5e: Expose PCIe statistics to ethtool
From: Saeed Mahameed @ 2016-11-15 21:30 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Gal Pressman, Saeed Mahameed
In-Reply-To: <1479245407-6884-1-git-send-email-saeedm@mellanox.com>
From: Gal Pressman <galp@mellanox.com>
This patch exposes two groups of PCIe counters:
- Performance counters.
- Timers and states counters.
Queried with ethtool -S <devname>.
Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 17 ++++++++++++
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 24 ++++++++++++++++
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 32 +++++++++++++++++++++-
3 files changed, 72 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index b154621..9ea7b37 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -171,6 +171,7 @@ static int mlx5e_get_sset_count(struct net_device *dev, int sset)
return NUM_SW_COUNTERS +
MLX5E_NUM_Q_CNTRS(priv) +
NUM_VPORT_COUNTERS + NUM_PPORT_COUNTERS +
+ NUM_PCIE_COUNTERS +
MLX5E_NUM_RQ_STATS(priv) +
MLX5E_NUM_SQ_STATS(priv) +
MLX5E_NUM_PFC_COUNTERS(priv) +
@@ -216,6 +217,14 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data)
strcpy(data + (idx++) * ETH_GSTRING_LEN,
pport_2819_stats_desc[i].format);
+ for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++)
+ strcpy(data + (idx++) * ETH_GSTRING_LEN,
+ pcie_perf_stats_desc[i].format);
+
+ for (i = 0; i < NUM_PCIE_TAS_COUNTERS; i++)
+ strcpy(data + (idx++) * ETH_GSTRING_LEN,
+ pcie_tas_stats_desc[i].format);
+
for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
sprintf(data + (idx++) * ETH_GSTRING_LEN,
@@ -325,6 +334,14 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev,
data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2819_counters,
pport_2819_stats_desc, i);
+ for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++)
+ data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_perf_counters,
+ pcie_perf_stats_desc, i);
+
+ for (i = 0; i < NUM_PCIE_TAS_COUNTERS; i++)
+ data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_tas_counters,
+ pcie_tas_stats_desc, i);
+
for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio],
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 313b765..7a2540a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -290,12 +290,36 @@ static void mlx5e_update_q_counter(struct mlx5e_priv *priv)
&qcnt->rx_out_of_buffer);
}
+static void mlx5e_update_pcie_counters(struct mlx5e_priv *priv)
+{
+ struct mlx5e_pcie_stats *pcie_stats = &priv->stats.pcie;
+ struct mlx5_core_dev *mdev = priv->mdev;
+ int sz = MLX5_ST_SZ_BYTES(mpcnt_reg);
+ void *out;
+ u32 *in;
+
+ in = mlx5_vzalloc(sz);
+ if (!in)
+ return;
+
+ out = pcie_stats->pcie_perf_counters;
+ MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP);
+ mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0);
+
+ out = pcie_stats->pcie_tas_counters;
+ MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP);
+ mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0);
+
+ kvfree(in);
+}
+
void mlx5e_update_stats(struct mlx5e_priv *priv)
{
mlx5e_update_q_counter(priv);
mlx5e_update_vport_counters(priv);
mlx5e_update_pport_counters(priv);
mlx5e_update_sw_counters(priv);
+ mlx5e_update_pcie_counters(priv);
}
void mlx5e_update_stats_work(struct work_struct *work)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
index b817e51..5da6a1c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
@@ -39,7 +39,7 @@
#define MLX5E_READ_CTR32_CPU(ptr, dsc, i) \
(*(u32 *)((char *)ptr + dsc[i].offset))
#define MLX5E_READ_CTR32_BE(ptr, dsc, i) \
- be64_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset))
+ be32_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset))
#define MLX5E_DECLARE_STAT(type, fld) #fld, offsetof(type, fld)
#define MLX5E_DECLARE_RX_STAT(type, fld) "rx%d_"#fld, offsetof(type, fld)
@@ -276,6 +276,32 @@ static const struct counter_desc pport_per_prio_pfc_stats_desc[] = {
{ "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) },
};
+#define PCIE_PERF_OFF(c) \
+ MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_perf_cntrs_grp_data_layout.c)
+#define PCIE_PERF_GET(pcie_stats, c) \
+ MLX5_GET(mpcnt_reg, pcie_stats->pcie_perf_counters, \
+ counter_set.pcie_perf_cntrs_grp_data_layout.c)
+#define PCIE_TAS_OFF(c) \
+ MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_tas_cntrs_grp_data_layout.c)
+#define PCIE_TAS_GET(pcie_stats, c) \
+ MLX5_GET(mpcnt_reg, pcie_stats->pcie_tas_counters, \
+ counter_set.pcie_tas_cntrs_grp_data_layout.c)
+
+struct mlx5e_pcie_stats {
+ __be64 pcie_perf_counters[MLX5_ST_SZ_QW(mpcnt_reg)];
+ __be64 pcie_tas_counters[MLX5_ST_SZ_QW(mpcnt_reg)];
+};
+
+static const struct counter_desc pcie_perf_stats_desc[] = {
+ { "rx_pci_signal_integrity", PCIE_PERF_OFF(rx_errors) },
+ { "tx_pci_signal_integrity", PCIE_PERF_OFF(tx_errors) },
+};
+
+static const struct counter_desc pcie_tas_stats_desc[] = {
+ { "tx_pci_transport_nonfatal_msg", PCIE_TAS_OFF(non_fatal_err_msg_sent) },
+ { "tx_pci_transport_fatal_msg", PCIE_TAS_OFF(fatal_err_msg_sent) },
+};
+
struct mlx5e_rq_stats {
u64 packets;
u64 bytes;
@@ -360,6 +386,8 @@ static const struct counter_desc sq_stats_desc[] = {
#define NUM_PPORT_802_3_COUNTERS ARRAY_SIZE(pport_802_3_stats_desc)
#define NUM_PPORT_2863_COUNTERS ARRAY_SIZE(pport_2863_stats_desc)
#define NUM_PPORT_2819_COUNTERS ARRAY_SIZE(pport_2819_stats_desc)
+#define NUM_PCIE_PERF_COUNTERS ARRAY_SIZE(pcie_perf_stats_desc)
+#define NUM_PCIE_TAS_COUNTERS ARRAY_SIZE(pcie_tas_stats_desc)
#define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS \
ARRAY_SIZE(pport_per_prio_traffic_stats_desc)
#define NUM_PPORT_PER_PRIO_PFC_COUNTERS \
@@ -369,6 +397,7 @@ static const struct counter_desc sq_stats_desc[] = {
NUM_PPORT_2819_COUNTERS + \
NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \
NUM_PPORT_PRIO)
+#define NUM_PCIE_COUNTERS (NUM_PCIE_PERF_COUNTERS + NUM_PCIE_TAS_COUNTERS)
#define NUM_RQ_STATS ARRAY_SIZE(rq_stats_desc)
#define NUM_SQ_STATS ARRAY_SIZE(sq_stats_desc)
@@ -377,6 +406,7 @@ struct mlx5e_stats {
struct mlx5e_qcounter_stats qcnt;
struct mlx5e_vport_stats vport;
struct mlx5e_pport_stats pport;
+ struct mlx5e_pcie_stats pcie;
};
static const struct counter_desc mlx5e_pme_status_desc[] = {
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 6/8] net/mlx5: Set driver version into firmware
From: Saeed Mahameed @ 2016-11-15 21:30 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Huy Nguyen, Saeed Mahameed
In-Reply-To: <1479245407-6884-1-git-send-email-saeedm@mellanox.com>
From: Huy Nguyen <huyn@mellanox.com>
If driver_version capability bit is enabled, set driver version
to firmware after the init HCA command, for display purposes.
Example of driver version: "Linux,mlx5_core,3.0-1"
Signed-off-by: Huy Nguyen <huyn@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/main.c | 37 ++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index a3a0887..e9e5803 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -175,6 +175,41 @@ static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili)
return err;
}
+static void mlx5_set_driver_version(struct mlx5_core_dev *dev)
+{
+ int driver_ver_sz = MLX5_FLD_SZ_BYTES(set_driver_version_in,
+ driver_version);
+ u8 in[MLX5_ST_SZ_BYTES(set_driver_version_in)] = {0};
+ u8 out[MLX5_ST_SZ_BYTES(set_driver_version_out)] = {0};
+ int remaining_size = driver_ver_sz;
+ char *string;
+
+ if (!MLX5_CAP_GEN(dev, driver_version))
+ return;
+
+ string = MLX5_ADDR_OF(set_driver_version_in, in, driver_version);
+
+ strncpy(string, "Linux", remaining_size);
+
+ remaining_size = max_t(int, 0, driver_ver_sz - strlen(string));
+ strncat(string, ",", remaining_size);
+
+ remaining_size = max_t(int, 0, driver_ver_sz - strlen(string));
+ strncat(string, DRIVER_NAME, remaining_size);
+
+ remaining_size = max_t(int, 0, driver_ver_sz - strlen(string));
+ strncat(string, ",", remaining_size);
+
+ remaining_size = max_t(int, 0, driver_ver_sz - strlen(string));
+ strncat(string, DRIVER_VERSION, remaining_size);
+
+ /*Send the command*/
+ MLX5_SET(set_driver_version_in, in, opcode,
+ MLX5_CMD_OP_SET_DRIVER_VERSION);
+
+ mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
+}
+
static int set_dma_caps(struct pci_dev *pdev)
{
int err;
@@ -1015,6 +1050,8 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
goto err_pagealloc_stop;
}
+ mlx5_set_driver_version(dev);
+
mlx5_start_health_poll(dev);
err = mlx5_query_hca_caps(dev);
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 2/8] net/mlx5: Port module event hardware structures
From: Saeed Mahameed @ 2016-11-15 21:30 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Huy Nguyen, Saeed Mahameed, Leon Romanovsky
In-Reply-To: <1479245407-6884-1-git-send-email-saeedm@mellanox.com>
From: Huy Nguyen <huyn@mellanox.com>
Add hardware structures and constants definitions needed for module
events support.
Signed-off-by: Huy Nguyen <huyn@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
include/linux/mlx5/device.h | 11 +++++++++++
include/linux/mlx5/mlx5_ifc.h | 3 ++-
include/linux/mlx5/port.h | 3 +++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 5827614..52b4374 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -277,6 +277,7 @@ enum mlx5_event {
MLX5_EVENT_TYPE_INTERNAL_ERROR = 0x08,
MLX5_EVENT_TYPE_PORT_CHANGE = 0x09,
MLX5_EVENT_TYPE_GPIO_EVENT = 0x15,
+ MLX5_EVENT_TYPE_PORT_MODULE_EVENT = 0x16,
MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19,
MLX5_EVENT_TYPE_DB_BF_CONGESTION = 0x1a,
@@ -552,6 +553,15 @@ struct mlx5_eqe_vport_change {
__be32 rsvd1[6];
} __packed;
+struct mlx5_eqe_port_module {
+ u8 reserved_at_0[1];
+ u8 module;
+ u8 reserved_at_2[1];
+ u8 module_status;
+ u8 reserved_at_4[2];
+ u8 error_type;
+} __packed;
+
union ev_data {
__be32 raw[7];
struct mlx5_eqe_cmd cmd;
@@ -565,6 +575,7 @@ union ev_data {
struct mlx5_eqe_page_req req_pages;
struct mlx5_eqe_page_fault page_fault;
struct mlx5_eqe_vport_change vport_change;
+ struct mlx5_eqe_port_module port_module;
} __packed;
struct mlx5_eqe {
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 2632cb2..cd1d530 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -824,7 +824,8 @@ struct mlx5_ifc_cmd_hca_cap_bits {
u8 early_vf_enable[0x1];
u8 reserved_at_1a9[0x2];
u8 local_ca_ack_delay[0x5];
- u8 reserved_at_1af[0x2];
+ u8 port_module_event[0x1];
+ u8 reserved_at_1b0[0x1];
u8 ports_check[0x1];
u8 reserved_at_1b2[0x1];
u8 disable_link_up[0x1];
diff --git a/include/linux/mlx5/port.h b/include/linux/mlx5/port.h
index b3065ac..dde8c7e 100644
--- a/include/linux/mlx5/port.h
+++ b/include/linux/mlx5/port.h
@@ -94,6 +94,9 @@ enum mlx5e_link_mode {
#define MLX5E_PROT_MASK(link_mode) (1 << link_mode)
+#define PORT_MODULE_EVENT_MODULE_STATUS_MASK 0xF
+#define PORT_MODULE_EVENT_ERROR_TYPE_MASK 0xF
+
int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps);
int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys,
int ptys_size, int proto_mask, u8 local_port);
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 4/8] net/mlx5e: Add port module event counters to ethtool stats
From: Saeed Mahameed @ 2016-11-15 21:30 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Huy Nguyen, Saeed Mahameed
In-Reply-To: <1479245407-6884-1-git-send-email-saeedm@mellanox.com>
From: Huy Nguyen <huyn@mellanox.com>
Add port module event counters to ethtool -S command
Signed-off-by: Huy Nguyen <huyn@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 23 +++++++++++++++++++++-
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 17 ++++++++++++++++
2 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index 27ff401..b154621 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -173,7 +173,10 @@ static int mlx5e_get_sset_count(struct net_device *dev, int sset)
NUM_VPORT_COUNTERS + NUM_PPORT_COUNTERS +
MLX5E_NUM_RQ_STATS(priv) +
MLX5E_NUM_SQ_STATS(priv) +
- MLX5E_NUM_PFC_COUNTERS(priv);
+ MLX5E_NUM_PFC_COUNTERS(priv) +
+ ARRAY_SIZE(mlx5e_pme_status_desc) +
+ ARRAY_SIZE(mlx5e_pme_error_desc);
+
case ETH_SS_PRIV_FLAGS:
return ARRAY_SIZE(mlx5e_priv_flags);
/* fallthrough */
@@ -237,6 +240,13 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data)
}
}
+ /* port module event counters */
+ for (i = 0; i < ARRAY_SIZE(mlx5e_pme_status_desc); i++)
+ strcpy(data + (idx++) * ETH_GSTRING_LEN, mlx5e_pme_status_desc[i].format);
+
+ for (i = 0; i < ARRAY_SIZE(mlx5e_pme_error_desc); i++)
+ strcpy(data + (idx++) * ETH_GSTRING_LEN, mlx5e_pme_error_desc[i].format);
+
if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
return;
@@ -279,6 +289,7 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *data)
{
struct mlx5e_priv *priv = netdev_priv(dev);
+ struct mlx5_priv *mlx5_priv;
int i, j, tc, prio, idx = 0;
unsigned long pfc_combined;
@@ -335,6 +346,16 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev,
}
}
+ /* port module event counters */
+ mlx5_priv = &priv->mdev->priv;
+ for (i = 0; i < ARRAY_SIZE(mlx5e_pme_status_desc); i++)
+ data[idx++] = MLX5E_READ_CTR64_CPU(mlx5_priv->pme_stats.status_counters,
+ mlx5e_pme_status_desc, i);
+
+ for (i = 0; i < ARRAY_SIZE(mlx5e_pme_error_desc); i++)
+ data[idx++] = MLX5E_READ_CTR64_CPU(mlx5_priv->pme_stats.error_counters,
+ mlx5e_pme_error_desc, i);
+
if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
return;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
index 57452fd..b817e51 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
@@ -379,4 +379,21 @@ struct mlx5e_stats {
struct mlx5e_pport_stats pport;
};
+static const struct counter_desc mlx5e_pme_status_desc[] = {
+ { "module_plug", 0 },
+ { "module_unplug", 8 },
+};
+
+static const struct counter_desc mlx5e_pme_error_desc[] = {
+ { "module_pwr_budget_exd", 0 }, /* power budget exceed */
+ { "module_long_range", 8 }, /* long range for non MLNX cable */
+ { "module_bus_stuck", 16 }, /* bus stuck (I2C or data shorted) */
+ { "module_no_eeprom", 24 }, /* no eeprom/retry time out */
+ { "module_enforce_part", 32 }, /* enforce part number list */
+ { "module_unknown_id", 40 }, /* unknown identifier */
+ { "module_high_temp", 48 }, /* high temperature */
+ { "module_bad_shorted", 56 }, /* bad or shorted cable/module */
+ { "module_unknown_status", 64 },
+};
+
#endif /* __MLX5_EN_STATS_H__ */
--
2.7.4
^ 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