Received: from out-185.mta1.migadu.com (out-185.mta1.migadu.com [95.215.58.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 186DA12E64 for ; Fri, 8 Dec 2023 10:07:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="bpmDQ2I0" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702030029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N6jdGUbq6aO8ksEy9yV6mHkYN+t7brBX25JvW9rkL48=; b=bpmDQ2I04dk0uqxUqThQzqCkrmD4NUHnJlExzSNZbQnmnltCeJEYPzLcKwVwGIcdauQuQD t9A70x783RKXvojYMqfWq/Mxs3iSTF3uyDI6LxDk0tsFObVH3yzT7ektjctJU2w5DQ5oDU UM4zUur/Wn5CqFqUtcggbYuhRG7iXiw= From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v14 01/25] mptcp: export pm_nl_get_pernet_from_msk Date: Fri, 8 Dec 2023 18:07:14 +0800 Message-Id: In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT This patch moves struct pm_nl_pernet from pm_netlink.c to protocol.h, and export pm_nl_get_pernet_from_msk() helper. Then every fields of struct pm_nl_pernet can be accessed everywhere, not only being limited in pm_netlink.c. Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 17 ++--------------- net/mptcp/protocol.h | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index b93683b5e618..9aa51f6fb2fd 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -31,20 +31,6 @@ struct mptcp_pm_add_entry { struct mptcp_sock *sock; }; -struct pm_nl_pernet { - /* protects pernet updates */ - spinlock_t lock; - struct list_head local_addr_list; - unsigned int addrs; - unsigned int stale_loss_cnt; - unsigned int add_addr_signal_max; - unsigned int add_addr_accept_max; - unsigned int local_addr_max; - unsigned int subflows_max; - unsigned int next_id; - DECLARE_BITMAP(id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); -}; - #define MPTCP_PM_ADDR_MAX 8 #define ADD_ADDR_RETRANS_MAX 3 @@ -53,11 +39,12 @@ static struct pm_nl_pernet *pm_nl_get_pernet(const struct net *net) return net_generic(net, pm_nl_pernet_id); } -static struct pm_nl_pernet * +struct pm_nl_pernet * pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk) { return pm_nl_get_pernet(sock_net((struct sock *)msk)); } +EXPORT_SYMBOL_GPL(pm_nl_get_pernet_from_msk); bool mptcp_addresses_equal(const struct mptcp_addr_info *a, const struct mptcp_addr_info *b, bool use_port) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index f7b9c1b995df..8db50fdccfee 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1030,6 +1030,23 @@ void __init mptcp_pm_nl_init(void); void mptcp_pm_nl_work(struct mptcp_sock *msk); void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list); + +struct pm_nl_pernet { + /* protects pernet updates */ + spinlock_t lock; + struct list_head local_addr_list; + unsigned int addrs; + unsigned int stale_loss_cnt; + unsigned int add_addr_signal_max; + unsigned int add_addr_accept_max; + unsigned int local_addr_max; + unsigned int subflows_max; + unsigned int next_id; + DECLARE_BITMAP(id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); +}; + +struct pm_nl_pernet * +pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk); unsigned int mptcp_pm_get_add_addr_signal_max(const struct mptcp_sock *msk); unsigned int mptcp_pm_get_add_addr_accept_max(const struct mptcp_sock *msk); unsigned int mptcp_pm_get_subflows_max(const struct mptcp_sock *msk); -- 2.35.3