Add a qpair parameter to arp(), forwarding it to tap_send_single()
instead of hardcoding QPAIR_DEFAULT, so replies go out on the same
queue pair the request arrived on.
arp_send_init_req() and arp_announce() are unsolicited, low-volume
messages with no meaningful queue pair context, so they hardcode
QPAIR_DEFAULT internally.
No functional change.
Signed-off-by: Laurent Vivier
---
arp.c | 5 +++--
arp.h | 2 +-
tap.c | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arp.c b/arp.c
index e97c4de86a99..a12b50ff8439 100644
--- a/arp.c
+++ b/arp.c
@@ -63,11 +63,12 @@ static bool ignore_arp(const struct ctx *c,
/**
* arp() - Check if this is a supported ARP message, reply as needed
* @c: Execution context
+ * @qpair: Queue pair on which to send the reply
* @data: Single packet with Ethernet buffer
*
* Return: 1 if handled, -1 on failure
*/
-int arp(const struct ctx *c, struct iov_tail *data)
+int arp(const struct ctx *c, unsigned int qpair, struct iov_tail *data)
{
union inany_addr tgt;
struct {
@@ -112,7 +113,7 @@ int arp(const struct ctx *c, struct iov_tail *data)
memcpy(resp.am.tha, am->sha, sizeof(resp.am.tha));
memcpy(resp.am.tip, am->sip, sizeof(resp.am.tip));
- tap_send_single(c, QPAIR_DEFAULT, &resp, sizeof(resp));
+ tap_send_single(c, qpair, &resp, sizeof(resp));
return 1;
}
diff --git a/arp.h b/arp.h
index 4b1f38bcec9b..5872b535635a 100644
--- a/arp.h
+++ b/arp.h
@@ -22,7 +22,7 @@ struct arpmsg {
unsigned char tip[4];
} __attribute__((__packed__));
-int arp(const struct ctx *c, struct iov_tail *data);
+int arp(const struct ctx *c, unsigned int qpair, struct iov_tail *data);
void arp_send_init_req(const struct ctx *c);
void arp_announce(const struct ctx *c, struct in_addr *ip,
const unsigned char *mac);
diff --git a/tap.c b/tap.c
index 206a1c36b779..928cf5c086ee 100644
--- a/tap.c
+++ b/tap.c
@@ -727,7 +727,7 @@ resume:
if (!eh)
continue;
if (ntohs(eh->h_proto) == ETH_P_ARP) {
- arp(c, &data);
+ arp(c, qpair, &data);
continue;
}
--
2.54.0