Commit 60658059 authored by Stephen Hemminger's avatar Stephen Hemminger

Merge branch 'master' into net-next

parents 346410bd 4bf138d6
This diff is collapsed.
......@@ -33,6 +33,30 @@ enum devlink_command {
DEVLINK_CMD_PORT_SPLIT,
DEVLINK_CMD_PORT_UNSPLIT,
DEVLINK_CMD_SB_GET, /* can dump */
DEVLINK_CMD_SB_SET,
DEVLINK_CMD_SB_NEW,
DEVLINK_CMD_SB_DEL,
DEVLINK_CMD_SB_POOL_GET, /* can dump */
DEVLINK_CMD_SB_POOL_SET,
DEVLINK_CMD_SB_POOL_NEW,
DEVLINK_CMD_SB_POOL_DEL,
DEVLINK_CMD_SB_PORT_POOL_GET, /* can dump */
DEVLINK_CMD_SB_PORT_POOL_SET,
DEVLINK_CMD_SB_PORT_POOL_NEW,
DEVLINK_CMD_SB_PORT_POOL_DEL,
DEVLINK_CMD_SB_TC_POOL_BIND_GET, /* can dump */
DEVLINK_CMD_SB_TC_POOL_BIND_SET,
DEVLINK_CMD_SB_TC_POOL_BIND_NEW,
DEVLINK_CMD_SB_TC_POOL_BIND_DEL,
/* Shared buffer occupancy monitoring commands */
DEVLINK_CMD_SB_OCC_SNAPSHOT,
DEVLINK_CMD_SB_OCC_MAX_CLEAR,
/* add new commands above here */
__DEVLINK_CMD_MAX,
......@@ -46,6 +70,31 @@ enum devlink_port_type {
DEVLINK_PORT_TYPE_IB,
};
enum devlink_sb_pool_type {
DEVLINK_SB_POOL_TYPE_INGRESS,
DEVLINK_SB_POOL_TYPE_EGRESS,
};
/* static threshold - limiting the maximum number of bytes.
* dynamic threshold - limiting the maximum number of bytes
* based on the currently available free space in the shared buffer pool.
* In this mode, the maximum quota is calculated based
* on the following formula:
* max_quota = alpha / (1 + alpha) * Free_Buffer
* While Free_Buffer is the amount of none-occupied buffer associated to
* the relevant pool.
* The value range which can be passed is 0-20 and serves
* for computation of alpha by following formula:
* alpha = 2 ^ (passed_value - 10)
*/
enum devlink_sb_threshold_type {
DEVLINK_SB_THRESHOLD_TYPE_STATIC,
DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC,
};
#define DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX 20
enum devlink_attr {
/* don't change the order or add anything between, this is ABI! */
DEVLINK_ATTR_UNSPEC,
......@@ -62,6 +111,20 @@ enum devlink_attr {
DEVLINK_ATTR_PORT_IBDEV_NAME, /* string */
DEVLINK_ATTR_PORT_SPLIT_COUNT, /* u32 */
DEVLINK_ATTR_PORT_SPLIT_GROUP, /* u32 */
DEVLINK_ATTR_SB_INDEX, /* u32 */
DEVLINK_ATTR_SB_SIZE, /* u32 */
DEVLINK_ATTR_SB_INGRESS_POOL_COUNT, /* u16 */
DEVLINK_ATTR_SB_EGRESS_POOL_COUNT, /* u16 */
DEVLINK_ATTR_SB_INGRESS_TC_COUNT, /* u16 */
DEVLINK_ATTR_SB_EGRESS_TC_COUNT, /* u16 */
DEVLINK_ATTR_SB_POOL_INDEX, /* u16 */
DEVLINK_ATTR_SB_POOL_TYPE, /* u8 */
DEVLINK_ATTR_SB_POOL_SIZE, /* u32 */
DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE, /* u8 */
DEVLINK_ATTR_SB_THRESHOLD, /* u32 */
DEVLINK_ATTR_SB_TC_INDEX, /* u16 */
DEVLINK_ATTR_SB_OCC_CUR, /* u32 */
DEVLINK_ATTR_SB_OCC_MAX, /* u32 */
/* add new attributes above here, update the policy in devlink.c */
......
......@@ -33,6 +33,11 @@ static inline void list_add(struct list_head *new, struct list_head *head)
__list_add(new, head, head->next);
}
static inline void list_add_tail(struct list_head *new, struct list_head *head)
{
__list_add(new, head->prev, head);
}
static inline void __list_del(struct list_head *prev, struct list_head *next)
{
next->prev = prev;
......@@ -50,9 +55,15 @@ static inline void list_del(struct list_head *entry)
#define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member)
#define list_last_entry(ptr, type, member) \
list_entry((ptr)->prev, type, member)
#define list_next_entry(pos, member) \
list_entry((pos)->member.next, typeof(*(pos)), member)
#define list_prev_entry(pos, member) \
list_entry((pos)->member.prev, typeof(*(pos)), member)
#define list_for_each_entry(pos, head, member) \
for (pos = list_first_entry(head, typeof(*pos), member); \
&pos->member != (head); \
......@@ -64,6 +75,11 @@ static inline void list_del(struct list_head *entry)
&pos->member != (head); \
pos = n, n = list_next_entry(n, member))
#define list_for_each_entry_reverse(pos, head, member) \
for (pos = list_last_entry(head, typeof(*pos), member); \
&pos->member != (head); \
pos = list_prev_entry(pos, member))
struct hlist_head {
struct hlist_node *first;
};
......
......@@ -430,6 +430,8 @@ static int do_show_or_flush(int argc, char **argv, int flush)
addattr32(&req.n, sizeof(req), NDA_IFINDEX, filter.index);
}
req.ndm.ndm_family = filter.family;
if (flush) {
int round = 0;
char flushb[4096-512];
......@@ -440,7 +442,7 @@ static int do_show_or_flush(int argc, char **argv, int flush)
filter.state &= ~NUD_FAILED;
while (round < MAX_ROUNDS) {
if (rtnl_wilddump_request(&rth, filter.family, RTM_GETNEIGH) < 0) {
if (rtnl_dump_request_n(&rth, &req.n) < 0) {
perror("Cannot send dump request");
exit(1);
}
......@@ -472,8 +474,6 @@ static int do_show_or_flush(int argc, char **argv, int flush)
return 1;
}
req.ndm.ndm_family = filter.family;
if (rtnl_dump_request_n(&rth, &req.n) < 0) {
perror("Cannot send dump request");
exit(1);
......
......@@ -16,6 +16,7 @@ devlink-dev \- devlink device configuration
.ti -8
.IR OPTIONS " := { "
\fB\-V\fR[\fIersion\fR] |
\fB\-n\fR[\fIno-nice-names\fR] }
.ti -8
.B devlink dev show
......@@ -51,6 +52,7 @@ Shows the state of specified devlink device.
.SH SEE ALSO
.BR devlink (8),
.BR devlink-port (8),
.BR devlink-sb (8),
.BR devlink-monitor (8),
.br
......
......@@ -29,6 +29,7 @@ opens Devlink Netlink socket, listens on it and dumps state changes.
.SH SEE ALSO
.BR devlink (8),
.BR devlink-dev (8),
.BR devlink-sb (8),
.BR devlink-port (8),
.br
......
......@@ -16,6 +16,7 @@ devlink-port \- devlink port configuration
.ti -8
.IR OPTIONS " := { "
\fB\-V\fR[\fIersion\fR] |
\fB\-n\fR[\fIno-nice-names\fR] }
.ti -8
.BR "devlink port set "
......@@ -119,6 +120,7 @@ Unplit the specified previously split devlink port.
.SH SEE ALSO
.BR devlink (8),
.BR devlink-dev (8),
.BR devlink-sb (8),
.BR devlink-monitor (8),
.br
......
.TH DEVLINK\-SB 8 "14 Apr 2016" "iproute2" "Linux"
.SH NAME
devlink-sb \- devlink shared buffer configuration
.SH SYNOPSIS
.sp
.ad l
.in +8
.ti -8
.B devlink
.RI "[ " OPTIONS " ]"
.B sb
.RI " { " COMMAND " | "
.BR help " }"
.sp
.ti -8
.IR OPTIONS " := { "
\fB\-V\fR[\fIersion\fR] |
\fB\-n\fR[\fIno-nice-names\fR] }
.ti -8
.BR "devlink sb show "
.RI "[ " DEV " [ "
.B sb
.IR SB_INDEX " ] ]"
.ti -8
.BR "devlink sb pool show "
.RI "[ " DEV " [ "
.B sb
.IR SB_INDEX " ] "
.br
.B pool
.IR POOL_INDEX " ]"
.ti -8
.BI "devlink sb pool set " DEV "
.RB "[ " sb
.IR SB_INDEX " ] "
.br
.BI pool " POOL_INDEX "
.br
.BI size " POOL_SIZE "
.br
.BR thtype " { " static " | " dynamic " }"
.ti -8
.BR "devlink sb port pool show "
.RI "[ " DEV/PORT_INDEX " [ "
.B sb
.IR SB_INDEX " ] "
.br
.B pool
.IR POOL_INDEX " ]"
.ti -8
.BI "devlink sb port pool set " DEV/PORT_INDEX "
.RB "[ " sb
.IR SB_INDEX " ] "
.br
.BI pool " POOL_INDEX "
.br
.BI th " THRESHOLD "
.ti -8
.BR "devlink sb tc bind show "
.RI "[ " DEV/PORT_INDEX " [ "
.B sb
.IR SB_INDEX " ] "
.br
.BI tc " TC_INDEX "
.br
.B type
.RB "{ " ingress " | " egress " } ]"
.ti -8
.BI "devlink sb tc bind set " DEV/PORT_INDEX "
.RB "[ " sb
.IR SB_INDEX " ] "
.br
.BI tc " TC_INDEX "
.br
.BR type " { " ingress " | " egress " }"
.br
.BI pool " POOL_INDEX "
.br
.BI th " THRESHOLD "
.ti -8
.BR "devlink sb occupancy show "
.RI "{ " DEV " | " DEV/PORT_INDEX " } [ "
.B sb
.IR SB_INDEX " ] "
.ti -8
.BR "devlink sb occupancy snapshot "
.IR DEV " [ "
.B sb
.IR SB_INDEX " ]"
.ti -8
.BR "devlink sb occupancy clearmax "
.IR DEV " [ "
.B sb
.IR SB_INDEX " ]"
.ti -8
.B devlink sb help
.SH "DESCRIPTION"
.SS devlink sb show - display available shared buffers and their attributes
.PP
.I "DEV"
- specifies the devlink device to show shared buffers.
If this argument is omitted all shared buffers of all devices are listed.
.PP
.I "SB_INDEX"
- specifies the shared buffer.
If this argument is omitted shared buffer with index 0 is selected.
Behaviour of this argument it the same for every command.
.SS devlink sb pool show - display available pools and their attributes
.PP
.I "DEV"
- specifies the devlink device to show pools.
If this argument is omitted all pools of all devices are listed.
.SS devlink sb pool set - set attributes of pool
.PP
.I "DEV"
- specifies the devlink device to set pool.
.TP
.BI size " POOL_SIZE"
size of the pool in Bytes.
.TP
.BR thtype " { " static " | " dynamic " } "
pool threshold type.
.I static
- Threshold values for the pool will be passed in Bytes.
.I dynamic
- Threshold values ("to_alpha") for the pool will be used to compute alpha parameter according to formula:
.br
.in +16
alpha = 2 ^ (to_alpha - 10)
.in -16
.in +10
The range of the passed value is between 0 to 20. The computed alpha is used to determine the maximum usage of the flow:
.in -10
.br
.in +16
max_usage = alpha / (1 + alpha) * Free_Buffer
.in -16
.SS devlink sb port pool show - display port-pool combinations and threshold for each
.I "DEV/PORT_INDEX"
- specifies the devlink port.
.TP
.BI pool " POOL_INDEX"
pool index.
.SS devlink sb port pool set - set port-pool threshold
.I "DEV/PORT_INDEX"
- specifies the devlink port.
.TP
.BI pool " POOL_INDEX"
pool index.
.TP
.BI th " THRESHOLD"
threshold value. Type of the value is either Bytes or "to_alpha", depends on
.B thtype
set for the pool.
.SS devlink sb tc bind show - display port-TC to pool bindings and threshold for each
.I "DEV/PORT_INDEX"
- specifies the devlink port.
.TP
.BI tc " TC_INDEX"
index of either ingress or egress TC, usually in range 0 to 8 (depends on device).
.TP
.BR type " { " ingress " | " egress " } "
TC type.
.SS devlink sb tc bind set - set port-TC to pool binding with specified threshold
.I "DEV/PORT_INDEX"
- specifies the devlink port.
.TP
.BI tc " TC_INDEX"
index of either ingress or egress TC, usually in range 0 to 8 (depends on device).
.TP
.BR type " { " ingress " | " egress " } "
TC type.
.TP
.BI pool " POOL_INDEX"
index of pool to bind this to.
.TP
.BI th " THRESHOLD"
threshold value. Type of the value is either Bytes or "to_alpha", depends on
.B thtype
set for the pool.
.SS devlink sb occupancy show - display shared buffer occupancy values for device or port
.PP
This command is used to browse shared buffer occupancy values. Values are showed for every port-pool combination as well as for all port-TC combinations (with pool this port-TC is bound to). Format of value is:
.br
.in +16
current_value/max_value
.in -16
Note that before showing values, one has to issue
.b occupancy snapshot
command first.
.PP
.I "DEV"
- specifies the devlink device to show occupancy values for.
.I "DEV/PORT_INDEX"
- specifies the devlink port to show occupancy values for.
.SS devlink sb occupancy snapshot - take occupancy snapshot of shared buffer for device
This command is used to take a snapshot of shared buffer occupancy values. After that, the values can be showed using
.B occupancy show
command.
.PP
.I "DEV"
- specifies the devlink device to take occupancy snapshot on.
.SS devlink sb occupancy clearmax - clear occupancy watermarks of shared buffer for device
This command is used to reset maximal occupancy values reached for whole device. Note that before browsing reset values, one has to issue
.B occupancy snapshot
command.
.PP
.I "DEV"
- specifies the devlink device to clear occupancy watermarks on.
.SH "EXAMPLES"
.PP
devlink sb show
.RS 4
List available share buffers.
.RE
.PP
devlink sb pool show
.RS 4
List available pools and their config.
.RE
.PP
devlink sb port pool show pci/0000:03:00.0/1 pool 0
.RS 4
Show port-pool setup for specified port and pool.
.RE
.PP
sudo devlink sb port pool set pci/0000:03:00.0/1 pool 0 th 15
.RS 4
Change threshold for port specified port and pool.
.RE
.PP
devlink sb tc bind show pci/0000:03:00.0/1 tc 0 type ingress
.RS 4
Show pool binding and threshold for specified port and TC.
.RE
.PP
sudo devlink sb tc bind set pci/0000:03:00.0/1 tc 0 type ingress pool 0 th 9
.RS 4
Set pool binding and threshold for specified port and TC.
.RE
.PP
sudo devlink sb occupancy snapshot pci/0000:03:00.0
.RS 4
Make a snapshot of occupancy of shared buffer for specified devlink device.
.RE
.PP
devlink sb occupancy show pci/0000:03:00.0/1
.RS 4
Show occupancy for specified port from the snapshot.
.RE
.PP
sudo devlink sb occupancy clearmax pci/0000:03:00.0
.RS 4
Clear watermarks for shared buffer of specified devlink device.
.SH SEE ALSO
.BR devlink (8),
.BR devlink-dev (8),
.BR devlink-port (8),
.BR devlink-monitor (8),
.br
.SH AUTHOR
Jiri Pirko <jiri@mellanox.com>
......@@ -19,6 +19,7 @@ devlink \- Devlink tool
.ti -8
.IR OPTIONS " := { "
\fB\-V\fR[\fIersion\fR] |
\fB\-n\fR[\fIno-nice-names\fR] }
.SH OPTIONS
......@@ -28,6 +29,10 @@ Print the version of the
.B devlink
utility and exit.
.TP
.BR "\-n" , " -no-nice-names"
Turn off printing out nice names, for example netdevice ifnames instead of devlink port identification.
.SS
.I OBJECT
......
......@@ -267,7 +267,7 @@ static void filter_default_dbs(struct filter *f)
static void filter_states_set(struct filter *f, int states)
{
if (states)
f->states = (f->states | states) & states;
f->states = states;
}
static void filter_merge_defaults(struct filter *f)
......@@ -1556,9 +1556,10 @@ void *parse_hostcond(char *addr, bool is_port)
out:
if (fam != AF_UNSPEC) {
int states = f->states;
f->families = 0;
filter_af_set(f, fam);
filter_states_set(f, 0);
filter_states_set(f, states);
}
res = malloc(sizeof(*res));
......@@ -2018,6 +2019,7 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r,
s.segs_out = info->tcpi_segs_out;
s.segs_in = info->tcpi_segs_in;
s.not_sent = info->tcpi_notsent_bytes;
if (info->tcpi_min_rtt && info->tcpi_min_rtt != ~0U)
s.min_rtt = (double) info->tcpi_min_rtt / 1000;
tcp_stats_print(&s);
free(s.dctcp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment