#include "vswitchd/vswitch-idl.h"
#include "xenserver.h"
#include "xtoxll.h"
+#include "sflow_api.h"
#define THIS_MODULE VLM_bridge
#include "vlog.h"
static struct bridge *bridge_lookup(const char *name);
static unixctl_cb_func bridge_unixctl_dump_flows;
static int bridge_run_one(struct bridge *);
+static const struct ovsrec_controller *bridge_get_controller(
+ const struct ovsrec_open_vswitch *ovs_cfg,
+ const struct bridge *br);
static void bridge_reconfigure_one(const struct ovsrec_open_vswitch *,
struct bridge *);
static void bridge_reconfigure_controller(const struct ovsrec_open_vswitch *,
}
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,
struct shash_node *node;
struct bridge *br, *next;
size_t i;
+ int sflow_bridge_number;
COVERAGE_INC(bridge_reconfigure);
shash_destroy(&cur_ifaces);
shash_destroy(&want_ifaces);
}
+ sflow_bridge_number = 0;
LIST_FOR_EACH (br, struct bridge, node, &all_bridges) {
uint8_t ea[8];
uint64_t dpid;
ofproto_set_netflow(br->ofproto, NULL);
}
+ /* Set sFlow configuration on this bridge. */
+ if (br->cfg->sflow) {
+ const struct ovsrec_sflow *sflow_cfg = br->cfg->sflow;
+ const struct ovsrec_controller *ctrl;
+ struct ofproto_sflow_options oso;
+
+ memset(&oso, 0, sizeof oso);
+
+ oso.targets.n = sflow_cfg->n_targets;
+ oso.targets.names = sflow_cfg->targets;
+
+ oso.sampling_rate = SFL_DEFAULT_SAMPLING_RATE;
+ if (sflow_cfg->sampling) {
+ oso.sampling_rate = *sflow_cfg->sampling;
+ }
+
+ oso.polling_interval = SFL_DEFAULT_POLLING_INTERVAL;
+ if (sflow_cfg->polling) {
+ oso.polling_interval = *sflow_cfg->polling;
+ }
+
+ oso.header_len = SFL_DEFAULT_HEADER_SIZE;
+ if (sflow_cfg->header) {
+ oso.header_len = *sflow_cfg->header;
+ }
+
+ oso.sub_id = sflow_bridge_number++;
+ oso.agent_device = sflow_cfg->agent;
+
+ ctrl = bridge_get_controller(ovs_cfg, br);
+ oso.control_ip = ctrl ? ctrl->local_ip : NULL;
+ ofproto_set_sflow(br->ofproto, &oso);
+
+ svec_destroy(&oso.targets);
+ } else {
+ ofproto_set_sflow(br->ofproto, NULL);
+ }
+
/* Update the controller and related settings. It would be more
* straightforward to call this from bridge_reconfigure_one(), but we
* can't do it there for two reasons. First, and most importantly, at
/* 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;
br->cfg = br_cfg;
br->ml = mac_learning_create();
br->sent_config_request = false;
- eth_addr_random(br->default_ea);
+ eth_addr_nicira_random(br->default_ea);
port_array_init(&br->ifaces);
* 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;
local_iface = bridge_get_local_iface(br);
if (local_iface && c->local_ip && inet_aton(c->local_ip, &ip)) {
struct netdev *netdev = local_iface->netdev;
- struct in_addr ip, mask, gateway;
+ struct in_addr mask, gateway;
if (!c->local_netmask || !inet_aton(c->local_netmask, &mask)) {
mask.s_addr = 0;
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;
iface = shash_find_data(&old_ifaces, if_cfg->name);
if (!iface) {
- iface = iface_create(port, if_cfg);
+ iface_create(port, if_cfg);
} else {
iface->cfg = if_cfg;
}
size_t n_vlans;
size_t i;
- *vlans = xmalloc(sizeof *vlans * cfg->n_select_vlan);
+ *vlans = xmalloc(sizeof **vlans * cfg->n_select_vlan);
n_vlans = 0;
for (i = 0; i < cfg->n_select_vlan; i++) {
int64_t vlan = cfg->select_vlan[i];