aboutsummaryrefslogtreecommitdiffstats
path: root/net/dcb
diff options
context:
space:
mode:
Diffstat (limited to 'net/dcb')
-rw-r--r--net/dcb/dcbnl.c55
1 files changed, 51 insertions, 4 deletions
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index ffba32692bdb..3e3b51c4a84a 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1399,7 +1399,7 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlattr **tb,
1399 if (ops->ieee_setapp) 1399 if (ops->ieee_setapp)
1400 err = ops->ieee_setapp(netdev, app_data); 1400 err = ops->ieee_setapp(netdev, app_data);
1401 else 1401 else
1402 err = dcb_setapp(netdev, app_data); 1402 err = dcb_ieee_setapp(netdev, app_data);
1403 if (err) 1403 if (err)
1404 goto err; 1404 goto err;
1405 } 1405 }
@@ -1829,10 +1829,11 @@ u8 dcb_getapp(struct net_device *dev, struct dcb_app *app)
1829EXPORT_SYMBOL(dcb_getapp); 1829EXPORT_SYMBOL(dcb_getapp);
1830 1830
1831/** 1831/**
1832 * ixgbe_dcbnl_setapp - add dcb application data to app list 1832 * dcb_setapp - add CEE dcb application data to app list
1833 * 1833 *
1834 * Priority 0 is the default priority this removes applications 1834 * Priority 0 is an invalid priority in CEE spec. This routine
1835 * from the app list if the priority is set to zero. 1835 * removes applications from the app list if the priority is
1836 * set to zero.
1836 */ 1837 */
1837u8 dcb_setapp(struct net_device *dev, struct dcb_app *new) 1838u8 dcb_setapp(struct net_device *dev, struct dcb_app *new)
1838{ 1839{
@@ -1877,6 +1878,52 @@ out:
1877} 1878}
1878EXPORT_SYMBOL(dcb_setapp); 1879EXPORT_SYMBOL(dcb_setapp);
1879 1880
1881/**
1882 * dcb_ieee_setapp - add IEEE dcb application data to app list
1883 *
1884 * This adds Application data to the list. Multiple application
1885 * entries may exists for the same selector and protocol as long
1886 * as the priorities are different.
1887 */
1888int dcb_ieee_setapp(struct net_device *dev, struct dcb_app *new)
1889{
1890 struct dcb_app_type *itr, *entry;
1891 struct dcb_app_type event;
1892 int err = 0;
1893
1894 memcpy(&event.name, dev->name, sizeof(event.name));
1895 memcpy(&event.app, new, sizeof(event.app));
1896
1897 spin_lock(&dcb_lock);
1898 /* Search for existing match and abort if found */
1899 list_for_each_entry(itr, &dcb_app_list, list) {
1900 if (itr->app.selector == new->selector &&
1901 itr->app.protocol == new->protocol &&
1902 itr->app.priority == new->priority &&
1903 (strncmp(itr->name, dev->name, IFNAMSIZ) == 0)) {
1904 err = -EEXIST;
1905 goto out;
1906 }
1907 }
1908
1909 /* App entry does not exist add new entry */
1910 entry = kmalloc(sizeof(struct dcb_app_type), GFP_ATOMIC);
1911 if (!entry) {
1912 err = -ENOMEM;
1913 goto out;
1914 }
1915
1916 memcpy(&entry->app, new, sizeof(*new));
1917 strncpy(entry->name, dev->name, IFNAMSIZ);
1918 list_add(&entry->list, &dcb_app_list);
1919out:
1920 spin_unlock(&dcb_lock);
1921 if (!err)
1922 call_dcbevent_notifiers(DCB_APP_EVENT, &event);
1923 return err;
1924}
1925EXPORT_SYMBOL(dcb_ieee_setapp);
1926
1880static void dcb_flushapp(void) 1927static void dcb_flushapp(void)
1881{ 1928{
1882 struct dcb_app_type *app; 1929 struct dcb_app_type *app;