Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1733d75 authored by Ying Xue's avatar Ying Xue Committed by David S. Miller
Browse files

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: default avatarYing Xue <ying.xue@windriver.com>
Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 198d73b8
Loading
Loading
Loading
Loading
+7 −11
Original line number Original line Diff line number Diff line
@@ -1081,7 +1081,7 @@ int tipc_link_send_sections_fast(struct tipc_port *sender,
	 * (Must not hold any locks while building message.)
	 * (Must not hold any locks while building message.)
	 */
	 */
	res = tipc_msg_build(hdr, msg_sect, num_sect, total_len,
	res = tipc_msg_build(hdr, msg_sect, num_sect, total_len,
			     sender->max_pkt, !sender->user_port, &buf);
			     sender->max_pkt, &buf);


	read_lock_bh(&tipc_net_lock);
	read_lock_bh(&tipc_net_lock);
	node = tipc_node_find(destaddr);
	node = tipc_node_find(destaddr);
@@ -1216,7 +1216,6 @@ static int link_send_sections_long(struct tipc_port *sender,
		else
		else
			sz = fragm_rest;
			sz = fragm_rest;


		if (likely(!sender->user_port)) {
		if (copy_from_user(buf->data + fragm_crs, sect_crs, sz)) {
		if (copy_from_user(buf->data + fragm_crs, sect_crs, sz)) {
error:
error:
			for (; buf_chain; buf_chain = buf) {
			for (; buf_chain; buf_chain = buf) {
@@ -1225,9 +1224,6 @@ static int link_send_sections_long(struct tipc_port *sender,
			}
			}
			return -EFAULT;
			return -EFAULT;
		}
		}
		} else
			skb_copy_to_linear_data_offset(buf, fragm_crs,
						       sect_crs, sz);
		sect_crs += sz;
		sect_crs += sz;
		sect_rest -= sz;
		sect_rest -= sz;
		fragm_crs += sz;
		fragm_crs += sz;
+5 −10
Original line number Original line Diff line number Diff line
@@ -73,8 +73,8 @@ void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type,
 * Returns message data size or errno
 * Returns message data size or errno
 */
 */
int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
		   u32 num_sect, unsigned int total_len,
		   u32 num_sect, unsigned int total_len, int max_size,
			    int max_size, int usrmem, struct sk_buff **buf)
		   struct sk_buff **buf)
{
{
	int dsz, sz, hsz, pos, res, cnt;
	int dsz, sz, hsz, pos, res, cnt;


@@ -92,11 +92,6 @@ int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
		return -ENOMEM;
		return -ENOMEM;
	skb_copy_to_linear_data(*buf, hdr, hsz);
	skb_copy_to_linear_data(*buf, hdr, hsz);
	for (res = 1, cnt = 0; res && (cnt < num_sect); cnt++) {
	for (res = 1, cnt = 0; res && (cnt < num_sect); cnt++) {
		if (likely(usrmem))
			res = !copy_from_user((*buf)->data + pos,
					      msg_sect[cnt].iov_base,
					      msg_sect[cnt].iov_len);
		else
		skb_copy_to_linear_data_offset(*buf, pos,
		skb_copy_to_linear_data_offset(*buf, pos,
					       msg_sect[cnt].iov_base,
					       msg_sect[cnt].iov_base,
					       msg_sect[cnt].iov_len);
					       msg_sect[cnt].iov_len);
+2 −2
Original line number Original line Diff line number Diff line
@@ -722,6 +722,6 @@ u32 tipc_msg_tot_importance(struct tipc_msg *m);
void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type,
void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type,
			    u32 hsize, u32 destnode);
			    u32 hsize, u32 destnode);
int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
		   u32 num_sect, unsigned int total_len,
		   u32 num_sect, unsigned int total_len, int max_size,
			    int max_size, int usrmem, struct sk_buff **buf);
		   struct sk_buff **buf);
#endif
#endif
+3 −5
Original line number Original line Diff line number Diff line
@@ -115,7 +115,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
	msg_set_nameupper(hdr, seq->upper);
	msg_set_nameupper(hdr, seq->upper);
	msg_set_hdr_sz(hdr, MCAST_H_SIZE);
	msg_set_hdr_sz(hdr, MCAST_H_SIZE);
	res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE,
	res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE,
			!oport->user_port, &buf);
			     &buf);
	if (unlikely(!buf))
	if (unlikely(!buf))
		return res;
		return res;


