netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Loic Poulain <loic.poulain@linaro.org>
To: davem@davemloft.net, kuba@kernel.org
Cc: bjorn.andersson@linaro.org, manivannan.sadhasivam@linaro.org,
	cjhuang@codeaurora.org, netdev@vger.kernel.org,
	Loic Poulain <loic.poulain@linaro.org>
Subject: [PATCH v2 4/5] net: qrtr: Add GFP flags parameter to qrtr_alloc_ctrl_packet
Date: Fri,  6 Nov 2020 18:33:29 +0100	[thread overview]
Message-ID: <1604684010-24090-5-git-send-email-loic.poulain@linaro.org> (raw)
In-Reply-To: <1604684010-24090-1-git-send-email-loic.poulain@linaro.org>

This will be requested for allocating control packet in atomic context.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 net/qrtr/qrtr.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 1d12408..a05d01e 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -526,18 +526,20 @@ EXPORT_SYMBOL_GPL(qrtr_endpoint_post);
 /**
  * qrtr_alloc_ctrl_packet() - allocate control packet skb
  * @pkt: reference to qrtr_ctrl_pkt pointer
+ * @flags: the type of memory to allocate
  *
  * Returns newly allocated sk_buff, or NULL on failure
  *
  * This function allocates a sk_buff large enough to carry a qrtr_ctrl_pkt and
  * on success returns a reference to the control packet in @pkt.
  */
-static struct sk_buff *qrtr_alloc_ctrl_packet(struct qrtr_ctrl_pkt **pkt)
+static struct sk_buff *qrtr_alloc_ctrl_packet(struct qrtr_ctrl_pkt **pkt,
+					      gfp_t flags)
 {
 	const int pkt_len = sizeof(struct qrtr_ctrl_pkt);
 	struct sk_buff *skb;
 
-	skb = alloc_skb(QRTR_HDR_MAX_SIZE + pkt_len, GFP_KERNEL);
+	skb = alloc_skb(QRTR_HDR_MAX_SIZE + pkt_len, flags);
 	if (!skb)
 		return NULL;
 
@@ -606,7 +608,7 @@ void qrtr_endpoint_unregister(struct qrtr_endpoint *ep)
 	mutex_unlock(&node->ep_lock);
 
 	/* Notify the local controller about the event */
-	skb = qrtr_alloc_ctrl_packet(&pkt);
+	skb = qrtr_alloc_ctrl_packet(&pkt, GFP_KERNEL);
 	if (skb) {
 		pkt->cmd = cpu_to_le32(QRTR_TYPE_BYE);
 		qrtr_local_enqueue(NULL, skb, QRTR_TYPE_BYE, &src, &dst);
@@ -663,7 +665,7 @@ static void qrtr_port_remove(struct qrtr_sock *ipc)
 	to.sq_node = QRTR_NODE_BCAST;
 	to.sq_port = QRTR_PORT_CTRL;
 
-	skb = qrtr_alloc_ctrl_packet(&pkt);
+	skb = qrtr_alloc_ctrl_packet(&pkt, GFP_KERNEL);
 	if (skb) {
 		pkt->cmd = cpu_to_le32(QRTR_TYPE_DEL_CLIENT);
 		pkt->client.node = cpu_to_le32(ipc->us.sq_node);
@@ -987,7 +989,7 @@ static int qrtr_send_resume_tx(struct qrtr_cb *cb)
 	if (!node)
 		return -EINVAL;
 
-	skb = qrtr_alloc_ctrl_packet(&pkt);
+	skb = qrtr_alloc_ctrl_packet(&pkt, GFP_KERNEL);
 	if (!skb)
 		return -ENOMEM;
 
-- 
2.7.4


  parent reply	other threads:[~2020-11-06 17:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 17:33 [PATCH v2 0/5] net: qrtr: Add distant node support Loic Poulain
2020-11-06 17:33 ` [PATCH v2 1/5] net: qrtr: Fix port ID for control messages Loic Poulain
2020-11-06 17:33 ` [PATCH v2 2/5] net: qrtr: Allow forwarded services Loic Poulain
2020-11-06 17:33 ` [PATCH v2 3/5] net: qrtr: Allow non-immediate node routing Loic Poulain
2020-11-06 17:33 ` Loic Poulain [this message]
2020-11-06 17:33 ` [PATCH v2 5/5] net: qrtr: Release distant nodes along the bridge node Loic Poulain
2020-11-08  0:26 ` [PATCH v2 0/5] net: qrtr: Add distant node support Jakub Kicinski
2020-11-09  8:49   ` Loic Poulain
2020-11-09 18:39     ` Jakub Kicinski
2020-11-10  9:03       ` Loic Poulain
2020-11-10 17:44         ` Jakub Kicinski
2020-11-11 23:31           ` Jakub Kicinski
2020-11-12  3:14           ` Manivannan Sadhasivam

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=1604684010-24090-5-git-send-email-loic.poulain@linaro.org \
    --to=loic.poulain@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=cjhuang@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=netdev@vger.kernel.org \
    /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).