diff options
author | Ying Xue <ying.xue@windriver.com> | 2013-06-17 10:54:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-17 18:53:00 -0400 |
commit | f1733d7580ff94deb8ea071a293c23939ae0d450 (patch) | |
tree | 41e10295a1546d044cf529267f703e09b87b03d3 /net/tipc | |
parent | 198d73b82bf78739f8f11cf7ff567a2e0da1dbef (diff) |
tipc: remove user_port instance from tipc_port structure
After the native API has been completely removed, the 'user_port'
field in struct tipc_port becomes unused, and can be removed.
As a consequence, the "usrmem" argument in tipc_msg_build() is no
longer needed, and so we remove that one too.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/link.c | 18 | ||||
-rw-r--r-- | net/tipc/msg.c | 15 | ||||
-rw-r--r-- | net/tipc/msg.h | 4 | ||||
-rw-r--r-- | net/tipc/port.c | 8 | ||||
-rw-r--r-- | net/tipc/port.h | 14 |
5 files changed, 17 insertions, 42 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c index 0a4c3a1bb9cc..d34429d03c16 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -1081,7 +1081,7 @@ again: | |||
1081 | * (Must not hold any locks while building message.) | 1081 | * (Must not hold any locks while building message.) |
1082 | */ | 1082 | */ |
1083 | res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, | 1083 | res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, |
1084 | sender->max_pkt, !sender->user_port, &buf); | 1084 | sender->max_pkt, &buf); |
1085 | 1085 | ||
1086 | read_lock_bh(&tipc_net_lock); | 1086 | read_lock_bh(&tipc_net_lock); |
1087 | node = tipc_node_find(destaddr); | 1087 | node = tipc_node_find(destaddr); |
@@ -1216,18 +1216,14 @@ again: | |||
1216 | else | 1216 | else |
1217 | sz = fragm_rest; | 1217 | sz = fragm_rest; |
1218 | 1218 | ||
1219 | if (likely(!sender->user_port)) { | 1219 | if (copy_from_user(buf->data + fragm_crs, sect_crs, sz)) { |
1220 | if (copy_from_user(buf->data + fragm_crs, sect_crs, sz)) { | ||
1221 | error: | 1220 | error: |
1222 | for (; buf_chain; buf_chain = buf) { | 1221 | for (; buf_chain; buf_chain = buf) { |
1223 | buf = buf_chain->next; | 1222 | buf = buf_chain->next; |
1224 | kfree_skb(buf_chain); | 1223 | kfree_skb(buf_chain); |
1225 | } | ||
1226 | return -EFAULT; | ||
1227 | } | 1224 | } |
1228 | } else | 1225 | return -EFAULT; |
1229 | skb_copy_to_linear_data_offset(buf, fragm_crs, | 1226 | } |
1230 | sect_crs, sz); | ||
1231 | sect_crs += sz; | 1227 | sect_crs += sz; |
1232 | sect_rest -= sz; | 1228 | sect_rest -= sz; |
1233 | fragm_crs += sz; | 1229 | fragm_crs += sz; |
diff --git a/net/tipc/msg.c b/net/tipc/msg.c index f2db8a87d9c5..c2a261322515 100644 --- a/net/tipc/msg.c +++ b/net/tipc/msg.c | |||
@@ -73,8 +73,8 @@ void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, | |||
73 | * Returns message data size or errno | 73 | * Returns message data size or errno |
74 | */ | 74 | */ |
75 | int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect, | 75 | int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect, |
76 | u32 num_sect, unsigned int total_len, | 76 | u32 num_sect, unsigned int total_len, int max_size, |
77 | int max_size, int usrmem, struct sk_buff **buf) | 77 | struct sk_buff **buf) |
78 | { | 78 | { |
79 | int dsz, sz, hsz, pos, res, cnt; | 79 | int dsz, sz, hsz, pos, res, cnt; |
80 | 80 | ||
@@ -92,14 +92,9 @@ int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect, | |||
92 | return -ENOMEM; | 92 | return -ENOMEM; |
93 | skb_copy_to_linear_data(*buf, hdr, hsz); | 93 | skb_copy_to_linear_data(*buf, hdr, hsz); |
94 | for (res = 1, cnt = 0; res && (cnt < num_sect); cnt++) { | 94 | for (res = 1, cnt = 0; res && (cnt < num_sect); cnt++) { |
95 | if (likely(usrmem)) | 95 | skb_copy_to_linear_data_offset(*buf, pos, |
96 | res = !copy_from_user((*buf)->data + pos, | 96 | msg_sect[cnt].iov_base, |
97 | msg_sect[cnt].iov_base, | 97 | msg_sect[cnt].iov_len); |
98 | msg_sect[cnt].iov_len); | ||
99 | else | ||
100 | skb_copy_to_linear_data_offset(*buf, pos, | ||
101 | msg_sect[cnt].iov_base, | ||
102 | msg_sect[cnt].iov_len); | ||
103 | pos += msg_sect[cnt].iov_len; | 98 | pos += msg_sect[cnt].iov_len; |
104 | } | 99 | } |
105 | if (likely(res)) | 100 | if (likely(res)) |
diff --git a/net/tipc/msg.h b/net/tipc/msg.h index ba2a72beea68..511019a77c9c 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h | |||
@@ -722,6 +722,6 @@ u32 tipc_msg_tot_importance(struct tipc_msg *m); | |||
722 | void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, | 722 | void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, |
723 | u32 hsize, u32 destnode); | 723 | u32 hsize, u32 destnode); |
724 | int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect, | 724 | int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect, |
725 | u32 num_sect, unsigned int total_len, | 725 | u32 num_sect, unsigned int total_len, int max_size, |
726 | int max_size, int usrmem, struct sk_buff **buf); | 726 | struct sk_buff **buf); |
727 | #endif | 727 | #endif |
diff --git a/net/tipc/port.c b/net/tipc/port.c index 0651522c9435..f628c84a8f61 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c | |||
@@ -115,7 +115,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, | |||
115 | msg_set_nameupper(hdr, seq->upper); | 115 | msg_set_nameupper(hdr, seq->upper); |
116 | msg_set_hdr_sz(hdr, MCAST_H_SIZE); | 116 | msg_set_hdr_sz(hdr, MCAST_H_SIZE); |
117 | res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE, | 117 | res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE, |
118 | !oport->user_port, &buf); | 118 | &buf); |
119 | if (unlikely(!buf)) | 119 | if (unlikely(!buf)) |
120 | return res; | 120 | return res; |
121 | 121 | ||
@@ -234,7 +234,6 @@ struct tipc_port *tipc_createport_raw(void *usr_handle, | |||
234 | INIT_LIST_HEAD(&p_ptr->subscription.nodesub_list); | 234 | INIT_LIST_HEAD(&p_ptr->subscription.nodesub_list); |
235 | p_ptr->dispatcher = dispatcher; | 235 | p_ptr->dispatcher = dispatcher; |
236 | p_ptr->wakeup = wakeup; | 236 | p_ptr->wakeup = wakeup; |
237 | p_ptr->user_port = NULL; | ||
238 | k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref); | 237 | k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref); |
239 | INIT_LIST_HEAD(&p_ptr->publications); | 238 | INIT_LIST_HEAD(&p_ptr->publications); |
240 | INIT_LIST_HEAD(&p_ptr->port_list); | 239 | INIT_LIST_HEAD(&p_ptr->port_list); |
@@ -271,7 +270,6 @@ int tipc_deleteport(u32 ref) | |||
271 | buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT); | 270 | buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT); |
272 | tipc_nodesub_unsubscribe(&p_ptr->subscription); | 271 | tipc_nodesub_unsubscribe(&p_ptr->subscription); |
273 | } | 272 | } |
274 | kfree(p_ptr->user_port); | ||
275 | 273 | ||
276 | spin_lock_bh(&tipc_port_list_lock); | 274 | spin_lock_bh(&tipc_port_list_lock); |
277 | list_del(&p_ptr->port_list); | 275 | list_del(&p_ptr->port_list); |
@@ -444,7 +442,7 @@ int tipc_port_reject_sections(struct tipc_port *p_ptr, struct tipc_msg *hdr, | |||
444 | int res; | 442 | int res; |
445 | 443 | ||
446 | res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE, | 444 | res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE, |
447 | !p_ptr->user_port, &buf); | 445 | &buf); |
448 | if (!buf) | 446 | if (!buf) |
449 | return res; | 447 | return res; |
450 | 448 | ||
@@ -927,7 +925,7 @@ static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_se | |||
927 | int res; | 925 | int res; |
928 | 926 | ||
929 | res = tipc_msg_build(&sender->phdr, msg_sect, num_sect, total_len, | 927 | res = tipc_msg_build(&sender->phdr, msg_sect, num_sect, total_len, |
930 | MAX_MSG_SIZE, !sender->user_port, &buf); | 928 | MAX_MSG_SIZE, &buf); |
931 | if (likely(buf)) | 929 | if (likely(buf)) |
932 | tipc_port_recv_msg(buf); | 930 | tipc_port_recv_msg(buf); |
933 | return res; | 931 | return res; |
diff --git a/net/tipc/port.h b/net/tipc/port.h index 7fd37c202ce6..4779f0a82234 100644 --- a/net/tipc/port.h +++ b/net/tipc/port.h | |||
@@ -47,18 +47,6 @@ | |||
47 | SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE)) | 47 | SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE)) |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * struct user_port - TIPC user port (used with native API) | ||
51 | * @usr_handle: user-specified field | ||
52 | * @ref: object reference to associated TIPC port | ||
53 | * | ||
54 | * <various callback routines> | ||
55 | */ | ||
56 | struct user_port { | ||
57 | void *usr_handle; | ||
58 | u32 ref; | ||
59 | }; | ||
60 | |||
61 | /** | ||
62 | * struct tipc_port - TIPC port structure | 50 | * struct tipc_port - TIPC port structure |
63 | * @usr_handle: pointer to additional user-defined information about port | 51 | * @usr_handle: pointer to additional user-defined information about port |
64 | * @lock: pointer to spinlock for controlling access to port | 52 | * @lock: pointer to spinlock for controlling access to port |
@@ -74,7 +62,6 @@ struct user_port { | |||
74 | * @port_list: adjacent ports in TIPC's global list of ports | 62 | * @port_list: adjacent ports in TIPC's global list of ports |
75 | * @dispatcher: ptr to routine which handles received messages | 63 | * @dispatcher: ptr to routine which handles received messages |
76 | * @wakeup: ptr to routine to call when port is no longer congested | 64 | * @wakeup: ptr to routine to call when port is no longer congested |
77 | * @user_port: ptr to user port associated with port (if any) | ||
78 | * @wait_list: adjacent ports in list of ports waiting on link congestion | 65 | * @wait_list: adjacent ports in list of ports waiting on link congestion |
79 | * @waiting_pkts: | 66 | * @waiting_pkts: |
80 | * @sent: # of non-empty messages sent by port | 67 | * @sent: # of non-empty messages sent by port |
@@ -101,7 +88,6 @@ struct tipc_port { | |||
101 | struct list_head port_list; | 88 | struct list_head port_list; |
102 | u32 (*dispatcher)(struct tipc_port *, struct sk_buff *); | 89 | u32 (*dispatcher)(struct tipc_port *, struct sk_buff *); |
103 | void (*wakeup)(struct tipc_port *); | 90 | void (*wakeup)(struct tipc_port *); |
104 | struct user_port *user_port; | ||
105 | struct list_head wait_list; | 91 | struct list_head wait_list; |
106 | u32 waiting_pkts; | 92 | u32 waiting_pkts; |
107 | u32 sent; | 93 | u32 sent; |