2 * Copyright 2012 Mellanox Technologies Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * Compatibility file for Linux wireless for kernels 3.4.
11 #include <linux/kernel.h>
12 #include <linux/bitops.h>
13 #include <linux/export.h>
14 #include <linux/types.h>
15 #include <linux/pkt_sched.h>
17 #define ECN_OR_COST(class) TC_PRIO_##class
19 #ifndef CONFIG_COMPAT_IS_IP_TOS2PRIO
20 const __u8 ip_tos2prio[16] = {
22 ECN_OR_COST(BESTEFFORT),
24 ECN_OR_COST(BESTEFFORT),
30 ECN_OR_COST(INTERACTIVE),
32 ECN_OR_COST(INTERACTIVE),
33 TC_PRIO_INTERACTIVE_BULK,
34 ECN_OR_COST(INTERACTIVE_BULK),
35 TC_PRIO_INTERACTIVE_BULK,
36 ECN_OR_COST(INTERACTIVE_BULK)
38 EXPORT_SYMBOL(ip_tos2prio);
41 int dev_uc_add_excl(struct net_device *dev, unsigned char *addr)
43 struct netdev_hw_addr *ha;
46 netif_addr_lock_bh(dev);
47 netdev_for_each_uc_addr(ha, dev) {
48 if (!memcmp(ha->addr, addr, dev->addr_len) &&
49 ha->type == NETDEV_HW_ADDR_T_UNICAST) {
54 netif_addr_unlock_bh(dev);
56 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
57 return dev_uc_add(dev, addr);
59 return dev_unicast_add(dev, addr);
63 netif_addr_unlock_bh(dev);
66 EXPORT_SYMBOL(dev_uc_add_excl);
68 int dev_mc_add_excl(struct net_device *dev, unsigned char *addr)
70 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
71 struct netdev_hw_addr *ha;
73 struct dev_addr_list *ha;
77 netif_addr_lock_bh(dev);
78 netdev_for_each_mc_addr(ha, dev) {
79 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
80 if (!memcmp(ha->addr, addr, dev->addr_len)) {
82 if (!memcmp(ha->da_addr, addr, dev->addr_len)) {
88 netif_addr_lock_bh(dev);
90 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
91 return dev_mc_add(dev, addr);
93 return dev_mc_add(dev, addr, ETH_ALEN, true);
97 netif_addr_unlock_bh(dev);
100 EXPORT_SYMBOL(dev_mc_add_excl);