aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/bearer.c4
-rw-r--r--net/tipc/bearer.h8
-rw-r--r--net/tipc/eth_media.c56
-rw-r--r--net/tipc/ib_media.c46
4 files changed, 57 insertions, 57 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 609c30c80816..09faa5520079 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -387,7 +387,7 @@ restart:
387 387
388 b_ptr = &tipc_bearers[bearer_id]; 388 b_ptr = &tipc_bearers[bearer_id];
389 strcpy(b_ptr->name, name); 389 strcpy(b_ptr->name, name);
390 res = m_ptr->enable_bearer(b_ptr); 390 res = m_ptr->enable_media(b_ptr);
391 if (res) { 391 if (res) {
392 pr_warn("Bearer <%s> rejected, enable failure (%d)\n", 392 pr_warn("Bearer <%s> rejected, enable failure (%d)\n",
393 name, -res); 393 name, -res);
@@ -465,7 +465,7 @@ static void bearer_disable(struct tipc_bearer *b_ptr)
465 pr_info("Disabling bearer <%s>\n", b_ptr->name); 465 pr_info("Disabling bearer <%s>\n", b_ptr->name);
466 spin_lock_bh(&b_ptr->lock); 466 spin_lock_bh(&b_ptr->lock);
467 b_ptr->blocked = 1; 467 b_ptr->blocked = 1;
468 b_ptr->media->disable_bearer(b_ptr); 468 b_ptr->media->disable_media(b_ptr);
469 list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { 469 list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
470 tipc_link_delete(l_ptr); 470 tipc_link_delete(l_ptr);
471 } 471 }
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index 09c869adcfcf..f800e63980cf 100644
--- a/net/tipc/bearer.h
+++ b/net/tipc/bearer.h
@@ -75,8 +75,8 @@ struct tipc_bearer;
75/** 75/**
76 * struct tipc_media - TIPC media information available to internal users 76 * struct tipc_media - TIPC media information available to internal users
77 * @send_msg: routine which handles buffer transmission 77 * @send_msg: routine which handles buffer transmission
78 * @enable_bearer: routine which enables a bearer 78 * @enable_media: routine which enables a media
79 * @disable_bearer: routine which disables a bearer 79 * @disable_media: routine which disables a media
80 * @addr2str: routine which converts media address to string 80 * @addr2str: routine which converts media address to string
81 * @addr2msg: routine which converts media address to protocol message area 81 * @addr2msg: routine which converts media address to protocol message area
82 * @msg2addr: routine which converts media address from protocol message area 82 * @msg2addr: routine which converts media address from protocol message area
@@ -91,8 +91,8 @@ struct tipc_media {
91 int (*send_msg)(struct sk_buff *buf, 91 int (*send_msg)(struct sk_buff *buf,
92 struct tipc_bearer *b_ptr, 92 struct tipc_bearer *b_ptr,
93 struct tipc_media_addr *dest); 93 struct tipc_media_addr *dest);
94 int (*enable_bearer)(struct tipc_bearer *b_ptr); 94 int (*enable_media)(struct tipc_bearer *b_ptr);
95 void (*disable_bearer)(struct tipc_bearer *b_ptr); 95 void (*disable_media)(struct tipc_bearer *b_ptr);
96 int (*addr2str)(struct tipc_media_addr *a, char *str_buf, int str_size); 96 int (*addr2str)(struct tipc_media_addr *a, char *str_buf, int str_size);
97 int (*addr2msg)(struct tipc_media_addr *a, char *msg_area); 97 int (*addr2msg)(struct tipc_media_addr *a, char *msg_area);
98 int (*msg2addr)(const struct tipc_bearer *b_ptr, 98 int (*msg2addr)(const struct tipc_bearer *b_ptr,
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index 40ea40cf6204..e048d491cc0b 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -2,7 +2,7 @@
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-2007, Ericsson AB 4 * Copyright (c) 2001-2007, Ericsson AB
5 * Copyright (c) 2005-2008, 2011, Wind River Systems 5 * Copyright (c) 2005-2008, 2011-2013, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -37,19 +37,19 @@
37#include "core.h" 37#include "core.h"
38#include "bearer.h" 38#include "bearer.h"
39 39
40#define MAX_ETH_BEARERS MAX_BEARERS 40#define MAX_ETH_MEDIA MAX_BEARERS
41 41
42#define ETH_ADDR_OFFSET 4 /* message header offset of MAC address */ 42#define ETH_ADDR_OFFSET 4 /* message header offset of MAC address */
43 43
44/** 44/**
45 * struct eth_bearer - Ethernet bearer data structure 45 * struct eth_media - Ethernet bearer data structure
46 * @bearer: ptr to associated "generic" bearer structure 46 * @bearer: ptr to associated "generic" bearer structure
47 * @dev: ptr to associated Ethernet network device 47 * @dev: ptr to associated Ethernet network device
48 * @tipc_packet_type: used in binding TIPC to Ethernet driver 48 * @tipc_packet_type: used in binding TIPC to Ethernet driver
49 * @setup: work item used when enabling bearer 49 * @setup: work item used when enabling bearer
50 * @cleanup: work item used when disabling bearer 50 * @cleanup: work item used when disabling bearer
51 */ 51 */
52struct eth_bearer { 52struct eth_media {
53 struct tipc_bearer *bearer; 53 struct tipc_bearer *bearer;
54 struct net_device *dev; 54 struct net_device *dev;
55 struct packet_type tipc_packet_type; 55 struct packet_type tipc_packet_type;
@@ -58,7 +58,7 @@ struct eth_bearer {
58}; 58};
59 59
60static struct tipc_media eth_media_info; 60static struct tipc_media eth_media_info;
61static struct eth_bearer eth_bearers[MAX_ETH_BEARERS]; 61static struct eth_media eth_media_array[MAX_ETH_MEDIA];
62static int eth_started; 62static int eth_started;
63 63
64static int recv_notification(struct notifier_block *nb, unsigned long evt, 64static int recv_notification(struct notifier_block *nb, unsigned long evt,
@@ -100,7 +100,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
100 if (!clone) 100 if (!clone)
101 return 0; 101 return 0;
102 102
103 dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev; 103 dev = ((struct eth_media *)(tb_ptr->usr_handle))->dev;
104 delta = dev->hard_header_len - skb_headroom(buf); 104 delta = dev->hard_header_len - skb_headroom(buf);
105 105
106 if ((delta > 0) && 106 if ((delta > 0) &&
@@ -128,7 +128,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
128static int recv_msg(struct sk_buff *buf, struct net_device *dev, 128static int recv_msg(struct sk_buff *buf, struct net_device *dev,
129 struct packet_type *pt, struct net_device *orig_dev) 129 struct packet_type *pt, struct net_device *orig_dev)
130{ 130{
131 struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv; 131 struct eth_media *eb_ptr = (struct eth_media *)pt->af_packet_priv;
132 132
133 if (!net_eq(dev_net(dev), &init_net)) { 133 if (!net_eq(dev_net(dev), &init_net)) {
134 kfree_skb(buf); 134 kfree_skb(buf);
@@ -147,24 +147,24 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
147} 147}
148 148
149/** 149/**
150 * setup_bearer - setup association between Ethernet bearer and interface 150 * setup_media - setup association between Ethernet bearer and interface
151 */ 151 */
152static void setup_bearer(struct work_struct *work) 152static void setup_media(struct work_struct *work)
153{ 153{
154 struct eth_bearer *eb_ptr = 154 struct eth_media *eb_ptr =
155 container_of(work, struct eth_bearer, setup); 155 container_of(work, struct eth_media, setup);
156 156
157 dev_add_pack(&eb_ptr->tipc_packet_type); 157 dev_add_pack(&eb_ptr->tipc_packet_type);
158} 158}
159 159
160/** 160/**
161 * enable_bearer - attach TIPC bearer to an Ethernet interface 161 * enable_media - attach TIPC bearer to an Ethernet interface
162 */ 162 */
163static int enable_bearer(struct tipc_bearer *tb_ptr) 163static int enable_media(struct tipc_bearer *tb_ptr)
164{ 164{
165 struct net_device *dev; 165 struct net_device *dev;
166 struct eth_bearer *eb_ptr = &eth_bearers[0]; 166 struct eth_media *eb_ptr = &eth_media_array[0];
167 struct eth_bearer *stop = &eth_bearers[MAX_ETH_BEARERS]; 167 struct eth_media *stop = &eth_media_array[MAX_ETH_MEDIA];
168 char *driver_name = strchr((const char *)tb_ptr->name, ':') + 1; 168 char *driver_name = strchr((const char *)tb_ptr->name, ':') + 1;
169 int pending_dev = 0; 169 int pending_dev = 0;
170 170
@@ -188,7 +188,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
188 eb_ptr->tipc_packet_type.func = recv_msg; 188 eb_ptr->tipc_packet_type.func = recv_msg;
189 eb_ptr->tipc_packet_type.af_packet_priv = eb_ptr; 189 eb_ptr->tipc_packet_type.af_packet_priv = eb_ptr;
190 INIT_LIST_HEAD(&(eb_ptr->tipc_packet_type.list)); 190 INIT_LIST_HEAD(&(eb_ptr->tipc_packet_type.list));
191 INIT_WORK(&eb_ptr->setup, setup_bearer); 191 INIT_WORK(&eb_ptr->setup, setup_media);
192 schedule_work(&eb_ptr->setup); 192 schedule_work(&eb_ptr->setup);
193 193
194 /* Associate TIPC bearer with Ethernet bearer */ 194 /* Associate TIPC bearer with Ethernet bearer */
@@ -205,14 +205,14 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
205} 205}
206 206
207/** 207/**
208 * cleanup_bearer - break association between Ethernet bearer and interface 208 * cleanup_media - break association between Ethernet bearer and interface
209 * 209 *
210 * This routine must be invoked from a work queue because it can sleep. 210 * This routine must be invoked from a work queue because it can sleep.
211 */ 211 */
212static void cleanup_bearer(struct work_struct *work) 212static void cleanup_media(struct work_struct *work)
213{ 213{
214 struct eth_bearer *eb_ptr = 214 struct eth_media *eb_ptr =
215 container_of(work, struct eth_bearer, cleanup); 215 container_of(work, struct eth_media, cleanup);
216 216
217 dev_remove_pack(&eb_ptr->tipc_packet_type); 217 dev_remove_pack(&eb_ptr->tipc_packet_type);
218 dev_put(eb_ptr->dev); 218 dev_put(eb_ptr->dev);
@@ -220,18 +220,18 @@ static void cleanup_bearer(struct work_struct *work)
220} 220}
221 221
222/** 222/**
223 * disable_bearer - detach TIPC bearer from an Ethernet interface 223 * disable_media - detach TIPC bearer from an Ethernet interface
224 * 224 *
225 * Mark Ethernet bearer as inactive so that incoming buffers are thrown away, 225 * Mark Ethernet bearer as inactive so that incoming buffers are thrown away,
226 * then get worker thread to complete bearer cleanup. (Can't do cleanup 226 * then get worker thread to complete bearer cleanup. (Can't do cleanup
227 * here because cleanup code needs to sleep and caller holds spinlocks.) 227 * here because cleanup code needs to sleep and caller holds spinlocks.)
228 */ 228 */
229static void disable_bearer(struct tipc_bearer *tb_ptr) 229static void disable_media(struct tipc_bearer *tb_ptr)
230{ 230{
231 struct eth_bearer *eb_ptr = (struct eth_bearer *)tb_ptr->usr_handle; 231 struct eth_media *eb_ptr = (struct eth_media *)tb_ptr->usr_handle;
232 232
233 eb_ptr->bearer = NULL; 233 eb_ptr->bearer = NULL;
234 INIT_WORK(&eb_ptr->cleanup, cleanup_bearer); 234 INIT_WORK(&eb_ptr->cleanup, cleanup_media);
235 schedule_work(&eb_ptr->cleanup); 235 schedule_work(&eb_ptr->cleanup);
236} 236}
237 237
@@ -245,8 +245,8 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
245 void *ptr) 245 void *ptr)
246{ 246{
247 struct net_device *dev = netdev_notifier_info_to_dev(ptr); 247 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
248 struct eth_bearer *eb_ptr = &eth_bearers[0]; 248 struct eth_media *eb_ptr = &eth_media_array[0];
249 struct eth_bearer *stop = &eth_bearers[MAX_ETH_BEARERS]; 249 struct eth_media *stop = &eth_media_array[MAX_ETH_MEDIA];
250 250
251 if (!net_eq(dev_net(dev), &init_net)) 251 if (!net_eq(dev_net(dev), &init_net))
252 return NOTIFY_DONE; 252 return NOTIFY_DONE;
@@ -327,8 +327,8 @@ static int eth_msg2addr(const struct tipc_bearer *tb_ptr,
327 */ 327 */
328static struct tipc_media eth_media_info = { 328static struct tipc_media eth_media_info = {
329 .send_msg = send_msg, 329 .send_msg = send_msg,
330 .enable_bearer = enable_bearer, 330 .enable_media = enable_media,
331 .disable_bearer = disable_bearer, 331 .disable_media = disable_media,
332 .addr2str = eth_addr2str, 332 .addr2str = eth_addr2str,
333 .addr2msg = eth_addr2msg, 333 .addr2msg = eth_addr2msg,
334 .msg2addr = eth_msg2addr, 334 .msg2addr = eth_msg2addr,
diff --git a/net/tipc/ib_media.c b/net/tipc/ib_media.c
index 9934a32bfa87..5545145ccffa 100644
--- a/net/tipc/ib_media.c
+++ b/net/tipc/ib_media.c
@@ -42,17 +42,17 @@
42#include "core.h" 42#include "core.h"
43#include "bearer.h" 43#include "bearer.h"
44 44
45#define MAX_IB_BEARERS MAX_BEARERS 45#define MAX_IB_MEDIA MAX_BEARERS
46 46
47/** 47/**
48 * struct ib_bearer - Infiniband bearer data structure 48 * struct ib_media - Infiniband media data structure
49 * @bearer: ptr to associated "generic" bearer structure 49 * @bearer: ptr to associated "generic" bearer structure
50 * @dev: ptr to associated Infiniband network device 50 * @dev: ptr to associated Infiniband network device
51 * @tipc_packet_type: used in binding TIPC to Infiniband driver 51 * @tipc_packet_type: used in binding TIPC to Infiniband driver
52 * @cleanup: work item used when disabling bearer 52 * @cleanup: work item used when disabling bearer
53 */ 53 */
54 54
55struct ib_bearer { 55struct ib_media {
56 struct tipc_bearer *bearer; 56 struct tipc_bearer *bearer;
57 struct net_device *dev; 57 struct net_device *dev;
58 struct packet_type tipc_packet_type; 58 struct packet_type tipc_packet_type;
@@ -61,7 +61,7 @@ struct ib_bearer {
61}; 61};
62 62
63static struct tipc_media ib_media_info; 63static struct tipc_media ib_media_info;
64static struct ib_bearer ib_bearers[MAX_IB_BEARERS]; 64static struct ib_media ib_media_array[MAX_IB_MEDIA];
65static int ib_started; 65static int ib_started;
66 66
67/** 67/**
@@ -93,7 +93,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
93 if (!clone) 93 if (!clone)
94 return 0; 94 return 0;
95 95
96 dev = ((struct ib_bearer *)(tb_ptr->usr_handle))->dev; 96 dev = ((struct ib_media *)(tb_ptr->usr_handle))->dev;
97 delta = dev->hard_header_len - skb_headroom(buf); 97 delta = dev->hard_header_len - skb_headroom(buf);
98 98
99 if ((delta > 0) && 99 if ((delta > 0) &&
@@ -121,7 +121,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
121static int recv_msg(struct sk_buff *buf, struct net_device *dev, 121static int recv_msg(struct sk_buff *buf, struct net_device *dev,
122 struct packet_type *pt, struct net_device *orig_dev) 122 struct packet_type *pt, struct net_device *orig_dev)
123{ 123{
124 struct ib_bearer *ib_ptr = (struct ib_bearer *)pt->af_packet_priv; 124 struct ib_media *ib_ptr = (struct ib_media *)pt->af_packet_priv;
125 125
126 if (!net_eq(dev_net(dev), &init_net)) { 126 if (!net_eq(dev_net(dev), &init_net)) {
127 kfree_skb(buf); 127 kfree_skb(buf);
@@ -142,22 +142,22 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
142/** 142/**
143 * setup_bearer - setup association between InfiniBand bearer and interface 143 * setup_bearer - setup association between InfiniBand bearer and interface
144 */ 144 */
145static void setup_bearer(struct work_struct *work) 145static void setup_media(struct work_struct *work)
146{ 146{
147 struct ib_bearer *ib_ptr = 147 struct ib_media *ib_ptr =
148 container_of(work, struct ib_bearer, setup); 148 container_of(work, struct ib_media, setup);
149 149
150 dev_add_pack(&ib_ptr->tipc_packet_type); 150 dev_add_pack(&ib_ptr->tipc_packet_type);
151} 151}
152 152
153/** 153/**
154 * enable_bearer - attach TIPC bearer to an InfiniBand interface 154 * enable_media - attach TIPC bearer to an InfiniBand interface
155 */ 155 */
156static int enable_bearer(struct tipc_bearer *tb_ptr) 156static int enable_media(struct tipc_bearer *tb_ptr)
157{ 157{
158 struct net_device *dev; 158 struct net_device *dev;
159 struct ib_bearer *ib_ptr = &ib_bearers[0]; 159 struct ib_media *ib_ptr = &ib_media_array[0];
160 struct ib_bearer *stop = &ib_bearers[MAX_IB_BEARERS]; 160 struct ib_media *stop = &ib_media_array[MAX_IB_MEDIA];
161 char *driver_name = strchr((const char *)tb_ptr->name, ':') + 1; 161 char *driver_name = strchr((const char *)tb_ptr->name, ':') + 1;
162 int pending_dev = 0; 162 int pending_dev = 0;
163 163
@@ -181,7 +181,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
181 ib_ptr->tipc_packet_type.func = recv_msg; 181 ib_ptr->tipc_packet_type.func = recv_msg;
182 ib_ptr->tipc_packet_type.af_packet_priv = ib_ptr; 182 ib_ptr->tipc_packet_type.af_packet_priv = ib_ptr;
183 INIT_LIST_HEAD(&(ib_ptr->tipc_packet_type.list)); 183 INIT_LIST_HEAD(&(ib_ptr->tipc_packet_type.list));
184 INIT_WORK(&ib_ptr->setup, setup_bearer); 184 INIT_WORK(&ib_ptr->setup, setup_media);
185 schedule_work(&ib_ptr->setup); 185 schedule_work(&ib_ptr->setup);
186 186
187 /* Associate TIPC bearer with InfiniBand bearer */ 187 /* Associate TIPC bearer with InfiniBand bearer */
@@ -204,8 +204,8 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
204 */ 204 */
205static void cleanup_bearer(struct work_struct *work) 205static void cleanup_bearer(struct work_struct *work)
206{ 206{
207 struct ib_bearer *ib_ptr = 207 struct ib_media *ib_ptr =
208 container_of(work, struct ib_bearer, cleanup); 208 container_of(work, struct ib_media, cleanup);
209 209
210 dev_remove_pack(&ib_ptr->tipc_packet_type); 210 dev_remove_pack(&ib_ptr->tipc_packet_type);
211 dev_put(ib_ptr->dev); 211 dev_put(ib_ptr->dev);
@@ -213,15 +213,15 @@ static void cleanup_bearer(struct work_struct *work)
213} 213}
214 214
215/** 215/**
216 * disable_bearer - detach TIPC bearer from an InfiniBand interface 216 * disable_media - detach TIPC bearer from an InfiniBand interface
217 * 217 *
218 * Mark InfiniBand bearer as inactive so that incoming buffers are thrown away, 218 * Mark InfiniBand bearer as inactive so that incoming buffers are thrown away,
219 * then get worker thread to complete bearer cleanup. (Can't do cleanup 219 * then get worker thread to complete bearer cleanup. (Can't do cleanup
220 * here because cleanup code needs to sleep and caller holds spinlocks.) 220 * here because cleanup code needs to sleep and caller holds spinlocks.)
221 */ 221 */
222static void disable_bearer(struct tipc_bearer *tb_ptr) 222static void disable_media(struct tipc_bearer *tb_ptr)
223{ 223{
224 struct ib_bearer *ib_ptr = (struct ib_bearer *)tb_ptr->usr_handle; 224 struct ib_media *ib_ptr = (struct ib_media *)tb_ptr->usr_handle;
225 225
226 ib_ptr->bearer = NULL; 226 ib_ptr->bearer = NULL;
227 INIT_WORK(&ib_ptr->cleanup, cleanup_bearer); 227 INIT_WORK(&ib_ptr->cleanup, cleanup_bearer);
@@ -238,8 +238,8 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
238 void *ptr) 238 void *ptr)
239{ 239{
240 struct net_device *dev = netdev_notifier_info_to_dev(ptr); 240 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
241 struct ib_bearer *ib_ptr = &ib_bearers[0]; 241 struct ib_media *ib_ptr = &ib_media_array[0];
242 struct ib_bearer *stop = &ib_bearers[MAX_IB_BEARERS]; 242 struct ib_media *stop = &ib_media_array[MAX_IB_MEDIA];
243 243
244 if (!net_eq(dev_net(dev), &init_net)) 244 if (!net_eq(dev_net(dev), &init_net))
245 return NOTIFY_DONE; 245 return NOTIFY_DONE;
@@ -323,8 +323,8 @@ static int ib_msg2addr(const struct tipc_bearer *tb_ptr,
323 */ 323 */
324static struct tipc_media ib_media_info = { 324static struct tipc_media ib_media_info = {
325 .send_msg = send_msg, 325 .send_msg = send_msg,
326 .enable_bearer = enable_bearer, 326 .enable_media = enable_media,
327 .disable_bearer = disable_bearer, 327 .disable_media = disable_media,
328 .addr2str = ib_addr2str, 328 .addr2str = ib_addr2str,
329 .addr2msg = ib_addr2msg, 329 .addr2msg = ib_addr2msg,
330 .msg2addr = ib_msg2addr, 330 .msg2addr = ib_msg2addr,