From patchwork Wed Jun 5 07:15:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13686261 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BDD919148A for ; Wed, 5 Jun 2024 07:16:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717571761; cv=none; b=bqYGXcgFhwNp4LaSavLPYlH0HutYF64bt7Z9LoeaKKkYtclFrKDzoSb/9sPqUp92gAheON+AwohkLIiJSUFYk5r37vS4Y5qH3rBBj09stU7CFp3nJuin+Gavyj2Gg8Gi8H2TP5l1S7ct5hTSPvuwnH4DbIaY3TKpW60pCRGCdhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717571761; c=relaxed/simple; bh=rMJnbMLONdx8crevHeHr1r1Va4Rzg59xhcvTxekZSik=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Ca9uWOswSubM/Hh4Z8MBCzdSh4PceAPsRj0Nh9PDMZ9ivDohzBx3gcW+TCezwhvqtuR/7NZSiVZrp/0fOlrk7gjZNHlLeVDWbaJbH2oH7aSC/JDUKFF03nM6QZ8aeJ8A44eeCJy1DlDFlUuXFPCXnY0eWqMfoj/WvHf49S22SZI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=wR4sUYOn; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="wR4sUYOn" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-df796aaa57dso7856532276.1 for ; Wed, 05 Jun 2024 00:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717571759; x=1718176559; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=YIH0whQedBMQLxD1lF7hY5JXX4O8JNYqdi5UpXX5ybs=; b=wR4sUYOnSrfRYpQYQvivLjJKJ3JdLItngvR1rO3AQEglNko/AfjaiFtxdIKdkUL7Au vOXspQkdNiW5leOnNqZCnKZ60gRI8XnaoKe5MtH8/pXSvdX8U75cuDKTYWOvkJTWO7Ks 5dYJa73YIZWZ8MGmnACobeSuDYKYIKciy6LK+ZNQxT6EnhDvFkiI28fr9mF5cG2Z7v4X T39S2CF4NYm7ErSrCUX/sg+6ZgsuYlBQP/inHFJ/kuBAQ1DygI9KACqI4uFPQyo92ARt eDc/w5iPLIGbKlHWAsrapmxGXvF9M6Rx3PoFP0sGqm4mshPMOtKXtz+SAWubh6GmHwdE aLnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717571759; x=1718176559; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YIH0whQedBMQLxD1lF7hY5JXX4O8JNYqdi5UpXX5ybs=; b=IoxwqS2oZaNtuRVP7AADXZOKzCUVYVK4dar2GXp1Lh23uYs1kZCUUFt1U0KhhLvD4D aMzixgxeReXW5Ssc/FkzNn4P2weUDawo/KNnnTfltOH+dElh3Bz3GaqTd7Mi4PKv0GYD O8eZPaKav3mebASkXqiEArOT0gqXjedksD42bzv6yr+fdw0t5D0iYMBhU+yQaFgmroRL Pk0M7wI9EJdAH4vCo6AGQoMfUP2gQcwW0sSwuo72ABvyykRSECpODSUBonaDfSftbgs0 qGec7mQcFGKX3VFd9lVvfSkH/kpmvyOP+tz+dojJ/cK/GkcSwnXyFv5e+MzTO0V2sYmi 4nnA== X-Gm-Message-State: AOJu0YyamlFcESbbXvTXWAkUUX7WHYerw81sKIEgARJZgjq39rkhH8G1 6NJoSJtCbm5S8TI/7Au2MEDaOTmtZ+gesF8PQ5tvxrJJdK49i2s7WaNhoIaPEg9WrWfPZV2FXIU bpuebqG7Ybw== X-Google-Smtp-Source: AGHT+IGUla0W3/ozXGg8OroukkU8BlyEjF/KqSslV3v/W6z+l4UCm/3Zv+m71NJrxfSdoVVq7ywCzEmY1shaVA== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a25:d6d4:0:b0:df7:6f84:f36f with SMTP id 3f1490d57ef6-dfacac3ad18mr74157276.4.1717571759216; Wed, 05 Jun 2024 00:15:59 -0700 (PDT) Date: Wed, 5 Jun 2024 07:15:51 +0000 In-Reply-To: <20240605071553.1365557-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605071553.1365557-1-edumazet@google.com> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: <20240605071553.1365557-2-edumazet@google.com> Subject: [PATCH net-next 1/3] tcp: small changes in reqsk_put() and reqsk_free() From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: kuba@kernel.org In reqsk_free(), use DEBUG_NET_WARN_ON_ONCE() instead of WARN_ON_ONCE() for a condition which never fired. In reqsk_put() directly call __reqsk_free(), there is no point checking rsk_refcnt again right after a transition to zero. Signed-off-by: Eric Dumazet Reviewed-by: Kuniyuki Iwashima --- include/net/request_sock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/net/request_sock.h b/include/net/request_sock.h index ebcb8896bffc..a8f82216c628 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h @@ -172,14 +172,14 @@ static inline void __reqsk_free(struct request_sock *req) static inline void reqsk_free(struct request_sock *req) { - WARN_ON_ONCE(refcount_read(&req->rsk_refcnt) != 0); + DEBUG_NET_WARN_ON_ONCE(refcount_read(&req->rsk_refcnt) != 0); __reqsk_free(req); } static inline void reqsk_put(struct request_sock *req) { if (refcount_dec_and_test(&req->rsk_refcnt)) - reqsk_free(req); + __reqsk_free(req); } /* From patchwork Wed Jun 5 07:15:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13686262 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C319518F2C9 for ; Wed, 5 Jun 2024 07:16:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717571763; cv=none; b=Fu4aJh0D8S4uxIYRVPuxFdaAaM/XO4460OuxDUolyTa3A7+AzpLK6rKbVXlJ9PmuXf4fD1eeiuXKqJJA/0IjH+KTleEcckiTX5rqJ+JAs/NJ7WiaYpKzRdIJbjt2kFmFbeLBehlXdAsvxSa5iCgjdDakUu0ZGxk4EMNQ1Vs2kFM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717571763; c=relaxed/simple; bh=TG41aC4i/FUaVvsbHGCUaFpOFijRZgpSqPKl/xfWlrg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=eG01mRb/84Os04lTDf+yL6rJOvrEuOKOXVJSsArko3gp5B501W/qOqf5tY4k/X1n+xcgGwtHzuN0Kz4PbMGRT00cS18bmRUJ7raNLJRj5t0kLrrBTjlhG2i7UraMkWPnMB6mo0i1CbEe4J9dS8MH6/zWarKY7RWho29H2eo+ydA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=2YxHlWSS; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="2YxHlWSS" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-df7bdb0455bso3122837276.2 for ; Wed, 05 Jun 2024 00:16:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717571761; x=1718176561; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=KavMCqME4wKgLSC+O6pjx/Bc818a9gtmfOnSQN0yjy0=; b=2YxHlWSSzEj2mBxNwKHF4c0ChAX5GoU9GIpfVMpT4AcGo7W37YtCXPHanZfR8ZojQy 6jxBupNxRT5iPJ2QbKF36pk4UCyctK1wYcHUk+bVNYtufucdtD1ToYMSCNpG5b+5kygV fCDa+IsbKeg110J3WWCi6BBKXd3/rYVn4iFMk9cUH7KSbbaMQ0Q/ATXyUEZlcZNJPhYB bKZma+pjIvxjS39izIXwgkzqTM2W0EsB9cd/NaMTCYHeBvr2OPO22cHiVC16dzAE/NW1 6/c8NqfWtUyS6KqwPI4gHsIcqcwpM2dNaCTWna+/oGRPLKLjCbrhVELOetmUcS0OwLKg YzQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717571761; x=1718176561; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KavMCqME4wKgLSC+O6pjx/Bc818a9gtmfOnSQN0yjy0=; b=DxMlOW9m9tsSYcspCVTSRBDhPvebC34sAf626ElqaKzl23bS7dN6wvB6yVaB08lOoJ bab2aXnc7kHX7KCG3quQGczd0nhWjqCgM76voW8qrIY0GOh9cR9J3v5y3h/YzyXdaRRs SDJMsUzLnsb//QGgOeS564rqHvGzq6yld0X3PQ/6aqd1BMoe7lTh6v2SzNZ/u+lly5/e uulsLYbi2WYRls4wwJ1/Llp8gH/DGGYFkjU1qfT9klo/2xolBf+uYyXwdZ9ckM/D/FGZ Cy/keb6CRwOj7NX53v8efSfGQr1rOOl6IT1psIbf1xGDAOqtU5iAcB6WC/ZVu7CNFbw6 esAw== X-Gm-Message-State: AOJu0Yw0OlwC+c2pP9LITghjpGISJuA+9+VUVorMD69qcrEFbXNzaanh 45kwqKx0SPSxkVAaTehGwiAH7E+trTPw+da79LE9fhLDM6m8cJmdqn4DaQ1r8Jwoped64gVnFT4 aIJWiL+Iijg== X-Google-Smtp-Source: AGHT+IHl9XI4q8EFSb/EKUebZSk7H9E84ZaDAPdpPvsfQh27hZQC88h3jAh3DwnZSMDbM2J8rpCTCu/SXOfrGw== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a05:6902:2b90:b0:df4:920f:3192 with SMTP id 3f1490d57ef6-dfacacf10edmr172657276.8.1717571760626; Wed, 05 Jun 2024 00:16:00 -0700 (PDT) Date: Wed, 5 Jun 2024 07:15:52 +0000 In-Reply-To: <20240605071553.1365557-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605071553.1365557-1-edumazet@google.com> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: <20240605071553.1365557-3-edumazet@google.com> Subject: [PATCH net-next 2/3] tcp: move inet_reqsk_alloc() close to inet_reqsk_clone() From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: kuba@kernel.org inet_reqsk_alloc() does not belong to tcp_input.c, move it to inet_connection_sock.c instead. Signed-off-by: Eric Dumazet Reviewed-by: Kuniyuki Iwashima --- net/ipv4/inet_connection_sock.c | 25 +++++++++++++++++++++++++ net/ipv4/tcp_input.c | 25 ------------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index d81f74ce0f02..a9d2e6308910 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c @@ -911,6 +911,31 @@ int inet_rtx_syn_ack(const struct sock *parent, struct request_sock *req) } EXPORT_SYMBOL(inet_rtx_syn_ack); +struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops, + struct sock *sk_listener, + bool attach_listener) +{ + struct request_sock *req = reqsk_alloc(ops, sk_listener, + attach_listener); + + if (req) { + struct inet_request_sock *ireq = inet_rsk(req); + + ireq->ireq_opt = NULL; +#if IS_ENABLED(CONFIG_IPV6) + ireq->pktopts = NULL; +#endif + atomic64_set(&ireq->ir_cookie, 0); + ireq->ireq_state = TCP_NEW_SYN_RECV; + write_pnet(&ireq->ireq_net, sock_net(sk_listener)); + ireq->ireq_family = sk_listener->sk_family; + req->timeout = TCP_TIMEOUT_INIT; + } + + return req; +} +EXPORT_SYMBOL(inet_reqsk_alloc); + static struct request_sock *inet_reqsk_clone(struct request_sock *req, struct sock *sk) { diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 212b6fd0caf7..eb187450e4d7 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -6986,31 +6986,6 @@ static void tcp_openreq_init(struct request_sock *req, #endif } -struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops, - struct sock *sk_listener, - bool attach_listener) -{ - struct request_sock *req = reqsk_alloc(ops, sk_listener, - attach_listener); - - if (req) { - struct inet_request_sock *ireq = inet_rsk(req); - - ireq->ireq_opt = NULL; -#if IS_ENABLED(CONFIG_IPV6) - ireq->pktopts = NULL; -#endif - atomic64_set(&ireq->ir_cookie, 0); - ireq->ireq_state = TCP_NEW_SYN_RECV; - write_pnet(&ireq->ireq_net, sock_net(sk_listener)); - ireq->ireq_family = sk_listener->sk_family; - req->timeout = TCP_TIMEOUT_INIT; - } - - return req; -} -EXPORT_SYMBOL(inet_reqsk_alloc); - /* * Return true if a syncookie should be sent */ From patchwork Wed Jun 5 07:15:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13686263 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C7C919148A for ; Wed, 5 Jun 2024 07:16:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717571764; cv=none; b=HjJ7vp64k9Icv55zwMlnRgNMHYEbx3V6j2kFdpUdv4MLMpJi+JiC0FfKkSQUM6YZ40xGMqziWc4klS/lxzu6LLzn32rnCe/BwdZ459qEzkbfJC5Lt3qWMhquPfY63+D0l1dy5+RlmSKSOqyslZE/vabaJI/arsIcuoRfHUNvSsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717571764; c=relaxed/simple; bh=WIAsTRlTcqwPIt+nbXduoXTeM8XuXQkgvEZz7rh7T8o=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=IrJULrVOCmDMyP8FryuAPLFqjSfmfbRhgA0owSH5hNz93bP6I9OkOwsg/WstaATI1dtZvQYCfW3NVIgwBCFTf7AIHtIa626qmVKN+iwyDip/ou24DTNTv0scsm44NZns1CZdDGsbMdbn8MXy7c7dzWTK64dx65Lf/vr8h2PF6LU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=3fkx972n; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3fkx972n" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-df7bdb0455bso3122857276.2 for ; Wed, 05 Jun 2024 00:16:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717571762; x=1718176562; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=XohALCxhIQuxmdqn4ziWm9Xd66SL12SuMLJAdzpuJIc=; b=3fkx972n64qTlK0H9WDZY/3j2ozF6pXNBBa/VFD9sYDHt7m+pXr5qi542hjLRypT38 dY7T/7hGOMd6YBBVpO/o7mUrUKtv8U5jnPEt+wJXvTV4gL1QDToTmmiH/u/IL5FeM8Yd qkTpy3eqiHwsav2NezfTrgGNOqJB5y92dV1NL50odOhaszy+UQXQ+DHHKRqPXxzh48p9 wJMrTfV0gbZoJfRKQdEoN+2GMkzFvC2EVBM8cvWyreiHgqHaf2UEaU/xQPOQsnqs1gwt ZkI5xcmDw71ZyuNkjMxHmWpeJLDYsUCem9yqFa7rLbrhCaHMDQO6hxdWs0SnZ6OpAuyk i84g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717571762; x=1718176562; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XohALCxhIQuxmdqn4ziWm9Xd66SL12SuMLJAdzpuJIc=; b=bhActlvoJAh66O024cgpli0rq0/49w2eUNrnAIfVqUkR1nEwb1MMvwMllk1Qsk71+j uzcb92H5IJ9WW40bPzfyOvQ0A3X5aX+KXinIVnfF96ovo+m+b5tBFaJG35OFSbpllf4v 50yd3TAFKzKJIKZ6vIBLRbFY1UE+f2BYoUnANaEZY07RGl8gbcuqSZwzztPR6lnDKQ7e e2qV9B3KEk/n15JRGwLygfv+WaKU9Z5o9knCYfnrgA9lgi+a/rdp9kitJSQjVgsSaZ7U Cz42PaRkjIfzVjB512uRSrSGSeuPMjbNyZv7grUGH1cWrnl8sKq/aK5jSK1KWkPaJRug Nc6g== X-Gm-Message-State: AOJu0YymlAoErfdTo0ekyRP0agv4S0Z5hrgLG0rH6jyGsLML1VBMASma o8Aov5wAGsBImn98+MygFOP4yfUjP/ZIR/FDEcimMdyyM1obfG6JS7KQVwr2UZJWOmWjoAycWuK n31D7uKeARg== X-Google-Smtp-Source: AGHT+IEuV2lMLWeb9M043lMbtWKUml0I0/5PYkFyoRmCZ1OV+cq8p/mbf8eMFwmBZKrlq7fbqNRoUAEsS0lEzw== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a05:6902:1244:b0:dfa:cd81:4c6a with SMTP id 3f1490d57ef6-dfacd815034mr64722276.6.1717571762161; Wed, 05 Jun 2024 00:16:02 -0700 (PDT) Date: Wed, 5 Jun 2024 07:15:53 +0000 In-Reply-To: <20240605071553.1365557-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605071553.1365557-1-edumazet@google.com> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: <20240605071553.1365557-4-edumazet@google.com> Subject: [PATCH net-next 3/3] tcp: move reqsk_alloc() to inet_connection_sock.c From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: kuba@kernel.org reqsk_alloc() has a single caller, no need to expose it in include/net/request_sock.h. Signed-off-by: Eric Dumazet Reviewed-by: Kuniyuki Iwashima --- include/net/request_sock.h | 33 --------------------------------- net/ipv4/inet_connection_sock.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/include/net/request_sock.h b/include/net/request_sock.h index a8f82216c628..b07b1cd14e9f 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h @@ -128,39 +128,6 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb, return sk; } -static inline struct request_sock * -reqsk_alloc_noprof(const struct request_sock_ops *ops, struct sock *sk_listener, - bool attach_listener) -{ - struct request_sock *req; - - req = kmem_cache_alloc_noprof(ops->slab, GFP_ATOMIC | __GFP_NOWARN); - if (!req) - return NULL; - req->rsk_listener = NULL; - if (attach_listener) { - if (unlikely(!refcount_inc_not_zero(&sk_listener->sk_refcnt))) { - kmem_cache_free(ops->slab, req); - return NULL; - } - req->rsk_listener = sk_listener; - } - req->rsk_ops = ops; - req_to_sk(req)->sk_prot = sk_listener->sk_prot; - sk_node_init(&req_to_sk(req)->sk_node); - sk_tx_queue_clear(req_to_sk(req)); - req->saved_syn = NULL; - req->syncookie = 0; - req->timeout = 0; - req->num_timeout = 0; - req->num_retrans = 0; - req->sk = NULL; - refcount_set(&req->rsk_refcnt, 0); - - return req; -} -#define reqsk_alloc(...) alloc_hooks(reqsk_alloc_noprof(__VA_ARGS__)) - static inline void __reqsk_free(struct request_sock *req) { req->rsk_ops->destructor(req); diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index a9d2e6308910..7ced569778ab 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c @@ -911,6 +911,39 @@ int inet_rtx_syn_ack(const struct sock *parent, struct request_sock *req) } EXPORT_SYMBOL(inet_rtx_syn_ack); +static struct request_sock * +reqsk_alloc_noprof(const struct request_sock_ops *ops, struct sock *sk_listener, + bool attach_listener) +{ + struct request_sock *req; + + req = kmem_cache_alloc_noprof(ops->slab, GFP_ATOMIC | __GFP_NOWARN); + if (!req) + return NULL; + req->rsk_listener = NULL; + if (attach_listener) { + if (unlikely(!refcount_inc_not_zero(&sk_listener->sk_refcnt))) { + kmem_cache_free(ops->slab, req); + return NULL; + } + req->rsk_listener = sk_listener; + } + req->rsk_ops = ops; + req_to_sk(req)->sk_prot = sk_listener->sk_prot; + sk_node_init(&req_to_sk(req)->sk_node); + sk_tx_queue_clear(req_to_sk(req)); + req->saved_syn = NULL; + req->syncookie = 0; + req->timeout = 0; + req->num_timeout = 0; + req->num_retrans = 0; + req->sk = NULL; + refcount_set(&req->rsk_refcnt, 0); + + return req; +} +#define reqsk_alloc(...) alloc_hooks(reqsk_alloc_noprof(__VA_ARGS__)) + struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener, bool attach_listener)