/* Strings to describe the manufacturer, hardware, and software. This data
- * is queriable through the version stats message. */
-static char mfr_desc[VERSION_STR_LEN] = "Nicira Networks";
-static char hw_desc[VERSION_STR_LEN] = "Reference Linux Kernel Module";
-static char sw_desc[VERSION_STR_LEN] = VERSION;
+ * is queriable through the switch description stats message. */
+static char mfr_desc[DESC_STR_LEN] = "Nicira Networks";
+static char hw_desc[DESC_STR_LEN] = "Reference Linux Kernel Module";
+static char sw_desc[DESC_STR_LEN] = VERSION;
+static char serial_num[SERIAL_NUM_LEN] = "None";
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
module_param_string(mfr_desc, mfr_desc, sizeof mfr_desc, 0444);
module_param_string(hw_desc, hw_desc, sizeof hw_desc, 0444);
module_param_string(sw_desc, sw_desc, sizeof sw_desc, 0444);
+module_param_string(serial_num, serial_num, sizeof serial_num, 0444);
#else
MODULE_PARM(mfr_desc, "s");
MODULE_PARM(hw_desc, "s");
MODULE_PARM(sw_desc, "s");
+MODULE_PARM(serial_num, "s");
#endif
[DP_GENL_A_DP_IDX] = { .type = NLA_U32 },
};
-static int version_stats_dump(struct datapath *dp, void *state,
+static int desc_stats_dump(struct datapath *dp, void *state,
void *body, int *body_len)
{
- struct ofp_version_stats *ovs = body;
- int n_bytes = sizeof *ovs;
+ struct ofp_desc_stats *ods = body;
+ int n_bytes = sizeof *ods;
if (n_bytes > *body_len) {
return -ENOBUFS;
}
*body_len = n_bytes;
- strncpy(ovs->mfr_desc, mfr_desc, sizeof ovs->mfr_desc);
- strncpy(ovs->hw_desc, hw_desc, sizeof ovs->hw_desc);
- strncpy(ovs->sw_desc, sw_desc, sizeof ovs->sw_desc);
+ strncpy(ods->mfr_desc, mfr_desc, sizeof ods->mfr_desc);
+ strncpy(ods->hw_desc, hw_desc, sizeof ods->hw_desc);
+ strncpy(ods->sw_desc, sw_desc, sizeof ods->sw_desc);
+ strncpy(ods->serial_num, serial_num, sizeof ods->serial_num);
return 0;
}
};
static const struct stats_type stats[] = {
- [OFPST_VERSION] = {
+ [OFPST_DESC] = {
0,
0,
NULL,
- version_stats_dump,
+ desc_stats_dump,
NULL
},
[OFPST_FLOW] = {
+++ /dev/null
-Subproject commit 4cf18a517a2663e945529a16e5d18e3b676c2687
enum ofp_stats_types {
/* Description of this OpenFlow switch.
* The request body is empty.
- * The reply body is struct ofp_version_stats. */
- OFPST_VERSION,
+ * The reply body is struct ofp_desc_stats. */
+ OFPST_DESC,
/* Individual flow statistics.
* The request body is struct ofp_flow_stats_request.
};
OFP_ASSERT(sizeof(struct ofp_stats_reply) == 12);
-#define VERSION_STR_LEN 256
-/* Body of reply to OFPST_VERSION request. Each entry is a NULL-terminated
+#define DESC_STR_LEN 256
+#define SERIAL_NUM_LEN 32
+/* Body of reply to OFPST_DESC request. Each entry is a NULL-terminated
* ASCII string. */
-struct ofp_version_stats {
- char mfr_desc[VERSION_STR_LEN]; /* Manufacturer description. */
- char hw_desc[VERSION_STR_LEN]; /* Hardware description. */
- char sw_desc[VERSION_STR_LEN]; /* Software description. */
+struct ofp_desc_stats {
+ char mfr_desc[DESC_STR_LEN]; /* Manufacturer description. */
+ char hw_desc[DESC_STR_LEN]; /* Hardware description. */
+ char sw_desc[DESC_STR_LEN]; /* Software description. */
+ char serial_num[SERIAL_NUM_LEN]; /* Serial number. */
};
-OFP_ASSERT(sizeof(struct ofp_version_stats) == 768);
+OFP_ASSERT(sizeof(struct ofp_desc_stats) == 800);
/* Body for ofp_stats_request of type OFPST_FLOW. */
struct ofp_flow_stats_request {
}
static void
-ofp_version_stats_reply(struct ds *string, const void *body, size_t len,
+ofp_desc_stats_reply(struct ds *string, const void *body, size_t len,
int verbosity)
{
- const struct ofp_version_stats *vs = body;
+ const struct ofp_desc_stats *ods = body;
- ds_put_format(string, "Manufacturer: %s\n", vs->mfr_desc);
- ds_put_format(string, "Hardware: %s\n", vs->hw_desc);
- ds_put_format(string, "Software: %s\n", vs->sw_desc);
+ ds_put_format(string, "Manufacturer: %s\n", ods->mfr_desc);
+ ds_put_format(string, "Hardware: %s\n", ods->hw_desc);
+ ds_put_format(string, "Software: %s\n", ods->sw_desc);
+ ds_put_format(string, "Serial Num: %s\n", ods->serial_num);
}
static void
};
static const struct stats_type stats_types[] = {
- [OFPST_VERSION] = {
- "version",
+ [OFPST_DESC] = {
+ "description",
{ 0, 0, NULL },
- { 0, SIZE_MAX, ofp_version_stats_reply },
+ { 0, SIZE_MAX, ofp_desc_stats_reply },
},
[OFPST_FLOW] = {
"flow",
extern char mfr_desc;
extern char hw_desc;
extern char sw_desc;
+extern char serial_num;
/* Capabilities supported by this implementation. */
#define OFP_SUPPORTED_CAPABILITIES ( OFPC_FLOW_STATS \
}
}
-static int version_stats_dump(struct datapath *dp, void *state,
+static int desc_stats_dump(struct datapath *dp, void *state,
struct buffer *buffer)
{
- struct ofp_version_stats *ovs = buffer_put_uninit(buffer, sizeof *ovs);
+ struct ofp_desc_stats *ods = buffer_put_uninit(buffer, sizeof *ods);
- strncpy(ovs->mfr_desc, &mfr_desc, sizeof ovs->mfr_desc);
- strncpy(ovs->hw_desc, &hw_desc, sizeof ovs->hw_desc);
- strncpy(ovs->sw_desc, &sw_desc, sizeof ovs->sw_desc);
+ strncpy(ods->mfr_desc, &mfr_desc, sizeof ods->mfr_desc);
+ strncpy(ods->hw_desc, &hw_desc, sizeof ods->hw_desc);
+ strncpy(ods->sw_desc, &sw_desc, sizeof ods->sw_desc);
+ strncpy(ods->serial_num, &serial_num, sizeof ods->serial_num);
return 0;
}
};
static const struct stats_type stats[] = {
- [OFPST_VERSION] = {
+ [OFPST_DESC] = {
0,
0,
NULL,
- version_stats_dump,
+ desc_stats_dump,
NULL
},
[OFPST_FLOW] = {
/* Strings to describe the manufacturer, hardware, and software. This data
- * is queriable through the version stats message. */
-char mfr_desc[VERSION_STR_LEN] = "Nicira Networks";
-char hw_desc[VERSION_STR_LEN] = "Reference User-Space Switch";
-char sw_desc[VERSION_STR_LEN] = VERSION;
+ * is queriable through the switch description stats message. */
+char mfr_desc[DESC_STR_LEN] = "Nicira Networks";
+char hw_desc[DESC_STR_LEN] = "Reference User-Space Switch";
+char sw_desc[DESC_STR_LEN] = VERSION;
+char serial_num[SERIAL_NUM_LEN] = "None";
static void parse_options(int argc, char *argv[]);
static void usage(void) NO_RETURN;
OPT_MAX_BACKOFF = UCHAR_MAX + 1,
OPT_MFR_DESC,
OPT_HW_DESC,
- OPT_SW_DESC
+ OPT_SW_DESC,
+ OPT_SERIAL_NUM
};
static struct option long_options[] = {
{"mfr-desc", required_argument, 0, OPT_MFR_DESC},
{"hw-desc", required_argument, 0, OPT_HW_DESC},
{"sw-desc", required_argument, 0, OPT_SW_DESC},
+ {"serial_num", required_argument, 0, OPT_SERIAL_NUM},
VCONN_SSL_LONG_OPTIONS
{0, 0, 0, 0},
};
strncpy(sw_desc, optarg, sizeof sw_desc);
break;
+ case OPT_SERIAL_NUM:
+ strncpy(serial_num, optarg, sizeof serial_num);
+ break;
+
case 'l':
if (listen_vconn_name) {
fatal(0, "-l or --listen may be only specified once");
"\nFor local datapaths and remote switches:\n"
" show SWITCH show basic information\n"
" status SWITCH [KEY] report statistics (about KEY)\n"
- " dump-version SWITCH print version information\n"
+ " dump-desc SWITCH print switch description\n"
" dump-tables SWITCH print table stats\n"
" mod-port SWITCH IFACE ACT modify port behavior\n"
" dump-ports SWITCH print port statistics\n"
}
static void
-do_dump_version(int argc, char *argv[])
+do_dump_desc(int argc, char *argv[])
{
- dump_trivial_stats_transaction(argv[1], OFPST_VERSION);
+ dump_trivial_stats_transaction(argv[1], OFPST_DESC);
}
static void
{ "help", 0, INT_MAX, do_help },
{ "monitor", 1, 1, do_monitor },
- { "dump-version", 1, 1, do_dump_version },
+ { "dump-desc", 1, 1, do_dump_desc },
{ "dump-tables", 1, 1, do_dump_tables },
{ "dump-flows", 1, 2, do_dump_flows },
{ "dump-aggregate", 1, 2, do_dump_aggregate },