@@ -234,7 +234,6 @@ struct tipc_port *tipc_createport_raw(void *usr_handle,
	INIT_LIST_HEAD(&p_ptr->subscription.nodesub_list);
	INIT_LIST_HEAD(&p_ptr->subscription.nodesub_list);
	p_ptr->dispatcher = dispatcher;
	p_ptr->dispatcher = dispatcher;
	p_ptr->wakeup = wakeup;
	p_ptr->wakeup = wakeup;
	p_ptr->user_port = NULL;
	k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref);
	k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref);
	INIT_LIST_HEAD(&p_ptr->publications);
	INIT_LIST_HEAD(&p_ptr->publications);
	INIT_LIST_HEAD(&p_ptr->port_list);
	INIT_LIST_HEAD(&p_ptr->port_list);
@@ -271,7 +270,6 @@ int tipc_deleteport(u32 ref)
		buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT);
		buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT);
		tipc_nodesub_unsubscribe(&p_ptr->subscription);
		tipc_nodesub_unsubscribe(&p_ptr->subscription);
	}
	}
	kfree(p_ptr->user_port);


	spin_lock_bh(&tipc_port_list_lock);
	spin_lock_bh(&tipc_port_list_lock);
	list_del(&p_ptr->port_list);
	list_del(&p_ptr->port_list);
@@ -444,7 +442,7 @@ int tipc_port_reject_sections(struct tipc_port *p_ptr, struct tipc_msg *hdr,
	int res;
	int res;


	res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE,
	res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE,
			!p_ptr->user_port, &buf);
			     &buf);
	if (!buf)
	if (!buf)
		return res;
		return res;


@@ -927,7 +925,7 @@ static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_se
	int res;
	int res;


	res = tipc_msg_build(&sender->phdr, msg_sect, num_sect, total_len,
	res = tipc_msg_build(&sender->phdr, msg_sect, num_sect, total_len,
			MAX_MSG_SIZE, !sender->user_port, &buf);
			     MAX_MSG_SIZE, &buf);
	if (likely(buf))
	if (likely(buf))
		tipc_port_recv_msg(buf);
		tipc_port_recv_msg(buf);
	return res;
	return res;
+0 −14
Original line number Original line Diff line number Diff line
@@ -46,18 +46,6 @@
#define CONN_OVERLOAD_LIMIT	((TIPC_FLOW_CONTROL_WIN * 2 + 1) * \
#define CONN_OVERLOAD_LIMIT	((TIPC_FLOW_CONTROL_WIN * 2 + 1) * \
				SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE))
				SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE))


/**
 * struct user_port - TIPC user port (used with native API)
 * @usr_handle: user-specified field
 * @ref: object reference to associated TIPC port
 *
 * <various callback routines>
 */
struct user_port {
	void *usr_handle;
	u32 ref;
};

/**
/**
 * struct tipc_port - TIPC port structure
 * struct tipc_port - TIPC port structure
 * @usr_handle: pointer to additional user-defined information about port
 * @usr_handle: pointer to additional user-defined information about port
@@ -74,7 +62,6 @@ struct user_port {
 * @port_list: adjacent ports in TIPC's global list of ports
 * @port_list: adjacent ports in TIPC's global list of ports
 * @dispatcher: ptr to routine which handles received messages
 * @dispatcher: ptr to routine which handles received messages
 * @wakeup: ptr to routine to call when port is no longer congested
 * @wakeup: ptr to routine to call when port is no longer congested
 * @user_port: ptr to user port associated with port (if any)
 * @wait_list: adjacent ports in list of ports waiting on link congestion
 * @wait_list: adjacent ports in list of ports waiting on link congestion
 * @waiting_pkts:
 * @waiting_pkts:
 * @sent: # of non-empty messages sent by port
 * @sent: # of non-empty messages sent by port
@@ -101,7 +88,6 @@ struct tipc_port {
	struct list_head port_list;
	struct list_head port_list;
	u32 (*dispatcher)(struct tipc_port *, struct sk_buff *);
	u32 (*dispatcher)(struct tipc_port *, struct sk_buff *);
	void (*wakeup)(struct tipc_port *);
	void (*wakeup)(struct tipc_port *);
	struct user_port *user_port;
	struct list_head wait_list;
	struct list_head wait_list;
	u32 waiting_pkts;
	u32 waiting_pkts;
	u32 sent;
	u32 sent;