forked from vtl/ethblk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.h
39 lines (33 loc) · 896 Bytes
/
worker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2019 Vitaly Mayatskikh <[email protected]>
*
* This work is licensed under the terms of the GNU GPL, version 2.
*
*/
#ifndef _ETHBLK_WORKER_H_
#define _ETHBLK_WORKER_H_
#include <linux/kthread.h>
#include <linux/cpumask.h>
struct ethblk_worker {
int idx;
struct ethblk_worker_pool *pool;
struct kthread_worker *worker;
struct kthread_work work;
int neighbour;
bool active;
spinlock_t lock;
struct list_head queue;
};
struct ethblk_worker_pool {
char name[16];
struct cpumask cpumask;
struct ethblk_worker worker[NR_CPUS];
};
struct ethblk_worker_pool *
ethblk_worker_create_pool(const char *name, kthread_work_func_t fn,
const struct cpumask *cpumask);
void ethblk_worker_destroy_pool(struct ethblk_worker_pool *p);
void ethblk_worker_enqueue(struct ethblk_worker_pool *p,
struct list_head *list);
#endif