Skip to content

Commit

Permalink
lldpad: add -c modify tlv option to commands
Browse files Browse the repository at this point in the history
Add a -c option to modify TLV query commands to indicate that
the command pertains to the configuration of the TLV instead of
the contents of the local or remote LLDP MIB.  Supplying the
-c argument by itself will result in all of the configuration
elements for the specified TLV to be returned.

This patch also updates the man pages with information about
the -c option.

Signed-off-by: John Fastabend <[email protected]>
  • Loading branch information
snackewm authored and John Fastabend committed Jun 21, 2011
1 parent 071c3dd commit 9b06d18
Show file tree
Hide file tree
Showing 16 changed files with 203 additions and 102 deletions.
4 changes: 2 additions & 2 deletions docs/lldptool-app.8
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.SH NAME
APP \- Show / manipulate APP TLV configuration
.SH SYNOPSIS
.B lldptool -t -i ethx -V APP [app]
.B lldptool -t -i ethx -V APP [-c app]
.sp
.B lldptool -T -i ethx -V APP app=prio,sel,pid
.sp
Expand Down Expand Up @@ -38,7 +38,7 @@ Configure FCoE application for priority 3 on \fIeth2\fR
.B lldptool -T -i eth2 -V APP app=3,1,35078
.TP
Display locally configured application table on \fIeth2\fR
.B lldptool -t -i eth2 -V APP app
.B lldptool -t -i eth2 -V APP -c app
.TP
Display last transmitted APP TLV on \fIeth2\fR
.B lldptool -t -i eth2 -V APP
Expand Down
46 changes: 27 additions & 19 deletions docs/lldptool-ets.8
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,72 @@
ETS-{CFG|REC} \- Show / manipulate ETS TLV configuration
.SH SYNOPSIS
.B lldptool -t -i ethx -V ETS-CFG
.RI COMMAND
.RI <-c " " CONFIG_ARG " " ...>
.sp

.ti +4
.IR COMMAND " := { "
.BR willing " | " tsa " | " up2tc " | " numtcs " | " tcbw " }"
.IR CONFIG_ARG " := { "
.BR enableTx " | " willing " | " tsa " | " up2tc " | " numtcs " | " tcbw " }"
.sp

.B lldptool -T -i ethx -V ETS-CFG
.RI COMMAND
.RI CONFIG_ARG=value " " ...
.sp
.ti +4
.IR COMMAND " :=
.IR CONFIG_ARG " :=
.sp
.BR enableTx " = " {yes|no} " | "
.sp
.BR willing " = " {0|1} " | "
.sp
.BR tsa " = " tc:{ets|strict|vendor},... " | "
.sp
.BR up2tc " = " priority:tc,... " | "
.sp
.BR tcbw " = " bw1,bw2,...
.BR tcbw " = " bw1,bw2,...
.sp

.B lldptool -t -i ethx -V ETS-REC { tsa | up2tc | tcbw }
.B lldptool -t -i ethx -V ETS-REC
.RI <-c " " CONFIG_ARG " " ...>
.sp

.B lldptool -T -i ethx -V ETS-REC
.RI COMMAND
.RI CONFIG_ARG=value " " ...
.sp
.ti +4
.IR COMMAND " :=
.IR CONFIG_ARG " :=
.sp
.BR enableTx " = " {yes|no} " | "
.sp
.BR tsa " = " tc:{ets|strict|vendor},... " | "
.sp
.BR up2tc " = " priority:tc,... " | "
.sp
.BR tcbw " = " bw1,bw2,...
.BR tcbw " = " bw1,bw2,...
.sp
.SH DESCRIPTION
The Extended Transmission Selection (ETS) TLV is has a recommendation
TLV and a configuration TLV configured with ETS-REC and ETS-CFG.
The Extended Transmission Selection (ETS) feature has a recommendation
TLV and a configuration TLV configured with ETS-REC and ETS-CFG respectively.
.SH ARGUMENTS
.TP
.B enableTx
Enables the ETS TLV to be transmitted
.TP
.B willing
Sets the ETS-CFG willing bit
Sets the ETS-CFG willing bit
.TP
.B tsa
.B tsa
Transmission selection algorithm, sets a comma seperated list \
of traffic classes to the corresponding selection algorithm. Valid algorithms \
include "ets", "stric" and "vendor".
include "ets", "strict" and "vendor".
.sp
.TP
.B up2tc
Comma seperated list mapping user priorities to traffic classes.
.sp
.TP
.B tcbw
Comma seperated list of bandwiths for each traffic class the first value
Comma separated list of bandwiths for each traffic class the first value
being assigned to traffic class 0 and the second to traffic class 1 and so
on. Undefined bandwidths are presumed to be 0.
.sp
Expand All @@ -82,7 +90,7 @@ To support legacy CEE DCBX the ETS-CFG and ETS-REC TLVs are disabled
if a CEE TLV is received and there are no valid IEEE 802.1Qaz TLVs
present. At this time the hardware DCBX mode will be set to CEE and
IEEE mode is disabled. This allows switches to be configured and
end nodes will then be configured accordingly without any configuration
end nodes will then be configured accordingly without any configuration
required on the end node.

