/* OpenFlow switch processing. */
struct ofproto *ofproto; /* OpenFlow switch. */
+ /* Description strings. */
+ char *mfr_desc; /* Manufacturer. */
+ char *hw_desc; /* Hardware. */
+ char *sw_desc; /* Software version. */
+ char *serial_desc; /* Serial number. */
+ char *dp_desc; /* Datapath description. */
+
/* Kernel datapath information. */
struct dpif *dpif; /* Datapath. */
struct port_array ifaces; /* Indexed by kernel datapath port number. */
memset(&netdev_options, 0, sizeof netdev_options);
netdev_options.name = iface_cfg->name;
- netdev_options.type = iface_cfg->type;
+ if (!strcmp(iface_cfg->type, "internal")) {
+ /* An "internal" config type maps to a netdev "system" type. */
+ netdev_options.type = "system";
+ } else {
+ netdev_options.type = iface_cfg->type;
+ }
netdev_options.args = &options;
netdev_options.ethertype = NETDEV_ETH_TYPE_NONE;
netdev_options.may_create = true;
const char *iface_type = iface_cfg->type && strlen(iface_cfg->type)
? iface_cfg->type : NULL;
+ /* An "internal" config type maps to a netdev "system" type. */
+ if (iface_type && !strcmp(iface_type, "internal")) {
+ iface_type = "system";
+ }
+
if (!iface_type || !strcmp(netdev_type, iface_type)) {
error = netdev_reconfigure(iface->netdev, &options);
} else {
}
static bool
-check_iface_netdev(struct bridge *br UNUSED, struct iface *iface,
- void *aux UNUSED)
+check_iface_netdev(struct bridge *br OVS_UNUSED, struct iface *iface,
+ void *aux OVS_UNUSED)
{
if (!iface->netdev) {
int error = set_up_iface(iface->cfg, iface, true);
}
static bool
-check_iface_dp_ifidx(struct bridge *br, struct iface *iface, void *aux UNUSED)
+check_iface_dp_ifidx(struct bridge *br, struct iface *iface,
+ void *aux OVS_UNUSED)
{
if (iface->dp_ifidx >= 0) {
VLOG_DBG("%s has interface %s on port %d",
}
static bool
-set_iface_properties(struct bridge *br UNUSED, struct iface *iface,
- void *aux UNUSED)
+set_iface_properties(struct bridge *br OVS_UNUSED, struct iface *iface,
+ void *aux OVS_UNUSED)
{
/* Set policing attributes. */
netdev_set_policing(iface->netdev,
/* Bridge unixctl user interface functions. */
static void
bridge_unixctl_fdb_show(struct unixctl_conn *conn,
- const char *args, void *aux UNUSED)
+ const char *args, void *aux OVS_UNUSED)
{
struct ds ds = DS_EMPTY_INITIALIZER;
const struct bridge *br;
* stack, including those normally hidden. */
static void
bridge_unixctl_dump_flows(struct unixctl_conn *conn,
- const char *args, void *aux UNUSED)
+ const char *args, void *aux OVS_UNUSED)
{
struct bridge *br;
struct ds results;
}
}
+static void
+bridge_update_desc(struct bridge *br)
+{
+#if 0
+ bool changed = false;
+ const char *desc;
+
+ desc = cfg_get_string(0, "bridge.%s.mfr-desc", br->name);
+ if (desc != br->mfr_desc) {
+ free(br->mfr_desc);
+ if (desc) {
+ br->mfr_desc = xstrdup(desc);
+ } else {
+ br->mfr_desc = xstrdup(DEFAULT_MFR_DESC);
+ }
+ changed = true;
+ }
+
+ desc = cfg_get_string(0, "bridge.%s.hw-desc", br->name);
+ if (desc != br->hw_desc) {
+ free(br->hw_desc);
+ if (desc) {
+ br->hw_desc = xstrdup(desc);
+ } else {
+ br->hw_desc = xstrdup(DEFAULT_HW_DESC);
+ }
+ changed = true;
+ }
+
+ desc = cfg_get_string(0, "bridge.%s.sw-desc", br->name);
+ if (desc != br->sw_desc) {
+ free(br->sw_desc);
+ if (desc) {
+ br->sw_desc = xstrdup(desc);
+ } else {
+ br->sw_desc = xstrdup(DEFAULT_SW_DESC);
+ }
+ changed = true;
+ }
+
+ desc = cfg_get_string(0, "bridge.%s.serial-desc", br->name);
+ if (desc != br->serial_desc) {
+ free(br->serial_desc);
+ if (desc) {
+ br->serial_desc = xstrdup(desc);
+ } else {
+ br->serial_desc = xstrdup(DEFAULT_SERIAL_DESC);
+ }
+ changed = true;
+ }
+
+ desc = cfg_get_string(0, "bridge.%s.dp-desc", br->name);
+ if (desc != br->dp_desc) {
+ free(br->dp_desc);
+ if (desc) {
+ br->dp_desc = xstrdup(desc);
+ } else {
+ br->dp_desc = xstrdup(DEFAULT_DP_DESC);
+ }
+ changed = true;
+ }
+
+ if (changed) {
+ ofproto_set_desc(br->ofproto, br->mfr_desc, br->hw_desc,
+ br->sw_desc, br->serial_desc, br->dp_desc);
+ }
+#endif
+}
+
static void
bridge_reconfigure_one(const struct ovsrec_open_vswitch *ovs_cfg,
struct bridge *br)
#endif
mirror_reconfigure(br);
+
+ bridge_update_desc(br);
}
static void
return dst - dsts;
}
-static void UNUSED
+static void OVS_UNUSED
print_dsts(const struct dst *dsts, size_t n)
{
for (; n--; dsts++) {
static void
bond_unixctl_list(struct unixctl_conn *conn,
- const char *args UNUSED, void *aux UNUSED)
+ const char *args OVS_UNUSED, void *aux OVS_UNUSED)
{
struct ds ds = DS_EMPTY_INITIALIZER;
const struct bridge *br;
static void
bond_unixctl_show(struct unixctl_conn *conn,
- const char *args, void *aux UNUSED)
+ const char *args, void *aux OVS_UNUSED)
{
struct ds ds = DS_EMPTY_INITIALIZER;
const struct port *port;
static void
bond_unixctl_migrate(struct unixctl_conn *conn, const char *args_,
- void *aux UNUSED)
+ void *aux OVS_UNUSED)
{
char *args = (char *) args_;
char *save_ptr = NULL;
static void
bond_unixctl_set_active_slave(struct unixctl_conn *conn, const char *args_,
- void *aux UNUSED)
+ void *aux OVS_UNUSED)
{
char *args = (char *) args_;
char *save_ptr = NULL;
static void
bond_unixctl_enable_slave(struct unixctl_conn *conn, const char *args,
- void *aux UNUSED)
+ void *aux OVS_UNUSED)
{
enable_slave(conn, args, true);
}
static void
bond_unixctl_disable_slave(struct unixctl_conn *conn, const char *args,
- void *aux UNUSED)
+ void *aux OVS_UNUSED)
{
enable_slave(conn, args, false);
}
static void
bond_unixctl_hash(struct unixctl_conn *conn, const char *args,
- void *aux UNUSED)
+ void *aux OVS_UNUSED)
{
uint8_t mac[ETH_ADDR_LEN];
uint8_t hash;