* Re: [PATCH v2 1/1] Revert "Prevent NUll pointer dereference with two PHYs on cpsw"
From: David Miller @ 2016-04-20 16:02 UTC (permalink / raw)
To: andrew.goodbody
Cc: netdev, linux-kernel, linux-omap, mugunthanvnm, grygorii.strashko,
tony
In-Reply-To: <1461165291-25043-2-git-send-email-andrew.goodbody@cambrionix.com>
From: Andrew Goodbody <andrew.goodbody@cambrionix.com>
Date: Wed, 20 Apr 2016 16:14:51 +0100
> This reverts commit cfe255600154f0072d4a8695590dbd194dfd1aeb
>
> This can result in a "Unable to handle kernel paging request"
> during boot. This was due to using an uninitialised struct member,
> data->slaves.
>
> Signed-off-by: Andrew Goodbody <andrew.goodbody@cambrionix.com>
> Tested-by: Tony Lindgren <tony@atomide.com>
> ---
>
> v2 No code change, added signoff and collected tested-by
Applied, thanks.
^ permalink raw reply
* [PATCH net-next v6] rtnetlink: add new RTM_GETSTATS message to dump link stats
From: Roopa Prabhu @ 2016-04-20 15:43 UTC (permalink / raw)
To: netdev; +Cc: jhs, davem, tgraf, nicolas.dichtel, nikolay
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This patch adds a new RTM_GETSTATS message to query link stats via netlink
from the kernel. RTM_NEWLINK also dumps stats today, but RTM_NEWLINK
returns a lot more than just stats and is expensive in some cases when
frequent polling for stats from userspace is a common operation.
RTM_GETSTATS is an attempt to provide a light weight netlink message
to explicity query only link stats from the kernel on an interface.
The idea is to also keep it extensible so that new kinds of stats can be
added to it in the future.
This patch adds the following attribute for NETDEV stats:
struct nla_policy ifla_stats_policy[IFLA_STATS_MAX + 1] = {
[IFLA_STATS_LINK_64] = { .len = sizeof(struct rtnl_link_stats64) },
};
Like any other rtnetlink message, RTM_GETSTATS can be used to get stats of
a single interface or all interfaces with NLM_F_DUMP.
Future possible new types of stat attributes:
link af stats:
- IFLA_STATS_LINK_IPV6 (nested. for ipv6 stats)
- IFLA_STATS_LINK_MPLS (nested. for mpls/mdev stats)
extended stats:
- IFLA_STATS_LINK_EXTENDED (nested. extended software netdev stats like bridge,
vlan, vxlan etc)
- IFLA_STATS_LINK_HW_EXTENDED (nested. extended hardware stats which are
available via ethtool today)
This patch also declares a filter mask for all stat attributes.
User has to provide a mask of stats attributes to query. filter mask
can be specified in the new hdr 'struct if_stats_msg' for stats messages.
Other important field in the header is the ifindex.
This api can also include attributes for global stats (eg tcp) in the future.
When global stats are included in a stats msg, the ifindex in the header
must be zero. A single stats message cannot contain both global and
netdev specific stats. To easily distinguish them, netdev specific stat
attributes name are prefixed with IFLA_STATS_LINK_
Without any attributes in the filter_mask, no stats will be returned.
This patch has been tested with mofified iproute2 ifstat.
Suggested-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
RFC to v1 (apologies for the delay in sending this version out. busy days):
- Addressed feedback from Dave
- removed rtnl_link_stats
- Added hdr struct if_stats_msg to carry ifindex and
filter mask
- new macro IFLA_STATS_FILTER_BIT(ATTR) for filter mask
- split the ipv6 patch into a separate patch, need some more eyes on it
- prefix attributes with IFLA_STATS instead of IFLA_LINK_STATS for
shorter attribute names
v2:
- move IFLA_STATS_INET6 declaration to the inet6 patch
- get rid of RTM_DELSTATS
- mark ipv6 patch RFC. It can be used as an example for
other AF stats like stats
v3:
- add required padding to the if_stats_msg structure(suggested by jamal)
- rename netdev stat attributes with IFLA_STATS_LINK prefix
so that they are easily distinguishable with global
stats in the future (after global stats discussion with thomas)
- get rid of unnecessary copy when getting stats with dev_get_stats
(suggested by dave)
v4:
- dropped calcit and af stats from this patch. Will add it
back when it becomes necessary and with the first af stats
patch
- add check for null filter in dump and return -EINVAL:
this follows rtnl_fdb_dump in returning an error.
But since netlink_dump does not propagate the error
to the user, the user will not see an error and
but will also not see any data. This is consistent with
other kinds of dumps.
v5:
- fix selinux nlmsgtab to account for new RTM_*STATS messages
v6:
- fix alignment for 64bit stats attribute, using davids new
cleaver trick of using a pad attribute and new helper apis
- change selinux RTM_NEWSTATS permissions to READ since this
patch does not support writes yet.
include/uapi/linux/if_link.h | 23 ++++++
include/uapi/linux/rtnetlink.h | 5 ++
net/core/rtnetlink.c | 158 +++++++++++++++++++++++++++++++++++++++++
security/selinux/nlmsgtab.c | 4 +-
4 files changed, 189 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 5ffdcb3..115ccc1 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -782,4 +782,27 @@ enum {
#define IFLA_HSR_MAX (__IFLA_HSR_MAX - 1)
+/* STATS section */
+
+struct if_stats_msg {
+ __u8 family;
+ __u8 pad1;
+ __u16 pad2;
+ __u32 ifindex;
+ __u32 filter_mask;
+};
+
+/* A stats attribute can be netdev specific or a global stat.
+ * For netdev stats, lets use the prefix IFLA_STATS_LINK_*
+ */
+enum {
+ IFLA_STATS_UNSPEC, /* also used as 64bit pad attribute */
+ IFLA_STATS_LINK_64,
+ __IFLA_STATS_MAX,
+};
+
+#define IFLA_STATS_MAX (__IFLA_STATS_MAX - 1)
+
+#define IFLA_STATS_FILTER_BIT(ATTR) (1 << (ATTR - 1))
+
#endif /* _UAPI_LINUX_IF_LINK_H */
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index ca764b5..cc885c4 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -139,6 +139,11 @@ enum {
RTM_GETNSID = 90,
#define RTM_GETNSID RTM_GETNSID
+ RTM_NEWSTATS = 92,
+#define RTM_NEWSTATS RTM_NEWSTATS
+ RTM_GETSTATS = 94,
+#define RTM_GETSTATS RTM_GETSTATS
+
__RTM_MAX,
#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
};
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index d3694a1..4a47a9a 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -3449,6 +3449,161 @@ out:
return err;
}
+static int rtnl_fill_statsinfo(struct sk_buff *skb, struct net_device *dev,
+ int type, u32 pid, u32 seq, u32 change,
+ unsigned int flags, unsigned int filter_mask)
+{
+ struct if_stats_msg *ifsm;
+ struct nlmsghdr *nlh;
+ struct nlattr *attr;
+
+ ASSERT_RTNL();
+
+ nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifsm), flags);
+ if (!nlh)
+ return -EMSGSIZE;
+
+ ifsm = nlmsg_data(nlh);
+ ifsm->ifindex = dev->ifindex;
+ ifsm->filter_mask = filter_mask;
+
+ if (filter_mask & IFLA_STATS_FILTER_BIT(IFLA_STATS_LINK_64)) {
+ struct rtnl_link_stats64 *sp;
+ int err;
+
+ /* if necessary, add a zero length NOP attribute so that
+ * IFLA_STATS_LINK_64 will be 64-bit aligned
+ */
+ err = nla_align_64bit(skb, IFLA_STATS_UNSPEC);
+ if (err)
+ goto nla_put_failure;
+
+ attr = nla_reserve(skb, IFLA_STATS_LINK_64,
+ sizeof(struct rtnl_link_stats64));
+ if (!attr)
+ goto nla_put_failure;
+
+ sp = nla_data(attr);
+ dev_get_stats(dev, sp);
+ }
+
+ nlmsg_end(skb, nlh);
+
+ return 0;
+
+nla_put_failure:
+ nlmsg_cancel(skb, nlh);
+
+ return -EMSGSIZE;
+}
+
+static const struct nla_policy ifla_stats_policy[IFLA_STATS_MAX + 1] = {
+ [IFLA_STATS_LINK_64] = { .len = sizeof(struct rtnl_link_stats64) },
+};
+
+static size_t if_nlmsg_stats_size(const struct net_device *dev,
+ u32 filter_mask)
+{
+ size_t size = 0;
+
+ if (filter_mask & IFLA_STATS_FILTER_BIT(IFLA_STATS_LINK_64))
+ size += nla_total_size_64bit(sizeof(struct rtnl_link_stats64));
+
+ return size;
+}
+
+static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh)
+{
+ struct net *net = sock_net(skb->sk);
+ struct if_stats_msg *ifsm;
+ struct net_device *dev = NULL;
+ struct sk_buff *nskb;
+ u32 filter_mask;
+ int err;
+
+ ifsm = nlmsg_data(nlh);
+ if (ifsm->ifindex > 0)
+ dev = __dev_get_by_index(net, ifsm->ifindex);
+ else
+ return -EINVAL;
+
+ if (!dev)
+ return -ENODEV;
+
+ filter_mask = ifsm->filter_mask;
+ if (!filter_mask)
+ return -EINVAL;
+
+ nskb = nlmsg_new(if_nlmsg_stats_size(dev, filter_mask), GFP_KERNEL);
+ if (!nskb)
+ return -ENOBUFS;
+
+ err = rtnl_fill_statsinfo(nskb, dev, RTM_NEWSTATS,
+ NETLINK_CB(skb).portid, nlh->nlmsg_seq, 0,
+ 0, filter_mask);
+ if (err < 0) {
+ /* -EMSGSIZE implies BUG in if_nlmsg_stats_size */
+ WARN_ON(err == -EMSGSIZE);
+ kfree_skb(nskb);
+ } else {
+ err = rtnl_unicast(nskb, net, NETLINK_CB(skb).portid);
+ }
+
+ return err;
+}
+
+static int rtnl_stats_dump(struct sk_buff *skb, struct netlink_callback *cb)
+{
+ struct net *net = sock_net(skb->sk);
+ struct if_stats_msg *ifsm;
+ int h, s_h;
+ int idx = 0, s_idx;
+ struct net_device *dev;
+ struct hlist_head *head;
+ unsigned int flags = NLM_F_MULTI;
+ u32 filter_mask = 0;
+ int err;
+
+ s_h = cb->args[0];
+ s_idx = cb->args[1];
+
+ cb->seq = net->dev_base_seq;
+
+ ifsm = nlmsg_data(cb->nlh);
+ filter_mask = ifsm->filter_mask;
+ if (!filter_mask)
+ return -EINVAL;
+
+ for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) {
+ idx = 0;
+ head = &net->dev_index_head[h];
+ hlist_for_each_entry(dev, head, index_hlist) {
+ if (idx < s_idx)
+ goto cont;
+ err = rtnl_fill_statsinfo(skb, dev, RTM_NEWSTATS,
+ NETLINK_CB(cb->skb).portid,
+ cb->nlh->nlmsg_seq, 0,
+ flags, filter_mask);
+ /* If we ran out of room on the first message,
+ * we're in trouble
+ */
+ WARN_ON((err == -EMSGSIZE) && (skb->len == 0));
+
+ if (err < 0)
+ goto out;
+
+ nl_dump_check_consistent(cb, nlmsg_hdr(skb));
+cont:
+ idx++;
+ }
+ }
+out:
+ cb->args[1] = idx;
+ cb->args[0] = h;
+
+ return skb->len;
+}
+
/* Process one rtnetlink message. */
static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
@@ -3598,4 +3753,7 @@ void __init rtnetlink_init(void)
rtnl_register(PF_BRIDGE, RTM_GETLINK, NULL, rtnl_bridge_getlink, NULL);
rtnl_register(PF_BRIDGE, RTM_DELLINK, rtnl_bridge_dellink, NULL, NULL);
rtnl_register(PF_BRIDGE, RTM_SETLINK, rtnl_bridge_setlink, NULL, NULL);
+
+ rtnl_register(PF_UNSPEC, RTM_GETSTATS, rtnl_stats_get, rtnl_stats_dump,
+ NULL);
}
diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c
index 8495b93..2ca9cde 100644
--- a/security/selinux/nlmsgtab.c
+++ b/security/selinux/nlmsgtab.c
@@ -76,6 +76,8 @@ static struct nlmsg_perm nlmsg_route_perms[] =
{ RTM_NEWNSID, NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
{ RTM_DELNSID, NETLINK_ROUTE_SOCKET__NLMSG_READ },
{ RTM_GETNSID, NETLINK_ROUTE_SOCKET__NLMSG_READ },
+ { RTM_NEWSTATS, NETLINK_ROUTE_SOCKET__NLMSG_READ },
+ { RTM_GETSTATS, NETLINK_ROUTE_SOCKET__NLMSG_READ },
};
static struct nlmsg_perm nlmsg_tcpdiag_perms[] =
@@ -155,7 +157,7 @@ int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm)
switch (sclass) {
case SECCLASS_NETLINK_ROUTE_SOCKET:
/* RTM_MAX always point to RTM_SETxxxx, ie RTM_NEWxxx + 3 */
- BUILD_BUG_ON(RTM_MAX != (RTM_NEWNSID + 3));
+ BUILD_BUG_ON(RTM_MAX != (RTM_NEWSTATS + 3));
err = nlmsg_perm(nlmsg_type, perm, nlmsg_route_perms,
sizeof(nlmsg_route_perms));
break;
--
1.9.1
^ permalink raw reply related
* Re: [PATCH 1/3] e1000e: e1000e_cyclecounter_read(): incvalue is 32 bits, not 64
From: Denys Vlasenko @ 2016-04-20 15:43 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: netdev
In-Reply-To: <1461099434.2923.6.camel@intel.com>
On 04/19/2016 10:57 PM, Jeff Kirsher wrote:
> On Tue, 2016-04-19 at 14:34 +0200, Denys Vlasenko wrote:
>> "incvalue" variable holds a result of "er32(TIMINCA) &
>> E1000_TIMINCA_INCVALUE_MASK"
>> and used in "do_div(temp, incvalue)" as a divisor.
>>
>> Thus, "u64 incvalue" declaration is probably a mistake.
>> Even though it seems to be a harmless one, let's fix it.
>>
>> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
>> CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>> CC: Jesse Brandeburg <jesse.brandeburg@intel.com>
>> CC: Shannon Nelson <shannon.nelson@intel.com>
>> CC: Carolyn Wyborny <carolyn.wyborny@intel.com>
>> CC: Don Skidmore <donald.c.skidmore@intel.com>
>> CC: Bruce Allan <bruce.w.allan@intel.com>
>> CC: John Ronciak <john.ronciak@intel.com>
>> CC: Mitch Williams <mitch.a.williams@intel.com>
>> CC: David S. Miller <davem@davemloft.net>
>> CC: LKML <linux-kernel@vger.kernel.org>
>> CC: netdev@vger.kernel.org
>> ---
>> drivers/net/ethernet/intel/e1000e/netdev.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> First of all, trimmed down the recipient list since almost all of the
> reviewers you added have nothing to do with e1000e.
I took the list here, MAINTAINERS:
INTEL ETHERNET DRIVERS
M: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
R: Jesse Brandeburg <jesse.brandeburg@intel.com>
R: Shannon Nelson <shannon.nelson@intel.com>
R: Carolyn Wyborny <carolyn.wyborny@intel.com>
R: Don Skidmore <donald.c.skidmore@intel.com>
R: Bruce Allan <bruce.w.allan@intel.com>
R: John Ronciak <john.ronciak@intel.com>
R: Mitch Williams <mitch.a.williams@intel.com>
No more specific information who's e1000e reviewer.
Sorry.
^ permalink raw reply
* Re: Regression in next for smsc911x with tigthen lockdep checks
From: Tony Lindgren @ 2016-04-20 15:32 UTC (permalink / raw)
To: Hannes Frederic Sowa
Cc: David S. Miller, netdev, linux-arm-kernel, linux-omap
In-Reply-To: <57179EC9.6000505@stressinduktion.org>
* Hannes Frederic Sowa <hannes@stressinduktion.org> [160420 08:24]:
> Hi,
>
> On 20.04.2016 17:01, Tony Lindgren wrote:
> > Looks like commit fafc4e1ea1a4 ("sock: tigthen lockdep checks for
> > sock_owned_by_user") in next causes a regression at least for
> > smsc911x with CONFIG_LOCKDEP. It keeps spamming with the following
> > message. Any ideas?
>
> Not yet, can you quickly send me your config?
It's just the arch/arm/configs/omap2plus_defconfig I'm using.
Tony
^ permalink raw reply
* Fwd: Davicom DM9162 PHY supported in the kernel?
From: Amr Bekhit @ 2016-04-20 15:25 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev
In-Reply-To: <CAOLz05qgn2-9Qxm1cR7mXa67GAwD2SGbMnbeeEBrYeSPsBexuw@mail.gmail.com>
(Sorry, repeat message due to the previous one being HTML)
Hello,
I'm using an embedded Linux board based on an AT91SAM9X25 that uses
the Davicom DM9162IEP PHY chip. I'm struggling to get packets out on
the wire and I'm suspecting that I might have an issue between the
AT91 MAC and the PHY chip. I've looked through the kernel config
options and the kernel already has compiled-in support for the Davicom
PHYs, however I noticed that according to the help text, only the
dm9161e and dm9131 chips are supported, which may indicate why my
ethernet isn't working. I was wondering whether the DM9162 is
backwards compatible with the existing driver? I'm currently using the
mainline kernel 4.3. (p.s. I know the hardware works fine since I have
no problem transferring files using tftp via u-boot).
Thanks,
Amr Bekhit
^ permalink raw reply
* Re: Regression in next for smsc911x with tigthen lockdep checks
From: Hannes Frederic Sowa @ 2016-04-20 15:22 UTC (permalink / raw)
To: Tony Lindgren, David S. Miller; +Cc: netdev, linux-arm-kernel, linux-omap
In-Reply-To: <20160420150108.GF5995@atomide.com>
Hi,
On 20.04.2016 17:01, Tony Lindgren wrote:
> Looks like commit fafc4e1ea1a4 ("sock: tigthen lockdep checks for
> sock_owned_by_user") in next causes a regression at least for
> smsc911x with CONFIG_LOCKDEP. It keeps spamming with the following
> message. Any ideas?
Not yet, can you quickly send me your config?
Thanks,
Hannes
^ permalink raw reply
* Re: [PATCH net 4/4] net/mlx4_en: Split SW RX dropped counter per RX ring
From: Or Gerlitz @ 2016-04-20 15:00 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S. Miller, netdev, Eran Ben Elisha, Yishai Hadas,
Saeed Mahameed
In-Reply-To: <1461164209.10638.262.camel@edumazet-glaptop3.roam.corp.google.com>
On 4/20/2016 5:56 PM, Eric Dumazet wrote:
>> >Fixes: a3333b35da16 ('net/mlx4_en: Moderate ethtool callback to [...] ')
>> >Signed-off-by: Eran Ben Elisha<eranbe@mellanox.com>
>> >Reported-by: Brenden Blanco<bblanco@plumgrid.com>
>> >Signed-off-by: Saeed Mahameed<saeedm@mellanox.com>
>> >Signed-off-by: Or Gerlitz<ogerlitz@mellanox.com>
>> >---
> Reported-by: Eric Dumazet<edumazet@google.com>
>
> (http://www.spinics.net/lists/netdev/msg371318.html )
Hi Eric,
Just to be sure, you'd like me to re-spin this and fix the reporter name?
>
> Thanks for following up !
sure
Or.
^ permalink raw reply
* ASSALAMU ALAIKUM
From: DrHaruna Bello @ 2016-04-20 15:07 UTC (permalink / raw)
In-Reply-To: <423625983.3261692.1461164821070.JavaMail.yahoo.ref@mail.yahoo.com>
BUSINESS RELATIONSHIP
Dear Friend,
Let me start by introducing myself,I am Dr Haruna Bello,
Manager of Bank Of Africa Burkina faso.
I am writting you this letter based on the latest development at my Departmentwhich I will like to bring to your personal edification.(18.5 million U.SDollars transfer claims).
This is a legitimate transaction and I agreed to offer you 40% of this money as my foreign partner after confirmation of the fund in your bank account.
If you are interested,get back to me with the following details below.
(1)Your age........................
(2)Sex........................
(3)Your occupation.....
(4)Your marital status.....
(5)Your country Name......
(6)Your full residential address.......
(7)Your private phone and fax number and your complete name.......
(8)A copy of your int'l passport or ID card............
As soon as I receive these data, I will forward to you the application form whichyou will send to the bank.
Best Regard
Dr Haruna Bello
^ permalink raw reply
* [PATCH v2 0/1] Revert "Prevent NUll pointer dereference with two PHYs"
From: Andrew Goodbody @ 2016-04-20 15:14 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-omap, mugunthanvnm, grygorii.strashko, tony,
davem, Andrew Goodbody
Revert this patch as not only did it use an unitialised member of a struct
but there is also a pre-existing patch that does it better.
V2 add signoff
Andrew Goodbody (1):
Revert "Prevent NUll pointer dereference with two PHYs on cpsw"
drivers/net/ethernet/ti/cpsw.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
--
2.5.0
^ permalink raw reply
* [PATCH v2 1/1] Revert "Prevent NUll pointer dereference with two PHYs on cpsw"
From: Andrew Goodbody @ 2016-04-20 15:14 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-omap, mugunthanvnm, grygorii.strashko, tony,
davem, Andrew Goodbody
In-Reply-To: <1461165291-25043-1-git-send-email-andrew.goodbody@cambrionix.com>
This reverts commit cfe255600154f0072d4a8695590dbd194dfd1aeb
This can result in a "Unable to handle kernel paging request"
during boot. This was due to using an uninitialised struct member,
data->slaves.
Signed-off-by: Andrew Goodbody <andrew.goodbody@cambrionix.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
v2 No code change, added signoff and collected tested-by
drivers/net/ethernet/ti/cpsw.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 2cd67a5..54bcc38 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -349,7 +349,6 @@ struct cpsw_slave {
struct cpsw_slave_data *data;
struct phy_device *phy;
struct net_device *ndev;
- struct device_node *phy_node;
u32 port_vlan;
u32 open_stat;
};
@@ -368,6 +367,7 @@ struct cpsw_priv {
spinlock_t lock;
struct platform_device *pdev;
struct net_device *ndev;
+ struct device_node *phy_node;
struct napi_struct napi_rx;
struct napi_struct napi_tx;
struct device *dev;
@@ -1142,8 +1142,8 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
1 << slave_port, 0, 0, ALE_MCAST_FWD_2);
- if (slave->phy_node)
- slave->phy = of_phy_connect(priv->ndev, slave->phy_node,
+ if (priv->phy_node)
+ slave->phy = of_phy_connect(priv->ndev, priv->phy_node,
&cpsw_adjust_link, 0, slave->data->phy_if);
else
slave->phy = phy_connect(priv->ndev, slave->data->phy_id,
@@ -2025,8 +2025,7 @@ static int cpsw_probe_dt(struct cpsw_priv *priv,
if (strcmp(slave_node->name, "slave"))
continue;
- priv->slaves[i].phy_node =
- of_parse_phandle(slave_node, "phy-handle", 0);
+ priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);
parp = of_get_property(slave_node, "phy_id", &lenp);
if (of_phy_is_fixed_link(slave_node)) {
struct device_node *phy_node;
@@ -2267,22 +2266,12 @@ static int cpsw_probe(struct platform_device *pdev)
/* Select default pin state */
pinctrl_pm_select_default_state(&pdev->dev);
- data = &priv->data;
- priv->slaves = devm_kzalloc(&pdev->dev,
- sizeof(struct cpsw_slave) * data->slaves,
- GFP_KERNEL);
- if (!priv->slaves) {
- ret = -ENOMEM;
- goto clean_runtime_disable_ret;
- }
- for (i = 0; i < data->slaves; i++)
- priv->slaves[i].slave_num = i;
-
if (cpsw_probe_dt(priv, pdev)) {
dev_err(&pdev->dev, "cpsw: platform data missing\n");
ret = -ENODEV;
goto clean_runtime_disable_ret;
}
+ data = &priv->data;
if (is_valid_ether_addr(data->slave_data[0].mac_addr)) {
memcpy(priv->mac_addr, data->slave_data[0].mac_addr, ETH_ALEN);
@@ -2294,6 +2283,16 @@ static int cpsw_probe(struct platform_device *pdev)
memcpy(ndev->dev_addr, priv->mac_addr, ETH_ALEN);
+ priv->slaves = devm_kzalloc(&pdev->dev,
+ sizeof(struct cpsw_slave) * data->slaves,
+ GFP_KERNEL);
+ if (!priv->slaves) {
+ ret = -ENOMEM;
+ goto clean_runtime_disable_ret;
+ }
+ for (i = 0; i < data->slaves; i++)
+ priv->slaves[i].slave_num = i;
+
priv->slaves[0].ndev = ndev;
priv->emac_port = 0;
--
2.5.0
^ permalink raw reply related
* Re: [PATCH 1/1] Revert "Prevent NUll pointer dereference with two PHYs on cpsw"
From: Tony Lindgren @ 2016-04-20 15:05 UTC (permalink / raw)
To: Andrew Goodbody
Cc: netdev, linux-kernel, linux-omap, mugunthanvnm, grygorii.strashko,
davem
In-Reply-To: <1461163349-24696-2-git-send-email-andrew.goodbody@cambrionix.com>
* Andrew Goodbody <andrew.goodbody@cambrionix.com> [160420 07:51]:
> This reverts commit cfe255600154f0072d4a8695590dbd194dfd1aeb
>
> This can result in a "Unable to handle kernel paging request"
> during boot. This was due to using an uninitialised struct member,
> data->slaves.
Missing Signed-off-by?
This gets cpsw boards working in next for me again:
Tested-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply
* Re: [PATCH net-next] net: fix HAVE_EFFICIENT_UNALIGNED_ACCESS typos
From: David Miller @ 2016-04-20 15:03 UTC (permalink / raw)
To: eric.dumazet; +Cc: nicolas.dichtel, netdev, roopa, tgraf, jhs
In-Reply-To: <1461162691.10638.260.camel@edumazet-glaptop3.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 20 Apr 2016 07:31:31 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> HAVE_EFFICIENT_UNALIGNED_ACCESS needs CONFIG_ prefix.
>
> Also add a comment in nla_align_64bit() explaining we have
> to add a padding if current skb->data is aligned, as it
> certainly can be confusing.
>
> Fixes: 35c5845957c7 ("net: Add helpers for 64-bit aligning netlink attributes.")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks.
^ permalink raw reply
* Re: Regression in next for smsc911x with tigthen lockdep checks
From: Tony Lindgren @ 2016-04-20 15:02 UTC (permalink / raw)
To: Hannes Frederic Sowa, David S. Miller
Cc: netdev, linux-arm-kernel, linux-omap, Steve Glendinning
In-Reply-To: <20160420150108.GF5995@atomide.com>
* Tony Lindgren <tony@atomide.com> [160420 08:02]:
> Hi,
>
> Looks like commit fafc4e1ea1a4 ("sock: tigthen lockdep checks for
> sock_owned_by_user") in next causes a regression at least for
> smsc911x with CONFIG_LOCKDEP. It keeps spamming with the following
> message. Any ideas?
Sorry forgot to add Steve to Cc, added now.
> Regards,
>
> Tony
>
> 8< ----------------
> WARNING: CPU: 0 PID: 0 at include/net/sock.h:1408 udp_queue_rcv_skb+0x398/0x640
> Modules linked in:
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.6.0-rc4-next-20160420 #1087
> Hardware name: Generic OMAP36xx (Flattened Device Tree)
> [<c01103c8>] (unwind_backtrace) from [<c010c400>] (show_stack+0x10/0x14)
> [<c010c400>] (show_stack) from [<c04813ec>] (dump_stack+0xb0/0xe4)
> [<c04813ec>] (dump_stack) from [<c0137afc>] (__warn+0xd8/0x104)
> [<c0137afc>] (__warn) from [<c0137bd8>] (warn_slowpath_null+0x20/0x28)
> [<c0137bd8>] (warn_slowpath_null) from [<c06d5310>] (udp_queue_rcv_skb+0x398/0x640)
> [<c06d5310>] (udp_queue_rcv_skb) from [<c06d5a84>] (__udp4_lib_rcv+0x4cc/0xc0c)
> [<c06d5a84>] (__udp4_lib_rcv) from [<c069e980>] (ip_local_deliver_finish+0xcc/0x4f4)
> [<c069e980>] (ip_local_deliver_finish) from [<c069f748>] (ip_local_deliver+0xcc/0xd8)
> [<c069f748>] (ip_local_deliver) from [<c069ee64>] (ip_rcv_finish+0xbc/0x700)
> [<c069ee64>] (ip_rcv_finish) from [<c069fbe0>] (ip_rcv+0x48c/0x6d4)
> [<c069fbe0>] (ip_rcv) from [<c0662790>] (__netif_receive_skb_core+0x380/0xa10)
> [<c0662790>] (__netif_receive_skb_core) from [<c0665138>] (netif_receive_skb_internal+
> 0x74/0x1ec)
> [<c0665138>] (netif_receive_skb_internal) from [<c05da394>] (smsc911x_poll+0xd8/0x228)
> [<c05da394>] (smsc911x_poll) from [<c0665cd0>] (net_rx_action+0x124/0x470)
> [<c0665cd0>] (net_rx_action) from [<c013e114>] (__do_softirq+0xc8/0x54c)
> [<c013e114>] (__do_softirq) from [<c013e8b8>] (irq_exit+0xbc/0x130)
> [<c013e8b8>] (irq_exit) from [<c019c8c8>] (__handle_domain_irq+0x6c/0xdc)
> [<c019c8c8>] (__handle_domain_irq) from [<c07af2b8>] (__irq_svc+0x58/0x78)
> [<c07af2b8>] (__irq_svc) from [<c0603884>] (cpuidle_enter_state+0xc4/0x3d4)
> [<c0603884>] (cpuidle_enter_state) from [<c0183be0>] (cpu_startup_entry+0x198/0x3a0)
> [<c0183be0>] (cpu_startup_entry) from [<c0b00c08>] (start_kernel+0x350/0x3c8)
> [<c0b00c08>] (start_kernel) from [<8000807c>] (0x8000807c)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Regression in next for smsc911x with tigthen lockdep checks
From: Tony Lindgren @ 2016-04-20 15:01 UTC (permalink / raw)
To: Hannes Frederic Sowa, David S. Miller
Cc: netdev, linux-arm-kernel, linux-omap
Hi,
Looks like commit fafc4e1ea1a4 ("sock: tigthen lockdep checks for
sock_owned_by_user") in next causes a regression at least for
smsc911x with CONFIG_LOCKDEP. It keeps spamming with the following
message. Any ideas?
Regards,
Tony
8< ----------------
WARNING: CPU: 0 PID: 0 at include/net/sock.h:1408 udp_queue_rcv_skb+0x398/0x640
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.6.0-rc4-next-20160420 #1087
Hardware name: Generic OMAP36xx (Flattened Device Tree)
[<c01103c8>] (unwind_backtrace) from [<c010c400>] (show_stack+0x10/0x14)
[<c010c400>] (show_stack) from [<c04813ec>] (dump_stack+0xb0/0xe4)
[<c04813ec>] (dump_stack) from [<c0137afc>] (__warn+0xd8/0x104)
[<c0137afc>] (__warn) from [<c0137bd8>] (warn_slowpath_null+0x20/0x28)
[<c0137bd8>] (warn_slowpath_null) from [<c06d5310>] (udp_queue_rcv_skb+0x398/0x640)
[<c06d5310>] (udp_queue_rcv_skb) from [<c06d5a84>] (__udp4_lib_rcv+0x4cc/0xc0c)
[<c06d5a84>] (__udp4_lib_rcv) from [<c069e980>] (ip_local_deliver_finish+0xcc/0x4f4)
[<c069e980>] (ip_local_deliver_finish) from [<c069f748>] (ip_local_deliver+0xcc/0xd8)
[<c069f748>] (ip_local_deliver) from [<c069ee64>] (ip_rcv_finish+0xbc/0x700)
[<c069ee64>] (ip_rcv_finish) from [<c069fbe0>] (ip_rcv+0x48c/0x6d4)
[<c069fbe0>] (ip_rcv) from [<c0662790>] (__netif_receive_skb_core+0x380/0xa10)
[<c0662790>] (__netif_receive_skb_core) from [<c0665138>] (netif_receive_skb_internal+
0x74/0x1ec)
[<c0665138>] (netif_receive_skb_internal) from [<c05da394>] (smsc911x_poll+0xd8/0x228)
[<c05da394>] (smsc911x_poll) from [<c0665cd0>] (net_rx_action+0x124/0x470)
[<c0665cd0>] (net_rx_action) from [<c013e114>] (__do_softirq+0xc8/0x54c)
[<c013e114>] (__do_softirq) from [<c013e8b8>] (irq_exit+0xbc/0x130)
[<c013e8b8>] (irq_exit) from [<c019c8c8>] (__handle_domain_irq+0x6c/0xdc)
[<c019c8c8>] (__handle_domain_irq) from [<c07af2b8>] (__irq_svc+0x58/0x78)
[<c07af2b8>] (__irq_svc) from [<c0603884>] (cpuidle_enter_state+0xc4/0x3d4)
[<c0603884>] (cpuidle_enter_state) from [<c0183be0>] (cpu_startup_entry+0x198/0x3a0)
[<c0183be0>] (cpu_startup_entry) from [<c0b00c08>] (start_kernel+0x350/0x3c8)
[<c0b00c08>] (start_kernel) from [<8000807c>] (0x8000807c)
^ permalink raw reply
* Re: [PATCH net 4/4] net/mlx4_en: Split SW RX dropped counter per RX ring
From: Eric Dumazet @ 2016-04-20 14:56 UTC (permalink / raw)
To: Or Gerlitz
Cc: David S. Miller, netdev, Eran Ben Elisha, Yishai Hadas,
Saeed Mahameed
In-Reply-To: <1461157278-18528-5-git-send-email-ogerlitz@mellanox.com>
On Wed, 2016-04-20 at 16:01 +0300, Or Gerlitz wrote:
> From: Eran Ben Elisha <eranbe@mellanox.com>
>
> Count SW packet drops per RX ring instead of a global counter. This
> will allow monitoring the number of rx drops per ring.
>
> In addition, SW rx_dropped counter was overwritten by HW rx_dropped
> counter, sum both of them instead to show the accurate value.
>
> Fixes: a3333b35da16 ('net/mlx4_en: Moderate ethtool callback to [...] ')
> Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
> Reported-by: Brenden Blanco <bblanco@plumgrid.com>
> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
> ---
Reported-by: Eric Dumazet <edumazet@google.com>
( http://www.spinics.net/lists/netdev/msg371318.html )
Thanks for following up !
^ permalink raw reply
* Re: [PATCH v2 0/1] drivers: net: cpsw: Fix NULL pointer dereference with two slave PHYs
From: David Miller @ 2016-04-20 14:56 UTC (permalink / raw)
To: andrew.goodbody
Cc: netdev, linux-kernel, drivshin.allworx, grygorii.strashko,
mugunthanvnm, linux-omap, tony
In-Reply-To: <c10cbc575f4d4e15bd27a8018f77baf1@THHSTE15D2BE2.hs20.net>
From: Andrew Goodbody <andrew.goodbody@cambrionix.com>
Date: Wed, 20 Apr 2016 08:49:34 +0000
> Sorry, I had no notification that this had happened. However I
> thought that the plan was to revert v1 and go with David Rivshin's
> patch instead. I'll see if I can create a revert in a little while.
Yes, that's fine.
^ permalink raw reply
* Re: [PATCH net-next] net/hsr: Fixed version field in ENUM
From: David Miller @ 2016-04-20 14:51 UTC (permalink / raw)
To: mail; +Cc: netdev, stephen, peter.heise
In-Reply-To: <20160420070829.GA24563@aircraft-controller>
From: Peter Heise <mail@pheise.de>
Date: Wed, 20 Apr 2016 09:08:29 +0200
> New field (IFLA_HSR_VERSION) was added in the middle of an existing
> ENUM and would break kernel ABI, therefore moved to the end.
> Reported by Stephen Hemminger.
>
> Signed-off-by: Peter Heise <peter.heise@airbus.com>
Applied, thanks.
^ permalink raw reply
* [net-next PATCH v2 3/3] net: Add support for IP ID mangling TSO in cases that require encapsulation
From: Alexander Duyck @ 2016-04-20 14:49 UTC (permalink / raw)
To: netdev, davem, alexander.duyck
In-Reply-To: <20160420144720.3100.74116.stgit@ahduyck-xeon-server>
This patch adds support for NETIF_F_TSO_MANGLEID if a given tunnel supports
NETIF_F_TSO. This way if needed a device can then later enable the TSO
with IP ID mangling and the tunnels on top of that device can then also
make use of the IP ID mangling as well.
Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
---
net/core/dev.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/core/dev.c b/net/core/dev.c
index 52d446b2cb99..6324bc9267f7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7029,8 +7029,19 @@ int register_netdevice(struct net_device *dev)
if (!(dev->flags & IFF_LOOPBACK))
dev->hw_features |= NETIF_F_NOCACHE_COPY;
+ /* If IPv4 TCP segmentation offload is supported we should also
+ * allow the device to enable segmenting the frame with the option
+ * of ignoring a static IP ID value. This doesn't enable the
+ * feature itself but allows the user to enable it later.
+ */
if (dev->hw_features & NETIF_F_TSO)
dev->hw_features |= NETIF_F_TSO_MANGLEID;
+ if (dev->vlan_features & NETIF_F_TSO)
+ dev->vlan_features |= NETIF_F_TSO_MANGLEID;
+ if (dev->mpls_features & NETIF_F_TSO)
+ dev->mpls_features |= NETIF_F_TSO_MANGLEID;
+ if (dev->hw_enc_features & NETIF_F_TSO)
+ dev->hw_enc_features |= NETIF_F_TSO_MANGLEID;
/* Make NETIF_F_HIGHDMA inheritable to VLAN devices.
*/
^ permalink raw reply related
* [net-next PATCH v2 2/3] veth: Update features to include all tunnel GSO types
From: Alexander Duyck @ 2016-04-20 14:49 UTC (permalink / raw)
To: netdev, davem, alexander.duyck
In-Reply-To: <20160420144720.3100.74116.stgit@ahduyck-xeon-server>
This patch adds support for the checksum enabled versions of UDP and GRE
tunnels. With this change we should be able to send and receive GSO frames
of these types over the veth pair without needing to segment the packets.
Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
---
drivers/net/veth.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 4f30a6ae50d0..f37a6e61d4ad 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -312,10 +312,9 @@ static const struct net_device_ops veth_netdev_ops = {
.ndo_set_rx_headroom = veth_set_rx_headroom,
};
-#define VETH_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
- NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_HIGHDMA | \
- NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL | \
- NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT | NETIF_F_UFO | \
+#define VETH_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HW_CSUM | \
+ NETIF_F_RXCSUM | NETIF_F_HIGHDMA | \
+ NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ENCAP_ALL | \
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | \
NETIF_F_HW_VLAN_STAG_TX | NETIF_F_HW_VLAN_STAG_RX )
^ permalink raw reply related
* [net-next PATCH v2 1/3] netdev_features: Fold NETIF_F_ALL_TSO into NETIF_F_GSO_SOFTWARE
From: Alexander Duyck @ 2016-04-20 14:49 UTC (permalink / raw)
To: netdev, davem, alexander.duyck
In-Reply-To: <20160420144720.3100.74116.stgit@ahduyck-xeon-server>
This patch folds NETIF_F_ALL_TSO into the bitmask for NETIF_F_GSO_SOFTWARE.
The idea is to avoid duplication of defines since the only difference
between the two was the GSO_UDP bit.
Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
---
include/linux/netdev_features.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 15eb0b12fff9..bc8736266749 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -152,11 +152,6 @@ enum {
#define NETIF_F_GSO_MASK (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \
__NETIF_F_BIT(NETIF_F_GSO_SHIFT))
-/* List of features with software fallbacks. */
-#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
- NETIF_F_TSO_MANGLEID | \
- NETIF_F_TSO6 | NETIF_F_UFO)
-
/* List of IP checksum features. Note that NETIF_F_ HW_CSUM should not be
* set in features when NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM are set--
* this would be contradictory
@@ -170,6 +165,9 @@ enum {
#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
NETIF_F_FSO)
+/* List of features with software fallbacks. */
+#define NETIF_F_GSO_SOFTWARE (NETIF_F_ALL_TSO | NETIF_F_UFO)
+
/*
* If one device supports one of these features, then enable them
* for all in netdev_increment_features.
^ permalink raw reply related
* [net-next PATCH v2 0/3] Feature tweaks/fixes follow-up to GSO partial patches
From: Alexander Duyck @ 2016-04-20 14:49 UTC (permalink / raw)
To: netdev, davem, alexander.duyck
This patch series is a set of minor fix-ups and tweaks following the GSO
partial and TSO with IPv4 ID mangling patches. It mostly is just meant to
make certain that if we have GSO partial support at the device we can make
use of it from the far end of the tunnel.
v2: Added cover page which was forgotten with first submission.
Added patch that enables TSOv4 IP ID mangling w/ tunnels and/or VLANs.
---
Alexander Duyck (3):
netdev_features: Fold NETIF_F_ALL_TSO into NETIF_F_GSO_SOFTWARE
veth: Update features to include all tunnel GSO types
net: Add support for IP ID mangling TSO in cases that require encapsulation
drivers/net/veth.c | 7 +++----
include/linux/netdev_features.h | 8 +++-----
net/core/dev.c | 11 +++++++++++
3 files changed, 17 insertions(+), 9 deletions(-)
^ permalink raw reply
* [PATCH 1/1] Revert "Prevent NUll pointer dereference with two PHYs on cpsw"
From: Andrew Goodbody @ 2016-04-20 14:42 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-omap, mugunthanvnm, grygorii.strashko, tony,
davem, Andrew Goodbody
In-Reply-To: <1461163349-24696-1-git-send-email-andrew.goodbody@cambrionix.com>
This reverts commit cfe255600154f0072d4a8695590dbd194dfd1aeb
This can result in a "Unable to handle kernel paging request"
during boot. This was due to using an uninitialised struct member,
data->slaves.
---
drivers/net/ethernet/ti/cpsw.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 2cd67a5..54bcc38 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -349,7 +349,6 @@ struct cpsw_slave {
struct cpsw_slave_data *data;
struct phy_device *phy;
struct net_device *ndev;
- struct device_node *phy_node;
u32 port_vlan;
u32 open_stat;
};
@@ -368,6 +367,7 @@ struct cpsw_priv {
spinlock_t lock;
struct platform_device *pdev;
struct net_device *ndev;
+ struct device_node *phy_node;
struct napi_struct napi_rx;
struct napi_struct napi_tx;
struct device *dev;
@@ -1142,8 +1142,8 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
1 << slave_port, 0, 0, ALE_MCAST_FWD_2);
- if (slave->phy_node)
- slave->phy = of_phy_connect(priv->ndev, slave->phy_node,
+ if (priv->phy_node)
+ slave->phy = of_phy_connect(priv->ndev, priv->phy_node,
&cpsw_adjust_link, 0, slave->data->phy_if);
else
slave->phy = phy_connect(priv->ndev, slave->data->phy_id,
@@ -2025,8 +2025,7 @@ static int cpsw_probe_dt(struct cpsw_priv *priv,
if (strcmp(slave_node->name, "slave"))
continue;
- priv->slaves[i].phy_node =
- of_parse_phandle(slave_node, "phy-handle", 0);
+ priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);
parp = of_get_property(slave_node, "phy_id", &lenp);
if (of_phy_is_fixed_link(slave_node)) {
struct device_node *phy_node;
@@ -2267,22 +2266,12 @@ static int cpsw_probe(struct platform_device *pdev)
/* Select default pin state */
pinctrl_pm_select_default_state(&pdev->dev);
- data = &priv->data;
- priv->slaves = devm_kzalloc(&pdev->dev,
- sizeof(struct cpsw_slave) * data->slaves,
- GFP_KERNEL);
- if (!priv->slaves) {
- ret = -ENOMEM;
- goto clean_runtime_disable_ret;
- }
- for (i = 0; i < data->slaves; i++)
- priv->slaves[i].slave_num = i;
-
if (cpsw_probe_dt(priv, pdev)) {
dev_err(&pdev->dev, "cpsw: platform data missing\n");
ret = -ENODEV;
goto clean_runtime_disable_ret;
}
+ data = &priv->data;
if (is_valid_ether_addr(data->slave_data[0].mac_addr)) {
memcpy(priv->mac_addr, data->slave_data[0].mac_addr, ETH_ALEN);
@@ -2294,6 +2283,16 @@ static int cpsw_probe(struct platform_device *pdev)
memcpy(ndev->dev_addr, priv->mac_addr, ETH_ALEN);
+ priv->slaves = devm_kzalloc(&pdev->dev,
+ sizeof(struct cpsw_slave) * data->slaves,
+ GFP_KERNEL);
+ if (!priv->slaves) {
+ ret = -ENOMEM;
+ goto clean_runtime_disable_ret;
+ }
+ for (i = 0; i < data->slaves; i++)
+ priv->slaves[i].slave_num = i;
+
priv->slaves[0].ndev = ndev;
priv->emac_port = 0;
--
2.5.0
^ permalink raw reply related
* [PATCH 0/1] Revert "Prevent NUll pointer dereference with two PHYs"
From: Andrew Goodbody @ 2016-04-20 14:42 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-omap, mugunthanvnm, grygorii.strashko, tony,
davem, Andrew Goodbody
Revert this patch as not only did it use an unitialised member of a struct
but there is also a pre-existing patch that does it better.
Andrew Goodbody (1):
Revert "Prevent NUll pointer dereference with two PHYs on cpsw"
drivers/net/ethernet/ti/cpsw.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
--
2.5.0
^ permalink raw reply
* Re: [PATCH net-next] net: dsa: remove tag_protocol from dsa_switch
From: Andrew Lunn @ 2016-04-20 14:39 UTC (permalink / raw)
To: Vivien Didelot
Cc: netdev, linux-kernel, kernel, David S. Miller, Florian Fainelli
In-Reply-To: <1461018244-5371-1-git-send-email-vivien.didelot@savoirfairelinux.com>
On Mon, Apr 18, 2016 at 06:24:04PM -0400, Vivien Didelot wrote:
> Having the tag protocol in dsa_switch_driver for setup time and in
> dsa_switch_tree for runtime is enough. Remove dsa_switch's one.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
I had to think about this one for a minute. At the moment it is good,
however, sometime in the future, we might want to revert it. Some
Marvell switches support two tagging schemes. At the moment, we have
no way to express that, so the switch driver only offers one. If we
were to extend the API to express a list of supported tagging schemes,
we would then want dsa_switch to contain the scheme actually chosen.
However, until we actually implement something like this, lets remove
it.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
> ---
> include/net/dsa.h | 5 -----
> net/dsa/dsa.c | 5 ++---
> 2 files changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index c4bc42b..2d280ab 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -136,11 +136,6 @@ struct dsa_switch {
> void *priv;
>
> /*
> - * Tagging protocol understood by this switch
> - */
> - enum dsa_tag_protocol tag_protocol;
> -
> - /*
> * Configuration data for this switch.
> */
> struct dsa_chip_data *pd;
> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> index efa612f..d61ceed 100644
> --- a/net/dsa/dsa.c
> +++ b/net/dsa/dsa.c
> @@ -267,7 +267,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
> * switch.
> */
> if (dst->cpu_switch == index) {
> - switch (ds->tag_protocol) {
> + switch (drv->tag_protocol) {
> #ifdef CONFIG_NET_DSA_TAG_DSA
> case DSA_TAG_PROTO_DSA:
> dst->rcv = dsa_netdev_ops.rcv;
> @@ -295,7 +295,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
> goto out;
> }
>
> - dst->tag_protocol = ds->tag_protocol;
> + dst->tag_protocol = drv->tag_protocol;
> }
>
> /*
> @@ -411,7 +411,6 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
> ds->pd = pd;
> ds->drv = drv;
> ds->priv = priv;
> - ds->tag_protocol = drv->tag_protocol;
> ds->master_dev = host_dev;
>
> ret = dsa_switch_setup_one(ds, parent);
> --
> 2.8.0
>
^ permalink raw reply
* [PATCH net-next] net: fix HAVE_EFFICIENT_UNALIGNED_ACCESS typos
From: Eric Dumazet @ 2016-04-20 14:31 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: netdev, davem, roopa, tgraf, jhs
In-Reply-To: <1461146278.10638.253.camel@edumazet-glaptop3.roam.corp.google.com>
From: Eric Dumazet <edumazet@google.com>
HAVE_EFFICIENT_UNALIGNED_ACCESS needs CONFIG_ prefix.
Also add a comment in nla_align_64bit() explaining we have
to add a padding if current skb->data is aligned, as it
certainly can be confusing.
Fixes: 35c5845957c7 ("net: Add helpers for 64-bit aligning netlink attributes.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
include/net/netlink.h | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/include/net/netlink.h b/include/net/netlink.h
index e644b3489acf..cf95df1fa14b 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -1238,18 +1238,21 @@ static inline int nla_validate_nested(const struct nlattr *start, int maxtype,
* Conditionally emit a padding netlink attribute in order to make
* the next attribute we emit have a 64-bit aligned nla_data() area.
* This will only be done in architectures which do not have
- * HAVE_EFFICIENT_UNALIGNED_ACCESS defined.
+ * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS defined.
*
* Returns zero on success or a negative error code.
*/
static inline int nla_align_64bit(struct sk_buff *skb, int padattr)
{
-#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS
- if (IS_ALIGNED((unsigned long)skb->data, 8)) {
- struct nlattr *attr = nla_reserve(skb, padattr, 0);
- if (!attr)
- return -EMSGSIZE;
- }
+#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
+ /* The nlattr header is 4 bytes in size, that's why we test
+ * if the skb->data _is_ aligned. This NOP attribute, plus
+ * nlattr header for next attribute, will make nla_data()
+ * 8-byte aligned.
+ */
+ if (IS_ALIGNED((unsigned long)skb->data, 8) &&
+ !nla_reserve(skb, padattr, 0))
+ return -EMSGSIZE;
#endif
return 0;
}
@@ -1261,7 +1264,7 @@ static inline int nla_align_64bit(struct sk_buff *skb, int padattr)
static inline int nla_total_size_64bit(int payload)
{
return NLA_ALIGN(nla_attr_size(payload))
-#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS
+#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
+ NLA_ALIGN(nla_attr_size(0))
#endif
;
^ 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