Mapping applications and protocols to traffic classes is required for
Expand All @@ -95,7 +103,7 @@ Additionally, tc qdiscs and filters can be used to map protocols to queues
see \fItc(8)\fR for more details along these lines. Finally, many drivers
have support for specific protocols ie Fiber Channel over Ethernet (FCoE).

.B
.B
.SH EXAMPLE & USAGE
.TP
Configure willing bit for interface \fIeth2\fR
Expand All @@ -108,7 +116,7 @@ Configure 1:1 mapping from priority to traffic classes on \fIeth2\fR
.B lldptool -T -i eth2 -V ETS-CFG up2tc=0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7
.TP
Display local configured ETS-CFG parameters for tcbw
.B lldptool -t -i eth2 -V ETS-CFG tcbw
.B lldptool -t -i eth2 -V ETS-CFG -c tcbw
.TP
Display last transmitted ETS-CFG TLV
.B lldptool -t -i eth2 -V ETS-CFG
Expand Down
28 changes: 15 additions & 13 deletions docs/lldptool-pfc.8
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ PFC \- Show / manipulate PFC TLV configuration
.B lldptool -t -i ethx -V PFC { willing | enabled | delay | numtcs }
.sp
.B lldptool -T -i ethx -V PFC
.RI COMMAND
.RI <-c " " CONFIG_ARG " " ...>
.sp
.ti +4
.IR COMMAND " :=
.IR CONFIG_ARG " :=
.sp
.BR enableTx " = " {yes|no} " | "
.sp
.BR willing " = " {0|1} " | "
.sp
Expand All @@ -22,23 +24,23 @@ attributes.

.SH ARGUMENTS
.TP
.B enableTx
Enable the PFC TLV to be transmitted in the LLDP PDU for the
specified interface.
.TP
.B willing
Display or set willing attribute. If set and peer TLV is received
the peer PFC attributes will be used. If cleared locally configured
attributes are used.
.TP
.B enabled
Display or set traffic classes with PFC enabled. The set attribute
takes a comma separated list of traffic classes to enable.
Display or set priorities with PFC enabled. The set attribute
takes a comma separated list of priorities to enable.
.TP
.B delay
.B delay
Display or set delay attribute used to configure PFC thresholds in
hardware buffers. If PFC is enabled and frames continue to be dropped
due to full hardware buffers increasing this value may help.
.TP
.B numtc
Display number of traffic classes that support enabling PFC. This
is a read only parameter.

.SH Theory of Operations
The PFC TLV uses Symmetric attribute passing meaning the attributes
Expand All @@ -50,14 +52,14 @@ scheme is used. For more detailed coverage see the specification.

.SH EXAMPLE & USAGE
.TP
Enable PFC on traffic classes 1, 2, and 4 for \fIeth2\fR
Enable PFC for priorities 1, 2, and 4 on \fIeth2\fR
.B lldptool -T -i eth2 -V PFC enabled=1,2,4
.TP
Display number of traffic classes that support PFC for \fIeth2\fR
.B lldptool -t -i eth2 -V PFC numtcs
Display priorities enabled for PFC on \fIeth2\fR
.B lldptool -t -i eth2 -V PFC -c enabled
.TP
Display last transmitted PFC TLV on \fIeth2\fR
.B lldptool -t -i eth2 -V PFC
.B lldptool -t -i eth2 -V PFC
.SH SOURCE
.TP
o
Expand Down
25 changes: 13 additions & 12 deletions docs/lldptool.8
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,12 @@ help output to see the list of supported TLV keywords.
.B \-n
"neighbor" option for commands which can use it (e.g. get-tlv)
.TP
.B \-a
"add" option for commands which can use it
.br
(not implemented yet)
.TP
.B \-d
"remove" option for commands which can use it
.br
(not implemented yet)
.B \-c <argument list>
"config" option for TLV queries. Indicates that the query is
for the configuration elements for the specified TLV. The
argument list specifies the specific elements to query. If
no arguments are listed, then all configuration elements for
the TLV are returned.
.TP
.B \-r
show raw client interface messages
Expand Down Expand Up @@ -185,9 +182,9 @@ Enable transmit of the Port Description TLV for all interfaces:

