Skip to content

Commit 404f2f1

Browse files
Shan Weijessegross
authored andcommitted
net: openvswitch: use this_cpu_ptr per-cpu helper
just use more faster this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id()); Signed-off-by: Shan Wei <davidshan@tencent.com> Reviewed-by: Christoph Lameter <cl@linux.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
1 parent 3fdbd1c commit 404f2f1

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

‎net/openvswitch/datapath.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb)
208208
int error;
209209
int key_len;
210210

211-
stats = per_cpu_ptr(dp->stats_percpu, smp_processor_id());
211+
stats = this_cpu_ptr(dp->stats_percpu);
212212

213213
/* Extract flow from 'skb' into 'key'. */
214214
error = ovs_flow_extract(skb, p->port_no, &key, &key_len);
@@ -282,7 +282,7 @@ int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb,
282282
return 0;
283283

284284
err:
285-
stats = per_cpu_ptr(dp->stats_percpu, smp_processor_id());
285+
stats = this_cpu_ptr(dp->stats_percpu);
286286

287287
u64_stats_update_begin(&stats->sync);
288288
stats->n_lost++;

‎net/openvswitch/vport.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,7 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb)
333333
{
334334
struct vport_percpu_stats *stats;
335335

336-
stats = per_cpu_ptr(vport->percpu_stats, smp_processor_id());
337-
336+
stats = this_cpu_ptr(vport->percpu_stats);
338337
u64_stats_update_begin(&stats->sync);
339338
stats->rx_packets++;
340339
stats->rx_bytes += skb->len;
@@ -359,7 +358,7 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
359358
if (likely(sent)) {
360359
struct vport_percpu_stats *stats;
361360

362-
stats = per_cpu_ptr(vport->percpu_stats, smp_processor_id());
361+
stats = this_cpu_ptr(vport->percpu_stats);
363362

364363
u64_stats_update_begin(&stats->sync);
365364
stats->tx_packets++;

0 commit comments

Comments
 (0)