1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-21 07:15:49 +00:00

iflib: Many style fixes

MFC after:	3 days
This commit is contained in:
Zhenlei Huang 2024-09-22 10:07:39 +08:00
parent b90ba458dc
commit fa7045f99c

View File

@ -532,7 +532,7 @@ rxd_info_zero(if_rxd_info_t ri)
* Only allow a single packet to take up most 1/nth of the tx ring
*/
#define MAX_SINGLE_PACKET_FRACTION 12
#define IF_BAD_DMA (bus_addr_t)-1
#define IF_BAD_DMA ((bus_addr_t)-1)
#define CTX_ACTIVE(ctx) ((if_getdrvflags((ctx)->ifc_ifp) & IFF_DRV_RUNNING))
@ -745,7 +745,7 @@ iflib_num_rx_descs(if_ctx_t ctx)
if_shared_ctx_t sctx = ctx->ifc_sctx;
uint16_t first_rxq = (sctx->isc_flags & IFLIB_HAS_RXCQ) ? 1 : 0;
return scctx->isc_nrxd[first_rxq];
return (scctx->isc_nrxd[first_rxq]);
}
static int
@ -755,7 +755,7 @@ iflib_num_tx_descs(if_ctx_t ctx)
if_shared_ctx_t sctx = ctx->ifc_sctx;
uint16_t first_txq = (sctx->isc_flags & IFLIB_HAS_TXCQ) ? 1 : 0;
return scctx->isc_ntxd[first_txq];
return (scctx->isc_ntxd[first_txq]);
}
#ifdef DEV_NETMAP
@ -851,7 +851,7 @@ iflib_netmap_config(struct netmap_adapter *na, struct nm_config_info *info)
info->num_tx_rings, info->num_rx_rings, info->num_tx_descs,
info->num_rx_descs, info->rx_buf_maxsize);
return 0;
return (0);
}
static int
@ -925,7 +925,7 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init)
MPASS(i < IFLIB_MAX_RX_REFRESH);
if (addr == NETMAP_BUF_BASE(na)) /* bad buf */
return netmap_ring_reinit(kring);
return (netmap_ring_reinit(kring));
fl->ifl_bus_addrs[i] = paddr +
nm_get_offset(kring, slot);
@ -2304,7 +2304,7 @@ iflib_fl_setup(iflib_fl_t fl)
bit_nclear(fl->ifl_rx_bitmap, 0, fl->ifl_size - 1);
/*
** Free current RX buffer structs and their mbufs
* Free current RX buffer structs and their mbufs
*/
iflib_fl_bufs_free(fl);
/* Now replenish the mbufs */
@ -2922,7 +2922,7 @@ iflib_check_lro_possible(struct mbuf *m, bool v4_forwarding, bool v6_forwarding)
#endif
}
return false;
return (false);
}
#else
static void
@ -3569,7 +3569,7 @@ iflib_ether_pad(device_t dev, struct mbuf **m_head, uint16_t min_frame_size)
device_printf(dev, "cannot pad short frame, m_dup() failed");
DBG_COUNTER_INC(encap_pad_mbuf_fail);
DBG_COUNTER_INC(tx_frees);
return ENOMEM;
return (ENOMEM);
}
m_freem(*m_head);
*m_head = new_head;
@ -3588,7 +3588,7 @@ iflib_ether_pad(device_t dev, struct mbuf **m_head, uint16_t min_frame_size)
return (ENOBUFS);
}
return 0;
return (0);
}
static int
@ -3650,7 +3650,7 @@ iflib_encap(iflib_txq_t txq, struct mbuf **m_headp)
err = iflib_ether_pad(ctx->ifc_dev, m_headp, scctx->isc_min_frame_size);
if (err) {
DBG_COUNTER_INC(encap_txd_encap_fail);
return err;
return (err);
}
}
m_head = *m_headp;
@ -4482,8 +4482,8 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data)
avoid_reset = true;
#endif
/*
** Calling init results in link renegotiation,
** so we avoid doing it when possible.
* Calling init results in link renegotiation,
* so we avoid doing it when possible.
*/
if (avoid_reset) {
if_setflagbits(ifp, IFF_UP, 0);
@ -4913,15 +4913,15 @@ find_child_with_core(int cpu, struct cpu_group *grp)
int i;
if (grp->cg_children == 0)
return -1;
return (-1);
MPASS(grp->cg_child);
for (i = 0; i < grp->cg_children; i++) {
if (CPU_ISSET(cpu, &grp->cg_child[i].cg_mask))
return i;
return (i);
}
return -1;
return (-1);
}
@ -4938,7 +4938,7 @@ find_l2_neighbor(int cpu)
grp = cpu_top;
if (grp == NULL)
return -1;
return (-1);
/*
* Find the smallest CPU group that contains the given core.
@ -4957,7 +4957,7 @@ find_l2_neighbor(int cpu)
/* Must share L2. */
if (grp->cg_level > CG_SHARE_L2 || grp->cg_level == CG_SHARE_NONE)
return -1;
return (-1);
/*
* Select the first member of the set that isn't the reference
@ -5302,8 +5302,8 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct
MPASS(CPU_COUNT(&ctx->ifc_cpus) > 0);
/*
** Now set up MSI or MSI-X, should return us the number of supported
** vectors (will be 1 for a legacy interrupt and MSI).
* Now set up MSI or MSI-X, should return us the number of supported
* vectors (will be 1 for a legacy interrupt and MSI).
*/
if (sctx->isc_flags & IFLIB_SKIP_MSIX) {
msix = scctx->isc_vectors;
@ -5583,7 +5583,7 @@ iflib_device_suspend(device_t dev)
IFDI_SUSPEND(ctx);
CTX_UNLOCK(ctx);
return bus_generic_suspend(dev);
return (bus_generic_suspend(dev));
}
int
iflib_device_shutdown(device_t dev)
@ -5594,7 +5594,7 @@ iflib_device_shutdown(device_t dev)
IFDI_SHUTDOWN(ctx);
CTX_UNLOCK(ctx);
return bus_generic_suspend(dev);
return (bus_generic_suspend(dev));
}
int
@ -6826,7 +6826,7 @@ mp_ndesc_handler(SYSCTL_HANDLER_ARGS)
rc = sysctl_handle_string(oidp, buf, sizeof(buf), req);
if (rc || req->newptr == NULL)
return rc;
return (rc);
for (i = 0, next = buf, p = strsep(&next, " ,"); i < 8 && p;
i++, p = strsep(&next, " ,")) {