#define THIS_MODULE VLM_port
#include "vlog.h"
-static struct svec port_cfg = SVEC_EMPTY_INITIALIZER;
-static struct svec all_ports = SVEC_EMPTY_INITIALIZER;
-
-
static int
set_ingress_policing(const char *port_name)
{
return netdev_nodev_set_policing(port_name, kbits_rate, kbits_burst);
}
-static int
-set_port_config(const char *port_name)
-{
- set_ingress_policing(port_name);
-
- return 0;
-}
-
-static void
-strip_port_config(const char *port_name)
-{
- netdev_nodev_set_policing(port_name, 0, 0);
-}
-
void
port_init(void)
{
void
port_reconfigure(void)
{
-#if 1
- /* xxx Hack to get around interfaces with a "." in their name, since
- * xxx that is the delimiter in vswitchd.conf. Once the delimiter
- * xxx is changed, this portion of the code can be removed. */
struct svec ports;
int i;
for (i=0; i<ports.n; i++) {
set_ingress_policing(ports.names[i]);
}
-#else
- struct svec new_cfg;
- struct svec new_ports;
- int i;
-
- svec_init(&new_cfg);
- cfg_get_section(&new_cfg, "port");
- svec_sort(&new_cfg);
-
- if (svec_equal(&port_cfg, &new_cfg)) {
- svec_destroy(&new_cfg);
- return;
- }
-
- svec_init(&new_ports);
- cfg_get_subsections(&new_ports, "port");
- for (i=0; i<all_ports.n; i++) {
- if (!svec_contains(&new_ports, all_ports.names[i])) {
- strip_port_config(all_ports.names[i]);
- }
- }
-
- for (i=0; i<new_ports.n; i++) {
- set_port_config(new_ports.names[i]);
- }
-
- svec_swap(&new_cfg, &port_cfg);
- svec_destroy(&new_cfg);
-
- svec_swap(&new_ports, &all_ports);
- svec_destroy(&new_ports);
-#endif
}