* [PATCH v4 net-next 1/6] lwt: Add net to build_state argument
From: Tom Herbert @ 2017-12-15 18:27 UTC (permalink / raw)
To: davem; +Cc: netdev, roopa, rohit, Tom Herbert
In-Reply-To: <20171215182800.10248-1-tom@quantonium.net>
Users of LWT need to know net if they want to have per net operations
in LWT.
Signed-off-by: Tom Herbert <tom@quantonium.net>
---
include/net/lwtunnel.h | 6 +++---
net/core/lwt_bpf.c | 2 +-
net/core/lwtunnel.c | 4 ++--
net/ipv4/fib_semantics.c | 13 ++++++++-----
net/ipv4/ip_tunnel_core.c | 4 ++--
net/ipv6/ila/ila_lwt.c | 2 +-
net/ipv6/route.c | 2 +-
net/ipv6/seg6_iptunnel.c | 2 +-
net/ipv6/seg6_local.c | 5 +++--
net/mpls/mpls_iptunnel.c | 2 +-
10 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/include/net/lwtunnel.h b/include/net/lwtunnel.h
index d747ef975cd8..da5e51e0d122 100644
--- a/include/net/lwtunnel.h
+++ b/include/net/lwtunnel.h
@@ -34,7 +34,7 @@ struct lwtunnel_state {
};
struct lwtunnel_encap_ops {
- int (*build_state)(struct nlattr *encap,
+ int (*build_state)(struct net *net, struct nlattr *encap,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts,
struct netlink_ext_ack *extack);
@@ -113,7 +113,7 @@ int lwtunnel_valid_encap_type(u16 encap_type,
struct netlink_ext_ack *extack);
int lwtunnel_valid_encap_type_attr(struct nlattr *attr, int len,
struct netlink_ext_ack *extack);
-int lwtunnel_build_state(u16 encap_type,
+int lwtunnel_build_state(struct net *net, u16 encap_type,
struct nlattr *encap,
unsigned int family, const void *cfg,
struct lwtunnel_state **lws,
@@ -192,7 +192,7 @@ static inline int lwtunnel_valid_encap_type_attr(struct nlattr *attr, int len,
return 0;
}
-static inline int lwtunnel_build_state(u16 encap_type,
+static inline int lwtunnel_build_state(struct net *net, u16 encap_type,
struct nlattr *encap,
unsigned int family, const void *cfg,
struct lwtunnel_state **lws,
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
index e7e626fb87bb..3a3ac13fcf06 100644
--- a/net/core/lwt_bpf.c
+++ b/net/core/lwt_bpf.c
@@ -238,7 +238,7 @@ static const struct nla_policy bpf_nl_policy[LWT_BPF_MAX + 1] = {
[LWT_BPF_XMIT_HEADROOM] = { .type = NLA_U32 },
};
-static int bpf_build_state(struct nlattr *nla,
+static int bpf_build_state(struct net *net, struct nlattr *nla,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts,
struct netlink_ext_ack *extack)
diff --git a/net/core/lwtunnel.c b/net/core/lwtunnel.c
index 0b171756453c..b3f2f77dfe72 100644
--- a/net/core/lwtunnel.c
+++ b/net/core/lwtunnel.c
@@ -103,7 +103,7 @@ int lwtunnel_encap_del_ops(const struct lwtunnel_encap_ops *ops,
}
EXPORT_SYMBOL_GPL(lwtunnel_encap_del_ops);
-int lwtunnel_build_state(u16 encap_type,
+int lwtunnel_build_state(struct net *net, u16 encap_type,
struct nlattr *encap, unsigned int family,
const void *cfg, struct lwtunnel_state **lws,
struct netlink_ext_ack *extack)
@@ -124,7 +124,7 @@ int lwtunnel_build_state(u16 encap_type,
ops = rcu_dereference(lwtun_encaps[encap_type]);
if (likely(ops && ops->build_state && try_module_get(ops->owner))) {
found = true;
- ret = ops->build_state(encap, family, cfg, lws, extack);
+ ret = ops->build_state(net, encap, family, cfg, lws, extack);
if (ret)
module_put(ops->owner);
}
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index f04d944f8abe..4979e5c6b9b8 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -523,6 +523,7 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh,
if (nla) {
struct lwtunnel_state *lwtstate;
struct nlattr *nla_entype;
+ struct net *net = cfg->fc_nlinfo.nl_net;
nla_entype = nla_find(attrs, attrlen,
RTA_ENCAP_TYPE);
@@ -533,7 +534,7 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh,
goto err_inval;
}
- ret = lwtunnel_build_state(nla_get_u16(
+ ret = lwtunnel_build_state(net, nla_get_u16(
nla_entype),
nla, AF_INET, cfg,
&lwtstate, extack);
@@ -607,7 +608,7 @@ static void fib_rebalance(struct fib_info *fi)
#endif /* CONFIG_IP_ROUTE_MULTIPATH */
-static int fib_encap_match(u16 encap_type,
+static int fib_encap_match(struct net *net, u16 encap_type,
struct nlattr *encap,
const struct fib_nh *nh,
const struct fib_config *cfg,
@@ -619,7 +620,7 @@ static int fib_encap_match(u16 encap_type,
if (encap_type == LWTUNNEL_ENCAP_NONE)
return 0;
- ret = lwtunnel_build_state(encap_type, encap, AF_INET,
+ ret = lwtunnel_build_state(net, encap_type, encap, AF_INET,
cfg, &lwtstate, extack);
if (!ret) {
result = lwtunnel_cmp_encap(lwtstate, nh->nh_lwtstate);
@@ -632,6 +633,7 @@ static int fib_encap_match(u16 encap_type,
int fib_nh_match(struct fib_config *cfg, struct fib_info *fi,
struct netlink_ext_ack *extack)
{
+ struct net *net = cfg->fc_nlinfo.nl_net;
#ifdef CONFIG_IP_ROUTE_MULTIPATH
struct rtnexthop *rtnh;
int remaining;
@@ -642,7 +644,8 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi,
if (cfg->fc_oif || cfg->fc_gw) {
if (cfg->fc_encap) {
- if (fib_encap_match(cfg->fc_encap_type, cfg->fc_encap,
+ if (fib_encap_match(net, cfg->fc_encap_type,
+ cfg->fc_encap,
fi->fib_nh, cfg, extack))
return 1;
}
@@ -1180,7 +1183,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg,
"LWT encap type not specified");
goto err_inval;
}
- err = lwtunnel_build_state(cfg->fc_encap_type,
+ err = lwtunnel_build_state(net, cfg->fc_encap_type,
cfg->fc_encap, AF_INET, cfg,
&lwtstate, extack);
if (err)
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 2f39479be92f..32e05aa6117d 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -228,7 +228,7 @@ static const struct nla_policy ip_tun_policy[LWTUNNEL_IP_MAX + 1] = {
[LWTUNNEL_IP_FLAGS] = { .type = NLA_U16 },
};
-static int ip_tun_build_state(struct nlattr *attr,
+static int ip_tun_build_state(struct net *net, struct nlattr *attr,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts,
struct netlink_ext_ack *extack)
@@ -327,7 +327,7 @@ static const struct nla_policy ip6_tun_policy[LWTUNNEL_IP6_MAX + 1] = {
[LWTUNNEL_IP6_FLAGS] = { .type = NLA_U16 },
};
-static int ip6_tun_build_state(struct nlattr *attr,
+static int ip6_tun_build_state(struct net *net, struct nlattr *attr,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts,
struct netlink_ext_ack *extack)
diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c
index 3d56a2fb6f86..9f1e46a1468e 100644
--- a/net/ipv6/ila/ila_lwt.c
+++ b/net/ipv6/ila/ila_lwt.c
@@ -125,7 +125,7 @@ static const struct nla_policy ila_nl_policy[ILA_ATTR_MAX + 1] = {
[ILA_ATTR_HOOK_TYPE] = { .type = NLA_U8, },
};
-static int ila_build_state(struct nlattr *nla,
+static int ila_build_state(struct net *net, struct nlattr *nla,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts,
struct netlink_ext_ack *extack)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index b3f4d19b3ca5..0e0cc97e8f42 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2565,7 +2565,7 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,
if (cfg->fc_encap) {
struct lwtunnel_state *lwtstate;
- err = lwtunnel_build_state(cfg->fc_encap_type,
+ err = lwtunnel_build_state(net, cfg->fc_encap_type,
cfg->fc_encap, AF_INET6, cfg,
&lwtstate, extack);
if (err)
diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
index bd6cc688bd19..a6cf2fba15f3 100644
--- a/net/ipv6/seg6_iptunnel.c
+++ b/net/ipv6/seg6_iptunnel.c
@@ -359,7 +359,7 @@ static int seg6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
return err;
}
-static int seg6_build_state(struct nlattr *nla,
+static int seg6_build_state(struct net *net, struct nlattr *nla,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts,
struct netlink_ext_ack *extack)
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 825b8e01f947..45dc670c5a93 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -779,8 +779,9 @@ static int parse_nla_action(struct nlattr **attrs, struct seg6_local_lwt *slwt)
return 0;
}
-static int seg6_local_build_state(struct nlattr *nla, unsigned int family,
- const void *cfg, struct lwtunnel_state **ts,
+static int seg6_local_build_state(struct net *net, struct nlattr *nla,
+ unsigned int family, const void *cfg,
+ struct lwtunnel_state **ts,
struct netlink_ext_ack *extack)
{
struct nlattr *tb[SEG6_LOCAL_MAX + 1];
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
index 6e558a419f60..c947310cc04f 100644
--- a/net/mpls/mpls_iptunnel.c
+++ b/net/mpls/mpls_iptunnel.c
@@ -157,7 +157,7 @@ static int mpls_xmit(struct sk_buff *skb)
return -EINVAL;
}
-static int mpls_build_state(struct nlattr *nla,
+static int mpls_build_state(struct net *net, struct nlattr *nla,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts,
struct netlink_ext_ack *extack)
--
2.11.0
^ permalink raw reply related
* [PATCH v4 net-next 0/6] net: ILA notification mechanism and fixes
From: Tom Herbert @ 2017-12-15 18:27 UTC (permalink / raw)
To: davem; +Cc: netdev, roopa, rohit, Tom Herbert
This patch set adds support to get netlink notifications for ILA
routes when a route is used. This is done to support ILA forwarding
cache address resolution as well as ILA router redirect mechanisms.
This patch set contains:
- The ILA route notification mechanism
- Routing messages are used over netlink to indicate resolution
requests
- Add net to ila build_state
- Add flush command to ila_xlat
- Fix use of rhashtable for latest fixes
v4:
- Remove front end cache per davem feedback
- Eliminate separate LWT type just use ILA LWT already in place
v3:
- Removed rhashtable changes to their own patch set
- Restructure ILA code to be more amenable to changes
- Remove extra call back functions in resolution interface
Changes from initial RFC:
- Added net argument to LWT build_state
- Made resolve timeout an attribute of the LWT encap route
- Changed ILA notifications to be regular routing messages of event
RTM_ADDR_RESOLVE, family RTNL_FAMILY_ILA, and group
RTNLGRP_ILA_NOTIFY
Tom Herbert (6):
lwt: Add net to build_state argument
ila: Fix use of rhashtable walk in ila_xlat.c
ila: Call library function alloc_bucket_locks
ila: create main ila source file
ila: Flush netlink command to clear xlat table
ila: Route notify
include/net/lwtunnel.h | 6 +-
include/uapi/linux/ila.h | 3 +
include/uapi/linux/rtnetlink.h | 8 +-
net/core/lwt_bpf.c | 2 +-
net/core/lwtunnel.c | 4 +-
net/ipv4/fib_semantics.c | 13 +-
net/ipv4/ip_tunnel_core.c | 4 +-
net/ipv6/ila/Makefile | 2 +-
net/ipv6/ila/ila.h | 27 +++-
net/ipv6/ila/ila_common.c | 30 -----
net/ipv6/ila/ila_lwt.c | 270 ++++++++++++++++++++++++++------------
net/ipv6/ila/ila_main.c | 121 +++++++++++++++++
net/ipv6/ila/ila_xlat.c | 290 ++++++++++++++++++++---------------------
net/ipv6/route.c | 2 +-
net/ipv6/seg6_iptunnel.c | 2 +-
net/ipv6/seg6_local.c | 5 +-
net/mpls/mpls_iptunnel.c | 2 +-
17 files changed, 508 insertions(+), 283 deletions(-)
create mode 100644 net/ipv6/ila/ila_main.c
--
2.11.0
^ permalink raw reply
* Re: [PATCHv2] ipv6: ip6mr: Recalc UDP checksum before forwarding
From: David Miller @ 2017-12-15 18:27 UTC (permalink / raw)
To: redmcg
Cc: eric.dumazet, marcelo.leitner, kuznet, yoshfuji, netdev,
linux-kernel
In-Reply-To: <1513251423-4166-1-git-send-email-redmcg@redmandi.dyndns.org>
From: Brendan McGrath <redmcg@redmandi.dyndns.org>
Date: Thu, 14 Dec 2017 22:37:03 +1100
> Currently, when forwarding a multicast packet originating from a
> Virtual Interface on a Multicast Router to one of its Physical
> Interfaces, ip_summed is set to a value of CHECKSUM_UNNECESSARY and
> the UDP checksum is not calculated.
>
> The checksum value of the forwarded packet is left as is and
> therefore rejected by the receiving machine(s).
>
> This patch ensures the checksum is recalculated before forwarding.
>
> Signed-off-by: Brendan McGrath <redmcg@redmandi.dyndns.org>
I still don't like this, UDP can't be the only protocol that goes
over multicast and might therefore have this problem.
Actually, I'm still also having trouble figuring out how this happens
in the first place.
Please draw a specific detailed network diagram, show the exact
configuration of each interface and exactly what driver runs that
interface, and show where the packet comes from, who creates it, and
where these checksum settings are done that lead to this problem.
Like Eric, I'm very suspicious and I think that there is some problem
with whoever builds or modifies this packet, and the code you are
touching has no business "fixing it up"
Thank you.
^ permalink raw reply
* [RFC v3 4/4] flow_dissector: Parse batman-adv unicast headers
From: Sven Eckelmann @ 2017-12-15 18:23 UTC (permalink / raw)
To: netdev
Cc: b.a.t.m.a.n, Eric Dumazet, linux-kernel, Jiri Pirko,
David S . Miller, Willem de Bruijn, Tom Herbert, Sven Eckelmann
In-Reply-To: <20171215182313.15767-1-sven.eckelmann@openmesh.com>
The batman-adv unicast packets contain a full layer 2 frame in encapsulated
form. The flow dissector must therefore be able to parse the batman-adv
unicast header to reach the layer 2+3 information.
+--------------------+
| ip(v6)hdr |
+--------------------+
| inner ethhdr |
+--------------------+
| batadv unicast hdr |
+--------------------+
| outer ethhdr |
+--------------------+
The obtained information from the upper layer can then be used by RPS to
schedule the processing on separate cores. This allows better distribution
of multiple flows from the same neighbor to different cores.
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
---
net/core/flow_dissector.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 15ce30063765..fa0a4879fb9d 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -24,6 +24,7 @@
#include <linux/tcp.h>
#include <net/flow_dissector.h>
#include <scsi/fc/fc_fcoe.h>
+#include <uapi/linux/batadv_packet.h>
static void dissector_set_key(struct flow_dissector *flow_dissector,
enum flow_dissector_key_id key_id)
@@ -436,6 +437,57 @@ __skb_flow_dissect_gre(const struct sk_buff *skb,
return FLOW_DISSECT_RET_PROTO_AGAIN;
}
+/**
+ * __skb_flow_dissect_batadv() - dissect batman-adv header
+ * @skb: sk_buff to with the batman-adv header
+ * @key_control: flow dissectors control key
+ * @data: raw buffer pointer to the packet, if NULL use skb->data
+ * @p_proto: pointer used to update the protocol to process next
+ * @p_nhoff: pointer used to update inner network header offset
+ * @hlen: packet header length
+ * @flags: any combination of FLOW_DISSECTOR_F_*
+ *
+ * ETH_P_BATMAN packets are tried to be dissected. Only
+ * &struct batadv_unicast packets are actually processed because they contain an
+ * inner ethernet header and are usually followed by actual network header. This
+ * allows the flow dissector to continue processing the packet.
+ *
+ * Return: FLOW_DISSECT_RET_PROTO_AGAIN when &struct batadv_unicast was found,
+ * FLOW_DISSECT_RET_OUT_GOOD when dissector should stop after encapsulation,
+ * otherwise FLOW_DISSECT_RET_OUT_BAD
+ */
+static enum flow_dissect_ret
+__skb_flow_dissect_batadv(const struct sk_buff *skb,
+ struct flow_dissector_key_control *key_control,
+ void *data, __be16 *p_proto, int *p_nhoff, int hlen,
+ unsigned int flags)
+{
+ struct {
+ struct batadv_unicast_packet batadv_unicast;
+ struct ethhdr eth;
+ } *hdr, _hdr;
+
+ hdr = __skb_header_pointer(skb, *p_nhoff, sizeof(_hdr), data, hlen,
+ &_hdr);
+ if (!hdr)
+ return FLOW_DISSECT_RET_OUT_BAD;
+
+ if (hdr->batadv_unicast.version != BATADV_COMPAT_VERSION)
+ return FLOW_DISSECT_RET_OUT_BAD;
+
+ if (hdr->batadv_unicast.packet_type != BATADV_UNICAST)
+ return FLOW_DISSECT_RET_OUT_BAD;
+
+ *p_proto = hdr->eth.h_proto;
+ *p_nhoff += sizeof(*hdr);
+
+ key_control->flags |= FLOW_DIS_ENCAPSULATION;
+ if (flags & FLOW_DISSECTOR_F_STOP_AT_ENCAP)
+ return FLOW_DISSECT_RET_OUT_GOOD;
+
+ return FLOW_DISSECT_RET_PROTO_AGAIN;
+}
+
static void
__skb_flow_dissect_tcp(const struct sk_buff *skb,
struct flow_dissector *flow_dissector,
@@ -817,6 +869,11 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
nhoff, hlen);
break;
+ case htons(ETH_P_BATMAN):
+ fdret = __skb_flow_dissect_batadv(skb, key_control, data,
+ &proto, &nhoff, hlen, flags);
+ break;
+
default:
fdret = FLOW_DISSECT_RET_OUT_BAD;
break;
--
2.11.0
^ permalink raw reply related
* Re: [PATCH 0/2] Add SFF module support
From: David Miller @ 2017-12-15 18:23 UTC (permalink / raw)
To: linux; +Cc: andrew, f.fainelli, robh+dt, devicetree, mark.rutland, netdev
In-Reply-To: <20171214102712.GP10595@n2100.armlinux.org.uk>
From: Russell King - ARM Linux <linux@armlinux.org.uk>
Date: Thu, 14 Dec 2017 10:27:13 +0000
> Add support for SFF modules. SFF modules are similar to SFP modules,
> but they have fewer control signals, and are soldered down rather than
> pluggable.
>
> They also have different IDs in the EEPROM to identify as soldered down
> SFF modules.
Series applied.
^ permalink raw reply
* [RFC v3 0/4] flow_dissector: Provide basic batman-adv unicast handling
From: Sven Eckelmann @ 2017-12-15 18:23 UTC (permalink / raw)
To: netdev
Cc: b.a.t.m.a.n, Eric Dumazet, linux-kernel, Jiri Pirko,
David S . Miller, Willem de Bruijn, Tom Herbert, Sven Eckelmann
Hi,
we are currently starting to use batman-adv as mesh protocol on multicore
embedded devices. These usually don't have a lot of CPU power per core but
are reasonable fast when using multiple cores.
It was noticed that sending was working very well but receiving was
basically only using on CPU core per neighbor. The reason for that is
format of the (normal) incoming packet:
+--------------------+
| ip(v6)hdr |
+--------------------+
| inner ethhdr |
+--------------------+
| batadv unicast hdr |
+--------------------+
| outer ethhdr |
+--------------------+
The flow dissector will therefore stop after parsing the outer ethernet
header and will not parse the actual ipv(4|6)/... header of the packet. Our
assumption was now that it would help us to add minimal support to the flow
dissector to jump over the batman-adv unicast and inner ethernet header
(like in gre ETH_P_TEB). The patch was implemented in a slightly hacky
way [1] and the results looked quite promising.
I didn't get any feedback how the files should actually be named and I am
not really happy with the current names - so please feel free to propose
better names.
The discussion of the RFC v2 can be found in the related patches of
https://patchwork.ozlabs.org/cover/844783/
Changes in v3:
==============
* removed change of uapi/linux/batman_adv.h to uapi/linux/batadv_genl.h
- requested by Willem de Bruijn <willemdebruijn.kernel@gmail.com>
* removed naming fixes for enums/defines in uapi/linux/batadv_genl.h
- requested by Willem de Bruijn <willemdebruijn.kernel@gmail.com>
* renamed uapi/linux/batadv.h to uapi/linux/batadv_packet.h
* moved batadv dissector functionality in own function
- requested by Tom Herbert <tom@herbertland.com>
* added support for flags FLOW_DISSECTOR_F_STOP_AT_ENCAP and
FLOW_DIS_ENCAPSULATION
- requested by Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Changes in v2:
==============
* removed the batman-adv unicast packet header definition from flow_dissector.c
* moved the batman-adv packet.h/uapi headers around to provide the correct
definitions to flow_dissector.c
Kind regards,
Sven
[1] https://patchwork.open-mesh.org/patch/17162/
Sven Eckelmann (4):
batman-adv: Let packet.h include its headers directly
batman-adv: Remove usage of BIT(x) in packet.h
batman-adv: Convert packet.h to uapi header
flow_dissector: Parse batman-adv unicast headers
MAINTAINERS | 1 +
.../packet.h => include/uapi/linux/batadv_packet.h | 31 ++++++------
net/batman-adv/bat_iv_ogm.c | 2 +-
net/batman-adv/bat_v.c | 2 +-
net/batman-adv/bat_v_elp.c | 2 +-
net/batman-adv/bat_v_ogm.c | 2 +-
net/batman-adv/bridge_loop_avoidance.c | 2 +-
net/batman-adv/distributed-arp-table.h | 2 +-
net/batman-adv/fragmentation.c | 2 +-
net/batman-adv/gateway_client.c | 2 +-
net/batman-adv/gateway_common.c | 2 +-
net/batman-adv/hard-interface.c | 2 +-
net/batman-adv/icmp_socket.c | 2 +-
net/batman-adv/main.c | 2 +-
net/batman-adv/main.h | 4 +-
net/batman-adv/multicast.c | 2 +-
net/batman-adv/netlink.c | 2 +-
net/batman-adv/network-coding.c | 2 +-
net/batman-adv/routing.c | 2 +-
net/batman-adv/send.h | 3 +-
net/batman-adv/soft-interface.c | 2 +-
net/batman-adv/sysfs.c | 2 +-
net/batman-adv/tp_meter.c | 2 +-
net/batman-adv/translation-table.c | 2 +-
net/batman-adv/tvlv.c | 2 +-
net/batman-adv/types.h | 3 +-
net/core/flow_dissector.c | 57 ++++++++++++++++++++++
27 files changed, 98 insertions(+), 43 deletions(-)
rename net/batman-adv/packet.h => include/uapi/linux/batadv_packet.h (96%)
--
2.11.0
^ permalink raw reply
* [RFC v3 3/4] batman-adv: Convert packet.h to uapi header
From: Sven Eckelmann @ 2017-12-15 18:23 UTC (permalink / raw)
To: netdev
Cc: b.a.t.m.a.n, Eric Dumazet, linux-kernel, Jiri Pirko,
David S . Miller, Willem de Bruijn, Tom Herbert, Sven Eckelmann
In-Reply-To: <20171215182313.15767-1-sven.eckelmann@openmesh.com>
The header file is used by different userspace programs to inject packets
or to decode sniffed packets. It should therefore be available to them as
userspace header.
Also other components in the kernel (like the flow dissector) require
access to the packet definitions to be able to decode ETH_P_BATMAN ethernet
packets.
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
---
MAINTAINERS | 1 +
net/batman-adv/packet.h => include/uapi/linux/batadv_packet.h | 8 ++++----
net/batman-adv/bat_iv_ogm.c | 2 +-
net/batman-adv/bat_v.c | 2 +-
net/batman-adv/bat_v_elp.c | 2 +-
net/batman-adv/bat_v_ogm.c | 2 +-
net/batman-adv/bridge_loop_avoidance.c | 2 +-
net/batman-adv/distributed-arp-table.h | 2 +-
net/batman-adv/fragmentation.c | 2 +-
net/batman-adv/gateway_client.c | 2 +-
net/batman-adv/gateway_common.c | 2 +-
net/batman-adv/hard-interface.c | 2 +-
net/batman-adv/icmp_socket.c | 2 +-
net/batman-adv/main.c | 2 +-
net/batman-adv/main.h | 2 +-
net/batman-adv/multicast.c | 2 +-
net/batman-adv/netlink.c | 2 +-
net/batman-adv/network-coding.c | 2 +-
net/batman-adv/routing.c | 2 +-
net/batman-adv/send.h | 3 +--
net/batman-adv/soft-interface.c | 2 +-
net/batman-adv/sysfs.c | 2 +-
net/batman-adv/tp_meter.c | 2 +-
net/batman-adv/translation-table.c | 2 +-
net/batman-adv/tvlv.c | 2 +-
net/batman-adv/types.h | 3 +--
26 files changed, 29 insertions(+), 30 deletions(-)
rename net/batman-adv/packet.h => include/uapi/linux/batadv_packet.h (99%)
diff --git a/MAINTAINERS b/MAINTAINERS
index aa71ab52fd76..4d6af00a5f10 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2563,6 +2563,7 @@ S: Maintained
F: Documentation/ABI/testing/sysfs-class-net-batman-adv
F: Documentation/ABI/testing/sysfs-class-net-mesh
F: Documentation/networking/batman-adv.rst
+F: include/uapi/linux/batadv_packet.h
F: include/uapi/linux/batman_adv.h
F: net/batman-adv/
diff --git a/net/batman-adv/packet.h b/include/uapi/linux/batadv_packet.h
similarity index 99%
rename from net/batman-adv/packet.h
rename to include/uapi/linux/batadv_packet.h
index 44f20d03205b..43462e17335a 100644
--- a/net/batman-adv/packet.h
+++ b/include/uapi/linux/batadv_packet.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) */
/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
*
* Marek Lindner, Simon Wunderlich
@@ -16,8 +16,8 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NET_BATMAN_ADV_PACKET_H_
-#define _NET_BATMAN_ADV_PACKET_H_
+#ifndef _UAPI_LINUX_BATADV_PACKET_H_
+#define _UAPI_LINUX_BATADV_PACKET_H_
#include <asm/byteorder.h>
#include <linux/if_ether.h>
@@ -641,4 +641,4 @@ struct batadv_tvlv_mcast_data {
u8 reserved[3];
};
-#endif /* _NET_BATMAN_ADV_PACKET_H_ */
+#endif /* _UAPI_LINUX_BATADV_PACKET_H_ */
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index c9955f29a2bf..a4a331c56a60 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -52,6 +52,7 @@
#include <linux/workqueue.h>
#include <net/genetlink.h>
#include <net/netlink.h>
+#include <uapi/linux/batadv_packet.h>
#include <uapi/linux/batman_adv.h>
#include "bat_algo.h"
@@ -63,7 +64,6 @@
#include "netlink.h"
#include "network-coding.h"
#include "originator.h"
-#include "packet.h"
#include "routing.h"
#include "send.h"
#include "translation-table.h"
diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index 14ec3677c391..f5abe4a4e247 100644
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -37,6 +37,7 @@
#include <linux/workqueue.h>
#include <net/genetlink.h>
#include <net/netlink.h>
+#include <uapi/linux/batadv_packet.h>
#include <uapi/linux/batman_adv.h>
#include "bat_algo.h"
@@ -49,7 +50,6 @@
#include "log.h"
#include "netlink.h"
#include "originator.h"
-#include "packet.h"
struct sk_buff;
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 59ae96cef596..a83478c46597 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -42,13 +42,13 @@
#include <linux/types.h>
#include <linux/workqueue.h>
#include <net/cfg80211.h>
+#include <uapi/linux/batadv_packet.h>
#include "bat_algo.h"
#include "bat_v_ogm.h"
#include "hard-interface.h"
#include "log.h"
#include "originator.h"
-#include "packet.h"
#include "routing.h"
#include "send.h"
diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c
index e415974c540d..ba59b77c605d 100644
--- a/net/batman-adv/bat_v_ogm.c
+++ b/net/batman-adv/bat_v_ogm.c
@@ -39,13 +39,13 @@
#include <linux/string.h>
#include <linux/types.h>
#include <linux/workqueue.h>
+#include <uapi/linux/batadv_packet.h>
#include "bat_algo.h"
#include "hard-interface.h"
#include "hash.h"
#include "log.h"
#include "originator.h"
-#include "packet.h"
#include "routing.h"
#include "send.h"
#include "translation-table.h"
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index e647450e5d0f..fad47853ad3c 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -50,6 +50,7 @@
#include <net/genetlink.h>
#include <net/netlink.h>
#include <net/sock.h>
+#include <uapi/linux/batadv_packet.h>
#include <uapi/linux/batman_adv.h>
#include "hard-interface.h"
@@ -57,7 +58,6 @@
#include "log.h"
#include "netlink.h"
#include "originator.h"
-#include "packet.h"
#include "soft-interface.h"
#include "sysfs.h"
#include "translation-table.h"
diff --git a/net/batman-adv/distributed-arp-table.h b/net/batman-adv/distributed-arp-table.h
index 3d47bedaf661..12897eb46268 100644
--- a/net/batman-adv/distributed-arp-table.h
+++ b/net/batman-adv/distributed-arp-table.h
@@ -24,9 +24,9 @@
#include <linux/compiler.h>
#include <linux/netdevice.h>
#include <linux/types.h>
+#include <uapi/linux/batadv_packet.h>
#include "originator.h"
-#include "packet.h"
struct seq_file;
struct sk_buff;
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index 36f8a84153bf..b893627767f2 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -33,10 +33,10 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/string.h>
+#include <uapi/linux/batadv_packet.h>
#include "hard-interface.h"
#include "originator.h"
-#include "packet.h"
#include "routing.h"
#include "send.h"
#include "soft-interface.h"
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 2488e25d0eef..37fe9a644f22 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -43,6 +43,7 @@
#include <linux/stddef.h>
#include <linux/udp.h>
#include <net/sock.h>
+#include <uapi/linux/batadv_packet.h>
#include <uapi/linux/batman_adv.h>
#include "gateway_common.h"
@@ -50,7 +51,6 @@
#include "log.h"
#include "netlink.h"
#include "originator.h"
-#include "packet.h"
#include "routing.h"
#include "soft-interface.h"
#include "sysfs.h"
diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c
index 83bfeecf661c..b3e156af2256 100644
--- a/net/batman-adv/gateway_common.c
+++ b/net/batman-adv/gateway_common.c
@@ -27,10 +27,10 @@
#include <linux/netdevice.h>
#include <linux/stddef.h>
#include <linux/string.h>
+#include <uapi/linux/batadv_packet.h>
#include "gateway_client.h"
#include "log.h"
-#include "packet.h"
#include "tvlv.h"
/**
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 13d04dba0b3a..5f186bff284a 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -38,6 +38,7 @@
#include <linux/spinlock.h>
#include <net/net_namespace.h>
#include <net/rtnetlink.h>
+#include <uapi/linux/batadv_packet.h>
#include "bat_v.h"
#include "bridge_loop_avoidance.h"
@@ -46,7 +47,6 @@
#include "gateway_client.h"
#include "log.h"
#include "originator.h"
-#include "packet.h"
#include "send.h"
#include "soft-interface.h"
#include "sysfs.h"
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
index f2ef75b7fa73..8041cf106c37 100644
--- a/net/batman-adv/icmp_socket.c
+++ b/net/batman-adv/icmp_socket.c
@@ -44,11 +44,11 @@
#include <linux/string.h>
#include <linux/uaccess.h>
#include <linux/wait.h>
+#include <uapi/linux/batadv_packet.h>
#include "hard-interface.h"
#include "log.h"
#include "originator.h"
-#include "packet.h"
#include "send.h"
static struct batadv_socket_client *batadv_socket_client_hash[256];
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 8bee4279d579..d31c8266e244 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -46,6 +46,7 @@
#include <linux/workqueue.h>
#include <net/dsfield.h>
#include <net/rtnetlink.h>
+#include <uapi/linux/batadv_packet.h>
#include <uapi/linux/batman_adv.h>
#include "bat_algo.h"
@@ -63,7 +64,6 @@
#include "netlink.h"
#include "network-coding.h"
#include "originator.h"
-#include "packet.h"
#include "routing.h"
#include "send.h"
#include "soft-interface.h"
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index d5484ac381d3..f7ba3f96d8f3 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -223,8 +223,8 @@ enum batadv_uev_type {
#include <linux/jiffies.h>
#include <linux/percpu.h>
#include <linux/types.h>
+#include <uapi/linux/batadv_packet.h>
-#include "packet.h"
#include "types.h"
struct net_device;
diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index 8a503c526b90..cbdeb47ec3f6 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -55,11 +55,11 @@
#include <net/if_inet6.h>
#include <net/ip.h>
#include <net/ipv6.h>
+#include <uapi/linux/batadv_packet.h>
#include "hard-interface.h"
#include "hash.h"
#include "log.h"
-#include "packet.h"
#include "translation-table.h"
#include "tvlv.h"
diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
index 103d4bdcdbdb..a823d3899bad 100644
--- a/net/batman-adv/netlink.c
+++ b/net/batman-adv/netlink.c
@@ -40,6 +40,7 @@
#include <net/genetlink.h>
#include <net/netlink.h>
#include <net/sock.h>
+#include <uapi/linux/batadv_packet.h>
#include <uapi/linux/batman_adv.h>
#include "bat_algo.h"
@@ -47,7 +48,6 @@
#include "gateway_client.h"
#include "hard-interface.h"
#include "originator.h"
-#include "packet.h"
#include "soft-interface.h"
#include "tp_meter.h"
#include "translation-table.h"
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c
index 3758be7fd881..b48116bb24ef 100644
--- a/net/batman-adv/network-coding.c
+++ b/net/batman-adv/network-coding.c
@@ -49,12 +49,12 @@
#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/workqueue.h>
+#include <uapi/linux/batadv_packet.h>
#include "hard-interface.h"
#include "hash.h"
#include "log.h"
#include "originator.h"
-#include "packet.h"
#include "routing.h"
#include "send.h"
#include "tvlv.h"
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index eb835bde502a..b6891e8b741c 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -34,6 +34,7 @@
#include <linux/skbuff.h>
#include <linux/spinlock.h>
#include <linux/stddef.h>
+#include <uapi/linux/batadv_packet.h>
#include "bitarray.h"
#include "bridge_loop_avoidance.h"
@@ -44,7 +45,6 @@
#include "log.h"
#include "network-coding.h"
#include "originator.h"
-#include "packet.h"
#include "send.h"
#include "soft-interface.h"
#include "tp_meter.h"
diff --git a/net/batman-adv/send.h b/net/batman-adv/send.h
index 8c7399dd06ca..1e8c79093623 100644
--- a/net/batman-adv/send.h
+++ b/net/batman-adv/send.h
@@ -24,8 +24,7 @@
#include <linux/compiler.h>
#include <linux/spinlock.h>
#include <linux/types.h>
-
-#include "packet.h"
+#include <uapi/linux/batadv_packet.h>
struct sk_buff;
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 1eb5555c5fe4..900c5ce21cd4 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -49,6 +49,7 @@
#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/types.h>
+#include <uapi/linux/batadv_packet.h>
#include "bat_algo.h"
#include "bridge_loop_avoidance.h"
@@ -60,7 +61,6 @@
#include "multicast.h"
#include "network-coding.h"
#include "originator.h"
-#include "packet.h"
#include "send.h"
#include "sysfs.h"
#include "translation-table.h"
diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c
index 56fb42551453..c1578fa0b952 100644
--- a/net/batman-adv/sysfs.c
+++ b/net/batman-adv/sysfs.c
@@ -39,6 +39,7 @@
#include <linux/string.h>
#include <linux/stringify.h>
#include <linux/workqueue.h>
+#include <uapi/linux/batadv_packet.h>
#include "bridge_loop_avoidance.h"
#include "distributed-arp-table.h"
@@ -47,7 +48,6 @@
#include "hard-interface.h"
#include "log.h"
#include "network-coding.h"
-#include "packet.h"
#include "soft-interface.h"
static struct net_device *batadv_kobj_to_netdev(struct kobject *obj)
diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c
index b443b9d28918..c68c41e713a6 100644
--- a/net/batman-adv/tp_meter.c
+++ b/net/batman-adv/tp_meter.c
@@ -49,13 +49,13 @@
#include <linux/timer.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
+#include <uapi/linux/batadv_packet.h>
#include <uapi/linux/batman_adv.h>
#include "hard-interface.h"
#include "log.h"
#include "netlink.h"
#include "originator.h"
-#include "packet.h"
#include "send.h"
/**
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 0e53be3f8df0..7550a9ccd695 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -52,6 +52,7 @@
#include <net/genetlink.h>
#include <net/netlink.h>
#include <net/sock.h>
+#include <uapi/linux/batadv_packet.h>
#include <uapi/linux/batman_adv.h>
#include "bridge_loop_avoidance.h"
@@ -60,7 +61,6 @@
#include "log.h"
#include "netlink.h"
#include "originator.h"
-#include "packet.h"
#include "soft-interface.h"
#include "tvlv.h"
diff --git a/net/batman-adv/tvlv.c b/net/batman-adv/tvlv.c
index e189f026974c..5ffcb45ac6ff 100644
--- a/net/batman-adv/tvlv.c
+++ b/net/batman-adv/tvlv.c
@@ -36,9 +36,9 @@
#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/types.h>
+#include <uapi/linux/batadv_packet.h>
#include "originator.h"
-#include "packet.h"
#include "send.h"
#include "tvlv.h"
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 77b145eba193..bb1578410e0c 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -35,10 +35,9 @@
#include <linux/types.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
+#include <uapi/linux/batadv_packet.h>
#include <uapi/linux/batman_adv.h>
-#include "packet.h"
-
struct seq_file;
#ifdef CONFIG_BATMAN_ADV_DAT
--
2.11.0
^ permalink raw reply related
* [RFC v3 2/4] batman-adv: Remove usage of BIT(x) in packet.h
From: Sven Eckelmann @ 2017-12-15 18:23 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: Willem de Bruijn, Tom Herbert,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r, Jiri Pirko,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Eric Dumazet, Sven Eckelmann,
David S . Miller
In-Reply-To: <20171215182313.15767-1-sven.eckelmann-lv6y7wLVQPlWk0Htik3J/w@public.gmane.org>
The BIT(x) macro is no longer available for uapi headers because it is
defined outside of it (linux/bitops.h). The use of it must therefore be
avoided and replaced by an appropriate other representation.
Signed-off-by: Sven Eckelmann <sven.eckelmann-lv6y7wLVQPlWk0Htik3J/w@public.gmane.org>
---
net/batman-adv/packet.h | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h
index 6b6563867455..44f20d03205b 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -20,7 +20,6 @@
#define _NET_BATMAN_ADV_PACKET_H_
#include <asm/byteorder.h>
-#include <linux/bitops.h>
#include <linux/if_ether.h>
#include <linux/types.h>
@@ -92,9 +91,9 @@ enum batadv_subtype {
* one hop neighbor on the interface where it was originally received.
*/
enum batadv_iv_flags {
- BATADV_NOT_BEST_NEXT_HOP = BIT(0),
- BATADV_PRIMARIES_FIRST_HOP = BIT(1),
- BATADV_DIRECTLINK = BIT(2),
+ BATADV_NOT_BEST_NEXT_HOP = 1UL << 0,
+ BATADV_PRIMARIES_FIRST_HOP = 1UL << 1,
+ BATADV_DIRECTLINK = 1UL << 2,
};
/**
@@ -123,9 +122,9 @@ enum batadv_icmp_packettype {
* @BATADV_MCAST_WANT_ALL_IPV6: we want all IPv6 multicast packets
*/
enum batadv_mcast_flags {
- BATADV_MCAST_WANT_ALL_UNSNOOPABLES = BIT(0),
- BATADV_MCAST_WANT_ALL_IPV4 = BIT(1),
- BATADV_MCAST_WANT_ALL_IPV6 = BIT(2),
+ BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0,
+ BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1,
+ BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2,
};
/* tt data subtypes */
@@ -139,10 +138,10 @@ enum batadv_mcast_flags {
* @BATADV_TT_FULL_TABLE: contains full table to replace existing table
*/
enum batadv_tt_data_flags {
- BATADV_TT_OGM_DIFF = BIT(0),
- BATADV_TT_REQUEST = BIT(1),
- BATADV_TT_RESPONSE = BIT(2),
- BATADV_TT_FULL_TABLE = BIT(4),
+ BATADV_TT_OGM_DIFF = 1UL << 0,
+ BATADV_TT_REQUEST = 1UL << 1,
+ BATADV_TT_RESPONSE = 1UL << 2,
+ BATADV_TT_FULL_TABLE = 1UL << 4,
};
/**
@@ -150,7 +149,7 @@ enum batadv_tt_data_flags {
* @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not
*/
enum batadv_vlan_flags {
- BATADV_VLAN_HAS_TAG = BIT(15),
+ BATADV_VLAN_HAS_TAG = 1UL << 15,
};
/**
--
2.11.0
^ permalink raw reply related
* [RFC v3 1/4] batman-adv: Let packet.h include its headers directly
From: Sven Eckelmann @ 2017-12-15 18:23 UTC (permalink / raw)
To: netdev
Cc: b.a.t.m.a.n, Eric Dumazet, linux-kernel, Jiri Pirko,
David S . Miller, Willem de Bruijn, Tom Herbert, Sven Eckelmann
In-Reply-To: <20171215182313.15767-1-sven.eckelmann@openmesh.com>
The headers used by packet.h should also be included by it directly. main.h
is currently dealing with it in batman-adv, but this will no longer work
when this header is moved to include/uapi/linux/.
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
---
net/batman-adv/main.h | 2 --
net/batman-adv/packet.h | 2 ++
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 5ac86df48c42..d5484ac381d3 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -217,10 +217,8 @@ enum batadv_uev_type {
/* Kernel headers */
-#include <linux/bitops.h> /* for packet.h */
#include <linux/compiler.h>
#include <linux/etherdevice.h>
-#include <linux/if_ether.h> /* for packet.h */
#include <linux/if_vlan.h>
#include <linux/jiffies.h>
#include <linux/percpu.h>
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h
index dccbd4a6f019..6b6563867455 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -20,6 +20,8 @@
#define _NET_BATMAN_ADV_PACKET_H_
#include <asm/byteorder.h>
+#include <linux/bitops.h>
+#include <linux/if_ether.h>
#include <linux/types.h>
/**
--
2.11.0
^ permalink raw reply related
* [net-next:master 353/371] drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c:162:39: sparse: cast to restricted __le16
From: kbuild test robot @ 2017-12-15 18:19 UTC (permalink / raw)
To: Salil Mehta; +Cc: kbuild-all, netdev, lipeng
Hi Salil,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head: 9463b2f72eadf93132815e7ee8e54b4f46e39be9
commit: e963cb789a29b890678b58ef7da5d7c497510b7e [353/371] net: hns3: Add HNS3 VF driver to kernel build framework
reproduce:
# apt-get install sparse
git checkout e963cb789a29b890678b58ef7da5d7c497510b7e
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
vim +162 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
b11a0bb2 Salil Mehta 2017-12-14 124
b11a0bb2 Salil Mehta 2017-12-14 125 void hclgevf_mbx_handler(struct hclgevf_dev *hdev)
b11a0bb2 Salil Mehta 2017-12-14 126 {
b11a0bb2 Salil Mehta 2017-12-14 127 struct hclgevf_mbx_resp_status *resp;
b11a0bb2 Salil Mehta 2017-12-14 128 struct hclge_mbx_pf_to_vf_cmd *req;
b11a0bb2 Salil Mehta 2017-12-14 129 struct hclgevf_cmq_ring *crq;
b11a0bb2 Salil Mehta 2017-12-14 130 struct hclgevf_desc *desc;
b11a0bb2 Salil Mehta 2017-12-14 131 u16 link_status, flag;
b11a0bb2 Salil Mehta 2017-12-14 132 u8 *temp;
b11a0bb2 Salil Mehta 2017-12-14 133 int i;
b11a0bb2 Salil Mehta 2017-12-14 134
b11a0bb2 Salil Mehta 2017-12-14 135 resp = &hdev->mbx_resp;
b11a0bb2 Salil Mehta 2017-12-14 136 crq = &hdev->hw.cmq.crq;
b11a0bb2 Salil Mehta 2017-12-14 137
b11a0bb2 Salil Mehta 2017-12-14 138 flag = le16_to_cpu(crq->desc[crq->next_to_use].flag);
b11a0bb2 Salil Mehta 2017-12-14 139 while (hnae_get_bit(flag, HCLGEVF_CMDQ_RX_OUTVLD_B)) {
b11a0bb2 Salil Mehta 2017-12-14 140 desc = &crq->desc[crq->next_to_use];
b11a0bb2 Salil Mehta 2017-12-14 141 req = (struct hclge_mbx_pf_to_vf_cmd *)desc->data;
b11a0bb2 Salil Mehta 2017-12-14 142
b11a0bb2 Salil Mehta 2017-12-14 143 switch (req->msg[0]) {
b11a0bb2 Salil Mehta 2017-12-14 144 case HCLGE_MBX_PF_VF_RESP:
b11a0bb2 Salil Mehta 2017-12-14 145 if (resp->received_resp)
b11a0bb2 Salil Mehta 2017-12-14 146 dev_warn(&hdev->pdev->dev,
b11a0bb2 Salil Mehta 2017-12-14 147 "VF mbx resp flag not clear(%d)\n",
b11a0bb2 Salil Mehta 2017-12-14 148 req->msg[1]);
b11a0bb2 Salil Mehta 2017-12-14 149 resp->received_resp = true;
b11a0bb2 Salil Mehta 2017-12-14 150
b11a0bb2 Salil Mehta 2017-12-14 151 resp->origin_mbx_msg = (req->msg[1] << 16);
b11a0bb2 Salil Mehta 2017-12-14 152 resp->origin_mbx_msg |= req->msg[2];
b11a0bb2 Salil Mehta 2017-12-14 153 resp->resp_status = req->msg[3];
b11a0bb2 Salil Mehta 2017-12-14 154
b11a0bb2 Salil Mehta 2017-12-14 155 temp = (u8 *)&req->msg[4];
b11a0bb2 Salil Mehta 2017-12-14 156 for (i = 0; i < HCLGE_MBX_MAX_RESP_DATA_SIZE; i++) {
b11a0bb2 Salil Mehta 2017-12-14 157 resp->additional_info[i] = *temp;
b11a0bb2 Salil Mehta 2017-12-14 158 temp++;
b11a0bb2 Salil Mehta 2017-12-14 159 }
b11a0bb2 Salil Mehta 2017-12-14 160 break;
b11a0bb2 Salil Mehta 2017-12-14 161 case HCLGE_MBX_LINK_STAT_CHANGE:
b11a0bb2 Salil Mehta 2017-12-14 @162 link_status = le16_to_cpu(req->msg[1]);
:::::: The code at line 162 was first introduced by commit
:::::: b11a0bb231f3d83429c5e88451ca85ce27c4a9dd net: hns3: Add mailbox support to VF driver
:::::: TO: Salil Mehta <salil.mehta@huawei.com>
:::::: CC: David S. Miller <davem@davemloft.net>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply
* [PULL] vhost: regression fixes
From: Michael S. Tsirkin @ 2017-12-15 18:19 UTC (permalink / raw)
To: Linus Torvalds
Cc: mark.rutland, kvm, mst, netdev, cohuck, linux-kernel,
virtualization, zhangweiping
The following changes since commit 03e9f8a05bce7330bcd9c5cc54c8e42d0fcbf993:
virtio_net: fix return value check in receive_mergeable() (2017-12-07 18:34:52 +0200)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus
for you to fetch changes up to c2e90800aef22e7ea14ea7560ba99993f11d3616:
virtio_mmio: fix devm cleanup (2017-12-14 21:01:40 +0200)
----------------------------------------------------------------
virtio: regression fixes
Fixes two issues in the latest kernel.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
----------------------------------------------------------------
Mark Rutland (1):
virtio_mmio: fix devm cleanup
Michael S. Tsirkin (1):
ptr_ring: fix up after recent ptr_ring changes
drivers/virtio/virtio_mmio.c | 43 +++++++++-------------------------------
tools/virtio/ringtest/ptr_ring.c | 29 +++++++++++++++++++++------
2 files changed, 32 insertions(+), 40 deletions(-)
^ permalink raw reply
* Re: [PATCH net-next v6 2/2] net: ethernet: socionext: add AVE ethernet driver
From: David Miller @ 2017-12-15 17:57 UTC (permalink / raw)
To: hayashi.kunihiko-uWyLwvC0a2jby3iVrkZq2A
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, andrew-g2DYL2Zd6BY,
f.fainelli-Re5JQEeQqe8AvxtiuMwx3w, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
mark.rutland-5wv7dgnIgG8,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A,
masami.hiramatsu-QSEj5FYQhm4dnm+yROfE0A,
jaswinder.singh-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <1513245910-15961-3-git-send-email-hayashi.kunihiko-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
From: Kunihiko Hayashi <hayashi.kunihiko-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
Date: Thu, 14 Dec 2017 19:05:10 +0900
> +static void ave_desc_write(struct net_device *ndev, enum desc_id id,
> + int entry, int offset, u32 val)
> +{
> + struct ave_private *priv = netdev_priv(ndev);
> + u32 addr = (id == AVE_DESCID_TX) ? priv->tx.daddr : priv->rx.daddr;
Please always order local variables from longest to shortest line.
Audit your entire submission for this issue, thank you.
> + ret = register_netdev(ndev);
> + if (ret) {
> + dev_err(dev, "failed to register netdevice\n");
> + goto out_del_napi;
> + }
> +
> + platform_set_drvdata(pdev, ndev);
You must make all software state settings before reigster_netdev() is
invoked.
At the exact moment you call register_netdev(), your device can be
brought up, interrupts processed, PHY state changes made, etc.
So you must put this platform_set_drvdata() before the
register_netdev() call.
Generally speaking, register_netdev() must always be the last state
modification done by your probe routine.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH v2 net-next 4/4] net: tracepoint: using sock_set_state tracepoint to trace SCTP state transition
From: Yafang Shao @ 2017-12-15 17:56 UTC (permalink / raw)
To: songliubraving, davem, marcelo.leitner, rostedt
Cc: bgregg, netdev, linux-kernel, Yafang Shao
In-Reply-To: <1513360611-11392-1-git-send-email-laoar.shao@gmail.com>
With changes in inet_ files, SCTP state transitions are traced with
sockt_set_state tracepoint.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
net/sctp/endpointola.c | 2 +-
net/sctp/sm_sideeffect.c | 4 ++--
net/sctp/socket.c | 12 ++++++------
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index ee1e601..5e129df 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -232,7 +232,7 @@ void sctp_endpoint_free(struct sctp_endpoint *ep)
{
ep->base.dead = true;
- ep->base.sk->sk_state = SCTP_SS_CLOSED;
+ sk_set_state(ep->base.sk, SCTP_SS_CLOSED);
/* Unlink this endpoint, so we can't find it again! */
sctp_unhash_endpoint(ep);
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 8adde71..22ab3b4 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -878,12 +878,12 @@ static void sctp_cmd_new_state(struct sctp_cmd_seq *cmds,
* successfully completed a connect() call.
*/
if (sctp_state(asoc, ESTABLISHED) && sctp_sstate(sk, CLOSED))
- sk->sk_state = SCTP_SS_ESTABLISHED;
+ sk_set_state(sk, SCTP_SS_ESTABLISHED);
/* Set the RCV_SHUTDOWN flag when a SHUTDOWN is received. */
if (sctp_state(asoc, SHUTDOWN_RECEIVED) &&
sctp_sstate(sk, ESTABLISHED)) {
- sk->sk_state = SCTP_SS_CLOSING;
+ sk_set_state(sk, SCTP_SS_CLOSING);
sk->sk_shutdown |= RCV_SHUTDOWN;
}
}
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 7eec0a0..ecb532c 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1544,7 +1544,7 @@ static void sctp_close(struct sock *sk, long timeout)
lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
sk->sk_shutdown = SHUTDOWN_MASK;
- sk->sk_state = SCTP_SS_CLOSING;
+ sk_set_state(sk, SCTP_SS_CLOSING);
ep = sctp_sk(sk)->ep;
@@ -4653,7 +4653,7 @@ static void sctp_shutdown(struct sock *sk, int how)
if (how & SEND_SHUTDOWN && !list_empty(&ep->asocs)) {
struct sctp_association *asoc;
- sk->sk_state = SCTP_SS_CLOSING;
+ sk_set_state(sk, SCTP_SS_CLOSING);
asoc = list_entry(ep->asocs.next,
struct sctp_association, asocs);
sctp_primitive_SHUTDOWN(net, asoc, NULL);
@@ -7509,13 +7509,13 @@ static int sctp_listen_start(struct sock *sk, int backlog)
* sockets.
*
*/
- sk->sk_state = SCTP_SS_LISTENING;
+ sk_set_state(sk, SCTP_SS_LISTENING);
if (!ep->base.bind_addr.port) {
if (sctp_autobind(sk))
return -EAGAIN;
} else {
if (sctp_get_port(sk, inet_sk(sk)->inet_num)) {
- sk->sk_state = SCTP_SS_CLOSED;
+ sk_set_state(sk, SCTP_SS_CLOSED);
return -EADDRINUSE;
}
}
@@ -8538,10 +8538,10 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
* is called, set RCV_SHUTDOWN flag.
*/
if (sctp_state(assoc, CLOSED) && sctp_style(newsk, TCP)) {
- newsk->sk_state = SCTP_SS_CLOSED;
+ sk_set_state(newsk, SCTP_SS_CLOSED);
newsk->sk_shutdown |= RCV_SHUTDOWN;
} else {
- newsk->sk_state = SCTP_SS_ESTABLISHED;
+ sk_set_state(newsk, SCTP_SS_ESTABLISHED);
}
release_sock(newsk);
^ permalink raw reply related
* [PATCH v2 net-next 0/4] replace tcp_set_state tracepoint with sock_set_state tracepoint
From: Yafang Shao @ 2017-12-15 17:56 UTC (permalink / raw)
To: songliubraving, davem, marcelo.leitner, rostedt
Cc: bgregg, netdev, linux-kernel, Yafang Shao
Hi,
According to the discussion in the mail thread
https://patchwork.kernel.org/patch/10099243/,
tcp_set_state tracepoint is renamed to sock_set_state tracepoint and is moved
to include/trace/events/sock.h.
Using this new tracepoint to trace TCP/DCCP/SCTP state transition.
v1->v2: Steven's patch is included in this series.
Steven Rostedt (1):
tcp: Export to userspace the TCP state names for the trace events
Yafang Shao (3):
net: tracepoint: replace tcp_set_state tracepoint with sock_set_state
tracepoint
net: tracepoint: using sock_set_state tracepoint to trace SCTP state
transition
net: tracepoint: using sock_set_state tracepoint to trace DCCP state
transition
include/net/sock.h | 15 +-----
include/trace/events/sock.h | 106 ++++++++++++++++++++++++++++++++++++++++
include/trace/events/tcp.h | 76 ----------------------------
net/core/sock.c | 13 +++++
net/dccp/proto.c | 2 +-
net/ipv4/inet_connection_sock.c | 4 +-
net/ipv4/inet_hashtables.c | 2 +-
net/ipv4/tcp.c | 4 --
net/sctp/endpointola.c | 2 +-
net/sctp/sm_sideeffect.c | 4 +-
net/sctp/socket.c | 12 ++---
11 files changed, 134 insertions(+), 106 deletions(-)
--
1.8.3.1
^ permalink raw reply
* [PATCH v2 net-next 3/4] net: tracepoint: using sock_set_state tracepoint to trace DCCP state transition
From: Yafang Shao @ 2017-12-15 17:56 UTC (permalink / raw)
To: songliubraving, davem, marcelo.leitner, rostedt
Cc: bgregg, netdev, linux-kernel, Yafang Shao
In-Reply-To: <1513360611-11392-1-git-send-email-laoar.shao@gmail.com>
With changes in inet_ files, DCCP state transitions are traced with
sock_set_state tracepoint.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
net/dccp/proto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 9d43c1f..2874faf 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -110,7 +110,7 @@ void dccp_set_state(struct sock *sk, const int state)
/* Change state AFTER socket is unhashed to avoid closed
* socket sitting in hash tables.
*/
- sk->sk_state = state;
+ sk_set_state(sk, state);
}
EXPORT_SYMBOL_GPL(dccp_set_state);
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2 net-next 2/4] net: tracepoint: replace tcp_set_state tracepoint with sock_set_state tracepoint
From: Yafang Shao @ 2017-12-15 17:56 UTC (permalink / raw)
To: songliubraving, davem, marcelo.leitner, rostedt
Cc: bgregg, netdev, linux-kernel, Yafang Shao
In-Reply-To: <1513360611-11392-1-git-send-email-laoar.shao@gmail.com>
As sk_state is a common field for struct sock, so the state
transition should not be a TCP specific feature.
So I rename tcp_set_state tracepoint to sock_set_state tracepoint with
some minor changes and move it into file trace/events/sock.h.
Two helpers are introduced to trace sk_state transition
- void sk_state_store(struct sock *sk, int state);
- void sk_set_state(struct sock *sk, int state);
As trace header should not be included in other header files,
so they are defined in sock.c.
The protocol such as SCTP maybe compiled as a ko, hence export
sk_set_state().
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
include/net/sock.h | 15 +-----
include/trace/events/sock.h | 106 ++++++++++++++++++++++++++++++++++++++++
include/trace/events/tcp.h | 91 ----------------------------------
net/core/sock.c | 13 +++++
net/ipv4/inet_connection_sock.c | 4 +-
net/ipv4/inet_hashtables.c | 2 +-
net/ipv4/tcp.c | 4 --
7 files changed, 124 insertions(+), 111 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 9a90472..988ce82 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2344,19 +2344,8 @@ static inline int sk_state_load(const struct sock *sk)
return smp_load_acquire(&sk->sk_state);
}
-/**
- * sk_state_store - update sk->sk_state
- * @sk: socket pointer
- * @newstate: new state
- *
- * Paired with sk_state_load(). Should be used in contexts where
- * state change might impact lockless readers.
- */
-static inline void sk_state_store(struct sock *sk, int newstate)
-{
- smp_store_release(&sk->sk_state, newstate);
-}
-
+void sk_state_store(struct sock *sk, int newstate);
+void sk_set_state(struct sock *sk, int state);
void sock_enable_timestamp(struct sock *sk, int flag);
int sock_get_timestamp(struct sock *, struct timeval __user *);
int sock_get_timestampns(struct sock *, struct timespec __user *);
diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
index ec4dade..61977e5 100644
--- a/include/trace/events/sock.h
+++ b/include/trace/events/sock.h
@@ -6,7 +6,49 @@
#define _TRACE_SOCK_H
#include <net/sock.h>
+#include <net/ipv6.h>
#include <linux/tracepoint.h>
+#include <linux/ipv6.h>
+#include <linux/tcp.h>
+
+#define inet_protocol_names \
+ EM(IPPROTO_TCP) \
+ EM(IPPROTO_DCCP) \
+ EMe(IPPROTO_SCTP)
+
+#define tcp_state_names \
+ EM(TCP_ESTABLISHED) \
+ EM(TCP_SYN_SENT) \
+ EM(TCP_SYN_RECV) \
+ EM(TCP_FIN_WAIT1) \
+ EM(TCP_FIN_WAIT2) \
+ EM(TCP_TIME_WAIT) \
+ EM(TCP_CLOSE) \
+ EM(TCP_CLOSE_WAIT) \
+ EM(TCP_LAST_ACK) \
+ EM(TCP_LISTEN) \
+ EM(TCP_CLOSING) \
+ EMe(TCP_NEW_SYN_RECV)
+
+/* enums need to be exported to user space */
+#undef EM
+#undef EMe
+#define EM(a) TRACE_DEFINE_ENUM(a);
+#define EMe(a) TRACE_DEFINE_ENUM(a);
+
+inet_protocol_names
+tcp_state_names
+
+#undef EM
+#undef EMe
+#define EM(a) { a, #a },
+#define EMe(a) { a, #a }
+
+#define show_inet_protocol_name(val) \
+ __print_symbolic(val, inet_protocol_names)
+
+#define show_tcp_state_name(val) \
+ __print_symbolic(val, tcp_state_names)
TRACE_EVENT(sock_rcvqueue_full,
@@ -63,6 +105,70 @@
__entry->rmem_alloc)
);
+TRACE_EVENT(sock_set_state,
+
+ TP_PROTO(const struct sock *sk, const int oldstate, const int newstate),
+
+ TP_ARGS(sk, oldstate, newstate),
+
+ TP_STRUCT__entry(
+ __field(const void *, skaddr)
+ __field(int, oldstate)
+ __field(int, newstate)
+ __field(__u16, sport)
+ __field(__u16, dport)
+ __field(__u8, protocol)
+ __array(__u8, saddr, 4)
+ __array(__u8, daddr, 4)
+ __array(__u8, saddr_v6, 16)
+ __array(__u8, daddr_v6, 16)
+ ),
+
+ TP_fast_assign(
+ struct inet_sock *inet = inet_sk(sk);
+ struct in6_addr *pin6;
+ __be32 *p32;
+
+ __entry->skaddr = sk;
+ __entry->oldstate = oldstate;
+ __entry->newstate = newstate;
+
+ __entry->protocol = sk->sk_protocol;
+ __entry->sport = ntohs(inet->inet_sport);
+ __entry->dport = ntohs(inet->inet_dport);
+
+ p32 = (__be32 *) __entry->saddr;
+ *p32 = inet->inet_saddr;
+
+ p32 = (__be32 *) __entry->daddr;
+ *p32 = inet->inet_daddr;
+
+#if IS_ENABLED(CONFIG_IPV6)
+ if (sk->sk_family == AF_INET6) {
+ pin6 = (struct in6_addr *)__entry->saddr_v6;
+ *pin6 = sk->sk_v6_rcv_saddr;
+ pin6 = (struct in6_addr *)__entry->daddr_v6;
+ *pin6 = sk->sk_v6_daddr;
+ } else
+#endif
+ {
+ pin6 = (struct in6_addr *)__entry->saddr_v6;
+ ipv6_addr_set_v4mapped(inet->inet_saddr, pin6);
+ pin6 = (struct in6_addr *)__entry->daddr_v6;
+ ipv6_addr_set_v4mapped(inet->inet_daddr, pin6);
+ }
+ ),
+
+ TP_printk("protocol=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4"
+ "saddrv6=%pI6c daddrv6=%pI6c oldstate=%s newstate=%s",
+ show_inet_protocol_name(__entry->protocol),
+ __entry->sport, __entry->dport,
+ __entry->saddr, __entry->daddr,
+ __entry->saddr_v6, __entry->daddr_v6,
+ show_tcp_state_name(__entry->oldstate),
+ show_tcp_state_name(__entry->newstate))
+);
+
#endif /* _TRACE_SOCK_H */
/* This part must be outside protection */
diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h
index 40240ac..7399399 100644
--- a/include/trace/events/tcp.h
+++ b/include/trace/events/tcp.h
@@ -9,37 +9,6 @@
#include <linux/tracepoint.h>
#include <net/ipv6.h>
-#define tcp_state_names \
- EM(TCP_ESTABLISHED) \
- EM(TCP_SYN_SENT) \
- EM(TCP_SYN_RECV) \
- EM(TCP_FIN_WAIT1) \
- EM(TCP_FIN_WAIT2) \
- EM(TCP_TIME_WAIT) \
- EM(TCP_CLOSE) \
- EM(TCP_CLOSE_WAIT) \
- EM(TCP_LAST_ACK) \
- EM(TCP_LISTEN) \
- EM(TCP_CLOSING) \
- EMe(TCP_NEW_SYN_RECV) \
-
-/* enums need to be exported to user space */
-#undef EM
-#undef EMe
-#define EM(a) TRACE_DEFINE_ENUM(a);
-#define EMe(a) TRACE_DEFINE_ENUM(a);
-
-tcp_state_names
-
-#undef EM
-#undef EMe
-#define EM(a) tcp_state_name(a),
-#define EMe(a) tcp_state_name(a)
-
-#define tcp_state_name(state) { state, #state }
-#define show_tcp_state_name(val) \
- __print_symbolic(val, tcp_state_names)
-
/*
* tcp event with arguments sk and skb
*
@@ -192,66 +161,6 @@
TP_ARGS(sk)
);
-TRACE_EVENT(tcp_set_state,
-
- TP_PROTO(const struct sock *sk, const int oldstate, const int newstate),
-
- TP_ARGS(sk, oldstate, newstate),
-
- TP_STRUCT__entry(
- __field(const void *, skaddr)
- __field(int, oldstate)
- __field(int, newstate)
- __field(__u16, sport)
- __field(__u16, dport)
- __array(__u8, saddr, 4)
- __array(__u8, daddr, 4)
- __array(__u8, saddr_v6, 16)
- __array(__u8, daddr_v6, 16)
- ),
-
- TP_fast_assign(
- struct inet_sock *inet = inet_sk(sk);
- struct in6_addr *pin6;
- __be32 *p32;
-
- __entry->skaddr = sk;
- __entry->oldstate = oldstate;
- __entry->newstate = newstate;
-
- __entry->sport = ntohs(inet->inet_sport);
- __entry->dport = ntohs(inet->inet_dport);
-
- p32 = (__be32 *) __entry->saddr;
- *p32 = inet->inet_saddr;
-
- p32 = (__be32 *) __entry->daddr;
- *p32 = inet->inet_daddr;
-
-#if IS_ENABLED(CONFIG_IPV6)
- if (sk->sk_family == AF_INET6) {
- pin6 = (struct in6_addr *)__entry->saddr_v6;
- *pin6 = sk->sk_v6_rcv_saddr;
- pin6 = (struct in6_addr *)__entry->daddr_v6;
- *pin6 = sk->sk_v6_daddr;
- } else
-#endif
- {
- pin6 = (struct in6_addr *)__entry->saddr_v6;
- ipv6_addr_set_v4mapped(inet->inet_saddr, pin6);
- pin6 = (struct in6_addr *)__entry->daddr_v6;
- ipv6_addr_set_v4mapped(inet->inet_daddr, pin6);
- }
- ),
-
- TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c oldstate=%s newstate=%s",
- __entry->sport, __entry->dport,
- __entry->saddr, __entry->daddr,
- __entry->saddr_v6, __entry->daddr_v6,
- show_tcp_state_name(__entry->oldstate),
- show_tcp_state_name(__entry->newstate))
-);
-
TRACE_EVENT(tcp_retransmit_synack,
TP_PROTO(const struct sock *sk, const struct request_sock *req),
diff --git a/net/core/sock.c b/net/core/sock.c
index c0b5b2f..717f7f6 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2859,6 +2859,19 @@ int sock_get_timestampns(struct sock *sk, struct timespec __user *userstamp)
}
EXPORT_SYMBOL(sock_get_timestampns);
+void sk_state_store(struct sock *sk, int state)
+{
+ trace_sock_set_state(sk, sk->sk_state, state);
+ smp_store_release(&sk->sk_state, state);
+}
+
+void sk_set_state(struct sock *sk, int state)
+{
+ trace_sock_set_state(sk, sk->sk_state, state);
+ sk->sk_state = state;
+}
+EXPORT_SYMBOL(sk_set_state);
+
void sock_enable_timestamp(struct sock *sk, int flag)
{
if (!sock_flag(sk, flag)) {
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 4ca46dc..001f7b0 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -783,7 +783,7 @@ struct sock *inet_csk_clone_lock(const struct sock *sk,
if (newsk) {
struct inet_connection_sock *newicsk = inet_csk(newsk);
- newsk->sk_state = TCP_SYN_RECV;
+ sk_set_state(newsk, TCP_SYN_RECV);
newicsk->icsk_bind_hash = NULL;
inet_sk(newsk)->inet_dport = inet_rsk(req)->ir_rmt_port;
@@ -888,7 +888,7 @@ int inet_csk_listen_start(struct sock *sk, int backlog)
return 0;
}
- sk->sk_state = TCP_CLOSE;
+ sk_set_state(sk, TCP_CLOSE);
return err;
}
EXPORT_SYMBOL_GPL(inet_csk_listen_start);
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index f6f5810..5973693 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -544,7 +544,7 @@ bool inet_ehash_nolisten(struct sock *sk, struct sock *osk)
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
} else {
percpu_counter_inc(sk->sk_prot->orphan_count);
- sk->sk_state = TCP_CLOSE;
+ sk_set_state(sk, TCP_CLOSE);
sock_set_flag(sk, SOCK_DEAD);
inet_csk_destroy_sock(sk);
}
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index c470fec..df6da92 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -283,8 +283,6 @@
#include <asm/ioctls.h>
#include <net/busy_poll.h>
-#include <trace/events/tcp.h>
-
struct percpu_counter tcp_orphan_count;
EXPORT_SYMBOL_GPL(tcp_orphan_count);
@@ -2040,8 +2038,6 @@ void tcp_set_state(struct sock *sk, int state)
{
int oldstate = sk->sk_state;
- trace_tcp_set_state(sk, oldstate, state);
-
switch (state) {
case TCP_ESTABLISHED:
if (oldstate != TCP_ESTABLISHED)
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2 net-next 1/4] tcp: Export to userspace the TCP state names for the trace events
From: Yafang Shao @ 2017-12-15 17:56 UTC (permalink / raw)
To: songliubraving, davem, marcelo.leitner, rostedt
Cc: bgregg, netdev, linux-kernel, Yafang Shao
In-Reply-To: <1513360611-11392-1-git-send-email-laoar.shao@gmail.com>
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
The TCP trace events (specifically tcp_set_state), maps emums to symbol
names via __print_symbolic(). But this only works for reading trace events
from the tracefs trace files. If perf or trace-cmd were to record these
events, the event format file does not convert the enum names into numbers,
and you get something like:
__print_symbolic(REC->oldstate,
{ TCP_ESTABLISHED, "TCP_ESTABLISHED" },
{ TCP_SYN_SENT, "TCP_SYN_SENT" },
{ TCP_SYN_RECV, "TCP_SYN_RECV" },
{ TCP_FIN_WAIT1, "TCP_FIN_WAIT1" },
{ TCP_FIN_WAIT2, "TCP_FIN_WAIT2" },
{ TCP_TIME_WAIT, "TCP_TIME_WAIT" },
{ TCP_CLOSE, "TCP_CLOSE" },
{ TCP_CLOSE_WAIT, "TCP_CLOSE_WAIT" },
{ TCP_LAST_ACK, "TCP_LAST_ACK" },
{ TCP_LISTEN, "TCP_LISTEN" },
{ TCP_CLOSING, "TCP_CLOSING" },
{ TCP_NEW_SYN_RECV, "TCP_NEW_SYN_RECV" })
Where trace-cmd and perf do not know the values of those enums.
Use the TRACE_DEFINE_ENUM() macros that will have the trace events convert
the enum strings into their values at system boot. This will allow perf and
trace-cmd to see actual numbers and not enums:
__print_symbolic(REC->oldstate,
{ 1, "TCP_ESTABLISHED" },
{ 2, "TCP_SYN_SENT" },
{ 3, "TCP_SYN_RECV" },
{ 4, "TCP_FIN_WAIT1" },
{ 5, "TCP_FIN_WAIT2" },
{ 6, "TCP_TIME_WAIT" },
{ 7, "TCP_CLOSE" },
{ 8, "TCP_CLOSE_WAIT" },
{ 9, "TCP_LAST_ACK" },
{ 10, "TCP_LISTEN" },
{ 11, "TCP_CLOSING" },
{ 12, "TCP_NEW_SYN_RECV" })
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
include/trace/events/tcp.h | 41 ++++++++++++++++++++++++++++-------------
1 file changed, 28 insertions(+), 13 deletions(-)
diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h
index 07cccca..40240ac 100644
--- a/include/trace/events/tcp.h
+++ b/include/trace/events/tcp.h
@@ -9,21 +9,36 @@
#include <linux/tracepoint.h>
#include <net/ipv6.h>
+#define tcp_state_names \
+ EM(TCP_ESTABLISHED) \
+ EM(TCP_SYN_SENT) \
+ EM(TCP_SYN_RECV) \
+ EM(TCP_FIN_WAIT1) \
+ EM(TCP_FIN_WAIT2) \
+ EM(TCP_TIME_WAIT) \
+ EM(TCP_CLOSE) \
+ EM(TCP_CLOSE_WAIT) \
+ EM(TCP_LAST_ACK) \
+ EM(TCP_LISTEN) \
+ EM(TCP_CLOSING) \
+ EMe(TCP_NEW_SYN_RECV) \
+
+/* enums need to be exported to user space */
+#undef EM
+#undef EMe
+#define EM(a) TRACE_DEFINE_ENUM(a);
+#define EMe(a) TRACE_DEFINE_ENUM(a);
+
+tcp_state_names
+
+#undef EM
+#undef EMe
+#define EM(a) tcp_state_name(a),
+#define EMe(a) tcp_state_name(a)
+
#define tcp_state_name(state) { state, #state }
#define show_tcp_state_name(val) \
- __print_symbolic(val, \
- tcp_state_name(TCP_ESTABLISHED), \
- tcp_state_name(TCP_SYN_SENT), \
- tcp_state_name(TCP_SYN_RECV), \
- tcp_state_name(TCP_FIN_WAIT1), \
- tcp_state_name(TCP_FIN_WAIT2), \
- tcp_state_name(TCP_TIME_WAIT), \
- tcp_state_name(TCP_CLOSE), \
- tcp_state_name(TCP_CLOSE_WAIT), \
- tcp_state_name(TCP_LAST_ACK), \
- tcp_state_name(TCP_LISTEN), \
- tcp_state_name(TCP_CLOSING), \
- tcp_state_name(TCP_NEW_SYN_RECV))
+ __print_symbolic(val, tcp_state_names)
/*
* tcp event with arguments sk and skb
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH v2 net-next 0/4] replace tcp_set_state tracepoint with
From: David Miller @ 2017-12-15 17:51 UTC (permalink / raw)
To: laoar.shao
Cc: songliubraving, marcelo.leitner, rostedt, bgregg, netdev,
linux-kernel
In-Reply-To: <CALOAHbB_T4A4mK6RW0Rw3KTjoDTwj-KZ048kS-qPUeFShBWU_g@mail.gmail.com>
From: Yafang Shao <laoar.shao@gmail.com>
Date: Sat, 16 Dec 2017 01:50:12 +0800
> 2017-12-16 1:43 GMT+08:00 David Miller <davem@davemloft.net>:
>>
>> Your Subject line here is incomplete, "replace tcp_set_state
>> tracepoint with" what?
>
> Oh Sorry.
>
> The subject should be
>
> "replace tcp_set_state tracepoint with sock_set_state tracepoint"
Please resubmit with it fixed.
^ permalink raw reply
* Re: [PATCH v2 net-next 0/4] replace tcp_set_state tracepoint with
From: Yafang Shao @ 2017-12-15 17:50 UTC (permalink / raw)
To: David Miller
Cc: Song Liu, Marcelo Ricardo Leitner, Steven Rostedt, Brendan Gregg,
netdev, LKML
In-Reply-To: <20171215.124322.1720625792535447389.davem@davemloft.net>
2017-12-16 1:43 GMT+08:00 David Miller <davem@davemloft.net>:
>
> Your Subject line here is incomplete, "replace tcp_set_state
> tracepoint with" what?
Oh Sorry.
The subject should be
"replace tcp_set_state tracepoint with sock_set_state tracepoint"
Thanks
Yafang
^ permalink raw reply
* Re: [PATCH net-next 0/2] nfp: fix rtsym and XDP register handling in debug dump
From: David Miller @ 2017-12-15 17:49 UTC (permalink / raw)
To: simon.horman; +Cc: jakub.kicinski, netdev, oss-drivers, carl.heymann
In-Reply-To: <20171215141828.3m7f66ziv4fn33c2@netronome.com>
From: Simon Horman <simon.horman@netronome.com>
Date: Fri, 15 Dec 2017 15:18:29 +0100
> On Thu, Dec 14, 2017 at 10:50:24AM +0100, Simon Horman wrote:
>> Hi,
>>
>> this series resolves two problems in the recently added debug dump facility.
>>
>> * Correctly handle reading absolute rtysms
>> * Correctly handle special-case PB register reads
>>
>> These fixes are for code only present in net-next.
>
> Hi Dave,
>
> It seems that I made a thinko in the title of the cover letter. s/XDP/XPB/
> These changes do not relate to XDP.
Series applied with this fixed, thanks.
^ permalink raw reply
* Re: [PATCH net v3 0/9] net: aquantia: Atlantic driver 12/2017 updates
From: David Miller @ 2017-12-15 17:47 UTC (permalink / raw)
To: igor.russkikh
Cc: netdev, darcari, pavel.belous, Nadezhda.Krupnina, simon.edelhaus
In-Reply-To: <cover.1513242414.git.igor.russkikh@aquantia.com>
From: Igor Russkikh <igor.russkikh@aquantia.com>
Date: Thu, 14 Dec 2017 12:34:39 +0300
> The patchset contains important hardware fix for machines with large MRRS
> and couple of improvement in stats and capabilities reporting
>
> patch v3:
> - Fixed patch #7 after Andrew's finding. NIC level stats actually
> have to be cleaned only on hw struct creation (and this is done
> in kzalloc). On each hwinit we only have to reset link state
> to make sure hw stats update will not increment nic stats during init.
>
> patch v2:
> - split into more detailed commits
>
> Comment from David on wrong defines case will be submitted separately later
Series applied, but don't make me regret letting you fix this define
issue "later".
^ permalink raw reply
* Re: [PATCH v2 net-next 0/4] replace tcp_set_state tracepoint with
From: David Miller @ 2017-12-15 17:43 UTC (permalink / raw)
To: laoar.shao
Cc: songliubraving, marcelo.leitner, rostedt, bgregg, netdev,
linux-kernel
In-Reply-To: <1513357314-8402-1-git-send-email-laoar.shao@gmail.com>
Your Subject line here is incomplete, "replace tcp_set_state
tracepoint with" what?
^ permalink raw reply
* Re: [PATCH v2 net-next 1/3] net: dsa: mediatek: add VLAN support for MT7530
From: kbuild test robot @ 2017-12-15 17:37 UTC (permalink / raw)
To: sean.wang
Cc: kbuild-all, davem, andrew, f.fainelli, vivien.didelot, netdev,
linux-kernel, linux-mediatek, Sean Wang
In-Reply-To: <72a0a9f2748193bc02fed5e74c343aa5397348b7.1513136754.git.sean.wang@mediatek.com>
[-- Attachment #1: Type: text/plain, Size: 13966 bytes --]
Hi Sean,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/sean-wang-mediatek-com/add-VLAN-support-to-DSA-MT7530/20171215-214450
config: x86_64-randconfig-g0-12151942 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
drivers/net/dsa/mt7530.c: In function 'mt7530_port_vlan_add':
drivers/net/dsa/mt7530.c:1131:6: warning: unused variable 'ret' [-Wunused-variable]
int ret;
^
drivers/net/dsa/mt7530.c: At top level:
>> drivers/net/dsa/mt7530.c:1324:2: warning: initialization from incompatible pointer type
.port_vlan_prepare = mt7530_port_vlan_prepare,
^
drivers/net/dsa/mt7530.c:1324:2: warning: (near initialization for 'mt7530_switch_ops.port_vlan_prepare')
drivers/net/dsa/mt7530.c:1325:2: warning: initialization from incompatible pointer type
.port_vlan_add = mt7530_port_vlan_add,
^
drivers/net/dsa/mt7530.c:1325:2: warning: (near initialization for 'mt7530_switch_ops.port_vlan_add')
Cyclomatic Complexity 3 include/linux/string.h:strncpy
Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
Cyclomatic Complexity 3 include/linux/ktime.h:ktime_compare
Cyclomatic Complexity 1 include/linux/ktime.h:ktime_add_us
Cyclomatic Complexity 1 include/linux/device.h:devm_kzalloc
Cyclomatic Complexity 1 include/linux/device.h:dev_get_drvdata
Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata
Cyclomatic Complexity 5 include/linux/mii.h:mii_resolve_flowctrl_fdx
Cyclomatic Complexity 1 include/linux/of.h:of_property_read_bool
Cyclomatic Complexity 1 include/linux/phy.h:phy_is_pseudo_fixed_link
Cyclomatic Complexity 1 include/linux/reset.h:reset_control_assert
Cyclomatic Complexity 1 include/linux/reset.h:reset_control_deassert
Cyclomatic Complexity 2 include/linux/reset.h:__devm_reset_control_get
Cyclomatic Complexity 2 include/linux/reset.h:devm_reset_control_get_exclusive
Cyclomatic Complexity 1 include/linux/reset.h:devm_reset_control_get
Cyclomatic Complexity 1 include/net/dsa.h:dsa_to_port
Cyclomatic Complexity 1 include/net/dsa.h:dsa_is_cpu_port
Cyclomatic Complexity 1 include/net/dsa.h:dsa_is_user_port
Cyclomatic Complexity 3 include/net/dsa.h:dsa_user_ports
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.h:mt7530_hw_vlan_entry_init
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.h:INIT_MT7530_DUMMY_POLL
Cyclomatic Complexity 2 drivers/net/dsa/mt7530.c:mt7530_get_strings
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_get_sset_count
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_port_vlan_prepare
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mdio_module_init
Cyclomatic Complexity 2 drivers/net/dsa/mt7530.c:mt7530_mii_read
Cyclomatic Complexity 4 drivers/net/dsa/mt7530.c:mt7530_mii_write
Cyclomatic Complexity 4 drivers/net/dsa/mt7530.c:core_read_mmd_indirect
Cyclomatic Complexity 5 drivers/net/dsa/mt7530.c:core_write_mmd_indirect
Cyclomatic Complexity 3 drivers/net/dsa/mt7530.c:mt7530_remove
Cyclomatic Complexity 9 drivers/net/dsa/mt7530.c:mt7530_probe
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:_mt7530_read
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_read
Cyclomatic Complexity 2 drivers/net/dsa/mt7530.c:mt7530_fdb_read
Cyclomatic Complexity 3 drivers/net/dsa/mt7530.c:mt7530_get_ethtool_stats
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_write
Cyclomatic Complexity 2 drivers/net/dsa/mt7530.c:mt7530_fdb_write
Cyclomatic Complexity 3 drivers/net/dsa/mt7530.c:mt7530_hw_vlan_del
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_mib_reset
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_rmw
Cyclomatic Complexity 2 drivers/net/dsa/mt7530.c:mt7530_hw_vlan_add
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_port_set_vlan_aware
Cyclomatic Complexity 2 drivers/net/dsa/mt7530.c:mt7530_port_vlan_filtering
Cyclomatic Complexity 5 drivers/net/dsa/mt7530.c:mt7530_stp_state_set
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_clear
Cyclomatic Complexity 5 drivers/net/dsa/mt7530.c:mt7530_port_set_vlan_unaware
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_set
Cyclomatic Complexity 2 drivers/net/dsa/mt7530.c:mt7530_port_set_status
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_cpu_port_enable
Cyclomatic Complexity 8 drivers/net/dsa/mt7530.c:mt7530_port_bridge_leave
Cyclomatic Complexity 7 drivers/net/dsa/mt7530.c:mt7530_port_bridge_join
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_port_disable
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_port_enable
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:core_rmw
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:core_clear
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:core_set
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:core_write
Cyclomatic Complexity 11 drivers/net/dsa/mt7530.c:mt7530_fdb_cmd
Cyclomatic Complexity 8 drivers/net/dsa/mt7530.c:mt7530_port_fdb_dump
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_port_fdb_del
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_port_fdb_add
Cyclomatic Complexity 9 drivers/net/dsa/mt7530.c:mt7530_vlan_cmd
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_hw_vlan_update
Cyclomatic Complexity 4 drivers/net/dsa/mt7530.c:mt7530_port_vlan_del
Cyclomatic Complexity 4 drivers/net/dsa/mt7530.c:mt7530_port_vlan_add
Cyclomatic Complexity 2 drivers/net/dsa/mt7530.c:mt7623_trgmii_read
Cyclomatic Complexity 2 drivers/net/dsa/mt7530.c:mt7623_trgmii_write
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7623_trgmii_rmw
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7623_trgmii_set
Cyclomatic Complexity 7 drivers/net/dsa/mt7530.c:mt7530_pad_clk_setup
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7623_trgmii_clear
Cyclomatic Complexity 2 drivers/net/dsa/mt7530.c:mt7623_pad_clk_setup
Cyclomatic Complexity 12 drivers/net/dsa/mt7530.c:mt7530_adjust_link
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_phy_write
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mt7530_phy_read
Cyclomatic Complexity 16 drivers/net/dsa/mt7530.c:mt7530_setup
Cyclomatic Complexity 2 drivers/net/dsa/mt7530.c:mtk_get_tag_protocol
Cyclomatic Complexity 1 drivers/net/dsa/mt7530.c:mdio_module_exit
vim +1324 drivers/net/dsa/mt7530.c
1121
1122 static void
1123 mt7530_port_vlan_add(struct dsa_switch *ds, int port,
1124 const struct switchdev_obj_port_vlan *vlan,
1125 struct switchdev_trans *trans)
1126 {
1127 bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
1128 bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID;
1129 struct mt7530_hw_vlan_entry new_entry;
1130 struct mt7530_priv *priv = ds->priv;
> 1131 int ret;
1132 u16 vid;
1133
1134 /* The port is kept as VLAN-unaware if bridge with vlan_filtering not
1135 * being set.
1136 */
1137 if (!priv->ports[port].vlan_filtering)
1138 return;
1139
1140 mutex_lock(&priv->reg_mutex);
1141
1142 for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) {
1143 mt7530_hw_vlan_entry_init(&new_entry, port, untagged);
1144 mt7530_hw_vlan_update(priv, vid, &new_entry,
1145 mt7530_hw_vlan_add);
1146 }
1147
1148 if (pvid) {
1149 mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK,
1150 G0_PORT_VID(vlan->vid_end));
1151 priv->ports[port].pvid = vlan->vid_end;
1152 }
1153
1154 mutex_unlock(&priv->reg_mutex);
1155 }
1156
1157 static int
1158 mt7530_port_vlan_del(struct dsa_switch *ds, int port,
1159 const struct switchdev_obj_port_vlan *vlan)
1160 {
1161 struct mt7530_hw_vlan_entry target_entry;
1162 struct mt7530_priv *priv = ds->priv;
1163 u16 vid, pvid;
1164
1165 /* The port is kept as VLAN-unaware if bridge with vlan_filtering not
1166 * being set.
1167 */
1168 if (!priv->ports[port].vlan_filtering)
1169 return 0;
1170
1171 mutex_lock(&priv->reg_mutex);
1172
1173 pvid = priv->ports[port].pvid;
1174 for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) {
1175 mt7530_hw_vlan_entry_init(&target_entry, port, 0);
1176 mt7530_hw_vlan_update(priv, vid, &target_entry,
1177 mt7530_hw_vlan_del);
1178
1179 /* PVID is being restored to the default whenever the PVID port
1180 * is being removed from the VLAN.
1181 */
1182 if (pvid == vid)
1183 pvid = G0_PORT_VID_DEF;
1184 }
1185
1186 mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK, pvid);
1187 priv->ports[port].pvid = pvid;
1188
1189 mutex_unlock(&priv->reg_mutex);
1190
1191 return 0;
1192 }
1193
1194 static enum dsa_tag_protocol
1195 mtk_get_tag_protocol(struct dsa_switch *ds, int port)
1196 {
1197 struct mt7530_priv *priv = ds->priv;
1198
1199 if (port != MT7530_CPU_PORT) {
1200 dev_warn(priv->dev,
1201 "port not matched with tagging CPU port\n");
1202 return DSA_TAG_PROTO_NONE;
1203 } else {
1204 return DSA_TAG_PROTO_MTK;
1205 }
1206 }
1207
1208 static int
1209 mt7530_setup(struct dsa_switch *ds)
1210 {
1211 struct mt7530_priv *priv = ds->priv;
1212 int ret, i;
1213 u32 id, val;
1214 struct device_node *dn;
1215 struct mt7530_dummy_poll p;
1216
1217 /* The parent node of master netdev which holds the common system
1218 * controller also is the container for two GMACs nodes representing
1219 * as two netdev instances.
1220 */
1221 dn = ds->ports[MT7530_CPU_PORT].master->dev.of_node->parent;
1222 priv->ethernet = syscon_node_to_regmap(dn);
1223 if (IS_ERR(priv->ethernet))
1224 return PTR_ERR(priv->ethernet);
1225
1226 regulator_set_voltage(priv->core_pwr, 1000000, 1000000);
1227 ret = regulator_enable(priv->core_pwr);
1228 if (ret < 0) {
1229 dev_err(priv->dev,
1230 "Failed to enable core power: %d\n", ret);
1231 return ret;
1232 }
1233
1234 regulator_set_voltage(priv->io_pwr, 3300000, 3300000);
1235 ret = regulator_enable(priv->io_pwr);
1236 if (ret < 0) {
1237 dev_err(priv->dev, "Failed to enable io pwr: %d\n",
1238 ret);
1239 return ret;
1240 }
1241
1242 /* Reset whole chip through gpio pin or memory-mapped registers for
1243 * different type of hardware
1244 */
1245 if (priv->mcm) {
1246 reset_control_assert(priv->rstc);
1247 usleep_range(1000, 1100);
1248 reset_control_deassert(priv->rstc);
1249 } else {
1250 gpiod_set_value_cansleep(priv->reset, 0);
1251 usleep_range(1000, 1100);
1252 gpiod_set_value_cansleep(priv->reset, 1);
1253 }
1254
1255 /* Waiting for MT7530 got to stable */
1256 INIT_MT7530_DUMMY_POLL(&p, priv, MT7530_HWTRAP);
1257 ret = readx_poll_timeout(_mt7530_read, &p, val, val != 0,
1258 20, 1000000);
1259 if (ret < 0) {
1260 dev_err(priv->dev, "reset timeout\n");
1261 return ret;
1262 }
1263
1264 id = mt7530_read(priv, MT7530_CREV);
1265 id >>= CHIP_NAME_SHIFT;
1266 if (id != MT7530_ID) {
1267 dev_err(priv->dev, "chip %x can't be supported\n", id);
1268 return -ENODEV;
1269 }
1270
1271 /* Reset the switch through internal reset */
1272 mt7530_write(priv, MT7530_SYS_CTRL,
1273 SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST |
1274 SYS_CTRL_REG_RST);
1275
1276 /* Enable Port 6 only; P5 as GMAC5 which currently is not supported */
1277 val = mt7530_read(priv, MT7530_MHWTRAP);
1278 val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS;
1279 val |= MHWTRAP_MANUAL;
1280 mt7530_write(priv, MT7530_MHWTRAP, val);
1281
1282 /* Enable and reset MIB counters */
1283 mt7530_mib_reset(ds);
1284
1285 mt7530_clear(priv, MT7530_MFC, UNU_FFP_MASK);
1286
1287 for (i = 0; i < MT7530_NUM_PORTS; i++) {
1288 /* Disable forwarding by default on all ports */
1289 mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK,
1290 PCR_MATRIX_CLR);
1291
1292 if (dsa_is_cpu_port(ds, i))
1293 mt7530_cpu_port_enable(priv, i);
1294 else
1295 mt7530_port_disable(ds, i, NULL);
1296 }
1297
1298 /* Flush the FDB table */
1299 ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, 0);
1300 if (ret < 0)
1301 return ret;
1302
1303 return 0;
1304 }
1305
1306 static const struct dsa_switch_ops mt7530_switch_ops = {
1307 .get_tag_protocol = mtk_get_tag_protocol,
1308 .setup = mt7530_setup,
1309 .get_strings = mt7530_get_strings,
1310 .phy_read = mt7530_phy_read,
1311 .phy_write = mt7530_phy_write,
1312 .get_ethtool_stats = mt7530_get_ethtool_stats,
1313 .get_sset_count = mt7530_get_sset_count,
1314 .adjust_link = mt7530_adjust_link,
1315 .port_enable = mt7530_port_enable,
1316 .port_disable = mt7530_port_disable,
1317 .port_stp_state_set = mt7530_stp_state_set,
1318 .port_bridge_join = mt7530_port_bridge_join,
1319 .port_bridge_leave = mt7530_port_bridge_leave,
1320 .port_fdb_add = mt7530_port_fdb_add,
1321 .port_fdb_del = mt7530_port_fdb_del,
1322 .port_fdb_dump = mt7530_port_fdb_dump,
1323 .port_vlan_filtering = mt7530_port_vlan_filtering,
> 1324 .port_vlan_prepare = mt7530_port_vlan_prepare,
1325 .port_vlan_add = mt7530_port_vlan_add,
1326 .port_vlan_del = mt7530_port_vlan_del,
1327 };
1328
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31760 bytes --]
^ permalink raw reply
* Re: [PATCH net-next 0/4] ERSPAN version 2 (type III) support
From: David Miller @ 2017-12-15 17:34 UTC (permalink / raw)
To: u9012063; +Cc: netdev
In-Reply-To: <1513211938-8749-1-git-send-email-u9012063@gmail.com>
From: William Tu <u9012063@gmail.com>
Date: Wed, 13 Dec 2017 16:38:54 -0800
> ERSPAN has two versions, v1 (type II) and v2 (type III). This patch
> series add support for erspan v2 based on existing erspan v1
> implementation.
...
Series applied, thanks William.
^ permalink raw reply
* RE: v4.15-rc2 on thinkpad x60: ethernet stopped working
From: Keller, Jacob E @ 2017-12-15 17:30 UTC (permalink / raw)
To: Keller, Jacob E, Gabriel C, Pavel Machek, kernel list
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org
In-Reply-To: <02874ECE860811409154E81DA85FBB5882B5FB2A@ORSMSX115.amr.corp.intel.com>
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@osuosl.org] On Behalf Of
> Keller, Jacob E
> Sent: Friday, December 15, 2017 9:29 AM
> To: Gabriel C <nix.or.die@gmail.com>; Pavel Machek <pavel@ucw.cz>; kernel list
> <linux-kernel@vger.kernel.org>
> Cc: netdev@vger.kernel.org; intel-wired-lan@lists.osuosl.org
> Subject: Re: [Intel-wired-lan] v4.15-rc2 on thinkpad x60: ethernet stopped
> working
>
> > -----Original Message-----
> > From: netdev-owner@vger.kernel.org [mailto:netdev-
> owner@vger.kernel.org]
> > On Behalf Of Gabriel C
> > Sent: Sunday, December 10, 2017 4:44 AM
> > To: Pavel Machek <pavel@ucw.cz>; kernel list <linux-kernel@vger.kernel.org>
> > Cc: Kirsher, Jeffrey T <jeffrey.t.kirsher@intel.com>; intel-wired-
> > lan@lists.osuosl.org; netdev@vger.kernel.org
> > Subject: Re: v4.15-rc2 on thinkpad x60: ethernet stopped working
> >
> > On 10.12.2017 09:39, Pavel Machek wrote:
> > > Hi!
> >
> > Hi,
> >
> > > In v4.15-rc2+, network manager can not see my ethernet card, and
> > > manual attempts to ifconfig it up did not really help, either.
> > >
> > > Card is:
> > >
> > > 02:00.0 Ethernet controller: Intel Corporation 82573L Gigabit Ethernet
> > > Controller
> > >
> > > Dmesg says:
> > >
> > > dmesg | grep eth
> > > [ 0.648931] e1000e 0000:02:00.0 eth0: (PCI Express:2.5GT/s:Width
> > > x1) 00:16:d3:25:19:04
> > > [ 0.648934] e1000e 0000:02:00.0 eth0: Intel(R) PRO/1000 Network
> > > Connection
> > > [ 0.649012] e1000e 0000:02:00.0 eth0: MAC: 2, PHY: 2, PBA No:
> > > 005302-003
> > > [ 0.706510] usbcore: registered new interface driver cdc_ether
> > > [ 6.557022] e1000e 0000:02:00.0 eth1: renamed from eth0
> > > [ 6.577554] systemd-udevd[2363]: renamed network interface eth0 to
> > > eth1
> > >
> > > Any ideas ?
> >
> > Yes , 19110cfbb34d4af0cdfe14cd243f3b09dc95b013 broke it.
> >
> > See:
> > https://bugzilla.kernel.org/show_bug.cgi?id=198047
> >
> > Fix there :
> > https://marc.info/?l=linux-kernel&m=151272209903675&w=2
> >
> > Regards,
> >
> > Gabriel C
>
> Hi,
>
> Digging into this, the problem is complicated. The original bug assumed behavior
> of the .check_for_link call, which is universally not implemented.
>
> I think the correct fix is to revert 19110cfbb34d ("e1000e: Separate signaling for
> link check/link up", 2017-10-10) and find a more proper solution.
>
> I don't think any other code which uses check_for_link expects the interface to
> return in the way this patch attempted.
>
> Thanks,
> Jake
>
Alternatively, we can go a step farther and make sure every implementation of .check_for_link follows the modified interface.
Thanks,
Jake
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox