Skip to content

Comments

libbpf-tools/map_helpers: Fix duplicate map read operations#4998

Merged
yonghong-song merged 1 commit intoiovisor:masterfrom
ekyooo:map_helpers
May 19, 2024
Merged

libbpf-tools/map_helpers: Fix duplicate map read operations#4998
yonghong-song merged 1 commit intoiovisor:masterfrom
ekyooo:map_helpers

Conversation

@ekyooo
Copy link
Collaborator

@ekyooo ekyooo commented May 12, 2024

Even when the batch read is successful, a non-batch read is performed. Fixed so that non-batch reads are not performed once batch reads are done.

This is the result of testing tcpconnect by adding some logs to map_helpers.

Before:

  ./tcpconnect -c
    dump_hash_batch, *count: 3
    k: 16777343, v: 1
    k: 50331775, v: 0
    k: 385875968, v: 1

    dump_hash_iter, *count: 3
    k: 16777343, v: 1
    k: 50331775, v: 0
    k: 385875968, v: 1

    LADDR                     RADDR                     RPORT                CONNECT
    127.0.0.1                 127.0.0.3                 23                   1
    127.0.0.1                 127.0.0.1                 23                   1
    127.0.0.1                 127.0.0.2                 23                   1

After:

  ./tcpconnect -c
    dump_hash_batch *count: 2
    k: 16777343, v: 1
    k: 16777343, v: 0

    LADDR                     RADDR                     RPORT                CONNECT
    127.0.0.1                 127.0.0.1                 23                   1
    127.0.0.1                 127.0.0.2                 23                   1

Even when the batch read is successful, a non-batch read is performed.
Fixed so that non-batch reads are not performed once batch reads are done.

This is the result of testing tcpconnect by adding some logs to map_helpers.

Before:
  ./tcpconnect -c
    dump_hash_batch, *count: 3
    k: 16777343, v: 1
    k: 50331775, v: 0
    k: 385875968, v: 1

    dump_hash_iter, *count: 3
    k: 16777343, v: 1
    k: 50331775, v: 0
    k: 385875968, v: 1

    LADDR                     RADDR                     RPORT                CONNECT
    127.0.0.1                 127.0.0.3                 23                   1
    127.0.0.1                 127.0.0.1                 23                   1
    127.0.0.1                 127.0.0.2                 23                   1

After:
  ./tcpconnect -c
    dump_hash_batch *count: 2
    k: 16777343, v: 1
    k: 16777343, v: 0

    LADDR                     RADDR                     RPORT                CONNECT
    127.0.0.1                 127.0.0.1                 23                   1
    127.0.0.1                 127.0.0.2                 23                   1
@yonghong-song yonghong-song merged commit a620285 into iovisor:master May 19, 2024
dagomez137 pushed a commit to dagomez137/bcc that referenced this pull request Nov 28, 2024
…4998)

Even when the batch read is successful, a non-batch read is performed.
Fixed so that non-batch reads are not performed once batch reads are done.

This is the result of testing tcpconnect by adding some logs to map_helpers.

Before:
  ./tcpconnect -c
    dump_hash_batch, *count: 3
    k: 16777343, v: 1
    k: 50331775, v: 0
    k: 385875968, v: 1

    dump_hash_iter, *count: 3
    k: 16777343, v: 1
    k: 50331775, v: 0
    k: 385875968, v: 1

    LADDR                     RADDR                     RPORT                CONNECT
    127.0.0.1                 127.0.0.3                 23                   1
    127.0.0.1                 127.0.0.1                 23                   1
    127.0.0.1                 127.0.0.2                 23                   1

After:
  ./tcpconnect -c
    dump_hash_batch *count: 2
    k: 16777343, v: 1
    k: 16777343, v: 0

    LADDR                     RADDR                     RPORT                CONNECT
    127.0.0.1                 127.0.0.1                 23                   1
    127.0.0.1                 127.0.0.2                 23                   1
dagomez137 pushed a commit to dagomez137/bcc that referenced this pull request Mar 18, 2025
…4998)

Even when the batch read is successful, a non-batch read is performed.
Fixed so that non-batch reads are not performed once batch reads are done.

This is the result of testing tcpconnect by adding some logs to map_helpers.

Before:
  ./tcpconnect -c
    dump_hash_batch, *count: 3
    k: 16777343, v: 1
    k: 50331775, v: 0
    k: 385875968, v: 1

    dump_hash_iter, *count: 3
    k: 16777343, v: 1
    k: 50331775, v: 0
    k: 385875968, v: 1

    LADDR                     RADDR                     RPORT                CONNECT
    127.0.0.1                 127.0.0.3                 23                   1
    127.0.0.1                 127.0.0.1                 23                   1
    127.0.0.1                 127.0.0.2                 23                   1

After:
  ./tcpconnect -c
    dump_hash_batch *count: 2
    k: 16777343, v: 1
    k: 16777343, v: 0

    LADDR                     RADDR                     RPORT                CONNECT
    127.0.0.1                 127.0.0.1                 23                   1
    127.0.0.1                 127.0.0.2                 23                   1
dagomez137 pushed a commit to dagomez137/bcc that referenced this pull request Oct 9, 2025
…4998)

Even when the batch read is successful, a non-batch read is performed.
Fixed so that non-batch reads are not performed once batch reads are done.

This is the result of testing tcpconnect by adding some logs to map_helpers.

Before:
  ./tcpconnect -c
    dump_hash_batch, *count: 3
    k: 16777343, v: 1
    k: 50331775, v: 0
    k: 385875968, v: 1

    dump_hash_iter, *count: 3
    k: 16777343, v: 1
    k: 50331775, v: 0
    k: 385875968, v: 1

    LADDR                     RADDR                     RPORT                CONNECT
    127.0.0.1                 127.0.0.3                 23                   1
    127.0.0.1                 127.0.0.1                 23                   1
    127.0.0.1                 127.0.0.2                 23                   1

After:
  ./tcpconnect -c
    dump_hash_batch *count: 2
    k: 16777343, v: 1
    k: 16777343, v: 0

    LADDR                     RADDR                     RPORT                CONNECT
    127.0.0.1                 127.0.0.1                 23                   1
    127.0.0.1                 127.0.0.2                 23                   1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants