^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) BNEP implementation for Linux Bluetooth stack (BlueZ).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) Copyright (C) 2001-2002 Inventel Systemes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) Written 2001-2002 by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) Clément Moreau <clement.moreau@inventel.fr>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) David Libault <david.libault@inventel.fr>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) This program is free software; you can redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) it under the terms of the GNU General Public License version 2 as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) published by the Free Software Foundation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) SOFTWARE IS DISCLAIMED.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <linux/etherdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <net/bluetooth/bluetooth.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #include <net/bluetooth/hci_core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #include <net/bluetooth/l2cap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #include "bnep.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define BNEP_TX_QUEUE_LEN 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) static int bnep_net_open(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) netif_start_queue(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) static int bnep_net_close(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) netif_stop_queue(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) static void bnep_net_set_mc_list(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #ifdef CONFIG_BT_BNEP_MC_FILTER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct bnep_session *s = netdev_priv(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct sock *sk = s->sock->sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct bnep_set_filter_req *r;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct sk_buff *skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) BT_DBG("%s mc_count %d", dev->name, netdev_mc_count(dev));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) size = sizeof(*r) + (BNEP_MAX_MULTICAST_FILTERS + 1) * ETH_ALEN * 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) skb = alloc_skb(size, GFP_ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) if (!skb) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) BT_ERR("%s Multicast list allocation failed", dev->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) r = (void *) skb->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) __skb_put(skb, sizeof(*r));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) r->type = BNEP_CONTROL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) r->ctrl = BNEP_FILTER_MULTI_ADDR_SET;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) if (dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) u8 start[ETH_ALEN] = { 0x01 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) /* Request all addresses */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) __skb_put_data(skb, start, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) __skb_put_data(skb, dev->broadcast, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) r->len = htons(ETH_ALEN * 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) struct netdev_hw_addr *ha;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) int i, len = skb->len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) if (dev->flags & IFF_BROADCAST) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) __skb_put_data(skb, dev->broadcast, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) __skb_put_data(skb, dev->broadcast, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) /* FIXME: We should group addresses here. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) i = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) netdev_for_each_mc_addr(ha, dev) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) if (i == BNEP_MAX_MULTICAST_FILTERS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) __skb_put_data(skb, ha->addr, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) __skb_put_data(skb, ha->addr, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) i++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) r->len = htons(skb->len - len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) skb_queue_tail(&sk->sk_write_queue, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) wake_up_interruptible(sk_sleep(sk));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) static int bnep_net_set_mac_addr(struct net_device *dev, void *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) BT_DBG("%s", dev->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) static void bnep_net_timeout(struct net_device *dev, unsigned int txqueue)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) BT_DBG("net_timeout");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) netif_wake_queue(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #ifdef CONFIG_BT_BNEP_MC_FILTER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) static int bnep_net_mc_filter(struct sk_buff *skb, struct bnep_session *s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) struct ethhdr *eh = (void *) skb->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) if ((eh->h_dest[0] & 1) && !test_bit(bnep_mc_hash(eh->h_dest), (ulong *) &s->mc_filter))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) #ifdef CONFIG_BT_BNEP_PROTO_FILTER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) /* Determine ether protocol. Based on eth_type_trans. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) static u16 bnep_net_eth_proto(struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) struct ethhdr *eh = (void *) skb->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) u16 proto = ntohs(eh->h_proto);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) if (proto >= ETH_P_802_3_MIN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) return proto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) if (get_unaligned((__be16 *) skb->data) == htons(0xFFFF))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) return ETH_P_802_3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) return ETH_P_802_2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) static int bnep_net_proto_filter(struct sk_buff *skb, struct bnep_session *s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) u16 proto = bnep_net_eth_proto(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) struct bnep_proto_filter *f = s->proto_filter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) for (i = 0; i < BNEP_MAX_PROTO_FILTERS && f[i].end; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) if (proto >= f[i].start && proto <= f[i].end)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) BT_DBG("BNEP: filtered skb %p, proto 0x%.4x", skb, proto);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) static netdev_tx_t bnep_net_xmit(struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) struct bnep_session *s = netdev_priv(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) struct sock *sk = s->sock->sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) BT_DBG("skb %p, dev %p", skb, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) #ifdef CONFIG_BT_BNEP_MC_FILTER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) if (bnep_net_mc_filter(skb, s)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) kfree_skb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) return NETDEV_TX_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) #ifdef CONFIG_BT_BNEP_PROTO_FILTER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) if (bnep_net_proto_filter(skb, s)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) kfree_skb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) return NETDEV_TX_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) * We cannot send L2CAP packets from here as we are potentially in a bh.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) * So we have to queue them and wake up session thread which is sleeping
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) * on the sk_sleep(sk).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) netif_trans_update(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) skb_queue_tail(&sk->sk_write_queue, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) wake_up_interruptible(sk_sleep(sk));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) if (skb_queue_len(&sk->sk_write_queue) >= BNEP_TX_QUEUE_LEN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) BT_DBG("tx queue is full");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) /* Stop queuing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) * Session thread will do netif_wake_queue() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) netif_stop_queue(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) return NETDEV_TX_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) static const struct net_device_ops bnep_netdev_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) .ndo_open = bnep_net_open,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) .ndo_stop = bnep_net_close,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) .ndo_start_xmit = bnep_net_xmit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) .ndo_validate_addr = eth_validate_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) .ndo_set_rx_mode = bnep_net_set_mc_list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) .ndo_set_mac_address = bnep_net_set_mac_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) .ndo_tx_timeout = bnep_net_timeout,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) void bnep_net_setup(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) eth_broadcast_addr(dev->broadcast);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) dev->addr_len = ETH_ALEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) ether_setup(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) dev->min_mtu = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) dev->max_mtu = ETH_MAX_MTU;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) dev->priv_flags &= ~IFF_TX_SKB_SHARING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) dev->netdev_ops = &bnep_netdev_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) dev->watchdog_timeo = HZ * 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }