Bugfix: Remove class tc configuration after queue delete.

When removing queues from datapath, tc state was being left
at the qdisc configuration.
Add netdev_delete_class function which clears this state.
This commit is contained in:
Yiannis Yiakoumis committed 2009-12-16 01:20:30 -08:00
1 parent 9521a635c0
commit ae39860411
3 files changed
+27

No files matched your search

+25
View File
@@ -202,6 +202,7 @@ get_ipv6_address(const char *name, struct in6_addr *in6)
"classid %x:%x htb rate %dkbit ceil %dkbit"
#define COMMAND_CHANGE_CLASS "/sbin/tc class change dev %s parent %x:%x " \
"classid %x:%x htb rate %dkbit ceil %dkbit"
#define COMMAND_DEL_CLASS "/sbin/tc class del dev %s parent %x:%x classid %x:%x"
static int
netdev_setup_root_class(const struct netdev *netdev, uint16_t class_id,
@@ -288,6 +289,30 @@ netdev_change_class(const struct netdev *netdev, uint16_t class_id, uint16_t rat
return 0;
}
/** Deletes a class already defined to represent an OpenFlow queue.
*
* @param netdev the device under configuration
* @param class_id unique identifier for this queue.
* @param rate the minimum rate for this queue in kbps
* @return 0 on success, non-zero value when the configuration was not
* successful.
*/
int
netdev_delete_class(const struct netdev *netdev, uint16_t class_id)
{
char command[1024];
snprintf(command, sizeof(command), COMMAND_DEL_CLASS, netdev->name,
TC_QDISC, TC_ROOT_CLASS, TC_QDISC, class_id);
if (system(command) != 0) {
VLOG_ERR("Problem deleting class %d for device %s",class_id,
netdev->name);
return -1;
}
return 0;
}
static int
open_queue_socket(const char * name, uint16_t class_id, int * fd)
{
+1
View File
@@ -98,6 +98,7 @@ int netdev_arp_lookup(const struct netdev *, uint32_t ip, uint8_t mac[6]);
int netdev_setup_slicing(struct netdev *, uint16_t);
int netdev_setup_class(const struct netdev *, uint16_t , uint16_t);
int netdev_change_class(const struct netdev *, uint16_t , uint16_t);
int netdev_delete_class(const struct netdev *, uint16_t);
void netdev_enumerate(struct svec *);
int netdev_nodev_get_flags(const char *netdev_name, enum netdev_flags *);
+1
View File
@@ -107,6 +107,7 @@ recv_of_exp_queue_delete(struct datapath *dp,
if (p->netdev) {
q = dp_lookup_queue(p,queue_id);
if (q) {
netdev_delete_class(p->netdev,q->class_id);
port_delete_queue(p,q);
}
else {