1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-16 18:54:04 +02:00

ks7010: support kernel > 2.6.35

This commit is contained in:
kyak 2011-05-15 12:21:14 +04:00 committed by Xiangfu Liu
parent 5395297c8d
commit 82df0af0d9

View File

@ -2183,7 +2183,11 @@ void hostif_sme_multicast_set(ks_wlan_private *priv)
struct net_device *dev = priv->net_dev; struct net_device *dev = priv->net_dev;
int mc_count; int mc_count;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
struct netdev_hw_addr *ha;
#else
struct dev_mc_list *mclist; struct dev_mc_list *mclist;
#endif
char set_address[NIC_MAX_MCAST_LIST*ETH_ALEN]; char set_address[NIC_MAX_MCAST_LIST*ETH_ALEN];
unsigned long filter_type; unsigned long filter_type;
int i; int i;
@ -2199,16 +2203,22 @@ void hostif_sme_multicast_set(ks_wlan_private *priv)
hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER, sizeof(filter_type), hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER, sizeof(filter_type),
MIB_VALUE_TYPE_BOOL, &filter_type); MIB_VALUE_TYPE_BOOL, &filter_type);
} }
else if ((dev->mc_count > NIC_MAX_MCAST_LIST) || (dev->flags & IFF_ALLMULTI)){ else if ((netdev_mc_count(dev) > NIC_MAX_MCAST_LIST) || (dev->flags & IFF_ALLMULTI)){
filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_MCASTALL); filter_type = cpu_to_le32((uint32_t)MCAST_FILTER_MCASTALL);
hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER, sizeof(filter_type), hostif_mib_set_request(priv, LOCAL_MULTICAST_FILTER, sizeof(filter_type),
MIB_VALUE_TYPE_BOOL, &filter_type); MIB_VALUE_TYPE_BOOL, &filter_type);
} }
else { else {
if (priv->sme_i.sme_flag & SME_MULTICAST){ if (priv->sme_i.sme_flag & SME_MULTICAST){
mc_count = dev->mc_count; mc_count = netdev_mc_count(dev);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
netdev_for_each_mc_addr(ha, dev) {
memcpy(&set_address[i*ETH_ALEN], ha->addr, ETH_ALEN);
}
#else
for (i = 0, mclist = dev->mc_list; mclist && i < mc_count; i++, mclist = mclist->next) for (i = 0, mclist = dev->mc_list; mclist && i < mc_count; i++, mclist = mclist->next)
memcpy(&set_address[i*ETH_ALEN], mclist->dmi_addr, ETH_ALEN); memcpy(&set_address[i*ETH_ALEN], mclist->dmi_addr, ETH_ALEN);
#endif
priv->sme_i.sme_flag &= ~SME_MULTICAST; priv->sme_i.sme_flag &= ~SME_MULTICAST;
hostif_mib_set_request(priv, LOCAL_MULTICAST_ADDRESS, hostif_mib_set_request(priv, LOCAL_MULTICAST_ADDRESS,
(ETH_ALEN*mc_count), MIB_VALUE_TYPE_OSTRING, &set_address[0]); (ETH_ALEN*mc_count), MIB_VALUE_TYPE_OSTRING, &set_address[0]);