.TP
Query value of the transmit setting for the Port Description TLV for a given interface:
.B lldptool -t -V portDesc enableTx
.B lldptool -t -V portDesc -c enableTx
.br
.B lldptool get-tlv -V 4 enableTx
.B lldptool get-tlv -V 4 -c enableTx

.TP
Set a Management Address TLV on eth3 to carry IPv4 address 192.168.10.10
Expand All @@ -199,7 +196,11 @@ Set a Management Address TLV on eth3 to carry IPv6 address ::192.168.10.10

.TP
Get the configured IPv4 address for the Management Address TLV on eth3
.B lldptool -t -i eth3 -V mngAddr ipv4
.B lldptool -t -i eth3 -V mngAddr -c ipv4

.TP
Get all configured attributes for the Management Address TLV on eth3
.B lldptool -t -i eth3 -V mngAddr -c

.TP
Enable transmit of the Edge Virtual Bridging TLV for interface eth4
Expand Down
4 changes: 4 additions & 0 deletions include/clif_msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,12 @@ struct type_name_info {
void (* get_info)(__u16, char *);
};

#define LLDP_ARG 0x00
#define TLV_ARG 0x01

struct arg_handlers {
char *arg;
int arg_class;
int (*handle_get)(struct cmd *, char *, char *, char *, int);
int (*handle_set)(struct cmd *, char *, char *, char *, int);
int (*handle_test)(struct cmd *, char *, char *, char *, int);
Expand Down
1 change: 1 addition & 0 deletions include/lldp_mand_clif.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ typedef enum {
op_neighbor = 0x0002,
op_arg = 0x0004,
op_argval = 0x0008,
op_config = 0x0010,
} lldp_op;

struct tlv {
Expand Down
29 changes: 20 additions & 9 deletions lldp_8021qaz_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,25 @@ static int set_arg_app(struct cmd *, char *, char *, char *, int);
static int test_arg_app(struct cmd *, char *, char *, char *, int);

static struct arg_handlers arg_handlers[] = {
{ ARG_TLVTXENABLE, get_arg_tlvtxenable, set_arg_tlvtxenable, test_arg_tlvtxenable },
{ ARG_WILLING, get_arg_willing, set_arg_willing, test_arg_willing },
{ ARG_ETS_NUMTCS, get_arg_numtc, NULL, test_arg_numtc },
{ ARG_ETS_UP2TC, get_arg_up2tc, set_arg_up2tc, test_arg_up2tc },
{ ARG_ETS_TCBW, get_arg_tcbw, set_arg_tcbw, test_arg_tcbw },
{ ARG_ETS_TSA, get_arg_tsa, set_arg_tsa, test_arg_tsa },
{ ARG_PFC_ENABLED, get_arg_enabled, set_arg_enabled, test_arg_enabled },
{ ARG_PFC_DELAY, get_arg_delay, set_arg_delay, test_arg_delay },
{ ARG_APP, get_arg_app, set_arg_app, test_arg_app },
{ ARG_TLVTXENABLE, TLV_ARG,
get_arg_tlvtxenable, set_arg_tlvtxenable,
test_arg_tlvtxenable },
{ ARG_WILLING, TLV_ARG,
get_arg_willing, set_arg_willing, test_arg_willing },
{ ARG_ETS_NUMTCS, TLV_ARG,
get_arg_numtc, NULL, test_arg_numtc },
{ ARG_ETS_UP2TC, TLV_ARG,
get_arg_up2tc, set_arg_up2tc, test_arg_up2tc },
{ ARG_ETS_TCBW, TLV_ARG,
get_arg_tcbw, set_arg_tcbw, test_arg_tcbw },
{ ARG_ETS_TSA, TLV_ARG,
get_arg_tsa, set_arg_tsa, test_arg_tsa },
{ ARG_PFC_ENABLED, TLV_ARG,
get_arg_enabled, set_arg_enabled, test_arg_enabled },
{ ARG_PFC_DELAY, TLV_ARG,
get_arg_delay, set_arg_delay, test_arg_delay },
{ ARG_APP, TLV_ARG,
get_arg_app, set_arg_app, test_arg_app },
{ NULL }
};

Expand Down Expand Up @@ -193,6 +203,7 @@ static int get_arg_numtc(struct cmd *cmd, char *args,
case (OUI_IEEE_8021 << 8) | LLDP_8021QAZ_ETSCFG:
break;
case (OUI_IEEE_8021 << 8) | LLDP_8021QAZ_ETSREC:
return cmd_not_applicable;
case INVALID_TLVID:
return cmd_invalid;
default:
Expand Down
5 changes: 3 additions & 2 deletions lldp_8023_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ static int set_arg_tlvtxenable(struct cmd *, char *, char *, char *, int);
static int test_arg_tlvtxenable(struct cmd *, char *, char *, char *, int);

static struct arg_handlers arg_handlers[] = {
{ ARG_TLVTXENABLE, get_arg_tlvtxenable, set_arg_tlvtxenable,
test_arg_tlvtxenable },
{ ARG_TLVTXENABLE, TLV_ARG,
get_arg_tlvtxenable, set_arg_tlvtxenable,
test_arg_tlvtxenable },
{ NULL }
};

Expand Down
21 changes: 15 additions & 6 deletions lldp_basman_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ static int set_arg_tlvtxenable(struct cmd *, char *, char *, char *, int);
static int test_arg_tlvtxenable(struct cmd *, char *, char *, char *, int);

static struct arg_handlers arg_handlers[] = {
{ ARG_IPV4_ADDR, get_arg_ipv4, set_arg_ipv4, test_arg_ipv4 },
{ ARG_IPV6_ADDR, get_arg_ipv6, set_arg_ipv6, test_arg_ipv6 },
{ ARG_TLVTXENABLE, get_arg_tlvtxenable, set_arg_tlvtxenable,
test_arg_tlvtxenable},
{ ARG_IPV4_ADDR, TLV_ARG,
get_arg_ipv4, set_arg_ipv4, test_arg_ipv4 },
{ ARG_IPV6_ADDR, TLV_ARG,
get_arg_ipv6, set_arg_ipv6, test_arg_ipv6 },
{ ARG_TLVTXENABLE, TLV_ARG,
get_arg_tlvtxenable, set_arg_tlvtxenable,
test_arg_tlvtxenable },
{ NULL }
};

Expand Down Expand Up @@ -167,9 +170,12 @@ int get_arg_ipv4(struct cmd *cmd, char *arg, char *argvalue,
char *p;
char arg_path[256];

if (cmd->cmd != cmd_gettlv || cmd->tlvid != MANAGEMENT_ADDRESS_TLV)
if (cmd->cmd != cmd_gettlv)
return cmd_bad_params;

if (cmd->tlvid != MANAGEMENT_ADDRESS_TLV)
return cmd_not_applicable;

snprintf(arg_path, sizeof(arg_path), "%s%08x.%s",
TLVID_PREFIX, cmd->tlvid, arg);

Expand All @@ -188,9 +194,12 @@ int get_arg_ipv6(struct cmd *cmd, char *arg, char *argvalue,
char *p;
char arg_path[256];

if (cmd->cmd != cmd_gettlv || cmd->tlvid != MANAGEMENT_ADDRESS_TLV)
if (cmd->cmd != cmd_gettlv)
return cmd_bad_params;

if (cmd->tlvid != MANAGEMENT_ADDRESS_TLV)
return cmd_not_applicable;

snprintf(arg_path, sizeof(arg_path), "%s%08x.%s",
TLVID_PREFIX, cmd->tlvid, arg);

Expand Down
5 changes: 3 additions & 2 deletions lldp_dcbx_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ static int set_arg_tlvtxenable(struct cmd *, char *, char *, char *, int);
static int test_arg_tlvtxenable(struct cmd *, char *, char *, char *, int);

static struct arg_handlers arg_handlers[] = {
{ ARG_TLVTXENABLE, get_arg_tlvtxenable, set_arg_tlvtxenable,
test_arg_tlvtxenable },
{ ARG_TLVTXENABLE, TLV_ARG,
get_arg_tlvtxenable, set_arg_tlvtxenable,
test_arg_tlvtxenable },
{ NULL }
};

Expand Down
Loading

0 comments on commit 9b06d18

Please sign in to comment.