netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mi <cmi@nvidia.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: <netdev@vger.kernel.org>, <jiri@nvidia.com>, <saeedm@nvidia.com>,
	"kernel test robot" <lkp@intel.com>
Subject: Re: [PATCH net-next v4] net: psample: Introduce stubs to remove NIC driver dependency
Date: Sat, 30 Jan 2021 10:35:10 +0800	[thread overview]
Message-ID: <5b7a1928-be3f-4fa5-b9d2-0851d72ef542@nvidia.com> (raw)
In-Reply-To: <20210129135056.0e6733eb@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

On 1/30/2021 5:50 AM, Jakub Kicinski wrote:
> On Thu, 28 Jan 2021 09:45:43 +0800 Chris Mi wrote:
>> In order to send sampled packets to userspace, NIC driver calls
>> psample api directly. But it creates a hard dependency on module
>> psample. Introduce psample_ops to remove the hard dependency.
>> It is initialized when psample module is loaded and set to NULL
>> when the module is unloaded.
>>
>> Reported-by: kernel test robot <lkp@intel.com>
>> Signed-off-by: Chris Mi <cmi@nvidia.com>
>> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
>> diff --git a/include/net/psample.h b/include/net/psample.h
>> index 68ae16bb0a4a..e6a73128de59 100644
>> --- a/include/net/psample.h
>> +++ b/include/net/psample.h
>> @@ -4,6 +4,7 @@
>>   
>>   #include <uapi/linux/psample.h>
>>   #include <linux/list.h>
>> +#include <linux/skbuff.h>
> Forward declaration should be enough.
Done.
>
>>   struct psample_group {
>>   	struct list_head list;
>>   static void __exit psample_module_exit(void)
>>   {
>> +	RCU_INIT_POINTER(psample_ops, NULL);
> I think you can use rcu_assign_pointer(), it handles constants
> right these days.
Done.
>
> Please add a comment here saying that you depend on
> genl_unregister_family() executing synchronize_rcu()
> and name the function where it does so.
I added synchronize_rcu() here directly. Maybe it's more clear.
>
>>   	genl_unregister_family(&psample_nl_family);
>>   }
>> diff --git a/net/sched/psample_stub.c b/net/sched/psample_stub.c
>> new file mode 100644
>> index 000000000000..0615a7b64000
>> --- /dev/null
>> +++ b/net/sched/psample_stub.c
>> @@ -0,0 +1,7 @@
>> +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
>> +/* Copyright (c) 2021 Mellanox Technologies. */
>> +
>> +#include <net/psample.h>
> Forward declaration is sufficient.
Done.

Thanks,
Chris
>
>> +const struct psample_ops __rcu *psample_ops __read_mostly;
>> +EXPORT_SYMBOL_GPL(psample_ops);


      reply	other threads:[~2021-01-30  3:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28  1:45 [PATCH net-next v4] net: psample: Introduce stubs to remove NIC driver dependency Chris Mi
2021-01-29  5:14 ` Cong Wang
2021-01-29  6:08   ` Chris Mi
2021-01-29 20:30     ` Jakub Kicinski
2021-01-29 20:44       ` Saeed Mahameed
2021-01-29 21:47         ` Jakub Kicinski
2021-01-30 14:42       ` Ido Schimmel
2021-02-01  1:37         ` Chris Mi
2021-02-01 18:08           ` Ido Schimmel
2021-02-08  7:03             ` Leon Romanovsky
2021-02-08  8:57               ` Ido Schimmel
2021-02-08  9:07                 ` Leon Romanovsky
2021-02-08 17:07                   ` Ido Schimmel
2021-02-09  6:47                     ` Leon Romanovsky
2021-02-09  9:25                       ` Or Gerlitz
2021-02-09 10:01                         ` Leon Romanovsky
2021-02-09 10:49                           ` Or Gerlitz
2021-02-11  5:09                       ` Saeed Mahameed
2021-02-11 21:59                         ` Ido Schimmel
2021-02-12  0:41                           ` Saeed Mahameed
2021-01-29 21:50 ` Jakub Kicinski
2021-01-30  2:35   ` Chris Mi [this message]

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=5b7a1928-be3f-4fa5-b9d2-0851d72ef542@nvidia.com \
    --to=cmi@nvidia.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=lkp@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.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).