From: jmaloy@redhat.com
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: tipc-discussion@lists.sourceforge.net,
tung.q.nguyen@dektech.com.au, hoang.h.le@dektech.com.au,
tuong.t.lien@dektech.com.au, jmaloy@redhat.com,
maloy@donjonn.com, xinl@redhat.com, ying.xue@windriver.com,
parthasarathy.bhuvaragan@gmail.com
Subject: [net-next 10/16] tipc: simplify signature of tipc_nametbl_lookup_mcast_nodes()
Date: Tue, 16 Mar 2021 22:06:17 -0400 [thread overview]
Message-ID: <20210317020623.1258298-11-jmaloy@redhat.com> (raw)
In-Reply-To: <20210317020623.1258298-1-jmaloy@redhat.com>
From: Jon Maloy <jmaloy@redhat.com>
We follow up the preceding commits by reducing the signature of
the function tipc_nametbl_lookup_mcast_nodes().
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Hoang Le <hoang.h.le@dektech.com.au>
Acked-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
Acked-by: Xin Long <lucien.xin@gmail.com>
---
net/tipc/name_table.c | 8 ++++----
net/tipc/name_table.h | 4 ++--
net/tipc/socket.c | 18 ++++++++----------
3 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index ad021d8c02e7..33b79a5da8c9 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -698,20 +698,20 @@ void tipc_nametbl_lookup_mcast_sockets(struct net *net, struct tipc_uaddr *ua,
* Used on nodes which are sending out a multicast/broadcast message
* Returns a list of nodes, including own node if applicable
*/
-void tipc_nametbl_lookup_mcast_nodes(struct net *net, u32 type, u32 lower,
- u32 upper, struct tipc_nlist *nodes)
+void tipc_nametbl_lookup_mcast_nodes(struct net *net, struct tipc_uaddr *ua,
+ struct tipc_nlist *nodes)
{
struct service_range *sr;
struct tipc_service *sc;
struct publication *p;
rcu_read_lock();
- sc = tipc_service_find(net, type);
+ sc = tipc_service_find(net, ua->sr.type);
if (!sc)
goto exit;
spin_lock_bh(&sc->lock);
- service_range_foreach_match(sr, sc, lower, upper) {
+ service_range_foreach_match(sr, sc, ua->sr.lower, ua->sr.upper) {
list_for_each_entry(p, &sr->all_publ, all_publ) {
tipc_nlist_add(nodes, p->sk.node);
}
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h
index 26aa6acb4512..c5aa45abbdc3 100644
--- a/net/tipc/name_table.h
+++ b/net/tipc/name_table.h
@@ -114,8 +114,8 @@ bool tipc_nametbl_lookup_anycast(struct net *net, struct tipc_uaddr *ua,
struct tipc_socket_addr *sk);
void tipc_nametbl_lookup_mcast_sockets(struct net *net, struct tipc_uaddr *ua,
bool exact, struct list_head *dports);
-void tipc_nametbl_lookup_mcast_nodes(struct net *net, u32 type, u32 lower,
- u32 upper, struct tipc_nlist *nodes);
+void tipc_nametbl_lookup_mcast_nodes(struct net *net, struct tipc_uaddr *ua,
+ struct tipc_nlist *nodes);
bool tipc_nametbl_lookup_group(struct net *net, u32 type, u32 instance,
u32 domain, struct list_head *dsts,
int *dstcnt, u32 exclude,
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index b952128537e1..83d7c9c25c63 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -832,7 +832,7 @@ static __poll_t tipc_poll(struct file *file, struct socket *sock,
/**
* tipc_sendmcast - send multicast message
* @sock: socket structure
- * @seq: destination address
+ * @ua: destination address struct
* @msg: message to send
* @dlen: length of data to send
* @timeout: timeout to wait for wakeup
@@ -840,7 +840,7 @@ static __poll_t tipc_poll(struct file *file, struct socket *sock,
* Called from function tipc_sendmsg(), which has done all sanity checks
* Return: the number of bytes sent on success, or errno
*/
-static int tipc_sendmcast(struct socket *sock, struct tipc_service_range *seq,
+static int tipc_sendmcast(struct socket *sock, struct tipc_uaddr *ua,
struct msghdr *msg, size_t dlen, long timeout)
{
struct sock *sk = sock->sk;
@@ -848,7 +848,6 @@ static int tipc_sendmcast(struct socket *sock, struct tipc_service_range *seq,
struct tipc_msg *hdr = &tsk->phdr;
struct net *net = sock_net(sk);
int mtu = tipc_bcast_get_mtu(net);
- struct tipc_mc_method *method = &tsk->mc_method;
struct sk_buff_head pkts;
struct tipc_nlist dsts;
int rc;
@@ -863,8 +862,7 @@ static int tipc_sendmcast(struct socket *sock, struct tipc_service_range *seq,
/* Lookup destination nodes */
tipc_nlist_init(&dsts, tipc_own_addr(net));
- tipc_nametbl_lookup_mcast_nodes(net, seq->type, seq->lower,
- seq->upper, &dsts);
+ tipc_nametbl_lookup_mcast_nodes(net, ua, &dsts);
if (!dsts.local && !dsts.remote)
return -EHOSTUNREACH;
@@ -874,9 +872,9 @@ static int tipc_sendmcast(struct socket *sock, struct tipc_service_range *seq,
msg_set_lookup_scope(hdr, TIPC_CLUSTER_SCOPE);
msg_set_destport(hdr, 0);
msg_set_destnode(hdr, 0);
- msg_set_nametype(hdr, seq->type);
- msg_set_namelower(hdr, seq->lower);
- msg_set_nameupper(hdr, seq->upper);
+ msg_set_nametype(hdr, ua->sr.type);
+ msg_set_namelower(hdr, ua->sr.lower);
+ msg_set_nameupper(hdr, ua->sr.upper);
/* Build message as chain of buffers */
__skb_queue_head_init(&pkts);
@@ -886,7 +884,7 @@ static int tipc_sendmcast(struct socket *sock, struct tipc_service_range *seq,
if (unlikely(rc == dlen)) {
trace_tipc_sk_sendmcast(sk, skb_peek(&pkts),
TIPC_DUMP_SK_SNDQ, " ");
- rc = tipc_mcast_xmit(net, &pkts, method, &dsts,
+ rc = tipc_mcast_xmit(net, &pkts, &tsk->mc_method, &dsts,
&tsk->cong_link_cnt);
}
@@ -1479,7 +1477,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
/* Determine destination */
if (atype == TIPC_SERVICE_RANGE) {
- return tipc_sendmcast(sock, &ua->sr, m, dlen, timeout);
+ return tipc_sendmcast(sock, ua, m, dlen, timeout);
} else if (atype == TIPC_SERVICE_ADDR) {
skaddr.node = ua->lookup_node;
ua->scope = tipc_node2scope(skaddr.node);
--
2.29.2
next prev parent reply other threads:[~2021-03-17 2:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-17 2:06 [net-next 00/16] tipc: cleanups and simplifications jmaloy
2021-03-17 2:06 ` [net-next 01/16] tipc: re-organize members of struct publication jmaloy
2021-03-17 2:06 ` [net-next 02/16] tipc: move creation of publication item one level up in call chain jmaloy
2021-03-17 2:06 ` [net-next 03/16] tipc: introduce new unified address type for internal use jmaloy
2021-03-17 2:06 ` [net-next 04/16] tipc: simplify signature of tipc_namtbl_publish() jmaloy
2021-03-17 2:06 ` [net-next 05/16] tipc: simplify call signatures for publication creation jmaloy
2021-03-17 2:06 ` [net-next 06/16] tipc: simplify signature of tipc_nametbl_withdraw() functions jmaloy
2021-03-17 2:06 ` [net-next 07/16] tipc: rename binding table lookup functions jmaloy
2021-03-17 2:06 ` [net-next 08/16] tipc: refactor tipc_sendmsg() and tipc_lookup_anycast() jmaloy
2021-03-17 2:06 ` [net-next 09/16] tipc: simplify signature of tipc_namtbl_lookup_mcast_sockets() jmaloy
2021-03-17 2:06 ` jmaloy [this message]
2021-03-17 2:06 ` [net-next 11/16] tipc: simplify signature of tipc_nametbl_lookup_group() jmaloy
2021-03-17 2:06 ` [net-next 12/16] tipc: simplify signature of tipc_service_find_range() jmaloy
2021-03-17 2:06 ` [net-next 13/16] tipc: simplify signature of tipc_find_service() jmaloy
2021-03-17 2:06 ` [net-next 14/16] tipc: simplify api between binding table and topology server jmaloy
2021-03-17 2:06 ` [net-next 15/16] tipc: add host-endian copy of user subscription to struct tipc_subscription jmaloy
2021-03-17 2:06 ` [net-next 16/16] tipc: remove some unnecessary warnings jmaloy
2021-03-17 19:00 ` [net-next 00/16] tipc: cleanups and simplifications patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210317020623.1258298-11-jmaloy@redhat.com \
--to=jmaloy@redhat.com \
--cc=davem@davemloft.net \
--cc=hoang.h.le@dektech.com.au \
--cc=maloy@donjonn.com \
--cc=netdev@vger.kernel.org \
--cc=parthasarathy.bhuvaragan@gmail.com \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=tung.q.nguyen@dektech.com.au \
--cc=tuong.t.lien@dektech.com.au \
--cc=xinl@redhat.com \
--cc=ying.xue@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).