diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2025-02-18 19:59:23 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2025-02-18 13:33:10 +0100 |
commit | ba0823f8a0e60d4fc0cb21179aaf64940509156a (patch) | |
tree | 2ef11d6b402e611348d3e881864a566734706c55 | |
parent | 854bc7b1a3b4e5443ea071e49b3a68198dbb88b3 (diff) | |
download | passt-ba0823f8a0e60d4fc0cb21179aaf64940509156a.tar passt-ba0823f8a0e60d4fc0cb21179aaf64940509156a.tar.gz passt-ba0823f8a0e60d4fc0cb21179aaf64940509156a.tar.bz2 passt-ba0823f8a0e60d4fc0cb21179aaf64940509156a.tar.lz passt-ba0823f8a0e60d4fc0cb21179aaf64940509156a.tar.xz passt-ba0823f8a0e60d4fc0cb21179aaf64940509156a.tar.zst passt-ba0823f8a0e60d4fc0cb21179aaf64940509156a.zip |
tcp: Don't pass both flow pointer and flow index
tcp_flow_migrate_source_ext() is passed both the index of the flow it
operates on and the pointer to the connection structure. However, the
former is trivially derived from the latter. Simplify the interface.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | flow.c | 2 | ||||
-rw-r--r-- | tcp.c | 6 | ||||
-rw-r--r-- | tcp_conn.h | 3 |
3 files changed, 4 insertions, 7 deletions
@@ -1053,7 +1053,7 @@ int flow_migrate_source(struct ctx *c, const struct migrate_stage *stage, * as EIO). */ foreach_established_tcp_flow(i, flow, FLOW_MAX) { - rc = tcp_flow_migrate_source_ext(fd, i, &flow->tcp); + rc = tcp_flow_migrate_source_ext(fd, &flow->tcp); if (rc) { err("Extended data for flow %u: %s", i, strerror_(-rc)); @@ -3141,16 +3141,14 @@ int tcp_flow_migrate_source(int fd, struct tcp_tap_conn *conn) /** * tcp_flow_migrate_source_ext() - Dump queues, close sockets, send final data * @fd: Descriptor for state migration - * @fidx: Flow index * @conn: Pointer to the TCP connection structure * * Return: 0 on success, negative (not -EIO) on failure, -EIO on sending failure */ -int tcp_flow_migrate_source_ext(int fd, int fidx, - const struct tcp_tap_conn *conn) +int tcp_flow_migrate_source_ext(int fd, const struct tcp_tap_conn *conn) { uint32_t peek_offset = conn->seq_to_tap - conn->seq_ack_from_tap; - struct tcp_tap_transfer_ext *t = &migrate_ext[fidx]; + struct tcp_tap_transfer_ext *t = &migrate_ext[FLOW_IDX(conn)]; int s = conn->sock; int rc; @@ -234,8 +234,7 @@ int tcp_flow_repair_on(struct ctx *c, const struct tcp_tap_conn *conn); int tcp_flow_repair_off(struct ctx *c, const struct tcp_tap_conn *conn); int tcp_flow_migrate_source(int fd, struct tcp_tap_conn *conn); -int tcp_flow_migrate_source_ext(int fd, int fidx, - const struct tcp_tap_conn *conn); +int tcp_flow_migrate_source_ext(int fd, const struct tcp_tap_conn *conn); int tcp_flow_migrate_target(struct ctx *c, int fd); int tcp_flow_migrate_target_ext(struct ctx *c, struct tcp_tap_conn *conn, int fd); |