All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: change bq_enqueue() return type from int to void
@ 2020-08-31 15:07 Björn Töpel
  2020-08-31 16:07 ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: Björn Töpel @ 2020-08-31 15:07 UTC (permalink / raw)
  To: ast, daniel, bpf
  Cc: Björn Töpel, magnus.karlsson, netdev, toke, brouer

From: Björn Töpel <bjorn.topel@intel.com>

The bq_enqueue() functions for {DEV, CPU}MAP always return
zero. Changing the return type from int to void makes the code easier
to follow.

Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
---
 kernel/bpf/cpumap.c | 4 +---
 kernel/bpf/devmap.c | 9 ++++-----
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
index 8d2a8623d2a7..e486a84b1fce 100644
--- a/kernel/bpf/cpumap.c
+++ b/kernel/bpf/cpumap.c
@@ -708,7 +708,7 @@ static int bq_flush_to_queue(struct xdp_bulk_queue *bq)
 /* Runs under RCU-read-side, plus in softirq under NAPI protection.
  * Thus, safe percpu variable access.
  */
-static int bq_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_frame *xdpf)
+static void bq_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_frame *xdpf)
 {
 	struct list_head *flush_list = this_cpu_ptr(&cpu_map_flush_list);
 	struct xdp_bulk_queue *bq = this_cpu_ptr(rcpu->bulkq);
@@ -729,8 +729,6 @@ static int bq_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_frame *xdpf)
 
 	if (!bq->flush_node.prev)
 		list_add(&bq->flush_node, flush_list);
-
-	return 0;
 }
 
 int cpu_map_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_buff *xdp,
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index a42052b85c35..ce29ff7ba51f 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -421,8 +421,8 @@ struct bpf_dtab_netdev *__dev_map_lookup_elem(struct bpf_map *map, u32 key)
 /* Runs under RCU-read-side, plus in softirq under NAPI protection.
  * Thus, safe percpu variable access.
  */
-static int bq_enqueue(struct net_device *dev, struct xdp_frame *xdpf,
-		      struct net_device *dev_rx)
+static void bq_enqueue(struct net_device *dev, struct xdp_frame *xdpf,
+		       struct net_device *dev_rx)
 {
 	struct list_head *flush_list = this_cpu_ptr(&dev_flush_list);
 	struct xdp_dev_bulk_queue *bq = this_cpu_ptr(dev->xdp_bulkq);
@@ -441,8 +441,6 @@ static int bq_enqueue(struct net_device *dev, struct xdp_frame *xdpf,
 
 	if (!bq->flush_node.prev)
 		list_add(&bq->flush_node, flush_list);
-
-	return 0;
 }
 
 static inline int __xdp_enqueue(struct net_device *dev, struct xdp_buff *xdp,
@@ -462,7 +460,8 @@ static inline int __xdp_enqueue(struct net_device *dev, struct xdp_buff *xdp,
 	if (unlikely(!xdpf))
 		return -EOVERFLOW;
 
-	return bq_enqueue(dev, xdpf, dev_rx);
+	bq_enqueue(dev, xdpf, dev_rx);
+	return 0;
 }
 
 static struct xdp_buff *dev_map_run_prog(struct net_device *dev,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] bpf: change bq_enqueue() return type from int to void
  2020-08-31 15:07 [PATCH bpf-next] bpf: change bq_enqueue() return type from int to void Björn Töpel
@ 2020-08-31 16:07 ` David Ahern
  2020-09-01  6:12   ` Björn Töpel
  0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2020-08-31 16:07 UTC (permalink / raw)
  To: Björn Töpel, ast, daniel, bpf
  Cc: Björn Töpel, magnus.karlsson, netdev, toke, brouer

On 8/31/20 9:07 AM, Björn Töpel wrote:
> From: Björn Töpel <bjorn.topel@intel.com>
> 
> The bq_enqueue() functions for {DEV, CPU}MAP always return
> zero. Changing the return type from int to void makes the code easier
> to follow.
> 

You can expand that to a few other calls in this code path - both
bq_flush_to_queue and bq_xmit_all always return 0 as well.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] bpf: change bq_enqueue() return type from int to void
  2020-08-31 16:07 ` David Ahern
@ 2020-09-01  6:12   ` Björn Töpel
  0 siblings, 0 replies; 3+ messages in thread
From: Björn Töpel @ 2020-09-01  6:12 UTC (permalink / raw)
  To: David Ahern, Björn Töpel, ast, daniel, bpf
  Cc: magnus.karlsson, netdev, toke, brouer

On 2020-08-31 18:07, David Ahern wrote:
> On 8/31/20 9:07 AM, Björn Töpel wrote:
>> From: Björn Töpel <bjorn.topel@intel.com>
>>
>> The bq_enqueue() functions for {DEV, CPU}MAP always return
>> zero. Changing the return type from int to void makes the code easier
>> to follow.
>>
> 
> You can expand that to a few other calls in this code path - both
> bq_flush_to_queue and bq_xmit_all always return 0 as well.
> 

Indeed! I'll spin a new rev!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-01  6:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31 15:07 [PATCH bpf-next] bpf: change bq_enqueue() return type from int to void Björn Töpel
2020-08-31 16:07 ` David Ahern
2020-09-01  6:12   ` Björn Töpel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.