* [PATCH iproute2 13/22] tc/class: make filter variables static
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <20181115223640.411-1-stephen@networkplumber.org>
Only used in this file.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
tc/tc_class.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tc/tc_class.c b/tc/tc_class.c
index 7e4e17fd7f39..7ac700d7ab31 100644
--- a/tc/tc_class.c
+++ b/tc/tc_class.c
@@ -153,9 +153,9 @@ static int tc_class_modify(int cmd, unsigned int flags, int argc, char **argv)
return 0;
}
-int filter_ifindex;
-__u32 filter_qdisc;
-__u32 filter_classid;
+static int filter_ifindex;
+static __u32 filter_qdisc;
+static __u32 filter_classid;
static void graph_node_add(__u32 parent_id, __u32 id, void *data,
int len)
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2 11/22] tc: drop unused name_to_id function
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <20181115223640.411-1-stephen@networkplumber.org>
Not used in current code.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
include/names.h | 1 -
lib/names.c | 28 ----------------------------
2 files changed, 29 deletions(-)
diff --git a/include/names.h b/include/names.h
index 3e5d3b146a23..2fcaacc398d4 100644
--- a/include/names.h
+++ b/include/names.h
@@ -22,6 +22,5 @@ int db_names_load(struct db_names *db, const char *path);
void db_names_free(struct db_names *db);
char *id_to_name(struct db_names *db, int id, char *name);
-int name_to_id(struct db_names *db, int *id, const char *name);
#endif
diff --git a/lib/names.c b/lib/names.c
index fbd6503f22d4..b46ea7910946 100644
--- a/lib/names.c
+++ b/lib/names.c
@@ -150,31 +150,3 @@ char *id_to_name(struct db_names *db, int id, char *name)
snprintf(name, IDNAME_MAX, "%d", id);
return NULL;
}
-
-int name_to_id(struct db_names *db, int *id, const char *name)
-{
- struct db_entry *entry;
- int i;
-
- if (!db)
- return -1;
-
- if (db->cached && strcmp(db->cached->name, name) == 0) {
- *id = db->cached->id;
- return 0;
- }
-
- for (i = 0; i < db->size; i++) {
- entry = db->hash[i];
- while (entry && strcmp(entry->name, name))
- entry = entry->next;
-
- if (entry) {
- db->cached = entry;
- *id = entry->id;
- return 0;
- }
- }
-
- return -1;
-}
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2 12/22] tipc: make cmd_find static
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <20181115223640.411-1-stephen@networkplumber.org>
Function only used in one file.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
tipc/cmdl.c | 2 +-
tipc/cmdl.h | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/tipc/cmdl.c b/tipc/cmdl.c
index 4a2f4fd92f48..f2f259cc5320 100644
--- a/tipc/cmdl.c
+++ b/tipc/cmdl.c
@@ -17,7 +17,7 @@
#include "cmdl.h"
-const struct cmd *find_cmd(const struct cmd *cmds, char *str)
+static const struct cmd *find_cmd(const struct cmd *cmds, char *str)
{
const struct cmd *c;
const struct cmd *match = NULL;
diff --git a/tipc/cmdl.h b/tipc/cmdl.h
index d37239f85690..03db359956e6 100644
--- a/tipc/cmdl.h
+++ b/tipc/cmdl.h
@@ -54,6 +54,4 @@ char *shift_cmdl(struct cmdl *cmdl);
int run_cmd(struct nlmsghdr *nlh, const struct cmd *caller,
const struct cmd *cmds, struct cmdl *cmdl, void *data);
-const struct cmd *find_cmd(const struct cmd *cmds, char *str);
-
#endif
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2 10/22] ipxfrm: make local functions static
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <20181115223640.411-1-stephen@networkplumber.org>
Make functions only used in ipxfrm.c static.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
ip/ipxfrm.c | 11 ++++++-----
ip/xfrm.h | 9 ---------
ip/xfrm_monitor.c | 2 +-
3 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
index 17ab4abef4be..2dea4e37f209 100644
--- a/ip/ipxfrm.c
+++ b/ip/ipxfrm.c
@@ -186,7 +186,7 @@ const char *strxf_algotype(int type)
return str;
}
-const char *strxf_mask8(__u8 mask)
+static const char *strxf_mask8(__u8 mask)
{
static char str[16];
const int sn = sizeof(mask) * 8 - 1;
@@ -209,7 +209,7 @@ const char *strxf_mask32(__u32 mask)
return str;
}
-const char *strxf_share(__u8 share)
+static const char *strxf_share(__u8 share)
{
static char str[32];
@@ -270,7 +270,7 @@ const char *strxf_ptype(__u8 ptype)
return str;
}
-void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id,
+static void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id,
__u8 mode, __u32 reqid, __u16 family, int force_spi,
FILE *fp, const char *prefix, const char *title)
{
@@ -337,7 +337,8 @@ static const char *strxf_limit(__u64 limit)
return str;
}
-void xfrm_stats_print(struct xfrm_stats *s, FILE *fp, const char *prefix)
+static void xfrm_stats_print(struct xfrm_stats *s, FILE *fp,
+ const char *prefix)
{
if (prefix)
fputs(prefix, fp);
@@ -371,7 +372,7 @@ static const char *strxf_time(__u64 time)
return str;
}
-void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg,
+static void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg,
struct xfrm_lifetime_cur *cur,
FILE *fp, const char *prefix)
{
diff --git a/ip/xfrm.h b/ip/xfrm.h
index 3b158ad71c13..72390d79cfb5 100644
--- a/ip/xfrm.h
+++ b/ip/xfrm.h
@@ -118,18 +118,9 @@ int xfrm_algotype_getbyname(char *name);
int xfrm_parse_mark(struct xfrm_mark *mark, int *argcp, char ***argvp);
const char *strxf_xfrmproto(__u8 proto);
const char *strxf_algotype(int type);
-const char *strxf_mask8(__u8 mask);
const char *strxf_mask32(__u32 mask);
-const char *strxf_share(__u8 share);
const char *strxf_proto(__u8 proto);
const char *strxf_ptype(__u8 ptype);
-void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id,
- __u8 mode, __u32 reqid, __u16 family, int force_spi,
- FILE *fp, const char *prefix, const char *title);
-void xfrm_stats_print(struct xfrm_stats *s, FILE *fp, const char *prefix);
-void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg,
- struct xfrm_lifetime_cur *cur,
- FILE *fp, const char *prefix);
void xfrm_selector_print(struct xfrm_selector *sel, __u16 family,
FILE *fp, const char *prefix);
void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c
index eb07af17cadf..76905ed3f1e1 100644
--- a/ip/xfrm_monitor.c
+++ b/ip/xfrm_monitor.c
@@ -34,7 +34,7 @@
#include "ip_common.h"
static void usage(void) __attribute__((noreturn));
-int listen_all_nsid;
+static int listen_all_nsid;
static void usage(void)
{
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2 09/22] ipmonitor: make local variable static
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <20181115223640.411-1-stephen@networkplumber.org>
prefix_banner only used in one file.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
ip/ipmonitor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index 9d5ac2b5e4d2..743632cc5569 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -24,7 +24,7 @@
#include "ip_common.h"
static void usage(void) __attribute__((noreturn));
-int prefix_banner;
+static int prefix_banner;
int listen_all_nsid;
static void usage(void)
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2 08/22] ip: make flag names const/static
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <20181115223640.411-1-stephen@networkplumber.org>
The table of filter flags is only used in ipaddress
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
ip/ipaddress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index cd8cc76a3473..2671c4e162e3 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1149,7 +1149,7 @@ static unsigned int get_ifa_flags(struct ifaddrmsg *ifa,
}
/* Mapping from argument to address flag mask */
-struct {
+static const struct {
const char *name;
unsigned long value;
} ifa_flag_names[] = {
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2 07/22] bridge: make local variables static
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <20181115223640.411-1-stephen@networkplumber.org>
enable_color and set_color_palette only used here.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
bridge/bridge.c | 5 ++---
bridge/monitor.c | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/bridge/bridge.c b/bridge/bridge.c
index ac4d6a14f510..389f1bd5382b 100644
--- a/bridge/bridge.c
+++ b/bridge/bridge.c
@@ -23,12 +23,11 @@ int preferred_family = AF_UNSPEC;
int oneline;
int show_stats;
int show_details;
-int show_pretty;
-int color;
+static int color;
int compress_vlans;
int json;
int timestamp;
-char *batch_file;
+static const char *batch_file;
int force;
static void usage(void) __attribute__((noreturn));
diff --git a/bridge/monitor.c b/bridge/monitor.c
index 82bc6b407a06..708a1bd2ccb0 100644
--- a/bridge/monitor.c
+++ b/bridge/monitor.c
@@ -27,7 +27,7 @@
static void usage(void) __attribute__((noreturn));
-int prefix_banner;
+static int prefix_banner;
static void usage(void)
{
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2 06/22] genl: remove dead code
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <20181115223640.411-1-stephen@networkplumber.org>
The function genl_ctrl_resolve_family is defined but never used
in current code.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
genl/ctrl.c | 71 -----------------------------------------------
genl/genl_utils.h | 2 --
2 files changed, 73 deletions(-)
diff --git a/genl/ctrl.c b/genl/ctrl.c
index 6133336ab435..0fb464b01cfb 100644
--- a/genl/ctrl.c
+++ b/genl/ctrl.c
@@ -38,77 +38,6 @@ static int usage(void)
return -1;
}
-int genl_ctrl_resolve_family(const char *family)
-{
- struct rtnl_handle rth;
- int ret = 0;
- struct {
- struct nlmsghdr n;
- struct genlmsghdr g;
- char buf[4096];
- } req = {
- .n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN),
- .n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK,
- .n.nlmsg_type = GENL_ID_CTRL,
- .g.cmd = CTRL_CMD_GETFAMILY,
- };
- struct nlmsghdr *nlh = &req.n;
- struct genlmsghdr *ghdr = &req.g;
- struct nlmsghdr *answer = NULL;
-
- if (rtnl_open_byproto(&rth, 0, NETLINK_GENERIC) < 0) {
- fprintf(stderr, "Cannot open generic netlink socket\n");
- exit(1);
- }
-
- addattr_l(nlh, 128, CTRL_ATTR_FAMILY_NAME, family, strlen(family) + 1);
-
- if (rtnl_talk(&rth, nlh, &answer) < 0) {
- fprintf(stderr, "Error talking to the kernel\n");
- goto errout;
- }
-
- {
- struct rtattr *tb[CTRL_ATTR_MAX + 1];
- int len = answer->nlmsg_len;
- struct rtattr *attrs;
-
- if (answer->nlmsg_type != GENL_ID_CTRL) {
- fprintf(stderr, "Not a controller message, nlmsg_len=%d "
- "nlmsg_type=0x%x\n", answer->nlmsg_len, answer->nlmsg_type);
- goto errout;
- }
-
- if (ghdr->cmd != CTRL_CMD_NEWFAMILY) {
- fprintf(stderr, "Unknown controller command %d\n", ghdr->cmd);
- goto errout;
- }
-
- len -= NLMSG_LENGTH(GENL_HDRLEN);
-
- if (len < 0) {
- fprintf(stderr, "wrong controller message len %d\n", len);
- free(answer);
- return -1;
- }
-
- attrs = (struct rtattr *) ((char *) answer + NLMSG_LENGTH(GENL_HDRLEN));
- parse_rtattr(tb, CTRL_ATTR_MAX, attrs, len);
-
- if (tb[CTRL_ATTR_FAMILY_ID] == NULL) {
- fprintf(stderr, "Missing family id TLV\n");
- goto errout;
- }
-
- ret = rta_getattr_u16(tb[CTRL_ATTR_FAMILY_ID]);
- }
-
-errout:
- free(answer);
- rtnl_close(&rth);
- return ret;
-}
-
static void print_ctrl_cmd_flags(FILE *fp, __u32 fl)
{
fprintf(fp, "\n\t\tCapabilities (0x%x):\n ", fl);
diff --git a/genl/genl_utils.h b/genl/genl_utils.h
index cc1f3fb76596..a8d433a9574f 100644
--- a/genl/genl_utils.h
+++ b/genl/genl_utils.h
@@ -13,6 +13,4 @@ struct genl_util
int (*print_genlopt)(struct nlmsghdr *n, void *arg);
};
-int genl_ctrl_resolve_family(const char *family);
-
#endif
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2 05/22] libnetlnk: unused and local functions cleanup
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <20181115223640.411-1-stephen@networkplumber.org>
rntl_talk_extack and parse_rtattr_index not used in current code.
rtnl_dump_filter_l is only used in this file.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
include/libnetlink.h | 7 -------
lib/libnetlink.c | 28 ++--------------------------
2 files changed, 2 insertions(+), 33 deletions(-)
diff --git a/include/libnetlink.h b/include/libnetlink.h
index fa8de093d484..138840d5c892 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -102,8 +102,6 @@ struct rtnl_dump_filter_arg {
__u16 nc_flags;
};
-int rtnl_dump_filter_l(struct rtnl_handle *rth,
- const struct rtnl_dump_filter_arg *arg);
int rtnl_dump_filter_nc(struct rtnl_handle *rth,
rtnl_filter_t filter,
void *arg, __u16 nc_flags);
@@ -115,9 +113,6 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
int rtnl_talk_iov(struct rtnl_handle *rtnl, struct iovec *iovec, size_t iovlen,
struct nlmsghdr **answer)
__attribute__((warn_unused_result));
-int rtnl_talk_extack(struct rtnl_handle *rtnl, struct nlmsghdr *n,
- struct nlmsghdr **answer, nl_ext_ack_fn_t errfn)
- __attribute__((warn_unused_result));
int rtnl_talk_suppress_rtnl_errmsg(struct rtnl_handle *rtnl, struct nlmsghdr *n,
struct nlmsghdr **answer)
__attribute__((warn_unused_result));
@@ -152,8 +147,6 @@ int rta_addattr_l(struct rtattr *rta, int maxlen, int type,
int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
int parse_rtattr_flags(struct rtattr *tb[], int max, struct rtattr *rta,
int len, unsigned short flags);
-int parse_rtattr_byindex(struct rtattr *tb[], int max,
- struct rtattr *rta, int len);
struct rtattr *parse_rtattr_one(int type, struct rtattr *rta, int len);
int __parse_rtattr_nested_compat(struct rtattr *tb[], int max, struct rtattr *rta, int len);
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index fe4a7a4b9c71..c0b80ed6fdfb 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -611,8 +611,8 @@ static int rtnl_recvmsg(int fd, struct msghdr *msg, char **answer)
return len;
}
-int rtnl_dump_filter_l(struct rtnl_handle *rth,
- const struct rtnl_dump_filter_arg *arg)
+static int rtnl_dump_filter_l(struct rtnl_handle *rth,
+ const struct rtnl_dump_filter_arg *arg)
{
struct sockaddr_nl nladdr;
struct iovec iov;
@@ -877,13 +877,6 @@ int rtnl_talk_iov(struct rtnl_handle *rtnl, struct iovec *iovec, size_t iovlen,
return __rtnl_talk_iov(rtnl, iovec, iovlen, answer, true, NULL);
}
-int rtnl_talk_extack(struct rtnl_handle *rtnl, struct nlmsghdr *n,
- struct nlmsghdr **answer,
- nl_ext_ack_fn_t errfn)
-{
- return __rtnl_talk(rtnl, n, answer, true, errfn);
-}
-
int rtnl_talk_suppress_rtnl_errmsg(struct rtnl_handle *rtnl, struct nlmsghdr *n,
struct nlmsghdr **answer)
{
@@ -1242,23 +1235,6 @@ int parse_rtattr_flags(struct rtattr *tb[], int max, struct rtattr *rta,
return 0;
}
-int parse_rtattr_byindex(struct rtattr *tb[], int max,
- struct rtattr *rta, int len)
-{
- int i = 0;
-
- memset(tb, 0, sizeof(struct rtattr *) * max);
- while (RTA_OK(rta, len)) {
- if (rta->rta_type <= max && i < max)
- tb[i++] = rta;
- rta = RTA_NEXT(rta, len);
- }
- if (len)
- fprintf(stderr, "!!!Deficit %d, rta_len=%d\n",
- len, rta->rta_len);
- return i;
-}
-
struct rtattr *parse_rtattr_one(int type, struct rtattr *rta, int len)
{
while (RTA_OK(rta, len)) {
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2 04/22] lib/ll_map: make local function static
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <20181115223640.411-1-stephen@networkplumber.org>
ll_idx_a2n is only used in ll_map.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
include/ll_map.h | 1 -
lib/ll_map.c | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/include/ll_map.h b/include/ll_map.h
index fb708191c22c..511fe00b8567 100644
--- a/include/ll_map.h
+++ b/include/ll_map.h
@@ -12,6 +12,5 @@ int ll_index_to_flags(unsigned idx);
unsigned namehash(const char *str);
const char *ll_idx_n2a(unsigned int idx);
-unsigned int ll_idx_a2n(const char *name);
#endif /* __LL_MAP_H__ */
diff --git a/lib/ll_map.c b/lib/ll_map.c
index 1b4095a7d873..1ab8ef0758ac 100644
--- a/lib/ll_map.c
+++ b/lib/ll_map.c
@@ -143,7 +143,7 @@ const char *ll_idx_n2a(unsigned int idx)
return buf;
}
-unsigned int ll_idx_a2n(const char *name)
+static unsigned int ll_idx_a2n(const char *name)
{
unsigned int idx;
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2 03/22] lib/color: make local functions static
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <20181115223640.411-1-stephen@networkplumber.org>
color_enable etc, only used here.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
include/color.h | 2 --
lib/color.c | 6 ++++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/color.h b/include/color.h
index e30f28c51c84..17ec56f3d7b4 100644
--- a/include/color.h
+++ b/include/color.h
@@ -20,10 +20,8 @@ enum color_opt {
COLOR_OPT_ALWAYS = 2
};
-void enable_color(void);
bool check_enable_color(int color, int json);
bool matches_color(const char *arg, int *val);
-void set_color_palette(void);
int color_fprintf(FILE *fp, enum color_attr attr, const char *fmt, ...);
enum color_attr ifa_family_color(__u8 ifa_family);
enum color_attr oper_state_color(__u8 state);
diff --git a/lib/color.c b/lib/color.c
index e5406294dfc4..59976847295c 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -11,6 +11,8 @@
#include "color.h"
#include "utils.h"
+static void set_color_palette(void);
+
enum color {
C_RED,
C_GREEN,
@@ -73,7 +75,7 @@ static enum color attr_colors_dark[] = {
static int is_dark_bg;
static int color_is_enabled;
-void enable_color(void)
+static void enable_color(void)
{
color_is_enabled = 1;
set_color_palette();
@@ -117,7 +119,7 @@ bool matches_color(const char *arg, int *val)
return true;
}
-void set_color_palette(void)
+static void set_color_palette(void)
{
char *p = getenv("COLORFGBG");
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2 02/22] lib/utils: make local functions static
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <20181115223640.411-1-stephen@networkplumber.org>
Some of the print/parsing is only used internally.
Drop unused get_s8/get_s16.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
include/utils.h | 5 -----
lib/utils.c | 48 +++++++-----------------------------------------
2 files changed, 7 insertions(+), 46 deletions(-)
diff --git a/include/utils.h b/include/utils.h
index bf6dea23df66..1630dd0b2854 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -157,9 +157,7 @@ int get_u64(__u64 *val, const char *arg, int base);
int get_u32(__u32 *val, const char *arg, int base);
int get_s32(__s32 *val, const char *arg, int base);
int get_u16(__u16 *val, const char *arg, int base);
-int get_s16(__s16 *val, const char *arg, int base);
int get_u8(__u8 *val, const char *arg, int base);
-int get_s8(__s8 *val, const char *arg, int base);
int get_be64(__be64 *val, const char *arg, int base);
int get_be32(__be32 *val, const char *arg, int base);
int get_be16(__be16 *val, const char *arg, int base);
@@ -172,7 +170,6 @@ __u8 *hexstring_a2n(const char *str, __u8 *buf, int blen, unsigned int *len);
int addr64_n2a(__u64 addr, char *buff, size_t len);
int af_bit_len(int af);
-int af_byte_len(int af);
const char *format_host_r(int af, int len, const void *addr,
char *buf, int buflen);
@@ -326,8 +323,6 @@ void drop_cap(void);
int get_time(unsigned int *time, const char *str);
int get_time64(__s64 *time, const char *str);
-void print_time(char *buf, int len, __u32 time);
-void print_time64(char *buf, int len, __s64 time);
char *sprint_time(__u32 time, char *buf);
char *sprint_time64(__s64 time, char *buf);
diff --git a/lib/utils.c b/lib/utils.c
index 345630d04929..4965a5750880 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -45,6 +45,10 @@ int timestamp_short;
int pretty;
const char *_SL_ = "\n";
+static int af_byte_len(int af);
+static void print_time(char *buf, int len, __u32 time);
+static void print_time64(char *buf, int len, __s64 time);
+
int read_prop(const char *dev, char *prop, long *value)
{
char fname[128], buf[80], *endp, *nl;
@@ -426,43 +430,6 @@ int get_s32(__s32 *val, const char *arg, int base)
return 0;
}
-int get_s16(__s16 *val, const char *arg, int base)
-{
- long res;
- char *ptr;
-
- if (!arg || !*arg)
- return -1;
- res = strtol(arg, &ptr, base);
- if (!ptr || ptr == arg || *ptr)
- return -1;
- if ((res == LONG_MIN || res == LONG_MAX) && errno == ERANGE)
- return -1;
- if (res > 0x7FFF || res < -0x8000)
- return -1;
-
- *val = res;
- return 0;
-}
-
-int get_s8(__s8 *val, const char *arg, int base)
-{
- long res;
- char *ptr;
-
- if (!arg || !*arg)
- return -1;
- res = strtol(arg, &ptr, base);
- if (!ptr || ptr == arg || *ptr)
- return -1;
- if ((res == LONG_MIN || res == LONG_MAX) && errno == ERANGE)
- return -1;
- if (res > 0x7F || res < -0x80)
- return -1;
- *val = res;
- return 0;
-}
-
int get_be64(__be64 *val, const char *arg, int base)
{
__u64 v;
@@ -708,7 +675,7 @@ int af_bit_len(int af)
return 0;
}
-int af_byte_len(int af)
+static int af_byte_len(int af)
{
return af_bit_len(af) / 8;
}
@@ -1710,8 +1677,7 @@ int get_time(unsigned int *time, const char *str)
return 0;
}
-
-void print_time(char *buf, int len, __u32 time)
+static void print_time(char *buf, int len, __u32 time)
{
double tmp = time;
@@ -1764,7 +1730,7 @@ int get_time64(__s64 *time, const char *str)
return 0;
}
-void print_time64(char *buf, int len, __s64 time)
+static void print_time64(char *buf, int len, __s64 time)
{
double nsec = time;
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2 01/22] lib/ll_addr: whitespace and indent cleanup
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <20181115223640.411-1-stephen@networkplumber.org>
Run old ll_addr through kernel Lindent.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/ll_addr.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/lib/ll_addr.c b/lib/ll_addr.c
index 84de64e2e053..00b562aeda22 100644
--- a/lib/ll_addr.c
+++ b/lib/ll_addr.c
@@ -26,20 +26,20 @@
#include "rt_names.h"
#include "utils.h"
-
-const char *ll_addr_n2a(const unsigned char *addr, int alen, int type, char *buf, int blen)
+const char *ll_addr_n2a(const unsigned char *addr, int alen, int type,
+ char *buf, int blen)
{
int i;
int l;
if (alen == 4 &&
- (type == ARPHRD_TUNNEL || type == ARPHRD_SIT || type == ARPHRD_IPGRE)) {
+ (type == ARPHRD_TUNNEL || type == ARPHRD_SIT
+ || type == ARPHRD_IPGRE))
return inet_ntop(AF_INET, addr, buf, blen);
- }
- if (alen == 16 &&
- (type == ARPHRD_TUNNEL6 || type == ARPHRD_IP6GRE)) {
+
+ if (alen == 16 && (type == ARPHRD_TUNNEL6 || type == ARPHRD_IP6GRE))
return inet_ntop(AF_INET6, addr, buf, blen);
- }
+
snprintf(buf, blen, "%02x", addr[0]);
for (i = 1, l = 2; i < alen && l < blen; i++, l += 3)
snprintf(buf + l, blen - l, ":%02x", addr[i]);
@@ -62,7 +62,7 @@ int ll_addr_a2n(char *lladdr, int len, const char *arg)
} else {
int i;
- for (i=0; i<len; i++) {
+ for (i = 0; i < len; i++) {
int temp;
char *cp = strchr(arg, ':');
if (cp) {
@@ -70,11 +70,13 @@ int ll_addr_a2n(char *lladdr, int len, const char *arg)
cp++;
}
if (sscanf(arg, "%x", &temp) != 1) {
- fprintf(stderr, "\"%s\" is invalid lladdr.\n", arg);
+ fprintf(stderr, "\"%s\" is invalid lladdr.\n",
+ arg);
return -1;
}
if (temp < 0 || temp > 255) {
- fprintf(stderr, "\"%s\" is invalid lladdr.\n", arg);
+ fprintf(stderr, "\"%s\" is invalid lladdr.\n",
+ arg);
return -1;
}
lladdr[i] = temp;
@@ -82,6 +84,6 @@ int ll_addr_a2n(char *lladdr, int len, const char *arg)
break;
arg = cp;
}
- return i+1;
+ return i + 1;
}
}
--
2.17.1
^ permalink raw reply related
* [PATCH iproute2 00/22] misc cleanups
From: Stephen Hemminger @ 2018-11-15 22:36 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
Code cleanup including:
* make local functions static
* drop dead code
* whitespace code style cleanup
Stephen Hemminger (22):
lib/ll_addr: whitespace and indent cleanup
lib/utils: make local functions static
lib/color: make local functions static
lib/ll_map: make local function static
libnetlnk: unused and local functions cleanup
genl: remove dead code
bridge: make local variables static
ip: make flag names const/static
ipmonitor: make local variable static
ipxfrm: make local functions static
tc: drop unused name_to_id function
tipc: make cmd_find static
tc/class: make filter variables static
tc/police: make print_police static
ss: make local variables static
tc/pedit: make functions static
tc/ematch: make local functions static
tc/util: make local functions static
tc/meta: make meta_table static and const
tc/action: make variables static
tc/pedit: use structure initialization
rdma: make local functions static
bridge/bridge.c | 5 ++--
bridge/monitor.c | 2 +-
genl/ctrl.c | 71 --------------------------------------------
genl/genl_utils.h | 2 --
include/color.h | 2 --
include/libnetlink.h | 7 -----
include/ll_map.h | 1 -
include/names.h | 1 -
include/utils.h | 5 ----
ip/ipaddress.c | 2 +-
ip/ipmonitor.c | 2 +-
ip/ipxfrm.c | 11 +++----
ip/xfrm.h | 9 ------
ip/xfrm_monitor.c | 2 +-
lib/color.c | 6 ++--
lib/libnetlink.c | 28 ++---------------
lib/ll_addr.c | 24 ++++++++-------
lib/ll_map.c | 2 +-
lib/names.c | 28 -----------------
lib/utils.c | 48 +++++-------------------------
misc/ss.c | 28 ++++++++---------
rdma/rdma.h | 11 -------
rdma/utils.c | 12 ++++----
tc/em_meta.c | 12 ++++----
tc/m_action.c | 4 +--
tc/m_ematch.c | 30 ++-----------------
tc/m_ematch.h | 1 -
tc/m_pedit.c | 33 +++++++++-----------
tc/m_pedit.h | 15 ----------
tc/m_police.c | 10 +++++--
tc/p_eth.c | 5 ++--
tc/p_icmp.c | 5 ++--
tc/p_ip.c | 5 ++--
tc/p_ip6.c | 5 ++--
tc/p_tcp.c | 5 ++--
tc/p_udp.c | 5 ++--
tc/tc_class.c | 6 ++--
tc/tc_util.c | 17 ++---------
tc/tc_util.h | 8 -----
tipc/cmdl.c | 2 +-
tipc/cmdl.h | 2 --
41 files changed, 110 insertions(+), 369 deletions(-)
--
2.17.1
^ permalink raw reply
* Re: [PATCH net] sctp: not allow to set asoc prsctp_enable by sockopt
From: Marcelo Ricardo Leitner @ 2018-11-15 22:25 UTC (permalink / raw)
To: Neil Horman; +Cc: Xin Long, network dev, linux-sctp, davem
In-Reply-To: <20181115214310.GA8505@neilslaptop.think-freely.org>
On Thu, Nov 15, 2018 at 04:43:10PM -0500, Neil Horman wrote:
> On Thu, Nov 15, 2018 at 03:22:21PM -0200, Marcelo Ricardo Leitner wrote:
> > On Thu, Nov 15, 2018 at 07:14:28PM +0800, Xin Long wrote:
> > > As rfc7496#section4.5 says about SCTP_PR_SUPPORTED:
> > >
> > > This socket option allows the enabling or disabling of the
> > > negotiation of PR-SCTP support for future associations. For existing
> > > associations, it allows one to query whether or not PR-SCTP support
> > > was negotiated on a particular association.
> > >
> > > It means only sctp sock's prsctp_enable can be set.
> > >
> > > Note that for the limitation of SCTP_{CURRENT|ALL}_ASSOC, we will
> > > add it when introducing SCTP_{FUTURE|CURRENT|ALL}_ASSOC for linux
> > > sctp in another patchset.
> > >
> > > Fixes: 28aa4c26fce2 ("sctp: add SCTP_PR_SUPPORTED on sctp sockopt")
> > > Reported-by: Ying Xu <yinxu@redhat.com>
> > > Signed-off-by: Xin Long <lucien.xin@gmail.com>
> > > ---
> > > net/sctp/socket.c | 13 +++----------
> > > 1 file changed, 3 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> > > index 739f3e5..e9b8232 100644
> > > --- a/net/sctp/socket.c
> > > +++ b/net/sctp/socket.c
> > > @@ -3940,7 +3940,6 @@ static int sctp_setsockopt_pr_supported(struct sock *sk,
> > > unsigned int optlen)
> > > {
> > > struct sctp_assoc_value params;
> > > - struct sctp_association *asoc;
> > > int retval = -EINVAL;
> > >
> > > if (optlen != sizeof(params))
> > > @@ -3951,16 +3950,10 @@ static int sctp_setsockopt_pr_supported(struct sock *sk,
> > > goto out;
> > > }
> > >
> > > - asoc = sctp_id2assoc(sk, params.assoc_id);
> > > - if (asoc) {
> > > - asoc->prsctp_enable = !!params.assoc_value;
> > > - } else if (!params.assoc_id) {
> > > - struct sctp_sock *sp = sctp_sk(sk);
> > > -
> > > - sp->ep->prsctp_enable = !!params.assoc_value;
> > > - } else {
> > > + if (sctp_style(sk, UDP) && sctp_id2assoc(sk, params.assoc_id))
> >
> > This would allow using a non-existent assoc id on UDP-style sockets to
> > set it at the socket, which is not expected. It should be more like:
> >
> > + if (sctp_style(sk, UDP) && params.assoc_id)
> How do you see that to be the case? sctp_id2assoc will return NULL if an
> association isn't found, so the use of sctp_id2assoc should work just fine.
Right, it will return NULL, and because of that it won't bail out as
it should and will adjust the socket config instead.
> Just checking params.assoc_id would instead fail the setting of any association
> id that isn't 0, which I don't think is what we want at all.
I think it is.
For exisitng associations, we can't set this anymore because it was
already negotiated on the handshake
(sctp_process_ext_param()/SCTP_CID_FWD_TSN) and there is no way back
after it.
For non-existing assocs, they will always inherit it from the socket
value.
Question then is which semantics we want on validating the parameter
here. We have cases such as in sctp_setsockopt_delayed_ack() on which
it will reject using invalid asoc_ids as a way to mean the socket
itself for UDP-style sockets:
asoc = sctp_id2assoc(sk, params.sack_assoc_id);
if (!asoc && params.sack_assoc_id && sctp_style(sk, UDP))
return -EINVAL;
As we are returning the same error for both situations(invalid assoc id
and setting it on existing asoc), we don't need the asoc pointer
itself and can avoid sctp_id2assoc() call, leading to the if() I
suggested.
Marcelo
>
> Neil
>
> >
> > > goto out;
> > > - }
> > > +
> > > + sctp_sk(sk)->ep->prsctp_enable = !!params.assoc_value;
> > >
> > > retval = 0;
> > >
> > > --
> > > 2.1.0
> > >
> >
^ permalink raw reply
* Re: [PATCH v3 net-next 0/4] net: batched receive in GRO path
From: Eric Dumazet @ 2018-11-15 22:01 UTC (permalink / raw)
To: Edward Cree, Eric Dumazet, linux-net-drivers, davem; +Cc: netdev
In-Reply-To: <df3cf9f9-d40c-6d44-872b-8064c046bda6@solarflare.com>
On 11/15/2018 01:45 PM, Edward Cree wrote:
>
> If napi->poll() is only handling one packet, surely GRO can't do anything
> useful either? (AIUI at the end of the poll the GRO lists get flushed.)
That is my point.
Adding yet another layer that will add no gain but add more waste of cpu cycles.
In fact I know many people disabling GRO in some cases because it adds ~5% penalty
for traffic that is not aggregated.
> Is it maybe a sign that you're just spreading over too many queues??
Not really. You also want to be able to receive more traffic if the need comes.
Most NIC share the same IRQ for one TX/RX queue, and you might have an imbalance between TX and RX load.
^ permalink raw reply
* Re: [PATCH v3 net-next 0/4] net: batched receive in GRO path
From: Edward Cree @ 2018-11-15 21:45 UTC (permalink / raw)
To: Eric Dumazet, linux-net-drivers, davem; +Cc: netdev
In-Reply-To: <b163a6c8-d522-3fdd-9e22-ceed1eb5a7b3@gmail.com>
On 15/11/18 20:08, Eric Dumazet wrote:
> On 11/15/2018 10:43 AM, Edward Cree wrote:
>
> Most of the packet isn't touched and thus won't be brought into cache.
>> Only the headers of each packet (worst-case let's say 256 bytes) will
>> be touched during batch processing, that's 16kB.
> You assume perfect use of the caches, but part of the cache has collisions.
I assume nothing, that's why I'm running lots of tests & benchmarks.
Remember that gains from batching are not only in I$; the D$ cache is
also going to be used for things like route lookups and netfilter
progs, and locality for those is improved by batching.
It might be possible to use PMCs to get hard numbers on how I$ and D$
hit & eviction rates change, idk how useful that would be.
> I am alarmed by the complexity added, for example in GRO, considering
> that we also added GRO for UDP.
This series doesn't really add complexity _in_ GRO, it's more a piece
on the outside that's calling GRO machinery slightly differently.
Drivers which just call the existing non-list-based entry points won't
even see any of this code.
> I dunno, can you show us for example if a reassembly workload can benefit
> from all this stuff ?
Sure, I can try a UDP test with payload_size > MTU. (I can't think of a
way to force interleaving of fragments from different packets, though.)
> If you present numbers for traffic that GRO handles just fine, it does not
> really make sense, unless your plan maybe is to remove GRO completely ?
That's just the easiest thing to test. It's that much harder to set up
tests to use e.g. IP options that GRO will baulk at. It's also not too
easy to create traffic with the kind of flow interleaving that DDoS
scenarios would present, as that requires something like a many-to-one
rig with a switch and I don't have enough lab machines for such a test.
I'm not planning to remove GRO. GRO is faster than batched receive.
Batched receive, however, works equally well for all traffic whether it's
GRO-able or not.
Thus both are worth having. This patch series is about using batched
receive for packets that GRO looks at and says "no thanks".
> We have observed at Google a constant increase of cpu cycles spent for TCP_RR
> on latest kernels. The gap is now about 20% with kernels from two years ago,
> and I could not yet find a faulty commit. It seems we add little overhead after
> another, and every patch author is convinced he is doing the right thing.
>
> With multi queue NICS, vast majority of napi->poll() invocations handle only one packet.
> Unfortunately we can not really increase interrupt mitigations (ethtool -c)
> on NIC without sacrificing latencies.
At one point when I was working on the original batching patches, I tried
making them skip batching if poll() hadn't used up the entire NAPI budget
(as a signal that we're not BW-constrained), but it didn't seem to yield
any benefit. However I could try it again, or try checking the list
length and handling packets singly if it's less than some threshold...?
If napi->poll() is only handling one packet, surely GRO can't do anything
useful either? (AIUI at the end of the poll the GRO lists get flushed.)
Is it maybe a sign that you're just spreading over too many queues??
-Ed
^ permalink raw reply
* Re: [PATCH net] sctp: not allow to set asoc prsctp_enable by sockopt
From: Neil Horman @ 2018-11-15 21:43 UTC (permalink / raw)
To: Marcelo Ricardo Leitner; +Cc: Xin Long, network dev, linux-sctp, davem
In-Reply-To: <20181115172221.GA3601@localhost.localdomain>
On Thu, Nov 15, 2018 at 03:22:21PM -0200, Marcelo Ricardo Leitner wrote:
> On Thu, Nov 15, 2018 at 07:14:28PM +0800, Xin Long wrote:
> > As rfc7496#section4.5 says about SCTP_PR_SUPPORTED:
> >
> > This socket option allows the enabling or disabling of the
> > negotiation of PR-SCTP support for future associations. For existing
> > associations, it allows one to query whether or not PR-SCTP support
> > was negotiated on a particular association.
> >
> > It means only sctp sock's prsctp_enable can be set.
> >
> > Note that for the limitation of SCTP_{CURRENT|ALL}_ASSOC, we will
> > add it when introducing SCTP_{FUTURE|CURRENT|ALL}_ASSOC for linux
> > sctp in another patchset.
> >
> > Fixes: 28aa4c26fce2 ("sctp: add SCTP_PR_SUPPORTED on sctp sockopt")
> > Reported-by: Ying Xu <yinxu@redhat.com>
> > Signed-off-by: Xin Long <lucien.xin@gmail.com>
> > ---
> > net/sctp/socket.c | 13 +++----------
> > 1 file changed, 3 insertions(+), 10 deletions(-)
> >
> > diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> > index 739f3e5..e9b8232 100644
> > --- a/net/sctp/socket.c
> > +++ b/net/sctp/socket.c
> > @@ -3940,7 +3940,6 @@ static int sctp_setsockopt_pr_supported(struct sock *sk,
> > unsigned int optlen)
> > {
> > struct sctp_assoc_value params;
> > - struct sctp_association *asoc;
> > int retval = -EINVAL;
> >
> > if (optlen != sizeof(params))
> > @@ -3951,16 +3950,10 @@ static int sctp_setsockopt_pr_supported(struct sock *sk,
> > goto out;
> > }
> >
> > - asoc = sctp_id2assoc(sk, params.assoc_id);
> > - if (asoc) {
> > - asoc->prsctp_enable = !!params.assoc_value;
> > - } else if (!params.assoc_id) {
> > - struct sctp_sock *sp = sctp_sk(sk);
> > -
> > - sp->ep->prsctp_enable = !!params.assoc_value;
> > - } else {
> > + if (sctp_style(sk, UDP) && sctp_id2assoc(sk, params.assoc_id))
>
> This would allow using a non-existent assoc id on UDP-style sockets to
> set it at the socket, which is not expected. It should be more like:
>
> + if (sctp_style(sk, UDP) && params.assoc_id)
How do you see that to be the case? sctp_id2assoc will return NULL if an
association isn't found, so the use of sctp_id2assoc should work just fine.
Just checking params.assoc_id would instead fail the setting of any association
id that isn't 0, which I don't think is what we want at all.
Neil
>
> > goto out;
> > - }
> > +
> > + sctp_sk(sk)->ep->prsctp_enable = !!params.assoc_value;
> >
> > retval = 0;
> >
> > --
> > 2.1.0
> >
>
^ permalink raw reply
* Re: [PATCH v6] net: phy: mdio-gpio: Fix working over slow can_sleep GPIOs
From: Andrew Lunn @ 2018-11-16 7:53 UTC (permalink / raw)
To: Martin Schiller; +Cc: sergei.shtylyov, f.fainelli, davem, netdev, linux-kernel
In-Reply-To: <20181116073836.6013-1-ms@dev.tdt.de>
On Fri, Nov 16, 2018 at 08:38:36AM +0100, Martin Schiller wrote:
> Up until commit 7e5fbd1e0700 ("net: mdio-gpio: Convert to use gpiod
> functions where possible"), the _cansleep variants of the gpio_ API was
> used. After that commit and the change to gpiod_ API, the _cansleep()
> was dropped. This then results in WARN_ON() when used with GPIO
> devices which do sleep. Add back the _cansleep() to avoid this.
>
> Fixes: 7e5fbd1e0700 ("net: mdio-gpio: Convert to use gpiod functions where possible")
> Signed-off-by: Martin Schiller <ms@dev.tdt.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply
* [PATCH v6] net: phy: mdio-gpio: Fix working over slow can_sleep GPIOs
From: Martin Schiller @ 2018-11-16 7:38 UTC (permalink / raw)
To: andrew, sergei.shtylyov, f.fainelli
Cc: davem, netdev, linux-kernel, Martin Schiller
In-Reply-To: <20181114061703.11026-1-ms@dev.tdt.de>
Up until commit 7e5fbd1e0700 ("net: mdio-gpio: Convert to use gpiod
functions where possible"), the _cansleep variants of the gpio_ API was
used. After that commit and the change to gpiod_ API, the _cansleep()
was dropped. This then results in WARN_ON() when used with GPIO
devices which do sleep. Add back the _cansleep() to avoid this.
Fixes: 7e5fbd1e0700 ("net: mdio-gpio: Convert to use gpiod functions where possible")
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
---
v6:
- dropped warning about slow GPIO pins
v5:
- reworked commit message
- added "Fixes:" tag
- based on DaveM net tree instead of mainline
v4:
- remove linewrap of kernel message
v3:
- modified commit summary
- fixed commit cites in commit message
- fixed line continuation
v2:
- fixed copy/paste bug in warning about slow GPIO pins
---
drivers/net/phy/mdio-gpio.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index 33265747bf39..0fbcedcdf6e2 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -63,7 +63,7 @@ static void mdio_dir(struct mdiobb_ctrl *ctrl, int dir)
* assume the pin serves as pull-up. If direction is
* output, the default value is high.
*/
- gpiod_set_value(bitbang->mdo, 1);
+ gpiod_set_value_cansleep(bitbang->mdo, 1);
return;
}
@@ -78,7 +78,7 @@ static int mdio_get(struct mdiobb_ctrl *ctrl)
struct mdio_gpio_info *bitbang =
container_of(ctrl, struct mdio_gpio_info, ctrl);
- return gpiod_get_value(bitbang->mdio);
+ return gpiod_get_value_cansleep(bitbang->mdio);
}
static void mdio_set(struct mdiobb_ctrl *ctrl, int what)
@@ -87,9 +87,9 @@ static void mdio_set(struct mdiobb_ctrl *ctrl, int what)
container_of(ctrl, struct mdio_gpio_info, ctrl);
if (bitbang->mdo)
- gpiod_set_value(bitbang->mdo, what);
+ gpiod_set_value_cansleep(bitbang->mdo, what);
else
- gpiod_set_value(bitbang->mdio, what);
+ gpiod_set_value_cansleep(bitbang->mdio, what);
}
static void mdc_set(struct mdiobb_ctrl *ctrl, int what)
@@ -97,7 +97,7 @@ static void mdc_set(struct mdiobb_ctrl *ctrl, int what)
struct mdio_gpio_info *bitbang =
container_of(ctrl, struct mdio_gpio_info, ctrl);
- gpiod_set_value(bitbang->mdc, what);
+ gpiod_set_value_cansleep(bitbang->mdc, what);
}
static const struct mdiobb_ops mdio_gpio_ops = {
--
2.11.0
^ permalink raw reply related
* Re: [PATCH] rhashtable: detect when object movement between tables might have invalidated a lookup
From: NeilBrown @ 2018-11-16 6:59 UTC (permalink / raw)
To: Herbert Xu; +Cc: David Miller, tgraf, netdev, linux-kernel, eric.dumazet
In-Reply-To: <20181116055551.zxfydbpoicslsfkg@gondor.apana.org.au>
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
E
[-- Attachment #2.1: Type: text/plain, Size: 2011 bytes --]
On Fri, Nov 16 2018, Herbert Xu wrote:
> On Thu, Nov 15, 2018 at 10:32:13AM +1100, NeilBrown wrote:
>>
>> +#define RHT_NULLS_MARKER(ptr) \
>> + ((void *)NULLS_MARKER(((unsigned long) (ptr)) >> 1))
>> #define INIT_RHT_NULLS_HEAD(ptr) \
>> - ((ptr) = (typeof(ptr)) NULLS_MARKER(0))
>> + ((ptr) = RHT_NULLS_MARKER(&(ptr)))
>
> Why are you shifting this by one?
NULLS_MARKER assumes a hash value in which the bottom bits are most
likely to be unique. To convert this to a pointer which certainly not
valid, it shifts left by 1 and sets the lsb.
We aren't passing a hash value, but are passing an address instead.
In this case the bottom 2 bits are certain to be 0, and the top bit
could contain valuable information (on a 32bit system).
The best way to turn a pointer into a certainly-invalid pointer
is to just set the lsb. By shifting right by one, we discard an
uninteresting bit, preserve all the interesting bits, and effectively
just set the lsb.
I could add a comment explaining that if you like.
>
>> diff --git a/lib/rhashtable.c b/lib/rhashtable.c
>> index 30526afa8343..852ffa5160f1 100644
>> --- a/lib/rhashtable.c
>> +++ b/lib/rhashtable.c
>> @@ -1179,8 +1179,7 @@ struct rhash_head __rcu **rht_bucket_nested(const struct bucket_table *tbl,
>> unsigned int hash)
>> {
>> const unsigned int shift = PAGE_SHIFT - ilog2(sizeof(void *));
>> - static struct rhash_head __rcu *rhnull =
>> - (struct rhash_head __rcu *)NULLS_MARKER(0);
>> + static struct rhash_head __rcu *rhnull;
>
> I don't understand why you can't continue to do NULLS_MARKER(0) or
> RHT_NULLS_MARKER(0).
Because then the test
+ } while (he != RHT_NULLS_MARKER(head));
in __rhashtable_lookup() would always succeed, and it would loop
forever.
Thanks for the review.
NeilBrown
>
> Cheers,
> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
[-- Attachment #2.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply
* Re: [PATCH net-next 1/4] enetc: Introduce basic PF and VF ENETC ethernet drivers
From: Andrew Lunn @ 2018-11-15 20:35 UTC (permalink / raw)
To: Claudiu Manoil
Cc: David S . Miller, netdev, linux-kernel, alexandru.marginean,
catalin.horghidan
In-Reply-To: <1542298436-23422-2-git-send-email-claudiu.manoil@nxp.com>
On Thu, Nov 15, 2018 at 06:13:53PM +0200, Claudiu Manoil wrote:
> ENETC is a multi-port virtualized Ethernet controller supporting GbE
> designs
Hi Claudiu
Do you mean 1GbE, or multigigabit? Do you have a SERDES between the
MAC and the PHY? Could an SFP be connected?
> +static int enetc_of_get_phy(struct enetc_ndev_priv *priv)
> +{
> + struct device_node *np = priv->dev->of_node;
> + int err;
> +
> + if (!np) {
> + dev_err(priv->dev, "missing ENETC port node\n");
> + return -ENODEV;
> + }
> +
> + priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
> + if (!priv->phy_node) {
> + if (!of_phy_is_fixed_link(np)) {
> + dev_err(priv->dev, "PHY not specified\n");
> + return -ENODEV;
> + }
> +
> + err = of_phy_register_fixed_link(np);
> + if (err < 0) {
> + dev_err(priv->dev, "fixed link registration failed\n");
> + return err;
> + }
> +
> + priv->phy_node = of_node_get(np);
> + }
> +
> + priv->if_mode = of_get_phy_mode(np);
> + if (priv->if_mode < 0) {
> + dev_err(priv->dev, "missing phy type\n");
> + of_node_put(priv->phy_node);
> + if (of_phy_is_fixed_link(np))
> + of_phy_deregister_fixed_link(np);
> +
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
I asked the above questions because of this. Using phylink will
simplify a lot of this. And it makes you future proof for faster
speeds and handling the SERDES between the MAC and the PHY, and having
an SFP, etc.
Andrew
^ permalink raw reply
* Re: DSA support for Marvell 88e6065 switch
From: Andrew Lunn @ 2018-11-15 20:26 UTC (permalink / raw)
To: Pavel Machek; +Cc: netdev, f.fainelli, buytenh, buytenh, nico
In-Reply-To: <20181115195111.GA9946@amd>
On Thu, Nov 15, 2018 at 08:51:11PM +0100, Pavel Machek wrote:
> Hi!
>
> I'm trying to create support for Marvell 88e6065 switch... and it
> seems like drivers/net/dsa supports everything, but this model.
>
> Did someone work with this hardware before? Any idea if it would be
> more suitable to support by existing 88e6060 code, or if 88e6xxx code
> should serve as a base?
Hi Pavel
The 88e6xxx should be extended to support this. I think you will find
a lot of the building blocks are already in the driver. Compare the
various implementations of the functions in the mv88e6xxx_ops to what
the datasheet says for the registers, and pick those that match.
Andrew
^ permalink raw reply
* Re: [PATCH v3 net-next 0/4] net: batched receive in GRO path
From: Eric Dumazet @ 2018-11-15 20:08 UTC (permalink / raw)
To: Edward Cree, linux-net-drivers, davem; +Cc: netdev
In-Reply-To: <53c61113-dfce-88c6-7711-a308fcf451ad@solarflare.com>
On 11/15/2018 10:43 AM, Edward Cree wrote:
Most of the packet isn't touched and thus won't be brought into cache.
> Only the headers of each packet (worst-case let's say 256 bytes) will
> be touched during batch processing, that's 16kB.
You assume perfect use of the caches, but part of the cache has collisions.
I am alarmed by the complexity added, for example in GRO, considering
that we also added GRO for UDP.
I dunno, can you show us for example if a reassembly workload can benefit
from all this stuff ?
Paolo Abeni sure will be interested knowing if we can get a 20% increase for this
IP defrag workloads.
If you present numbers for traffic that GRO handles just fine, it does not
really make sense, unless your plan maybe is to remove GRO completely ?
We have observed at Google a constant increase of cpu cycles spent for TCP_RR
on latest kernels. The gap is now about 20% with kernels from two years ago,
and I could not yet find a faulty commit. It seems we add little overhead after
another, and every patch author is convinced he is doing the right thing.
With multi queue NICS, vast majority of napi->poll() invocations handle only one packet.
Unfortunately we can not really increase interrupt mitigations (ethtool -c)
on NIC without sacrificing latencies.
^ permalink raw reply
* [RFC] DTrace based on eBPF and other tracing facilities
From: Kris Van Hees @ 2018-11-16 6:02 UTC (permalink / raw)
To: linux-kernel, netdev
A lot of work has been done on various aspects of the tracing infrastructure
in Linux in the past years and with the further development of BPF a quite
powerful execution engine has become available as well.
One of the difficulties we have experienced in furthering DTrace on Linux is
that we have to duplicate functionality already available in the kernel
because that functionality is not easy to make use of.
In the past year or so we have been working towards changing that. There is
no point in having multiple projects reinvent the same wheel a couple of times
over, especially when there are ways where everyone can benefit from actually
cooperating. Our current (lofty) goal is to rework the DTrace implementation
that we currently have to make it more modular and less self-sufficient. We
are envisioning a future for DTrace where we can leverage its strengths in the
areas where it matters most (e.g. very efficient handling of large amounts of
kernel probes, well defined and understood D language, user familiarity with
existing providers, ...) while building on the existing tracing infrastructure
in Linux. That also means that we can contribute better to existing pieces
in the infrastructure and work together with other tracing projects to continue
to improve tracing on Linux.
Ideally we would like to see an infrastructure where any tracers can attach
actions to any kind of probe source, and have data generated according to the
actions the tracer associated with the probe source when a specific probe
fires. The execution of those actions would be done using BPF.
We believe that this proposal would be a benefit to all because it allows us
to pool resources in the areas that really need it. E.g. if we all depend on
BPF as execution engine we invariably work together to make it as solid as can
be.
Obviously we cannot do this work on our own, and we cannot do it behind closed
doors. We've created a github repository for the kernel with DTrace added in
at:
https://github.com/ezannoni/dtrace-linux-kernel/tree/master
We also have a branch there with the most recent BPF-based work:
https://github.com/ezannoni/dtrace-linux-kernel/tree/nix/bpf/4.19/helpers
Since most (if not all) tracing tools have similar requirements for what may
need to be done when a probe fires, we really want to join forces.
Cheers,
Kris
^ 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