lkml.org 
[lkml]   [2020]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC 0/7] Add support to process rx packets in thread
From
Date
On 2020-07-26 03:22, Hillf Danton wrote:
>> - add a state bit for threaded NAPI
>> - make netif_threaded_napi_add inline
>> - run queue_work outside of local_irq_save/restore (it does that
>> internally already)
>>
>> If you don't mind, I'd like to propose this to netdev soon. Can I have
>> your Signed-off-by for that?
>
> Feel free to do that. Is it likely for me to select a Cc?
Shall I use Signed-off-by: Hillf Danton <hdanton@sina.com>?
What Cc do you want me to add?

>> ---
>> --- a/include/linux/netdevice.h
>> +++ b/include/linux/netdevice.h
>> @@ -347,6 +347,7 @@ struct napi_struct {
>> struct list_head dev_list;
>> struct hlist_node napi_hash_node;
>> unsigned int napi_id;
>> + struct work_struct work;
>> };
>>
>> enum {
>> @@ -357,6 +358,7 @@ enum {
>> NAPI_STATE_HASHED, /* In NAPI hash (busy polling possible) */
>> NAPI_STATE_NO_BUSY_POLL,/* Do not add in napi_hash, no busy polling */
>> NAPI_STATE_IN_BUSY_POLL,/* sk_busy_loop() owns this NAPI */
>> + NAPI_STATE_THREADED, /* Use threaded NAPI */
>> };
>>
>> enum {
>> @@ -367,6 +369,7 @@ enum {
>> NAPIF_STATE_HASHED = BIT(NAPI_STATE_HASHED),
>> NAPIF_STATE_NO_BUSY_POLL = BIT(NAPI_STATE_NO_BUSY_POLL),
>> NAPIF_STATE_IN_BUSY_POLL = BIT(NAPI_STATE_IN_BUSY_POLL),
>> + NAPIF_STATE_THREADED = BIT(NAPI_STATE_THREADED),
>> };
>>
>> enum gro_result {
>> @@ -2315,6 +2318,26 @@ static inline void *netdev_priv(const struct net_device *dev)
>> void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
>> int (*poll)(struct napi_struct *, int), int weight);
>>
>> +/**
>> + * netif_threaded_napi_add - initialize a NAPI context
>> + * @dev: network device
>> + * @napi: NAPI context
>> + * @poll: polling function
>> + * @weight: default weight
>> + *
>> + * This variant of netif_napi_add() should be used from drivers using NAPI
>> + * with CPU intensive poll functions.
>> + * This will schedule polling from a high priority workqueue that
>> + */
>> +static inline void netif_threaded_napi_add(struct net_device *dev,
>> + struct napi_struct *napi,
>> + int (*poll)(struct napi_struct *, int),
>> + int weight)
>> +{
>> + set_bit(NAPI_STATE_THREADED, &napi->state);
>> + netif_napi_add(dev, napi, poll, weight);
>> +}
>> +
>> /**
>> * netif_tx_napi_add - initialize a NAPI context
>> * @dev: network device
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -158,6 +158,7 @@ static DEFINE_SPINLOCK(offload_lock);
>> struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
>> struct list_head ptype_all __read_mostly; /* Taps */
>> static struct list_head offload_base __read_mostly;
>> +static struct workqueue_struct *napi_workq;
>
> Is __read_mostly missing?
Yes, thanks. I will add that before sending the patch.

- Felix

\
 
 \ /
  Last update: 2020-07-26 10:11    [W:0.244 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site