divert: Avoid using atomic_(load|store)_(acq|rel)_16
It's not implemented on some arches. Use a plain int to count the
number of sockets in a divert lbgroup.
Reported by: Jenkins
Fixes: 895a0ae67f ("divert: Define semantics for SO_REUSEPORT_LB on divert sockets")
This commit is contained in:
@@ -50,12 +50,14 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <net/vnet.h>
|
||||
|
||||
#include <machine/atomic.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_private.h>
|
||||
#include <net/netisr.h>
|
||||
#include <net/vnet.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_pcb.h>
|
||||
@@ -152,7 +154,7 @@ struct divcblbgroup {
|
||||
CK_SLIST_ENTRY(divcblbgroup) dl_next;
|
||||
struct epoch_context dl_epochctx;
|
||||
uint16_t dl_port;
|
||||
uint16_t dl_count;
|
||||
int dl_count;
|
||||
#define DIVCBLBGROUP_SIZE 32
|
||||
struct divcb *dl_dcb[DIVCBLBGROUP_SIZE];
|
||||
};
|
||||
@@ -297,7 +299,7 @@ divert_packet(struct mbuf *m, uint64_t id, bool incoming)
|
||||
CK_SLIST_FOREACH(dlb, &V_divlbhash[DIVHASH(nport)], dl_next) {
|
||||
uint16_t count;
|
||||
|
||||
count = atomic_load_acq_16(&dlb->dl_count);
|
||||
count = atomic_load_acq_int(&dlb->dl_count);
|
||||
if (dlb->dl_port == nport && count > 0) {
|
||||
uint32_t hash;
|
||||
|
||||
@@ -666,7 +668,7 @@ div_lbgroup_detach(struct divcb *dcb)
|
||||
count = dlb->dl_count;
|
||||
if (i != count - 1)
|
||||
dlb->dl_dcb[i] = dlb->dl_dcb[count - 1];
|
||||
atomic_store_rel_16(&dlb->dl_count, count - 1);
|
||||
atomic_store_rel_int(&dlb->dl_count, count - 1);
|
||||
if (count == 1) {
|
||||
CK_SLIST_REMOVE(&V_divlbhash[DCBHASH(dcb)], dlb,
|
||||
divcblbgroup, dl_next);
|
||||
@@ -743,7 +745,7 @@ div_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
|
||||
("div_bind: lbgroup %p has count 0", tmp));
|
||||
|
||||
tmp->dl_dcb[tmp->dl_count] = dcb;
|
||||
atomic_store_rel_16(&tmp->dl_count, tmp->dl_count + 1);
|
||||
atomic_store_rel_int(&tmp->dl_count, tmp->dl_count + 1);
|
||||
free(dlb, M_PCB);
|
||||
} else {
|
||||
error = ENOSPC;
|
||||
|
||||
Reference in New Issue
Block a user