bool show_label);
char *int_to_str(int val, char *buf);
+int get_guid(__u64 *guid, const char *arg);
#endif /* __UTILS_H__ */
invarg("Invalid \"state\" value\n", *argv);
ivl.vf = vf;
addattr_l(&req->n, sizeof(*req), IFLA_VF_LINK_STATE, &ivl, sizeof(ivl));
+ } else if (matches(*argv, "node_guid") == 0) {
+ struct ifla_vf_guid ivg;
+
+ NEXT_ARG();
+ ivg.vf = vf;
+ if (get_guid(&ivg.guid, *argv)) {
+ invarg("Invalid GUID format\n", *argv);
+ return -1;
+ }
+ addattr_l(&req->n, sizeof(*req), IFLA_VF_IB_NODE_GUID, &ivg, sizeof(ivg));
+ } else if (matches(*argv, "port_guid") == 0) {
+ struct ifla_vf_guid ivg;
+
+ NEXT_ARG();
+ ivg.vf = vf;
+ if (get_guid(&ivg.guid, *argv)) {
+ invarg("Invalid GUID format\n", *argv);
+ return -1;
+ }
+ addattr_l(&req->n, sizeof(*req), IFLA_VF_IB_PORT_GUID, &ivg, sizeof(ivg));
} else {
/* rewind arg */
PREV_ARG();
sprintf(buf, "%d", val);
return buf;
}
+
+int get_guid(__u64 *guid, const char *arg)
+{
+ unsigned long int tmp;
+ char *endptr;
+ int i;
+
+#define GUID_STR_LEN 23
+ /* Verify strict format: format string must be
+ * xx:xx:xx:xx:xx:xx:xx:xx where xx can be an arbitrary
+ * hex digit
+ */
+
+ if (strlen(arg) != GUID_STR_LEN)
+ return -1;
+
+ /* make sure columns are in place */
+ for (i = 0; i < 7; i++)
+ if (arg[2 + i * 3] != ':')
+ return -1;
+
+ *guid = 0;
+ for (i = 0; i < 8; i++) {
+ tmp = strtoul(arg + i * 3, &endptr, 16);
+ if (endptr != arg + i * 3 + 2)
+ return -1;
+
+ if (tmp > 255)
+ return -1;
+
+ *guid |= tmp << (56 - 8 * i);
+ }
+
+ return 0;
+}
.br
.RB "[ " state " { " auto " | " enable " | " disable " } ]"
.br
-.RB "[ " trust " { " on " | " off " } ] ]"
+.RB "[ " trust " { " on " | " off " } ]"
+.br
+.RB "[ " node_guid " eui64 ]"
+.br
+.RB "[ " port_guid " eui64 ] ]"
.br
.in -9
.RB "[ " master
.BI trust " on|off"
- trust the specified VF user. This enables that VF user can set a specific feature
which may impact security and/or performance. (e.g. VF multicast promiscuous mode)
+.sp
+.BI node_guid " eui64"
+- configure node GUID for the VF.
+.sp
+.BI port_guid " eui64"
+- configure port GUID for the VF.
.in -8
.TP