net: Change the current NAPI context to use latest API

Commit 47405a253d ("percpu: Remove __this_cpu_ptr") and commit
6c51ec4d18 ("percpu: remove __get_cpu_var and __raw_get_cpu_var
macros") removed __this_cpu_ptr which is needed to access current
NAPI. Use this_cpu_ptr instead.

Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
This commit is contained in:
Subash Abhinov Kasiviswanathan 2016-02-05 11:11:56 -07:00 committed by David Keitel
parent 09a36c1368
commit 0dc9f20694

View file

@ -4620,7 +4620,7 @@ EXPORT_SYMBOL(__napi_schedule_irqoff);
void __napi_complete(struct napi_struct *n) void __napi_complete(struct napi_struct *n)
{ {
struct softnet_data *sd = &__get_cpu_var(softnet_data); struct softnet_data *sd = this_cpu_ptr(&softnet_data);
BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
@ -4779,17 +4779,16 @@ void netif_napi_del(struct napi_struct *napi)
} }
EXPORT_SYMBOL(netif_napi_del); EXPORT_SYMBOL(netif_napi_del);
static int napi_poll(struct napi_struct *n, struct list_head *repoll)
struct napi_struct *get_current_napi_context(void) struct napi_struct *get_current_napi_context(void)
{ {
struct softnet_data *sd = &__get_cpu_var(softnet_data); struct softnet_data *sd = this_cpu_ptr(&softnet_data);
return sd->current_napi; return sd->current_napi;
} }
EXPORT_SYMBOL(get_current_napi_context); EXPORT_SYMBOL(get_current_napi_context);
static void net_rx_action(struct softirq_action *h) static int napi_poll(struct napi_struct *n, struct list_head *repoll)
{ {
void *have; void *have;
int work, weight; int work, weight;
@ -4808,6 +4807,8 @@ static void net_rx_action(struct softirq_action *h)
*/ */
work = 0; work = 0;
if (test_bit(NAPI_STATE_SCHED, &n->state)) { if (test_bit(NAPI_STATE_SCHED, &n->state)) {
struct softnet_data *sd = this_cpu_ptr(&softnet_data);
sd->current_napi = n; sd->current_napi = n;
work = n->poll(n, weight); work = n->poll(n, weight);
trace_napi_poll(n); trace_napi_poll(n);