git: 81c1d7c9c727 - releng/13.1 - if_epair: build fix

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Sun, 20 Mar 2022 15:38:09 UTC
The branch releng/13.1 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=81c1d7c9c727184dacb31df563fb42d208ccde46

commit 81c1d7c9c727184dacb31df563fb42d208ccde46
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-03-17 02:35:13 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-03-20 15:25:40 +0000

    if_epair: build fix
    
    66acf7685b failed to build on riscv (and mips). This is because the
    atomic_testandset_int() (and friends) functions do not exist there.
    Happily those platforms do have the long variant, so switch to that.
    
    PR:             262571
    MFC after:      3 days
    Approved by:    re (gjb)
    
    (cherry picked from commit 0bf7acd6b7047537a38e2de391a461e4e8956630)
---
 sys/net/if_epair.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
index 16e7f602edee..23f7f6da6846 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -106,7 +106,7 @@ struct epair_queue {
 	int			 id;
 	struct buf_ring		*rxring[2];
 	volatile int		 ridx;		/* 0 || 1 */
-	volatile int		 state;		/* taskqueue coordination */
+	volatile long		 state;		/* taskqueue coordination */
 	struct task		 tx_task;
 	struct epair_softc	*sc;
 };
@@ -175,8 +175,8 @@ epair_tx_start_deferred(void *arg, int pending)
 	} while (!atomic_fcmpset_int(&q->ridx, &ridx, nidx));
 	epair_if_input(sc, q, ridx);
 
-	atomic_clear_int(&q->state, (1 << BIT_QUEUE_TASK));
-	if (atomic_testandclear_int(&q->state, BIT_MBUF_QUEUED))
+	atomic_clear_long(&q->state, (1 << BIT_QUEUE_TASK));
+	if (atomic_testandclear_long(&q->state, BIT_MBUF_QUEUED))
 		taskqueue_enqueue(epair_tasks.tq[q->id], &q->tx_task);
 
 	if_rele(sc->ifp);
@@ -238,7 +238,7 @@ epair_menq(struct mbuf *m, struct epair_softc *osc)
 #endif
 	q = &osc->queues[bucket];
 
-	atomic_set_int(&q->state, (1 << BIT_MBUF_QUEUED));
+	atomic_set_long(&q->state, (1 << BIT_MBUF_QUEUED));
 	ridx = atomic_load_int(&q->ridx);
 	ret = buf_ring_enqueue(q->rxring[ridx], m);
 	if (ret != 0) {
@@ -260,7 +260,7 @@ epair_menq(struct mbuf *m, struct epair_softc *osc)
 	/* Someone else received the packet. */
 	if_inc_counter(oifp, IFCOUNTER_IPACKETS, 1);
 
-	if (!atomic_testandset_int(&q->state, BIT_QUEUE_TASK))
+	if (!atomic_testandset_long(&q->state, BIT_QUEUE_TASK))
 		taskqueue_enqueue(epair_tasks.tq[bucket], &q->tx_task);
 
 	return (0);