summaryrefslogtreecommitdiff
path: root/net/mctp/test/utils.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@codeconstruct.com.au>2024-02-19 17:51:49 +0800
committerPaolo Abeni <pabeni@redhat.com>2024-02-22 13:32:55 +0100
commita1f4cf5791e7914f3e42f5462669353104fef8a9 (patch)
tree9b56a3605b3d4ee9888589498b80b350a19b4d83 /net/mctp/test/utils.c
parentfc944ecc4f1a287882d90441360a0ba61d45fd8b (diff)
net: mctp: tests: create test skbs with the correct net and device
In our test skb creation functions, we're not setting up the net and device data. This doesn't matter at the moment, but we will want to add support for distinct net IDs in future. Set the ->net identifier on the test MCTP device, and ensure that test skbs are set up with the correct device-related data on creation. Create a helper for setting skb->dev and mctp_skb_cb->net. We have a few cases where we're calling __mctp_cb() to initialise the cb (which we need for the above) separately, so integrate this into the skb creation helpers. Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/mctp/test/utils.c')
-rw-r--r--net/mctp/test/utils.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/mctp/test/utils.c b/net/mctp/test/utils.c
index e03ba66bbe18..565763eb0211 100644
--- a/net/mctp/test/utils.c
+++ b/net/mctp/test/utils.c
@@ -4,6 +4,7 @@
#include <linux/mctp.h>
#include <linux/if_arp.h>
+#include <net/mctp.h>
#include <net/mctpdevice.h>
#include <net/pkt_sched.h>
@@ -54,6 +55,7 @@ struct mctp_test_dev *mctp_test_create_dev(void)
rcu_read_lock();
dev->mdev = __mctp_dev_get(ndev);
+ dev->mdev->net = mctp_default_net(dev_net(ndev));
rcu_read_unlock();
return dev;