Skip to content

Commit

Permalink
usm: http2: Remove redundant heap map
Browse files Browse the repository at this point in the history
  • Loading branch information
guyarb committed Dec 27, 2023
1 parent 73c37d0 commit 0a5bd11
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
14 changes: 2 additions & 12 deletions pkg/network/ebpf/c/protocols/http2/decoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,8 @@ static __always_inline bool is_static_table_entry(const __u64 index) {

// http2_fetch_stream returns the current http2 in flight stream.
static __always_inline http2_stream_t *http2_fetch_stream(const http2_stream_key_t *http2_stream_key) {
http2_stream_t *http2_stream_ptr = bpf_map_lookup_elem(&http2_in_flight, http2_stream_key);
if (http2_stream_ptr != NULL) {
return http2_stream_ptr;
}

const __u32 zero = 0;
http2_stream_ptr = bpf_map_lookup_elem(&http2_stream_heap, &zero);
if (http2_stream_ptr == NULL) {
return NULL;
}
bpf_memset(http2_stream_ptr, 0, sizeof(http2_stream_t));
bpf_map_update_elem(&http2_in_flight, http2_stream_key, http2_stream_ptr, BPF_NOEXIST);
http2_stream_t http2_stream = {};
bpf_map_update_elem(&http2_in_flight, http2_stream_key, &http2_stream, BPF_NOEXIST);
return bpf_map_lookup_elem(&http2_in_flight, http2_stream_key);
}

Expand Down
3 changes: 0 additions & 3 deletions pkg/network/ebpf/c/protocols/http2/maps-defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ BPF_PERCPU_ARRAY_MAP(http2_headers_to_process, http2_header_t[HTTP2_MAX_HEADERS_
/* Allocating an array of frame, to hold all interesting frames from the packet. */
BPF_PERCPU_ARRAY_MAP(http2_frames_to_process, http2_tail_call_state_t, 1)

/* Allocating a stream on the heap, the stream is used to save the current stream info. */
BPF_PERCPU_ARRAY_MAP(http2_stream_heap, http2_stream_t, 1)

/* This map acts as a scratch buffer for "preparing" http2_event_t objects before they're
enqueued. The primary motivation here is to save eBPF stack memory. */
BPF_PERCPU_ARRAY_MAP(http2_scratch_buffer, http2_event_t, 1)
Expand Down
3 changes: 0 additions & 3 deletions pkg/network/protocols/http2/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ var Spec = &protocols.ProtocolSpec{
{
Name: "http2_frames_to_process",
},
{
Name: "http2_stream_heap",
},
{
Name: "http2_stream_key_heap",
},
Expand Down

0 comments on commit 0a5bd11

Please sign in to comment.