aboutsummaryrefslogtreecommitdiffstats
path: root/net/dcb
diff options
context:
space:
mode:
authorMark Rustad <mark.d.rustad@intel.com>2011-10-06 04:52:33 -0400
committerDavid S. Miller <davem@davemloft.net>2011-10-06 15:49:51 -0400
commite290ed81307ca7d92675f0d9c683add693c2f377 (patch)
treecf1f0b08f2eebdf47cc606db6506b164dc0dbd8a /net/dcb
parente878d78b9a7403fabc89ecc93c56928b74d14f01 (diff)
dcb: Use ifindex instead of ifname
Use ifindex instead of ifname in the DCB app ring. This makes for a smaller data structure and faster comparisons. It also avoids possible issues when a net device is renamed. Signed-off-by: Mark Rustad <mark.d.rustad@intel.com> Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dcb')
-rw-r--r--net/dcb/dcbnl.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 3cb56af4e13c..e508593d589b 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1255,7 +1255,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
1255 1255
1256 spin_lock(&dcb_lock); 1256 spin_lock(&dcb_lock);
1257 list_for_each_entry(itr, &dcb_app_list, list) { 1257 list_for_each_entry(itr, &dcb_app_list, list) {
1258 if (strncmp(itr->name, netdev->name, IFNAMSIZ) == 0) { 1258 if (itr->ifindex == netdev->ifindex) {
1259 err = nla_put(skb, DCB_ATTR_IEEE_APP, sizeof(itr->app), 1259 err = nla_put(skb, DCB_ATTR_IEEE_APP, sizeof(itr->app),
1260 &itr->app); 1260 &itr->app);
1261 if (err) { 1261 if (err) {
@@ -1412,7 +1412,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev)
1412 goto dcb_unlock; 1412 goto dcb_unlock;
1413 1413
1414 list_for_each_entry(itr, &dcb_app_list, list) { 1414 list_for_each_entry(itr, &dcb_app_list, list) {
1415 if (strncmp(itr->name, netdev->name, IFNAMSIZ) == 0) { 1415 if (itr->ifindex == netdev->ifindex) {
1416 struct nlattr *app_nest = nla_nest_start(skb, 1416 struct nlattr *app_nest = nla_nest_start(skb,
1417 DCB_ATTR_APP); 1417 DCB_ATTR_APP);
1418 if (!app_nest) 1418 if (!app_nest)
@@ -2050,7 +2050,7 @@ u8 dcb_getapp(struct net_device *dev, struct dcb_app *app)
2050 list_for_each_entry(itr, &dcb_app_list, list) { 2050 list_for_each_entry(itr, &dcb_app_list, list) {
2051 if (itr->app.selector == app->selector && 2051 if (itr->app.selector == app->selector &&
2052 itr->app.protocol == app->protocol && 2052 itr->app.protocol == app->protocol &&
2053 (strncmp(itr->name, dev->name, IFNAMSIZ) == 0)) { 2053 itr->ifindex == dev->ifindex) {
2054 prio = itr->app.priority; 2054 prio = itr->app.priority;
2055 break; 2055 break;
2056 } 2056 }
@@ -2073,7 +2073,7 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new)
2073 struct dcb_app_type *itr; 2073 struct dcb_app_type *itr;
2074 struct dcb_app_type event; 2074 struct dcb_app_type event;
2075 2075
2076 memcpy(&event.name, dev->name, sizeof(event.name)); 2076 event.ifindex = dev->ifindex;
2077 memcpy(&event.app, new, sizeof(event.app)); 2077 memcpy(&event.app, new, sizeof(event.app));
2078 2078
2079 spin_lock(&dcb_lock); 2079 spin_lock(&dcb_lock);
@@ -2081,7 +2081,7 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new)
2081 list_for_each_entry(itr, &dcb_app_list, list) { 2081 list_for_each_entry(itr, &dcb_app_list, list) {
2082 if (itr->app.selector == new->selector && 2082 if (itr->app.selector == new->selector &&
2083 itr->app.protocol == new->protocol && 2083 itr->app.protocol == new->protocol &&
2084 (strncmp(itr->name, dev->name, IFNAMSIZ) == 0)) { 2084 itr->ifindex == dev->ifindex) {
2085 if (new->priority) 2085 if (new->priority)
2086 itr->app.priority = new->priority; 2086 itr->app.priority = new->priority;
2087 else { 2087 else {
@@ -2101,7 +2101,7 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new)
2101 } 2101 }
2102 2102
2103 memcpy(&entry->app, new, sizeof(*new)); 2103 memcpy(&entry->app, new, sizeof(*new));
2104 strncpy(entry->name, dev->name, IFNAMSIZ); 2104 entry->ifindex = dev->ifindex;
2105 list_add(&entry->list, &dcb_app_list); 2105 list_add(&entry->list, &dcb_app_list);
2106 } 2106 }
2107out: 2107out:
@@ -2127,7 +2127,7 @@ u8 dcb_ieee_getapp_mask(struct net_device *dev, struct dcb_app *app)
2127 list_for_each_entry(itr, &dcb_app_list, list) { 2127 list_for_each_entry(itr, &dcb_app_list, list) {
2128 if (itr->app.selector == app->selector && 2128 if (itr->app.selector == app->selector &&
2129 itr->app.protocol == app->protocol && 2129 itr->app.protocol == app->protocol &&
2130 (strncmp(itr->name, dev->name, IFNAMSIZ) == 0)) { 2130 itr->ifindex == dev->ifindex) {
2131 prio |= 1 << itr->app.priority; 2131 prio |= 1 << itr->app.priority;
2132 } 2132 }
2133 } 2133 }
@@ -2150,7 +2150,7 @@ int dcb_ieee_setapp(struct net_device *dev, struct dcb_app *new)
2150 struct dcb_app_type event; 2150 struct dcb_app_type event;
2151 int err = 0; 2151 int err = 0;
2152 2152
2153 memcpy(&event.name, dev->name, sizeof(event.name)); 2153 event.ifindex = dev->ifindex;
2154 memcpy(&event.app, new, sizeof(event.app)); 2154 memcpy(&event.app, new, sizeof(event.app));
2155 2155
2156 spin_lock(&dcb_lock); 2156 spin_lock(&dcb_lock);
@@ -2159,7 +2159,7 @@ int dcb_ieee_setapp(struct net_device *dev, struct dcb_app *new)
2159 if (itr->app.selector == new->selector && 2159 if (itr->app.selector == new->selector &&
2160 itr->app.protocol == new->protocol && 2160 itr->app.protocol == new->protocol &&
2161 itr->app.priority == new->priority && 2161 itr->app.priority == new->priority &&
2162 (strncmp(itr->name, dev->name, IFNAMSIZ) == 0)) { 2162 itr->ifindex == dev->ifindex) {
2163 err = -EEXIST; 2163 err = -EEXIST;
2164 goto out; 2164 goto out;
2165 } 2165 }
@@ -2173,7 +2173,7 @@ int dcb_ieee_setapp(struct net_device *dev, struct dcb_app *new)
2173 } 2173 }
2174 2174
2175 memcpy(&entry->app, new, sizeof(*new)); 2175 memcpy(&entry->app, new, sizeof(*new));
2176 strncpy(entry->name, dev->name, IFNAMSIZ); 2176 entry->ifindex = dev->ifindex;
2177 list_add(&entry->list, &dcb_app_list); 2177 list_add(&entry->list, &dcb_app_list);
2178out: 2178out:
2179 spin_unlock(&dcb_lock); 2179 spin_unlock(&dcb_lock);
@@ -2194,7 +2194,7 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del)
2194 struct dcb_app_type event; 2194 struct dcb_app_type event;
2195 int err = -ENOENT; 2195 int err = -ENOENT;
2196 2196
2197 memcpy(&event.name, dev->name, sizeof(event.name)); 2197 event.ifindex = dev->ifindex;
2198 memcpy(&event.app, del, sizeof(event.app)); 2198 memcpy(&event.app, del, sizeof(event.app));
2199 2199
2200 spin_lock(&dcb_lock); 2200 spin_lock(&dcb_lock);
@@ -2203,7 +2203,7 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del)
2203 if (itr->app.selector == del->selector && 2203 if (itr->app.selector == del->selector &&
2204 itr->app.protocol == del->protocol && 2204 itr->app.protocol == del->protocol &&
2205 itr->app.priority == del->priority && 2205 itr->app.priority == del->priority &&
2206 (strncmp(itr->name, dev->name, IFNAMSIZ) == 0)) { 2206 itr->ifindex == dev->ifindex) {
2207 list_del(&itr->list); 2207 list_del(&itr->list);
2208 kfree(itr); 2208 kfree(itr);
2209 err = 0; 2209 err = 0;