aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/eth_media.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/eth_media.c')
-rw-r--r--net/tipc/eth_media.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index 682da4a28041..9be4839e32c5 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/eth_media.c: Ethernet bearer support for TIPC 2 * net/tipc/eth_media.c: Ethernet bearer support for TIPC
3 * 3 *
4 * Copyright (c) 2001-2006, Ericsson AB 4 * Copyright (c) 2001-2006, Ericsson AB
5 * Copyright (c) 2005-2006, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -50,7 +50,7 @@
50 * @dev: ptr to associated Ethernet network device 50 * @dev: ptr to associated Ethernet network device
51 * @tipc_packet_type: used in binding TIPC to Ethernet driver 51 * @tipc_packet_type: used in binding TIPC to Ethernet driver
52 */ 52 */
53 53
54struct eth_bearer { 54struct eth_bearer {
55 struct tipc_bearer *bearer; 55 struct tipc_bearer *bearer;
56 struct net_device *dev; 56 struct net_device *dev;
@@ -62,10 +62,10 @@ static int eth_started = 0;
62static struct notifier_block notifier; 62static struct notifier_block notifier;
63 63
64/** 64/**
65 * send_msg - send a TIPC message out over an Ethernet interface 65 * send_msg - send a TIPC message out over an Ethernet interface
66 */ 66 */
67 67
68static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, 68static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
69 struct tipc_media_addr *dest) 69 struct tipc_media_addr *dest)
70{ 70{
71 struct sk_buff *clone; 71 struct sk_buff *clone;
@@ -76,7 +76,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
76 clone->nh.raw = clone->data; 76 clone->nh.raw = clone->data;
77 dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev; 77 dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev;
78 clone->dev = dev; 78 clone->dev = dev;
79 dev->hard_header(clone, dev, ETH_P_TIPC, 79 dev->hard_header(clone, dev, ETH_P_TIPC,
80 &dest->dev_addr.eth_addr, 80 &dest->dev_addr.eth_addr,
81 dev->dev_addr, clone->len); 81 dev->dev_addr, clone->len);
82 dev_queue_xmit(clone); 82 dev_queue_xmit(clone);
@@ -86,12 +86,12 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
86 86
87/** 87/**
88 * recv_msg - handle incoming TIPC message from an Ethernet interface 88 * recv_msg - handle incoming TIPC message from an Ethernet interface
89 * 89 *
90 * Routine truncates any Ethernet padding/CRC appended to the message, 90 * Routine truncates any Ethernet padding/CRC appended to the message,
91 * and ensures message size matches actual length 91 * and ensures message size matches actual length
92 */ 92 */
93 93
94static int recv_msg(struct sk_buff *buf, struct net_device *dev, 94static int recv_msg(struct sk_buff *buf, struct net_device *dev,
95 struct packet_type *pt, struct net_device *orig_dev) 95 struct packet_type *pt, struct net_device *orig_dev)
96{ 96{
97 struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv; 97 struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv;
@@ -99,14 +99,14 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
99 99
100 if (likely(eb_ptr->bearer)) { 100 if (likely(eb_ptr->bearer)) {
101 if (likely(!dev->promiscuity) || 101 if (likely(!dev->promiscuity) ||
102 !memcmp(buf->mac.raw,dev->dev_addr,ETH_ALEN) || 102 !memcmp(buf->mac.raw,dev->dev_addr,ETH_ALEN) ||
103 !memcmp(buf->mac.raw,dev->broadcast,ETH_ALEN)) { 103 !memcmp(buf->mac.raw,dev->broadcast,ETH_ALEN)) {
104 size = msg_size((struct tipc_msg *)buf->data); 104 size = msg_size((struct tipc_msg *)buf->data);
105 skb_trim(buf, size); 105 skb_trim(buf, size);
106 if (likely(buf->len == size)) { 106 if (likely(buf->len == size)) {
107 buf->next = NULL; 107 buf->next = NULL;
108 tipc_recv_msg(buf, eb_ptr->bearer); 108 tipc_recv_msg(buf, eb_ptr->bearer);
109 return TIPC_OK; 109 return TIPC_OK;
110 } 110 }
111 } 111 }
112 } 112 }
@@ -115,7 +115,7 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
115} 115}
116 116
117/** 117/**
118 * enable_bearer - attach TIPC bearer to an Ethernet interface 118 * enable_bearer - attach TIPC bearer to an Ethernet interface
119 */ 119 */
120 120
121static int enable_bearer(struct tipc_bearer *tb_ptr) 121static int enable_bearer(struct tipc_bearer *tb_ptr)
@@ -127,7 +127,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
127 127
128 /* Find device with specified name */ 128 /* Find device with specified name */
129 129
130 while (dev && dev->name && strncmp(dev->name, driver_name, IFNAMSIZ)) { 130 while (dev && dev->name && strncmp(dev->name, driver_name, IFNAMSIZ)) {
131 dev = dev->next; 131 dev = dev->next;
132 } 132 }
133 if (!dev) 133 if (!dev)
@@ -154,14 +154,14 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
154 eb_ptr->bearer = tb_ptr; 154 eb_ptr->bearer = tb_ptr;
155 tb_ptr->usr_handle = (void *)eb_ptr; 155 tb_ptr->usr_handle = (void *)eb_ptr;
156 tb_ptr->mtu = dev->mtu; 156 tb_ptr->mtu = dev->mtu;
157 tb_ptr->blocked = 0; 157 tb_ptr->blocked = 0;
158 tb_ptr->addr.type = htonl(TIPC_MEDIA_TYPE_ETH); 158 tb_ptr->addr.type = htonl(TIPC_MEDIA_TYPE_ETH);
159 memcpy(&tb_ptr->addr.dev_addr, &dev->dev_addr, ETH_ALEN); 159 memcpy(&tb_ptr->addr.dev_addr, &dev->dev_addr, ETH_ALEN);
160 return 0; 160 return 0;
161} 161}
162 162
163/** 163/**
164 * disable_bearer - detach TIPC bearer from an Ethernet interface 164 * disable_bearer - detach TIPC bearer from an Ethernet interface
165 * 165 *
166 * We really should do dev_remove_pack() here, but this function can not be 166 * We really should do dev_remove_pack() here, but this function can not be
167 * called at tasklet level. => Use eth_bearer->bearer as a flag to throw away 167 * called at tasklet level. => Use eth_bearer->bearer as a flag to throw away
@@ -176,11 +176,11 @@ static void disable_bearer(struct tipc_bearer *tb_ptr)
176/** 176/**
177 * recv_notification - handle device updates from OS 177 * recv_notification - handle device updates from OS
178 * 178 *
179 * Change the state of the Ethernet bearer (if any) associated with the 179 * Change the state of the Ethernet bearer (if any) associated with the
180 * specified device. 180 * specified device.
181 */ 181 */
182 182
183static int recv_notification(struct notifier_block *nb, unsigned long evt, 183static int recv_notification(struct notifier_block *nb, unsigned long evt,
184 void *dv) 184 void *dv)
185{ 185{
186 struct net_device *dev = (struct net_device *)dv; 186 struct net_device *dev = (struct net_device *)dv;
@@ -194,7 +194,7 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
194 if (!eb_ptr->bearer) 194 if (!eb_ptr->bearer)
195 return NOTIFY_DONE; /* bearer had been disabled */ 195 return NOTIFY_DONE; /* bearer had been disabled */
196 196
197 eb_ptr->bearer->mtu = dev->mtu; 197 eb_ptr->bearer->mtu = dev->mtu;
198 198
199 switch (evt) { 199 switch (evt) {
200 case NETDEV_CHANGE: 200 case NETDEV_CHANGE:
@@ -210,12 +210,12 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
210 tipc_block_bearer(eb_ptr->bearer->name); 210 tipc_block_bearer(eb_ptr->bearer->name);
211 break; 211 break;
212 case NETDEV_CHANGEMTU: 212 case NETDEV_CHANGEMTU:
213 case NETDEV_CHANGEADDR: 213 case NETDEV_CHANGEADDR:
214 tipc_block_bearer(eb_ptr->bearer->name); 214 tipc_block_bearer(eb_ptr->bearer->name);
215 tipc_continue(eb_ptr->bearer); 215 tipc_continue(eb_ptr->bearer);
216 break; 216 break;
217 case NETDEV_UNREGISTER: 217 case NETDEV_UNREGISTER:
218 case NETDEV_CHANGENAME: 218 case NETDEV_CHANGENAME:
219 tipc_disable_bearer(eb_ptr->bearer->name); 219 tipc_disable_bearer(eb_ptr->bearer->name);
220 break; 220 break;
221 } 221 }
@@ -227,7 +227,7 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
227 */ 227 */
228 228
229static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size) 229static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size)
230{ 230{
231 unchar *addr = (unchar *)&a->dev_addr; 231 unchar *addr = (unchar *)&a->dev_addr;
232 232
233 if (str_size < 18) 233 if (str_size < 18)
@@ -246,7 +246,7 @@ static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size
246 */ 246 */
247 247
248int tipc_eth_media_start(void) 248int tipc_eth_media_start(void)
249{ 249{
250 struct tipc_media_addr bcast_addr; 250 struct tipc_media_addr bcast_addr;
251 int res; 251 int res;
252 252
@@ -259,8 +259,8 @@ int tipc_eth_media_start(void)
259 memset(eth_bearers, 0, sizeof(eth_bearers)); 259 memset(eth_bearers, 0, sizeof(eth_bearers));
260 260
261 res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth", 261 res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth",
262 enable_bearer, disable_bearer, send_msg, 262 enable_bearer, disable_bearer, send_msg,
263 eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY, 263 eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY,
264 ETH_LINK_TOLERANCE, ETH_LINK_WINDOW); 264 ETH_LINK_TOLERANCE, ETH_LINK_WINDOW);
265 if (res) 265 if (res)
266 return res; 266 return res;