Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /********************************************************************* |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 2 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * Filename: irlan_eth.c |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 4 | * Version: |
| 5 | * Description: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * Status: Experimental. |
| 7 | * Author: Dag Brattli <dagb@cs.uit.no> |
| 8 | * Created at: Thu Oct 15 08:37:58 1998 |
| 9 | * Modified at: Tue Mar 21 09:06:41 2000 |
| 10 | * Modified by: Dag Brattli <dagb@cs.uit.no> |
| 11 | * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> |
| 12 | * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> |
| 13 | * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 14 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved. |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 16 | * |
| 17 | * This program is free software; you can redistribute it and/or |
| 18 | * modify it under the terms of the GNU General Public License as |
| 19 | * published by the Free Software Foundation; either version 2 of |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | * the License, or (at your option) any later version. |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 21 | * |
Jan Engelhardt | 96de0e2 | 2007-10-19 23:21:04 +0200 | [diff] [blame] | 22 | * Neither Dag Brattli nor University of Tromsø admit liability nor |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 23 | * provide warranty for any of this software. This material is |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | * provided "AS-IS" and at no charge. |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 25 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | ********************************************************************/ |
| 27 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | #include <linux/netdevice.h> |
| 29 | #include <linux/etherdevice.h> |
| 30 | #include <linux/inetdevice.h> |
| 31 | #include <linux/if_arp.h> |
| 32 | #include <linux/module.h> |
Alexey Dobriyan | d43c36d | 2009-10-07 17:09:06 +0400 | [diff] [blame] | 33 | #include <linux/sched.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | #include <net/arp.h> |
| 35 | |
| 36 | #include <net/irda/irda.h> |
| 37 | #include <net/irda/irmod.h> |
| 38 | #include <net/irda/irlan_common.h> |
| 39 | #include <net/irda/irlan_client.h> |
| 40 | #include <net/irda/irlan_event.h> |
| 41 | #include <net/irda/irlan_eth.h> |
| 42 | |
| 43 | static int irlan_eth_open(struct net_device *dev); |
| 44 | static int irlan_eth_close(struct net_device *dev); |
Stephen Hemminger | 6518bbb | 2009-08-31 19:50:50 +0000 | [diff] [blame] | 45 | static netdev_tx_t irlan_eth_xmit(struct sk_buff *skb, |
| 46 | struct net_device *dev); |
Dragos Foianu | b6a82dd | 2013-07-13 15:03:55 +0100 | [diff] [blame] | 47 | static void irlan_eth_set_multicast_list(struct net_device *dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | |
Stephen Hemminger | 9cc8ba7 | 2009-03-20 19:35:34 +0000 | [diff] [blame] | 49 | static const struct net_device_ops irlan_eth_netdev_ops = { |
Dragos Foianu | b6a82dd | 2013-07-13 15:03:55 +0100 | [diff] [blame] | 50 | .ndo_open = irlan_eth_open, |
| 51 | .ndo_stop = irlan_eth_close, |
| 52 | .ndo_start_xmit = irlan_eth_xmit, |
Jiri Pirko | afc4b13 | 2011-08-16 06:29:01 +0000 | [diff] [blame] | 53 | .ndo_set_rx_mode = irlan_eth_set_multicast_list, |
Stephen Hemminger | 9cc8ba7 | 2009-03-20 19:35:34 +0000 | [diff] [blame] | 54 | .ndo_change_mtu = eth_change_mtu, |
| 55 | .ndo_validate_addr = eth_validate_addr, |
| 56 | }; |
| 57 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | /* |
| 59 | * Function irlan_eth_setup (dev) |
| 60 | * |
| 61 | * The network device initialization function. |
| 62 | * |
| 63 | */ |
| 64 | static void irlan_eth_setup(struct net_device *dev) |
| 65 | { |
Stephen Hemminger | 9cc8ba7 | 2009-03-20 19:35:34 +0000 | [diff] [blame] | 66 | ether_setup(dev); |
| 67 | |
| 68 | dev->netdev_ops = &irlan_eth_netdev_ops; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | dev->destructor = free_netdev; |
| 70 | |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 71 | |
| 72 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | * Lets do all queueing in IrTTP instead of this device driver. |
| 74 | * Queueing here as well can introduce some strange latency |
| 75 | * problems, which we will avoid by setting the queue size to 0. |
| 76 | */ |
| 77 | /* |
| 78 | * The bugs in IrTTP and IrLAN that created this latency issue |
| 79 | * have now been fixed, and we can propagate flow control properly |
| 80 | * to the network layer. However, this requires a minimal queue of |
| 81 | * packets for the device. |
| 82 | * Without flow control, the Tx Queue is 14 (ttp) + 0 (dev) = 14 |
| 83 | * With flow control, the Tx Queue is 7 (ttp) + 4 (dev) = 11 |
| 84 | * See irlan_eth_flow_indication()... |
| 85 | * Note : this number was randomly selected and would need to |
| 86 | * be adjusted. |
| 87 | * Jean II */ |
| 88 | dev->tx_queue_len = 4; |
| 89 | } |
| 90 | |
| 91 | /* |
| 92 | * Function alloc_irlandev |
| 93 | * |
| 94 | * Allocate network device and control block |
| 95 | * |
| 96 | */ |
| 97 | struct net_device *alloc_irlandev(const char *name) |
| 98 | { |
Tom Gundersen | c835a67 | 2014-07-14 16:37:24 +0200 | [diff] [blame] | 99 | return alloc_netdev(sizeof(struct irlan_cb), name, NET_NAME_UNKNOWN, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | irlan_eth_setup); |
| 101 | } |
| 102 | |
| 103 | /* |
| 104 | * Function irlan_eth_open (dev) |
| 105 | * |
| 106 | * Network device has been opened by user |
| 107 | * |
| 108 | */ |
| 109 | static int irlan_eth_open(struct net_device *dev) |
| 110 | { |
| 111 | struct irlan_cb *self = netdev_priv(dev); |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 112 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | /* Ready to play! */ |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 114 | netif_stop_queue(dev); /* Wait until data link is ready */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | |
| 116 | /* We are now open, so time to do some work */ |
| 117 | self->disconnect_reason = 0; |
| 118 | irlan_client_wakeup(self, self->saddr, self->daddr); |
| 119 | |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 120 | /* Make sure we have a hardware address before we return, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | so DHCP clients gets happy */ |
| 122 | return wait_event_interruptible(self->open_wait, |
| 123 | !self->tsap_data->connected); |
| 124 | } |
| 125 | |
| 126 | /* |
| 127 | * Function irlan_eth_close (dev) |
| 128 | * |
| 129 | * Stop the ether network device, his function will usually be called by |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 130 | * ifconfig down. We should now disconnect the link, We start the |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | * close timer, so that the instance will be removed if we are unable |
| 132 | * to discover the remote device after the disconnect. |
| 133 | */ |
| 134 | static int irlan_eth_close(struct net_device *dev) |
| 135 | { |
| 136 | struct irlan_cb *self = netdev_priv(dev); |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 137 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | /* Stop device */ |
| 139 | netif_stop_queue(dev); |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 140 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | irlan_close_data_channel(self); |
| 142 | irlan_close_tsaps(self); |
| 143 | |
| 144 | irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL); |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 145 | irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); |
| 146 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | /* Remove frames queued on the control channel */ |
| 148 | skb_queue_purge(&self->client.txq); |
| 149 | |
| 150 | self->client.tx_busy = 0; |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 151 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | return 0; |
| 153 | } |
| 154 | |
| 155 | /* |
| 156 | * Function irlan_eth_tx (skb) |
| 157 | * |
| 158 | * Transmits ethernet frames over IrDA link. |
| 159 | * |
| 160 | */ |
Stephen Hemminger | 6518bbb | 2009-08-31 19:50:50 +0000 | [diff] [blame] | 161 | static netdev_tx_t irlan_eth_xmit(struct sk_buff *skb, |
| 162 | struct net_device *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | { |
| 164 | struct irlan_cb *self = netdev_priv(dev); |
| 165 | int ret; |
Eric Dumazet | 79c5f51 | 2010-08-18 00:24:43 +0000 | [diff] [blame] | 166 | unsigned int len; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | |
| 168 | /* skb headroom large enough to contain all IrDA-headers? */ |
| 169 | if ((skb_headroom(skb) < self->max_header_size) || (skb_shared(skb))) { |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 170 | struct sk_buff *new_skb = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | skb_realloc_headroom(skb, self->max_header_size); |
| 172 | |
| 173 | /* We have to free the original skb anyway */ |
| 174 | dev_kfree_skb(skb); |
| 175 | |
| 176 | /* Did the realloc succeed? */ |
| 177 | if (new_skb == NULL) |
Patrick McHardy | 6ed1065 | 2009-06-23 06:03:08 +0000 | [diff] [blame] | 178 | return NETDEV_TX_OK; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | |
| 180 | /* Use the new skb instead */ |
| 181 | skb = new_skb; |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 182 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | |
| 184 | dev->trans_start = jiffies; |
| 185 | |
Eric Dumazet | 79c5f51 | 2010-08-18 00:24:43 +0000 | [diff] [blame] | 186 | len = skb->len; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | /* Now queue the packet in the transport layer */ |
| 188 | if (self->use_udata) |
| 189 | ret = irttp_udata_request(self->tsap_data, skb); |
| 190 | else |
| 191 | ret = irttp_data_request(self->tsap_data, skb); |
| 192 | |
| 193 | if (ret < 0) { |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 194 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | * IrTTPs tx queue is full, so we just have to |
| 196 | * drop the frame! You might think that we should |
| 197 | * just return -1 and don't deallocate the frame, |
| 198 | * but that is dangerous since it's possible that |
| 199 | * we have replaced the original skb with a new |
| 200 | * one with larger headroom, and that would really |
| 201 | * confuse do_dev_queue_xmit() in dev.c! I have |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 202 | * tried :-) DB |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | */ |
| 204 | /* irttp_data_request already free the packet */ |
Eric Dumazet | 81ce790 | 2010-08-19 23:51:33 +0000 | [diff] [blame] | 205 | dev->stats.tx_dropped++; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | } else { |
Eric Dumazet | 81ce790 | 2010-08-19 23:51:33 +0000 | [diff] [blame] | 207 | dev->stats.tx_packets++; |
| 208 | dev->stats.tx_bytes += len; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | } |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 210 | |
Patrick McHardy | 6ed1065 | 2009-06-23 06:03:08 +0000 | [diff] [blame] | 211 | return NETDEV_TX_OK; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | /* |
| 215 | * Function irlan_eth_receive (handle, skb) |
| 216 | * |
| 217 | * This function gets the data that is received on the data channel |
| 218 | * |
| 219 | */ |
| 220 | int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb) |
| 221 | { |
| 222 | struct irlan_cb *self = instance; |
Eric Dumazet | 81ce790 | 2010-08-19 23:51:33 +0000 | [diff] [blame] | 223 | struct net_device *dev = self->dev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | |
| 225 | if (skb == NULL) { |
Eric Dumazet | 81ce790 | 2010-08-19 23:51:33 +0000 | [diff] [blame] | 226 | dev->stats.rx_dropped++; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | return 0; |
| 228 | } |
| 229 | if (skb->len < ETH_HLEN) { |
Joe Perches | 955a9d20 | 2014-11-11 14:44:57 -0800 | [diff] [blame] | 230 | pr_debug("%s() : IrLAN frame too short (%d)\n", |
| 231 | __func__, skb->len); |
Eric Dumazet | 81ce790 | 2010-08-19 23:51:33 +0000 | [diff] [blame] | 232 | dev->stats.rx_dropped++; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | dev_kfree_skb(skb); |
| 234 | return 0; |
| 235 | } |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 236 | |
| 237 | /* |
| 238 | * Adopt this frame! Important to set all these fields since they |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | * might have been previously set by the low level IrDA network |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 240 | * device driver |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | */ |
Eric Dumazet | 81ce790 | 2010-08-19 23:51:33 +0000 | [diff] [blame] | 242 | skb->protocol = eth_type_trans(skb, dev); /* Remove eth header */ |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 243 | |
Eric Dumazet | 81ce790 | 2010-08-19 23:51:33 +0000 | [diff] [blame] | 244 | dev->stats.rx_packets++; |
| 245 | dev->stats.rx_bytes += skb->len; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | |
| 247 | netif_rx(skb); /* Eat it! */ |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 248 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | return 0; |
| 250 | } |
| 251 | |
| 252 | /* |
| 253 | * Function irlan_eth_flow (status) |
| 254 | * |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 255 | * Do flow control between IP/Ethernet and IrLAN/IrTTP. This is done by |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | * controlling the queue stop/start. |
| 257 | * |
| 258 | * The IrDA link layer has the advantage to have flow control, and |
| 259 | * IrTTP now properly handles that. Flow controlling the higher layers |
| 260 | * prevent us to drop Tx packets in here (up to 15% for a TCP socket, |
| 261 | * more for UDP socket). |
| 262 | * Also, this allow us to reduce the overall transmit queue, which means |
| 263 | * less latency in case of mixed traffic. |
| 264 | * Jean II |
| 265 | */ |
| 266 | void irlan_eth_flow_indication(void *instance, void *sap, LOCAL_FLOW flow) |
| 267 | { |
| 268 | struct irlan_cb *self; |
| 269 | struct net_device *dev; |
| 270 | |
Joe Perches | ea11073 | 2011-06-13 16:21:26 +0000 | [diff] [blame] | 271 | self = instance; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | |
| 273 | IRDA_ASSERT(self != NULL, return;); |
| 274 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 275 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | dev = self->dev; |
| 277 | |
| 278 | IRDA_ASSERT(dev != NULL, return;); |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 279 | |
Joe Perches | 955a9d20 | 2014-11-11 14:44:57 -0800 | [diff] [blame] | 280 | pr_debug("%s() : flow %s ; running %d\n", __func__, |
| 281 | flow == FLOW_STOP ? "FLOW_STOP" : "FLOW_START", |
| 282 | netif_running(dev)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | |
| 284 | switch (flow) { |
| 285 | case FLOW_STOP: |
| 286 | /* IrTTP is full, stop higher layers */ |
| 287 | netif_stop_queue(dev); |
| 288 | break; |
| 289 | case FLOW_START: |
| 290 | default: |
| 291 | /* Tell upper layers that its time to transmit frames again */ |
| 292 | /* Schedule network layer */ |
| 293 | netif_wake_queue(dev); |
| 294 | break; |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | * Function set_multicast_list (dev) |
| 300 | * |
| 301 | * Configure the filtering of the device |
| 302 | * |
| 303 | */ |
| 304 | #define HW_MAX_ADDRS 4 /* Must query to get it! */ |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 305 | static void irlan_eth_set_multicast_list(struct net_device *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | { |
YOSHIFUJI Hideaki | 6819bc2 | 2007-02-09 23:24:53 +0900 | [diff] [blame] | 307 | struct irlan_cb *self = netdev_priv(dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | /* Check if data channel has been connected yet */ |
| 310 | if (self->client.state != IRLAN_DATA) { |
Joe Perches | 955a9d20 | 2014-11-11 14:44:57 -0800 | [diff] [blame] | 311 | pr_debug("%s(), delaying!\n", __func__); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | return; |
| 313 | } |
| 314 | |
| 315 | if (dev->flags & IFF_PROMISC) { |
| 316 | /* Enable promiscuous mode */ |
Joe Perches | 6c91023 | 2014-11-11 13:37:30 -0800 | [diff] [blame] | 317 | net_warn_ratelimited("Promiscuous mode not implemented by IrLAN!\n"); |
Dragos Foianu | b6a82dd | 2013-07-13 15:03:55 +0100 | [diff] [blame] | 318 | } else if ((dev->flags & IFF_ALLMULTI) || |
Jiri Pirko | 4cd24ea | 2010-02-08 04:30:35 +0000 | [diff] [blame] | 319 | netdev_mc_count(dev) > HW_MAX_ADDRS) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | /* Disable promiscuous mode, use normal mode. */ |
Joe Perches | 955a9d20 | 2014-11-11 14:44:57 -0800 | [diff] [blame] | 321 | pr_debug("%s(), Setting multicast filter\n", __func__); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | /* hardware_set_filter(NULL); */ |
| 323 | |
| 324 | irlan_set_multicast_filter(self, TRUE); |
Dragos Foianu | b6a82dd | 2013-07-13 15:03:55 +0100 | [diff] [blame] | 325 | } else if (!netdev_mc_empty(dev)) { |
Joe Perches | 955a9d20 | 2014-11-11 14:44:57 -0800 | [diff] [blame] | 326 | pr_debug("%s(), Setting multicast filter\n", __func__); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | /* Walk the address list, and load the filter */ |
| 328 | /* hardware_set_filter(dev->mc_list); */ |
| 329 | |
| 330 | irlan_set_multicast_filter(self, TRUE); |
Dragos Foianu | b6a82dd | 2013-07-13 15:03:55 +0100 | [diff] [blame] | 331 | } else { |
Joe Perches | 955a9d20 | 2014-11-11 14:44:57 -0800 | [diff] [blame] | 332 | pr_debug("%s(), Clearing multicast filter\n", __func__); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | irlan_set_multicast_filter(self, FALSE); |
| 334 | } |
| 335 | |
| 336 | if (dev->flags & IFF_BROADCAST) |
| 337 | irlan_set_broadcast_filter(self, TRUE); |
| 338 | else |
| 339 | irlan_set_broadcast_filter(self, FALSE); |
| 340 | } |