* [iproute PATCH 16/18] ss: Make sstate_name local to sock_state_print()
From: Phil Sutter @ 2016-11-11 13:10 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20161111131014.21865-1-phil@nwl.cc>
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
misc/ss.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index cf4187310816e..14492da256c61 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -634,21 +634,6 @@ static unsigned long long cookie_sk_get(const uint32_t *cookie)
return (((unsigned long long)cookie[1] << 31) << 1) | cookie[0];
}
-static const char *sstate_name[] = {
- "UNKNOWN",
- [SS_ESTABLISHED] = "ESTAB",
- [SS_SYN_SENT] = "SYN-SENT",
- [SS_SYN_RECV] = "SYN-RECV",
- [SS_FIN_WAIT1] = "FIN-WAIT-1",
- [SS_FIN_WAIT2] = "FIN-WAIT-2",
- [SS_TIME_WAIT] = "TIME-WAIT",
- [SS_CLOSE] = "UNCONN",
- [SS_CLOSE_WAIT] = "CLOSE-WAIT",
- [SS_LAST_ACK] = "LAST-ACK",
- [SS_LISTEN] = "LISTEN",
- [SS_CLOSING] = "CLOSING",
-};
-
static const char *sstate_namel[] = {
"UNKNOWN",
[SS_ESTABLISHED] = "established",
@@ -769,6 +754,20 @@ static char *proto_name(int protocol)
static void sock_state_print(struct sockstat *s)
{
const char *sock_name;
+ static const char * const sstate_name[] = {
+ "UNKNOWN",
+ [SS_ESTABLISHED] = "ESTAB",
+ [SS_SYN_SENT] = "SYN-SENT",
+ [SS_SYN_RECV] = "SYN-RECV",
+ [SS_FIN_WAIT1] = "FIN-WAIT-1",
+ [SS_FIN_WAIT2] = "FIN-WAIT-2",
+ [SS_TIME_WAIT] = "TIME-WAIT",
+ [SS_CLOSE] = "UNCONN",
+ [SS_CLOSE_WAIT] = "CLOSE-WAIT",
+ [SS_LAST_ACK] = "LAST-ACK",
+ [SS_LISTEN] = "LISTEN",
+ [SS_CLOSING] = "CLOSING",
+ };
switch (s->local.family) {
case AF_UNIX:
--
2.10.0
^ permalink raw reply related
* [iproute PATCH 12/18] ss: Make slabstat_ids local to get_slabstat()
From: Phil Sutter @ 2016-11-11 13:10 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20161111131014.21865-1-phil@nwl.cc>
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
misc/ss.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index d546a00eb2c24..c3a5148e05013 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -580,21 +580,19 @@ struct slabstat {
static struct slabstat slabstat;
-static const char *slabstat_ids[] = {
-
- "sock",
- "tcp_bind_bucket",
- "tcp_tw_bucket",
- "tcp_open_request",
- "skbuff_head_cache",
-};
-
static int get_slabstat(struct slabstat *s)
{
char buf[256];
FILE *fp;
int cnt;
static int slabstat_valid;
+ static const char * const slabstat_ids[] = {
+ "sock",
+ "tcp_bind_bucket",
+ "tcp_tw_bucket",
+ "tcp_open_request",
+ "skbuff_head_cache",
+ };
if (slabstat_valid)
return 0;
--
2.10.0
^ permalink raw reply related
* [iproute PATCH 05/18] ss: introduce proc_ctx_print()
From: Phil Sutter @ 2016-11-11 13:10 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20161111131014.21865-1-phil@nwl.cc>
This consolidates identical code in three places. While the function
name is not quite perfect as there is different proc_ctx printing code
in netlink_show_one() as well, I sadly didn't find a more suitable one.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
misc/ss.c | 49 ++++++++++++++-----------------------------------
1 file changed, 14 insertions(+), 35 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index e6053467aaf82..b3475cc96ae7b 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1719,14 +1719,9 @@ void *parse_markmask(const char *markmask)
return res;
}
-static void inet_stats_print(struct sockstat *s)
+static void proc_ctx_print(struct sockstat *s)
{
- char *buf = NULL;
-
- sock_state_print(s);
-
- inet_addr_print(&s->local, s->lport, s->iface);
- inet_addr_print(&s->remote, s->rport, 0);
+ char *buf;
if (show_proc_ctx || show_sock_ctx) {
if (find_entry(s->ino, &buf,
@@ -1743,6 +1738,16 @@ static void inet_stats_print(struct sockstat *s)
}
}
+static void inet_stats_print(struct sockstat *s)
+{
+ sock_state_print(s);
+
+ inet_addr_print(&s->local, s->lport, s->iface);
+ inet_addr_print(&s->remote, s->rport, 0);
+
+ proc_ctx_print(s);
+}
+
static int proc_parse_inet_addr(char *loc, char *rem, int family, struct
sockstat * s)
{
@@ -2814,7 +2819,6 @@ static void unix_stats_print(struct sockstat *list, struct filter *f)
{
struct sockstat *s;
char *peer;
- char *ctx_buf = NULL;
bool use_proc = unix_use_proc();
char port_name[30] = {};
@@ -2863,19 +2867,7 @@ static void unix_stats_print(struct sockstat *list, struct filter *f)
sock_addr_print(peer, " ", int_to_str(s->rport, port_name),
NULL);
- if (show_proc_ctx || show_sock_ctx) {
- if (find_entry(s->ino, &ctx_buf,
- (show_proc_ctx & show_sock_ctx) ?
- PROC_SOCK_CTX : PROC_CTX) > 0) {
- printf(" users:(%s)", ctx_buf);
- free(ctx_buf);
- }
- } else if (show_users) {
- if (find_entry(s->ino, &ctx_buf, USERS) > 0) {
- printf(" users:(%s)", ctx_buf);
- free(ctx_buf);
- }
- }
+ proc_ctx_print(s);
printf("\n");
}
}
@@ -3071,7 +3063,6 @@ static int unix_show(struct filter *f)
static int packet_stats_print(struct sockstat *s, const struct filter *f)
{
- char *buf = NULL;
const char *addr, *port;
char ll_name[16];
@@ -3098,19 +3089,7 @@ static int packet_stats_print(struct sockstat *s, const struct filter *f)
sock_addr_print(addr, ":", port, NULL);
sock_addr_print("", "*", "", NULL);
- if (show_proc_ctx || show_sock_ctx) {
- if (find_entry(s->ino, &buf,
- (show_proc_ctx & show_sock_ctx) ?
- PROC_SOCK_CTX : PROC_CTX) > 0) {
- printf(" users:(%s)", buf);
- free(buf);
- }
- } else if (show_users) {
- if (find_entry(s->ino, &buf, USERS) > 0) {
- printf(" users:(%s)", buf);
- free(buf);
- }
- }
+ proc_ctx_print(s);
if (show_details)
sock_details_print(s);
--
2.10.0
^ permalink raw reply related
* [iproute PATCH 04/18] ss: Use sockstat->type in all socket types
From: Phil Sutter @ 2016-11-11 13:10 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20161111131014.21865-1-phil@nwl.cc>
Unix sockets used that field already to hold info about the socket type.
By replicating this approach in all other socket types, we can get rid
of protocol parameter in inet_stats_print() and have sock_state_print()
figure things out by itself.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
misc/ss.c | 124 +++++++++++++++++++++++++++++++++++---------------------------
1 file changed, 70 insertions(+), 54 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index d0b4f879c4d9f..e6053467aaf82 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -793,8 +793,57 @@ struct tcpstat {
struct tcp_bbr_info *bbr_info;
};
-static void sock_state_print(struct sockstat *s, const char *sock_name)
+static const char *unix_netid_name(int type)
+{
+ switch (type) {
+ case SOCK_STREAM:
+ return "u_str";
+ case SOCK_SEQPACKET:
+ return "u_seq";
+ case SOCK_DGRAM:
+ default:
+ return "u_dgr";
+ }
+}
+
+static char *proto_name(int protocol)
{
+ switch (protocol) {
+ case 0:
+ return "raw";
+ case IPPROTO_UDP:
+ return "udp";
+ case IPPROTO_TCP:
+ return "tcp";
+ case IPPROTO_DCCP:
+ return "dccp";
+ }
+
+ return "???";
+}
+
+static void sock_state_print(struct sockstat *s)
+{
+ const char *sock_name;
+
+ switch (s->local.family) {
+ case AF_UNIX:
+ sock_name = unix_netid_name(s->type);
+ break;
+ case AF_INET:
+ case AF_INET6:
+ sock_name = proto_name(s->type);
+ break;
+ case AF_PACKET:
+ sock_name = s->type == SOCK_RAW ? "p_raw" : "p_dgr";
+ break;
+ case AF_NETLINK:
+ sock_name = "nl";
+ break;
+ default:
+ sock_name = "unknown";
+ }
+
if (netid_width)
printf("%-*s ", netid_width, sock_name);
if (state_width)
@@ -1670,27 +1719,11 @@ void *parse_markmask(const char *markmask)
return res;
}
-static char *proto_name(int protocol)
-{
- switch (protocol) {
- case 0:
- return "raw";
- case IPPROTO_UDP:
- return "udp";
- case IPPROTO_TCP:
- return "tcp";
- case IPPROTO_DCCP:
- return "dccp";
- }
-
- return "???";
-}
-
-static void inet_stats_print(struct sockstat *s, int protocol)
+static void inet_stats_print(struct sockstat *s)
{
char *buf = NULL;
- sock_state_print(s, proto_name(protocol));
+ sock_state_print(s);
inet_addr_print(&s->local, s->lport, s->iface);
inet_addr_print(&s->remote, s->rport, 0);
@@ -1948,8 +1981,9 @@ static int tcp_show_line(char *line, const struct filter *f, int family)
s.rto = (double)rto;
s.ssthresh = s.ssthresh == -1 ? 0 : s.ssthresh;
s.rto = s.rto != 3 * hz ? s.rto / hz : 0;
+ s.ss.type = IPPROTO_TCP;
- inet_stats_print(&s.ss, IPPROTO_TCP);
+ inet_stats_print(&s.ss);
if (show_options)
tcp_timer_print(&s);
@@ -2201,8 +2235,7 @@ static void parse_diag_msg(struct nlmsghdr *nlh, struct sockstat *s)
}
static int inet_show_sock(struct nlmsghdr *nlh,
- struct sockstat *s,
- int protocol)
+ struct sockstat *s)
{
struct rtattr *tb[INET_DIAG_MAX+1];
struct inet_diag_msg *r = NLMSG_DATA(nlh);
@@ -2211,9 +2244,9 @@ static int inet_show_sock(struct nlmsghdr *nlh,
nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
if (tb[INET_DIAG_PROTOCOL])
- protocol = *(__u8 *)RTA_DATA(tb[INET_DIAG_PROTOCOL]);
+ s->type = *(__u8 *)RTA_DATA(tb[INET_DIAG_PROTOCOL]);
- inet_stats_print(s, protocol);
+ inet_stats_print(s);
if (show_options) {
struct tcpstat t = {};
@@ -2240,7 +2273,7 @@ static int inet_show_sock(struct nlmsghdr *nlh,
}
}
- if (show_mem || (show_tcpinfo && protocol != IPPROTO_UDP)) {
+ if (show_mem || (show_tcpinfo && s->type != IPPROTO_UDP)) {
printf("\n\t");
tcp_show_info(nlh, r, tb);
}
@@ -2414,6 +2447,7 @@ static int show_one_inet_sock(const struct sockaddr_nl *addr,
return 0;
parse_diag_msg(h, &s);
+ s.type = diag_arg->protocol;
if (diag_arg->f->f && run_ssfilter(diag_arg->f->f, &s) == 0)
return 0;
@@ -2428,7 +2462,7 @@ static int show_one_inet_sock(const struct sockaddr_nl *addr,
}
}
- err = inet_show_sock(h, &s, diag_arg->protocol);
+ err = inet_show_sock(h, &s);
if (err < 0)
return err;
@@ -2534,11 +2568,12 @@ static int tcp_show_netlink_file(struct filter *f)
}
parse_diag_msg(h, &s);
+ s.type = IPPROTO_TCP;
if (f && f->f && run_ssfilter(f->f, &s) == 0)
continue;
- err = inet_show_sock(h, &s, IPPROTO_TCP);
+ err = inet_show_sock(h, &s);
if (err < 0)
return err;
}
@@ -2657,7 +2692,8 @@ static int dgram_show_line(char *line, const struct filter *f, int family)
if (n < 9)
opt[0] = 0;
- inet_stats_print(&s, dg_proto == UDP_PROTO ? IPPROTO_UDP : 0);
+ s.type = dg_proto == UDP_PROTO ? IPPROTO_UDP : 0;
+ inet_stats_print(&s);
if (show_details && opt[0])
printf(" opt:\"%s\"", opt);
@@ -2758,25 +2794,6 @@ static void unix_list_free(struct sockstat *list)
}
}
-static const char *unix_netid_name(int type)
-{
- const char *netid;
-
- switch (type) {
- case SOCK_STREAM:
- netid = "u_str";
- break;
- case SOCK_SEQPACKET:
- netid = "u_seq";
- break;
- case SOCK_DGRAM:
- default:
- netid = "u_dgr";
- break;
- }
- return netid;
-}
-
static bool unix_type_skip(struct sockstat *s, struct filter *f)
{
if (s->type == SOCK_STREAM && !(f->dbs&(1<<UNIX_ST_DB)))
@@ -2839,7 +2856,7 @@ static void unix_stats_print(struct sockstat *list, struct filter *f)
continue;
}
- sock_state_print(s, unix_netid_name(s->type));
+ sock_state_print(s);
sock_addr_print(s->name ?: "*", " ",
int_to_str(s->lport, port_name), NULL);
@@ -3058,15 +3075,15 @@ static int packet_stats_print(struct sockstat *s, const struct filter *f)
const char *addr, *port;
char ll_name[16];
+ s->local.family = s->remote.family = AF_PACKET;
+
if (f->f) {
- s->local.family = AF_PACKET;
- s->remote.family = AF_PACKET;
s->local.data[0] = s->prot;
if (run_ssfilter(f->f, s) == 0)
return 1;
}
- sock_state_print(s, s->type == SOCK_RAW ? "p_raw" : "p_dgr");
+ sock_state_print(s);
if (s->prot == 3)
addr = "*";
@@ -3316,10 +3333,9 @@ static int netlink_show_one(struct filter *f,
st.state = SS_CLOSE;
st.rq = rq;
st.wq = wq;
+ st.local.family = st.remote.family = AF_NETLINK;
if (f->f) {
- st.local.family = AF_NETLINK;
- st.remote.family = AF_NETLINK;
st.rport = -1;
st.lport = pid;
st.local.data[0] = prot;
@@ -3327,7 +3343,7 @@ static int netlink_show_one(struct filter *f,
return 1;
}
- sock_state_print(&st, "nl");
+ sock_state_print(&st);
if (resolve_services)
prot_name = nl_proto_n2a(prot, prot_buf, sizeof(prot_buf));
--
2.10.0
^ permalink raw reply related
* Re: BUG() can be hit in tcp_collapse()
From: Vladis Dronov @ 2016-11-11 13:08 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, stable, Marco Grassi
In-Reply-To: <1478808780.8455.23.camel@edumazet-glaptop3.roam.corp.google.com>
Hello, Eric,
> Another sk_filter() is used in tcp v6.
> So the correct patch would be :
Thank you much for your research. I'm happy my report
has resulted as the proposed patch.
Best regards,
Vladis Dronov | Red Hat, Inc. | Product Security Engineer
^ permalink raw reply
* Re: [patch net 2/2] mlxsw: spectrum_router: Correctly dump neighbour activity
From: Ido Schimmel @ 2016-11-11 12:54 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, yotamg, arkadis, idosch, eladr, nogahf, ogerlitz
In-Reply-To: <1478859642-2918-3-git-send-email-jiri@resnulli.us>
On Fri, Nov 11, 2016 at 11:20:42AM +0100, Jiri Pirko wrote:
> From: Arkadi Sharshevsky <arkadis@mellanox.com>
>
> During neighbour activity check the device's table is dumped by multiple
> query requests. The query session should end when the response carries
> less records than requested or when a given record is not full. Current
> code only stops the dumping process if the number of returned records is
> zero, which can result in infinite loop in case of activity.
>
> Fix this by stopping the dumping process according to the above logic.
>
> Fixes: c723c735fa6b ("mlxsw: spectrum_router: Periodically update the kernel's neigh table")
> Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
> .../net/ethernet/mellanox/mlxsw/spectrum_router.c | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> index 040737e..d437457 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> @@ -800,6 +800,26 @@ static void mlxsw_sp_router_neigh_rec_process(struct mlxsw_sp *mlxsw_sp,
> }
> }
>
> +static bool mlxsw_sp_router_rauhtd_is_full(char *rauhtd_pl)
> +{
> + u8 num_rec, last_rec_index, num_entries;
> +
> + num_rec = mlxsw_reg_rauhtd_num_rec_get(rauhtd_pl);
> + last_rec_index = num_rec - 1;
> +
> + if (num_rec < MLXSW_REG_RAUHTD_REC_MAX_NUM)
> + return false;
> + if (mlxsw_reg_rauhtd_rec_type_get(rauhtd_pl, last_rec_index) ==
> + MLXSW_REG_RAUHTD_TYPE_IPV6)
> + return true;
> +
> + num_entries = mlxsw_reg_rauhtd_ipv4_rec_num_entries_get(rauhtd_pl,
> + last_rec_index);
> + if (++num_entries == MLXSW_REG_RAUHTD_IPV4_ENT_PER_REC)
Jiri, I just noticed we have an extra space after the '=='. Can you
please remove it in v2? Sorry for not spotting this earlier.
> + return true;
> + return false;
> +}
> +
> static int mlxsw_sp_router_neighs_update_rauhtd(struct mlxsw_sp *mlxsw_sp)
> {
> char *rauhtd_pl;
> @@ -826,7 +846,7 @@ static int mlxsw_sp_router_neighs_update_rauhtd(struct mlxsw_sp *mlxsw_sp)
> for (i = 0; i < num_rec; i++)
> mlxsw_sp_router_neigh_rec_process(mlxsw_sp, rauhtd_pl,
> i);
> - } while (num_rec);
> + } while (mlxsw_sp_router_rauhtd_is_full(rauhtd_pl));
> rtnl_unlock();
>
> kfree(rauhtd_pl);
> --
> 2.7.4
>
^ permalink raw reply
* Re: [patch net 1/2] mlxsw: spectrum: Fix refcount bug on span entries
From: Ido Schimmel @ 2016-11-11 12:49 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, yotamg, arkadis, idosch, eladr, nogahf, ogerlitz
In-Reply-To: <1478859642-2918-2-git-send-email-jiri@resnulli.us>
On Fri, Nov 11, 2016 at 11:20:41AM +0100, Jiri Pirko wrote:
> From: Yotam Gigi <yotamg@mellanox.com>
>
> When binding port to a newly created span entry, its refcount is set 0
> even though it has a bound port. That leeds to unexpected behaviour when
s/leeds/leads/
> the user tries to delete that port from the span entry.
>
> Change the binding process to increase the refcount of the bound entry
> even if the entry is newly created, and add warning on the process of
> removing bound port from entry when its refcount is 0.
>
> Fixes: 763b4b70afcd3 ("mlxsw: spectrum: Add support in matchall mirror TC offloading")
You only need the first 12 characters.
> Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
> drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
> index 1ec0a4c..d75c1ff 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
> @@ -269,17 +269,18 @@ static struct mlxsw_sp_span_entry
> struct mlxsw_sp_span_entry *span_entry;
>
> span_entry = mlxsw_sp_span_entry_find(port);
> - if (span_entry) {
> - span_entry->ref_count++;
> - return span_entry;
> - }
> + if (!span_entry)
> + span_entry = mlxsw_sp_span_entry_create(port);
>
> - return mlxsw_sp_span_entry_create(port);
> + span_entry->ref_count++;
mlxsw_sp_span_entry_create() can return NULL. You can look at
mlxsw_sp_fib_entry_get() for reference.
> + return span_entry;
> }
>
> static int mlxsw_sp_span_entry_put(struct mlxsw_sp *mlxsw_sp,
> struct mlxsw_sp_span_entry *span_entry)
> {
> + WARN_ON(!span_entry->ref_count);
> +
> if (--span_entry->ref_count == 0)
> mlxsw_sp_span_entry_destroy(mlxsw_sp, span_entry);
> return 0;
> --
> 2.7.4
>
^ permalink raw reply
* Re: [patch net-next 5/8] Introduce sample tc action
From: Simon Horman @ 2016-11-11 12:43 UTC (permalink / raw)
To: Yotam Gigi
Cc: John Fastabend, Jiri Pirko, netdev@vger.kernel.org,
davem@davemloft.net, Ido Schimmel, Elad Raz, Nogah Frankel,
Or Gerlitz, jhs@mojatatu.com, geert+renesas@glider.be,
stephen@networkplumber.org, xiyou.wangcong@gmail.com,
linux@roeck-us.net, roopa@cumulusnetworks.com
In-Reply-To: <DB3PR05MB0764850867353EEB018FCA5FACBB0@DB3PR05MB0764.eurprd05.prod.outlook.com>
On Fri, Nov 11, 2016 at 08:28:50AM +0000, Yotam Gigi wrote:
...
> John, as a result of your question I realized that our hardware does do
> randomized sampling that I was not aware of. I will use the extensibility of
> the API and implement a random keyword, that will be offloaded in our
> hardware. Those changes will be sent on v2.
>
> Eventually, your question was very relevant :) Thanks!
Perhaps I am missing the point but why not just make random the default and
implement the inverse as an extension if it turns out to be needed in
future?
^ permalink raw reply
* [PATCH v2] net: ethernet: ti: davinci_cpdma: free memory while channel destroy
From: Ivan Khoronzhuk @ 2016-11-11 12:39 UTC (permalink / raw)
To: mugunthanvnm, grygorii.strashko, netdev
Cc: linux-omap, linux-kernel, Ivan Khoronzhuk
While create/destroy channel operation memory is not freed. It was
supposed that memory is freed while driver remove. But a channel
can be created and destroyed many times while changing number of
channels with ethtool.
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
Based on net-next/master
drivers/net/ethernet/ti/davinci_cpdma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index 05afc05..07fc92d 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -586,7 +586,7 @@ int cpdma_chan_destroy(struct cpdma_chan *chan)
cpdma_chan_stop(chan);
ctlr->channels[chan->chan_num] = NULL;
ctlr->chan_num--;
-
+ devm_kfree(ctlr->dev, chan);
cpdma_chan_split_pool(ctlr);
spin_unlock_irqrestore(&ctlr->lock, flags);
--
1.9.1
^ permalink raw reply related
* [PATCH] netfilter: x_tables: simplify IS_ERR_OR_NULL to NULL test
From: Julia Lawall @ 2016-11-11 12:32 UTC (permalink / raw)
To: Florian Westphal, David S. Miller
Cc: kernel-janitors, linux-kernel, netdev, coreteam, netfilter-devel,
Hideaki YOSHIFUJI, James Morris, Alexey Kuznetsov,
Jozsef Kadlecsik, Patrick McHardy, Pablo Neira Ayuso,
christophe.jaillet
Since commit 7926dbfa4bc1 ("netfilter: don't use
mutex_lock_interruptible()"), the function xt_find_table_lock can only
return NULL on an error. Simplify the call sites and update the
comment before the function.
The semantic patch that change the code is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression t,e;
@@
t = \(xt_find_table_lock(...)\|
try_then_request_module(xt_find_table_lock(...),...)\)
... when != t=e
- ! IS_ERR_OR_NULL(t)
+ t
@@
expression t,e;
@@
t = \(xt_find_table_lock(...)\|
try_then_request_module(xt_find_table_lock(...),...)\)
... when != t=e
- IS_ERR_OR_NULL(t)
+ !t
@@
expression t,e,e1;
@@
t = \(xt_find_table_lock(...)\|
try_then_request_module(xt_find_table_lock(...),...)\)
... when != t=e
?- t ? PTR_ERR(t) : e1
+ e1
... when any
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
net/ipv4/netfilter/arp_tables.c | 20 ++++++++++----------
net/ipv4/netfilter/ip_tables.c | 20 ++++++++++----------
net/ipv6/netfilter/ip6_tables.c | 20 ++++++++++----------
net/netfilter/x_tables.c | 2 +-
4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index e76ab23..39004da 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -805,7 +805,7 @@ static int get_info(struct net *net, void __user *user,
#endif
t = try_then_request_module(xt_find_table_lock(net, NFPROTO_ARP, name),
"arptable_%s", name);
- if (!IS_ERR_OR_NULL(t)) {
+ if (t) {
struct arpt_getinfo info;
const struct xt_table_info *private = t->private;
#ifdef CONFIG_COMPAT
@@ -834,7 +834,7 @@ static int get_info(struct net *net, void __user *user,
xt_table_unlock(t);
module_put(t->me);
} else
- ret = t ? PTR_ERR(t) : -ENOENT;
+ ret = -ENOENT;
#ifdef CONFIG_COMPAT
if (compat)
xt_compat_unlock(NFPROTO_ARP);
@@ -859,7 +859,7 @@ static int get_entries(struct net *net, struct arpt_get_entries __user *uptr,
get.name[sizeof(get.name) - 1] = '\0';
t = xt_find_table_lock(net, NFPROTO_ARP, get.name);
- if (!IS_ERR_OR_NULL(t)) {
+ if (t) {
const struct xt_table_info *private = t->private;
if (get.size == private->size)
@@ -871,7 +871,7 @@ static int get_entries(struct net *net, struct arpt_get_entries __user *uptr,
module_put(t->me);
xt_table_unlock(t);
} else
- ret = t ? PTR_ERR(t) : -ENOENT;
+ ret = -ENOENT;
return ret;
}
@@ -898,8 +898,8 @@ static int __do_replace(struct net *net, const char *name,
t = try_then_request_module(xt_find_table_lock(net, NFPROTO_ARP, name),
"arptable_%s", name);
- if (IS_ERR_OR_NULL(t)) {
- ret = t ? PTR_ERR(t) : -ENOENT;
+ if (!t) {
+ ret = -ENOENT;
goto free_newinfo_counters_untrans;
}
@@ -1014,8 +1014,8 @@ static int do_add_counters(struct net *net, const void __user *user,
return PTR_ERR(paddc);
t = xt_find_table_lock(net, NFPROTO_ARP, tmp.name);
- if (IS_ERR_OR_NULL(t)) {
- ret = t ? PTR_ERR(t) : -ENOENT;
+ if (!t) {
+ ret = -ENOENT;
goto free;
}
@@ -1404,7 +1404,7 @@ static int compat_get_entries(struct net *net,
xt_compat_lock(NFPROTO_ARP);
t = xt_find_table_lock(net, NFPROTO_ARP, get.name);
- if (!IS_ERR_OR_NULL(t)) {
+ if (t) {
const struct xt_table_info *private = t->private;
struct xt_table_info info;
@@ -1419,7 +1419,7 @@ static int compat_get_entries(struct net *net,
module_put(t->me);
xt_table_unlock(t);
} else
- ret = t ? PTR_ERR(t) : -ENOENT;
+ ret = -ENOENT;
xt_compat_unlock(NFPROTO_ARP);
return ret;
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index de4fa03..46815c8 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -973,7 +973,7 @@ static int get_info(struct net *net, void __user *user,
#endif
t = try_then_request_module(xt_find_table_lock(net, AF_INET, name),
"iptable_%s", name);
- if (!IS_ERR_OR_NULL(t)) {
+ if (t) {
struct ipt_getinfo info;
const struct xt_table_info *private = t->private;
#ifdef CONFIG_COMPAT
@@ -1003,7 +1003,7 @@ static int get_info(struct net *net, void __user *user,
xt_table_unlock(t);
module_put(t->me);
} else
- ret = t ? PTR_ERR(t) : -ENOENT;
+ ret = -ENOENT;
#ifdef CONFIG_COMPAT
if (compat)
xt_compat_unlock(AF_INET);
@@ -1028,7 +1028,7 @@ static int get_info(struct net *net, void __user *user,
get.name[sizeof(get.name) - 1] = '\0';
t = xt_find_table_lock(net, AF_INET, get.name);
- if (!IS_ERR_OR_NULL(t)) {
+ if (t) {
const struct xt_table_info *private = t->private;
if (get.size == private->size)
ret = copy_entries_to_user(private->size,
@@ -1039,7 +1039,7 @@ static int get_info(struct net *net, void __user *user,
module_put(t->me);
xt_table_unlock(t);
} else
- ret = t ? PTR_ERR(t) : -ENOENT;
+ ret = -ENOENT;
return ret;
}
@@ -1064,8 +1064,8 @@ static int get_info(struct net *net, void __user *user,
t = try_then_request_module(xt_find_table_lock(net, AF_INET, name),
"iptable_%s", name);
- if (IS_ERR_OR_NULL(t)) {
- ret = t ? PTR_ERR(t) : -ENOENT;
+ if (!t) {
+ ret = -ENOENT;
goto free_newinfo_counters_untrans;
}
@@ -1180,8 +1180,8 @@ static int get_info(struct net *net, void __user *user,
return PTR_ERR(paddc);
t = xt_find_table_lock(net, AF_INET, tmp.name);
- if (IS_ERR_OR_NULL(t)) {
- ret = t ? PTR_ERR(t) : -ENOENT;
+ if (!t) {
+ ret = -ENOENT;
goto free;
}
@@ -1626,7 +1626,7 @@ struct compat_ipt_get_entries {
xt_compat_lock(AF_INET);
t = xt_find_table_lock(net, AF_INET, get.name);
- if (!IS_ERR_OR_NULL(t)) {
+ if (t) {
const struct xt_table_info *private = t->private;
struct xt_table_info info;
ret = compat_table_info(private, &info);
@@ -1640,7 +1640,7 @@ struct compat_ipt_get_entries {
module_put(t->me);
xt_table_unlock(t);
} else
- ret = t ? PTR_ERR(t) : -ENOENT;
+ ret = -ENOENT;
xt_compat_unlock(AF_INET);
return ret;
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 7eac01d..6ff42b8 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -1003,7 +1003,7 @@ static int get_info(struct net *net, void __user *user,
#endif
t = try_then_request_module(xt_find_table_lock(net, AF_INET6, name),
"ip6table_%s", name);
- if (!IS_ERR_OR_NULL(t)) {
+ if (t) {
struct ip6t_getinfo info;
const struct xt_table_info *private = t->private;
#ifdef CONFIG_COMPAT
@@ -1033,7 +1033,7 @@ static int get_info(struct net *net, void __user *user,
xt_table_unlock(t);
module_put(t->me);
} else
- ret = t ? PTR_ERR(t) : -ENOENT;
+ ret = -ENOENT;
#ifdef CONFIG_COMPAT
if (compat)
xt_compat_unlock(AF_INET6);
@@ -1059,7 +1059,7 @@ static int get_info(struct net *net, void __user *user,
get.name[sizeof(get.name) - 1] = '\0';
t = xt_find_table_lock(net, AF_INET6, get.name);
- if (!IS_ERR_OR_NULL(t)) {
+ if (t) {
struct xt_table_info *private = t->private;
if (get.size == private->size)
ret = copy_entries_to_user(private->size,
@@ -1070,7 +1070,7 @@ static int get_info(struct net *net, void __user *user,
module_put(t->me);
xt_table_unlock(t);
} else
- ret = t ? PTR_ERR(t) : -ENOENT;
+ ret = -ENOENT;
return ret;
}
@@ -1095,8 +1095,8 @@ static int get_info(struct net *net, void __user *user,
t = try_then_request_module(xt_find_table_lock(net, AF_INET6, name),
"ip6table_%s", name);
- if (IS_ERR_OR_NULL(t)) {
- ret = t ? PTR_ERR(t) : -ENOENT;
+ if (!t) {
+ ret = -ENOENT;
goto free_newinfo_counters_untrans;
}
@@ -1210,8 +1210,8 @@ static int get_info(struct net *net, void __user *user,
if (IS_ERR(paddc))
return PTR_ERR(paddc);
t = xt_find_table_lock(net, AF_INET6, tmp.name);
- if (IS_ERR_OR_NULL(t)) {
- ret = t ? PTR_ERR(t) : -ENOENT;
+ if (!t) {
+ ret = -ENOENT;
goto free;
}
@@ -1647,7 +1647,7 @@ struct compat_ip6t_get_entries {
xt_compat_lock(AF_INET6);
t = xt_find_table_lock(net, AF_INET6, get.name);
- if (!IS_ERR_OR_NULL(t)) {
+ if (t) {
const struct xt_table_info *private = t->private;
struct xt_table_info info;
ret = compat_table_info(private, &info);
@@ -1661,7 +1661,7 @@ struct compat_ip6t_get_entries {
module_put(t->me);
xt_table_unlock(t);
} else
- ret = t ? PTR_ERR(t) : -ENOENT;
+ ret = -ENOENT;
xt_compat_unlock(AF_INET6);
return ret;
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index fc49774..ad818e5 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -982,7 +982,7 @@ void xt_free_table_info(struct xt_table_info *info)
}
EXPORT_SYMBOL(xt_free_table_info);
-/* Find table by name, grabs mutex & ref. Returns ERR_PTR() on error. */
+/* Find table by name, grabs mutex & ref. Returns NULL on error. */
struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
const char *name)
{
^ permalink raw reply related
* Re: [PATCH net 2/2] r8152: rx descriptor check
From: Francois Romieu @ 2016-11-11 12:13 UTC (permalink / raw)
To: Hayes Wang; +Cc: netdev, nic_swsd, linux-kernel, linux-usb, mlord
In-Reply-To: <1394712342-15778-228-Taiwan-albertk@realtek.com>
Hayes Wang <hayeswang@realtek.com> :
> For some platforms, the data in memory is not the same with the one
> from the device. That is, the data of memory is unbelievable. The
> check is used to find out this situation.
Invalid packet size corrupted receive descriptors in Realtek's device
reminds of CVE-2009-4537.
Is the silicium of both devices different enough to prevent the same
exploit to happen ?
--
Ueimor
^ permalink raw reply
* Re: question about xt_find_table_lock
From: Julia Lawall @ 2016-11-11 11:58 UTC (permalink / raw)
To: Florian Westphal
Cc: Julia Lawall, pablo, kaber, kadlec, davem, netfilter-devel,
coreteam, netdev, linux-kernel, christophe.jaillet
In-Reply-To: <20161111112307.GA7274@breakpoint.cc>
On Fri, 11 Nov 2016, Florian Westphal wrote:
> Julia Lawall <julia.lawall@lip6.fr> wrote:
> > The function xt_find_table_lock defined in net/netfilter/x_tables.c is
> > preceeded by a comment that says that it returns ERR_PTR() on error. But
> > looking at the definition, I only see occurrences of return NULL and
> > returns of pointers that have previously been dereferenced. Is it the
> > code or the documentation that is incorrect? The call sites seem to be
> > using IS_ERR_OR_NULL. Is there a plan to return ERR_PTR values in the
> > future?
>
> It used to return ERR_PTR, see:
>
> commit 7926dbfa4bc14e27f4e18a6184a031a1c1e077dc
> netfilter: don't use mutex_lock_interruptible()
>
> So the comment isn't correct anymore and callers could test vs NULL.
Thanks for the quick feedback.
julia
^ permalink raw reply
* Re: question about xt_find_table_lock
From: Florian Westphal @ 2016-11-11 11:23 UTC (permalink / raw)
To: Julia Lawall
Cc: pablo, kaber, kadlec, davem, netfilter-devel, coreteam, netdev,
linux-kernel, christophe.jaillet
In-Reply-To: <alpine.DEB.2.20.1611111141380.2074@hadrien>
Julia Lawall <julia.lawall@lip6.fr> wrote:
> The function xt_find_table_lock defined in net/netfilter/x_tables.c is
> preceeded by a comment that says that it returns ERR_PTR() on error. But
> looking at the definition, I only see occurrences of return NULL and
> returns of pointers that have previously been dereferenced. Is it the
> code or the documentation that is incorrect? The call sites seem to be
> using IS_ERR_OR_NULL. Is there a plan to return ERR_PTR values in the
> future?
It used to return ERR_PTR, see:
commit 7926dbfa4bc14e27f4e18a6184a031a1c1e077dc
netfilter: don't use mutex_lock_interruptible()
So the comment isn't correct anymore and callers could test vs NULL.
^ permalink raw reply
* Re: [PATCH net-next v2 2/7] vxlan: simplify exception handling
From: Jiri Benc @ 2016-11-11 11:14 UTC (permalink / raw)
To: Pravin Shelar; +Cc: Linux Kernel Network Developers
In-Reply-To: <CAOrHB_AGV4x4G4QYFAaWNYgckvkDAS-prp65CgXfTqB4KoxHTw@mail.gmail.com>
On Thu, 10 Nov 2016 11:21:19 -0800, Pravin Shelar wrote:
> One additional variable is not bad but look at what has happened in
> vxlan_xmit_one(). There are already more than 20 variables defined. It
> is hard to read code in this case.
I agree that the function is horrible.
What I was thinking about was separating the vxlan data and control
plane. The vxlan data plane would perform encapsulation and
decapsulation based on lwtunnel infrastructure and the rest of the
"classical" vxlan would be just one of the users of that. Basically
replacing vxlan_rdst by ip_tunnel_info, among other things.
That would make the vxlan code much much cleaner.
> anyways I can add another variable to the function. I do not feel that
> strongly about this.
Me neither, actually. I prefer another variable but I won't oppose the
patchset just based on that if you choose differently.
Thanks,
Jiri
^ permalink raw reply
* Re: [mm PATCH v3 12/23] arch/nios2: Add option to skip DMA sync as a part of map and unmap
From: Tobias Klauser @ 2016-11-11 10:58 UTC (permalink / raw)
To: Alexander Duyck; +Cc: linux-mm, akpm, Ley Foon Tan, linux-kernel, netdev
In-Reply-To: <20161110113518.76501.52225.stgit@ahduyck-blue-test.jf.intel.com>
On 2016-11-10 at 12:35:18 +0100, Alexander Duyck <alexander.h.duyck@intel.com> wrote:
> This change allows us to pass DMA_ATTR_SKIP_CPU_SYNC which allows us to
> avoid invoking cache line invalidation if the driver will just handle it
> via a sync_for_cpu or sync_for_device call.
>
> Cc: Ley Foon Tan <lftan@altera.com>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Reviewed-by: Tobias Klauser <tklauser@distanz.ch>
^ permalink raw reply
* question about xt_find_table_lock
From: Julia Lawall @ 2016-11-11 10:49 UTC (permalink / raw)
To: pablo, kaber, kadlec, davem
Cc: netfilter-devel, coreteam, netdev, linux-kernel,
christophe.jaillet
The function xt_find_table_lock defined in net/netfilter/x_tables.c is
preceeded by a comment that says that it returns ERR_PTR() on error. But
looking at the definition, I only see occurrences of return NULL and
returns of pointers that have previously been dereferenced. Is it the
code or the documentation that is incorrect? The call sites seem to be
using IS_ERR_OR_NULL. Is there a plan to return ERR_PTR values in the
future?
julia
^ permalink raw reply
* [patch net-next] mlxsw: reg: Fix pwm_frequency field size in MFCR register
From: Jiri Pirko @ 2016-11-11 10:22 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, nogahf, arkadis, ogerlitz
From: Jiri Pirko <jiri@mellanox.com>
The field is 7bit long. Fix it.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/reg.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h
index 0936b4a..b5ab81a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h
@@ -4424,7 +4424,7 @@ enum mlxsw_reg_mfcr_pwm_frequency {
* Controls the frequency of the PWM signal.
* Access: RW
*/
-MLXSW_ITEM32(reg, mfcr, pwm_frequency, 0x00, 0, 6);
+MLXSW_ITEM32(reg, mfcr, pwm_frequency, 0x00, 0, 7);
#define MLXSW_MFCR_TACHOS_MAX 10
--
2.7.4
^ permalink raw reply related
* [patch net 2/2] mlxsw: spectrum_router: Correctly dump neighbour activity
From: Jiri Pirko @ 2016-11-11 10:20 UTC (permalink / raw)
To: netdev; +Cc: davem, yotamg, arkadis, idosch, eladr, nogahf, ogerlitz
In-Reply-To: <1478859642-2918-1-git-send-email-jiri@resnulli.us>
From: Arkadi Sharshevsky <arkadis@mellanox.com>
During neighbour activity check the device's table is dumped by multiple
query requests. The query session should end when the response carries
less records than requested or when a given record is not full. Current
code only stops the dumping process if the number of returned records is
zero, which can result in infinite loop in case of activity.
Fix this by stopping the dumping process according to the above logic.
Fixes: c723c735fa6b ("mlxsw: spectrum_router: Periodically update the kernel's neigh table")
Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
.../net/ethernet/mellanox/mlxsw/spectrum_router.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 040737e..d437457 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -800,6 +800,26 @@ static void mlxsw_sp_router_neigh_rec_process(struct mlxsw_sp *mlxsw_sp,
}
}
+static bool mlxsw_sp_router_rauhtd_is_full(char *rauhtd_pl)
+{
+ u8 num_rec, last_rec_index, num_entries;
+
+ num_rec = mlxsw_reg_rauhtd_num_rec_get(rauhtd_pl);
+ last_rec_index = num_rec - 1;
+
+ if (num_rec < MLXSW_REG_RAUHTD_REC_MAX_NUM)
+ return false;
+ if (mlxsw_reg_rauhtd_rec_type_get(rauhtd_pl, last_rec_index) ==
+ MLXSW_REG_RAUHTD_TYPE_IPV6)
+ return true;
+
+ num_entries = mlxsw_reg_rauhtd_ipv4_rec_num_entries_get(rauhtd_pl,
+ last_rec_index);
+ if (++num_entries == MLXSW_REG_RAUHTD_IPV4_ENT_PER_REC)
+ return true;
+ return false;
+}
+
static int mlxsw_sp_router_neighs_update_rauhtd(struct mlxsw_sp *mlxsw_sp)
{
char *rauhtd_pl;
@@ -826,7 +846,7 @@ static int mlxsw_sp_router_neighs_update_rauhtd(struct mlxsw_sp *mlxsw_sp)
for (i = 0; i < num_rec; i++)
mlxsw_sp_router_neigh_rec_process(mlxsw_sp, rauhtd_pl,
i);
- } while (num_rec);
+ } while (mlxsw_sp_router_rauhtd_is_full(rauhtd_pl));
rtnl_unlock();
kfree(rauhtd_pl);
--
2.7.4
^ permalink raw reply related
* [patch net 1/2] mlxsw: spectrum: Fix refcount bug on span entries
From: Jiri Pirko @ 2016-11-11 10:20 UTC (permalink / raw)
To: netdev; +Cc: davem, yotamg, arkadis, idosch, eladr, nogahf, ogerlitz
In-Reply-To: <1478859642-2918-1-git-send-email-jiri@resnulli.us>
From: Yotam Gigi <yotamg@mellanox.com>
When binding port to a newly created span entry, its refcount is set 0
even though it has a bound port. That leeds to unexpected behaviour when
the user tries to delete that port from the span entry.
Change the binding process to increase the refcount of the bound entry
even if the entry is newly created, and add warning on the process of
removing bound port from entry when its refcount is 0.
Fixes: 763b4b70afcd3 ("mlxsw: spectrum: Add support in matchall mirror TC offloading")
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 1ec0a4c..d75c1ff 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -269,17 +269,18 @@ static struct mlxsw_sp_span_entry
struct mlxsw_sp_span_entry *span_entry;
span_entry = mlxsw_sp_span_entry_find(port);
- if (span_entry) {
- span_entry->ref_count++;
- return span_entry;
- }
+ if (!span_entry)
+ span_entry = mlxsw_sp_span_entry_create(port);
- return mlxsw_sp_span_entry_create(port);
+ span_entry->ref_count++;
+ return span_entry;
}
static int mlxsw_sp_span_entry_put(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_span_entry *span_entry)
{
+ WARN_ON(!span_entry->ref_count);
+
if (--span_entry->ref_count == 0)
mlxsw_sp_span_entry_destroy(mlxsw_sp, span_entry);
return 0;
--
2.7.4
^ permalink raw reply related
* [patch net 0/2] mlxsw: Couple of fixes
From: Jiri Pirko @ 2016-11-11 10:20 UTC (permalink / raw)
To: netdev; +Cc: davem, yotamg, arkadis, idosch, eladr, nogahf, ogerlitz
From: Jiri Pirko <jiri@mellanox.com>
Please, queue-up both for stable. Thanks!
Arkadi Sharshevsky (1):
mlxsw: spectrum_router: Correctly dump neighbour activity
Yotam Gigi (1):
mlxsw: spectrum: Fix refcount bug on span entries
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 11 ++++++-----
.../net/ethernet/mellanox/mlxsw/spectrum_router.c | 22 +++++++++++++++++++++-
2 files changed, 27 insertions(+), 6 deletions(-)
--
2.7.4
^ permalink raw reply
* Re: [PATCH] Revert "include/uapi/linux/atm_zatm.h: include linux/time.h"
From: Mikko Rapeli @ 2016-11-11 9:12 UTC (permalink / raw)
To: Mike Frysinger; +Cc: netdev, David S. Miller, Arnd Bergmann
In-Reply-To: <20161111000839.23267-1-vapier@gentoo.org>
Hi,
On Thu, Nov 10, 2016 at 07:08:39PM -0500, Mike Frysinger wrote:
> This reverts commit cf00713a655d ("include/uapi/linux/atm_zatm.h: include
> linux/time.h").
>
> This attempted to fix userspace breakage that no longer existed when
> the patch was merged. Almost one year earlier, commit 70ba07b675b5
> ("atm: remove 'struct zatm_t_hist'") deleted the struct in question.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Yep, sorry about this. My development branches are living for too long and
I should check each patch again before submitting. Simply rebasing is too easy.
Maybe Arnd could have spotted this earlier but scripts/get_maintainer.pl
didn't add him to Cc.
> After this patch was merged, we now have to deal with people being
> unable to include this header in conjunction with standard C library
> headers like stdlib.h (which linux-atm does). Example breakage:
> x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../.. -I./../q2931 -I./../saal \
> -I. -DCPPFLAGS_TEST -I../../src/include -O2 -march=native -pipe -g \
> -frecord-gcc-switches -freport-bug -Wimplicit-function-declaration \
> -Wnonnull -Wstrict-aliasing -Wparentheses -Warray-bounds \
> -Wfree-nonheap-object -Wreturn-local-addr -fno-strict-aliasing -Wall \
> -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -c zntune.c
> In file included from /usr/include/linux/atm_zatm.h:17:0,
> from zntune.c:17:
> /usr/include/linux/time.h:9:8: error: redefinition of ‘struct timespec’
> struct timespec {
> ^
> In file included from /usr/include/sys/select.h:43:0,
> from /usr/include/sys/types.h:219,
> from /usr/include/stdlib.h:314,
> from zntune.c:9:
> /usr/include/time.h:120:8: note: originally defined here
> struct timespec
> ^
Well, this would help with the linux/time.h and glibc time.h conflicts:
https://patchwork.kernel.org/patch/9294305/
if linux/time.h is included after <time.h>.
Unfortunately I don't know when or if ever that will be applied.
-Mikko
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> include/uapi/linux/atm_zatm.h | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/include/uapi/linux/atm_zatm.h b/include/uapi/linux/atm_zatm.h
> index 5cd4d4d2dd1d..9c9c6ad55f14 100644
> --- a/include/uapi/linux/atm_zatm.h
> +++ b/include/uapi/linux/atm_zatm.h
> @@ -14,7 +14,6 @@
>
> #include <linux/atmapi.h>
> #include <linux/atmioc.h>
> -#include <linux/time.h>
>
> #define ZATM_GETPOOL _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc)
> /* get pool statistics */
> --
> 2.9.0
>
^ permalink raw reply
* RE: [patch net-next 5/8] Introduce sample tc action
From: Yotam Gigi @ 2016-11-11 8:28 UTC (permalink / raw)
To: John Fastabend, Jiri Pirko, netdev@vger.kernel.org
Cc: davem@davemloft.net, Ido Schimmel, Elad Raz, Nogah Frankel,
Or Gerlitz, jhs@mojatatu.com, geert+renesas@glider.be,
stephen@networkplumber.org, xiyou.wangcong@gmail.com,
linux@roeck-us.net, roopa@cumulusnetworks.com
In-Reply-To: <5824CCB0.4090302@gmail.com>
>-----Original Message-----
>From: Yotam Gigi
>Sent: Thursday, November 10, 2016 9:59 PM
>To: 'John Fastabend' <john.fastabend@gmail.com>; Jiri Pirko <jiri@resnulli.us>;
>netdev@vger.kernel.org
>Cc: davem@davemloft.net; Ido Schimmel <idosch@mellanox.com>; Elad Raz
><eladr@mellanox.com>; Nogah Frankel <nogahf@mellanox.com>; Or Gerlitz
><ogerlitz@mellanox.com>; jhs@mojatatu.com; geert+renesas@glider.be;
>stephen@networkplumber.org; xiyou.wangcong@gmail.com; linux@roeck-us.net;
>roopa@cumulusnetworks.com
>Subject: RE: [patch net-next 5/8] Introduce sample tc action
>
>
>
>>-----Original Message-----
>>From: John Fastabend [mailto:john.fastabend@gmail.com]
>>Sent: Thursday, November 10, 2016 9:38 PM
>>To: Jiri Pirko <jiri@resnulli.us>; netdev@vger.kernel.org
>>Cc: davem@davemloft.net; Yotam Gigi <yotamg@mellanox.com>; Ido Schimmel
>><idosch@mellanox.com>; Elad Raz <eladr@mellanox.com>; Nogah Frankel
>><nogahf@mellanox.com>; Or Gerlitz <ogerlitz@mellanox.com>;
>>jhs@mojatatu.com; geert+renesas@glider.be; stephen@networkplumber.org;
>>xiyou.wangcong@gmail.com; linux@roeck-us.net; roopa@cumulusnetworks.com
>>Subject: Re: [patch net-next 5/8] Introduce sample tc action
>>
>>On 16-11-10 11:35 AM, John Fastabend wrote:
>>> On 16-11-10 03:23 AM, Jiri Pirko wrote:
>>>> From: Yotam Gigi <yotamg@mellanox.com>
>>>>
>>>> This action allow the user to sample traffic matched by tc classifier.
>>>> The sampling consists of choosing packets randomly, truncating them,
>>>> adding some informative metadata regarding the interface and the original
>>>> packet size and mark them with specific mark, to allow further tc rules to
>>>> match and process. The marked sample packets are then injected into the
>>>> device ingress qdisc using netif_receive_skb.
>>>>
>>>> The packets metadata is packed using the ife encapsulation protocol, and
>>>> the outer packet's ethernet dest, source and eth_type, along with the
>>>> rate, mark and the optional truncation size can be configured from
>>>> userspace.
>>>>
>>>> Example:
>>>> To sample ingress traffic from interface eth1, and redirect the sampled
>>>> the sampled packets to interface dummy0, one may use the commands:
>>>>
>>>> tc qdisc add dev eth1 handle ffff: ingress
>>>>
>>>> tc filter add dev eth1 parent ffff: \
>>>> matchall action sample rate 12 mark 17
>>>>
>>>> tc filter add parent ffff: dev eth1 protocol all \
>>>> u32 match mark 17 0xff \
>>>> action mirred egress redirect dev dummy0
>>>>
>>>> Where the first command adds an ingress qdisc and the second starts
>>>> sampling every 12'th packet on dev eth1 and marks the sampled packets with
>>>> 17. The third command catches the sampled packets, which are marked with
>>>> 17, and redirects them to dev dummy0.
>>>
>>> The sampling algorithm was not randomized based on the above commit
>>> log? It really needs to be for all the reasons Roopa mentioned earlier.
>>> Did I miss some email on why it didn't get implemented?
>>>
>>> Also there was an indication the already is actually implemented
>>> correctly so don't we need the hw/sw to behave the same. The whole
>>> argument about sw/hw parity, etc.
>>
>>sorry bit of a typo there corrected 2nd paragraph here...
>>
>>Also there was an indication the hardware is already implemented \
>>correctly so don't we need the hw/sw to behave the same. The argument
>>about sw/hw parity, etc.
>
>Our hardware currently does not support sampling with random behavior, so
>we did implement it in software too.
>
>But, the API is extensible and it is possible to add a random keyword to
>the tc action to allow random sampling. In that case, the keyword will be
>implemented in sw only and our driver will fail offloading it.
>
John, as a result of your question I realized that our hardware does do
randomized sampling that I was not aware of. I will use the extensibility of
the API and implement a random keyword, that will be offloaded in our
hardware. Those changes will be sent on v2.
Eventually, your question was very relevant :) Thanks!
>>
>>>
>>>>
>>>> Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
>>>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>>>> ---
>>>
^ permalink raw reply
* [PATCH net-next v7 09/10] arch/powerpc: Enable FSL_FMAN
From: Madalin Bucur @ 2016-11-11 8:20 UTC (permalink / raw)
To: netdev
Cc: linuxppc-dev, linux-kernel, davem, oss, ppc, joe, pebolle,
joakim.tjernlund
In-Reply-To: <1478852407-27420-1-git-send-email-madalin.bucur@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
arch/powerpc/configs/dpaa.config | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/configs/dpaa.config b/arch/powerpc/configs/dpaa.config
index f124ee1..9ad9bc0 100644
--- a/arch/powerpc/configs/dpaa.config
+++ b/arch/powerpc/configs/dpaa.config
@@ -1,2 +1,3 @@
CONFIG_FSL_DPAA=y
CONFIG_FSL_PAMU=y
+CONFIG_FSL_FMAN=y
--
2.1.0
^ permalink raw reply related
* [PATCH net-next v7 08/10] arch/powerpc: Enable FSL_PAMU
From: Madalin Bucur @ 2016-11-11 8:20 UTC (permalink / raw)
To: netdev
Cc: linuxppc-dev, linux-kernel, davem, oss, ppc, joe, pebolle,
joakim.tjernlund
In-Reply-To: <1478852407-27420-1-git-send-email-madalin.bucur@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
arch/powerpc/configs/dpaa.config | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/configs/dpaa.config b/arch/powerpc/configs/dpaa.config
index efa99c0..f124ee1 100644
--- a/arch/powerpc/configs/dpaa.config
+++ b/arch/powerpc/configs/dpaa.config
@@ -1 +1,2 @@
CONFIG_FSL_DPAA=y
+CONFIG_FSL_PAMU=y
--
2.1.0
^ permalink raw reply related
* [PATCH net-next v7 10/10] arch/powerpc: Enable dpaa_eth
From: Madalin Bucur @ 2016-11-11 8:20 UTC (permalink / raw)
To: netdev
Cc: linuxppc-dev, linux-kernel, davem, oss, ppc, joe, pebolle,
joakim.tjernlund
In-Reply-To: <1478852407-27420-1-git-send-email-madalin.bucur@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
arch/powerpc/configs/dpaa.config | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/configs/dpaa.config b/arch/powerpc/configs/dpaa.config
index 9ad9bc0..2fe76f5 100644
--- a/arch/powerpc/configs/dpaa.config
+++ b/arch/powerpc/configs/dpaa.config
@@ -1,3 +1,4 @@
CONFIG_FSL_DPAA=y
CONFIG_FSL_PAMU=y
CONFIG_FSL_FMAN=y
+CONFIG_FSL_DPAA_ETH=y
--
2.1.0
^ 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