DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [RFC 2/5] tap: remove unnecessary bzero() calls in bpf api
Date: Fri,  5 Jan 2024 14:28:08 -0800	[thread overview]
Message-ID: <20240105222909.139674-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20240105222909.139674-1-stephen@networkplumber.org>

The structures are already fully initialized, bzero() or memset
is redundant.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/tap/tap_bpf_api.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/tap/tap_bpf_api.c b/drivers/net/tap/tap_bpf_api.c
index a6adec855dda..d176da0802eb 100644
--- a/drivers/net/tap/tap_bpf_api.c
+++ b/drivers/net/tap/tap_bpf_api.c
@@ -120,7 +120,6 @@ static int bpf_load(enum bpf_prog_type type,
 {
 	union bpf_attr attr = {};
 
-	bzero(&attr, sizeof(attr));
 	attr.prog_type = type;
 	attr.insn_cnt = (__u32)insns_cnt;
 	attr.insns = ptr_to_u64(insns);
@@ -153,7 +152,6 @@ int tap_flow_bpf_rss_map_create(unsigned int key_size,
 {
 	union bpf_attr attr = {};
 
-	bzero(&attr, sizeof(attr));
 	attr.map_type    = BPF_MAP_TYPE_HASH;
 	attr.key_size    = key_size;
 	attr.value_size  = value_size;
@@ -181,8 +179,6 @@ int tap_flow_bpf_update_rss_elem(int fd, void *key, void *value)
 {
 	union bpf_attr attr = {};
 
-	bzero(&attr, sizeof(attr));
-
 	attr.map_type = BPF_MAP_TYPE_HASH;
 	attr.map_fd = fd;
 	attr.key = ptr_to_u64(key);
-- 
2.43.0


  parent reply	other threads:[~2024-01-05 22:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-05 22:28 [RFC 0/5] BPF infrastructure enhancements Stephen Hemminger
2024-01-05 22:28 ` [RFC 1/5] tap: move forward declaration of bpf_load Stephen Hemminger
2024-01-05 22:28 ` Stephen Hemminger [this message]
2024-01-05 22:28 ` [RFC 3/5] tap: remove unnecessary cast in call to bpf_load Stephen Hemminger
2024-01-05 22:28 ` [RFC 4/5] tap: get errors from kernel on bpf load failure Stephen Hemminger
2024-01-05 22:28 ` [RFC 5/5] tap: stop "vendoring" linux bpf header Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240105222909.139674-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).