Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mlx4/mlx4_en/mlx4_en_rx.c
Show First 20 Lines • Show All 334 Lines • ▼ Show 20 Lines | num_rx_rings = mlx4_low_memory_profile() ? MIN_RX_RINGS : | ||||
num_of_eqs; | num_of_eqs; | ||||
mdev->profile.prof[i].rx_ring_num = | mdev->profile.prof[i].rx_ring_num = | ||||
rounddown_pow_of_two(num_rx_rings); | rounddown_pow_of_two(num_rx_rings); | ||||
} | } | ||||
} | } | ||||
void mlx4_en_calc_rx_buf(struct ifnet *dev) | void mlx4_en_calc_rx_buf(struct ifnet *dev) | ||||
{ | { | ||||
struct mlx4_en_priv *priv = netdev_priv(dev); | struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); | ||||
int eff_mtu = dev->if_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN + | int eff_mtu = dev->if_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN + | ||||
MLX4_NET_IP_ALIGN; | MLX4_NET_IP_ALIGN; | ||||
if (eff_mtu > MJUM16BYTES) { | if (eff_mtu > MJUM16BYTES) { | ||||
en_err(priv, "MTU(%u) is too big\n", (unsigned)dev->if_mtu); | en_err(priv, "MTU(%u) is too big\n", (unsigned)dev->if_mtu); | ||||
eff_mtu = MJUM16BYTES; | eff_mtu = MJUM16BYTES; | ||||
} else if (eff_mtu > MJUM9BYTES) { | } else if (eff_mtu > MJUM9BYTES) { | ||||
eff_mtu = MJUM16BYTES; | eff_mtu = MJUM16BYTES; | ||||
▲ Show 20 Lines • Show All 380 Lines • ▼ Show 20 Lines | |||||
/* For cpu arch with cache line of 64B the performance is better when cqe size==64B | /* For cpu arch with cache line of 64B the performance is better when cqe size==64B | ||||
* To enlarge cqe size from 32B to 64B --> 32B of garbage (i.e. 0xccccccc) | * To enlarge cqe size from 32B to 64B --> 32B of garbage (i.e. 0xccccccc) | ||||
* was added in the beginning of each cqe (the real data is in the corresponding 32B). | * was added in the beginning of each cqe (the real data is in the corresponding 32B). | ||||
* The following calc ensures that when factor==1, it means we are aligned to 64B | * The following calc ensures that when factor==1, it means we are aligned to 64B | ||||
* and we get the real cqe data*/ | * and we get the real cqe data*/ | ||||
#define CQE_FACTOR_INDEX(index, factor) (((index) << (factor)) + (factor)) | #define CQE_FACTOR_INDEX(index, factor) (((index) << (factor)) + (factor)) | ||||
int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget) | int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget) | ||||
{ | { | ||||
struct mlx4_en_priv *priv = netdev_priv(dev); | struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); | ||||
struct mlx4_cqe *cqe; | struct mlx4_cqe *cqe; | ||||
struct mlx4_en_rx_ring *ring = priv->rx_ring[cq->ring]; | struct mlx4_en_rx_ring *ring = priv->rx_ring[cq->ring]; | ||||
struct mlx4_en_rx_mbuf *mb_list; | struct mlx4_en_rx_mbuf *mb_list; | ||||
struct mlx4_en_rx_desc *rx_desc; | struct mlx4_en_rx_desc *rx_desc; | ||||
struct mbuf *mb; | struct mbuf *mb; | ||||
struct mlx4_cq *mcq = &cq->mcq; | struct mlx4_cq *mcq = &cq->mcq; | ||||
struct mlx4_cqe *buf = cq->buf; | struct mlx4_cqe *buf = cq->buf; | ||||
int index; | int index; | ||||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | static int mlx4_en_poll_rx_cq(struct mlx4_en_cq *cq, int budget) | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
cq->tot_rx += done; | cq->tot_rx += done; | ||||
return done; | return done; | ||||
} | } | ||||
void mlx4_en_rx_irq(struct mlx4_cq *mcq) | void mlx4_en_rx_irq(struct mlx4_cq *mcq) | ||||
{ | { | ||||
struct mlx4_en_cq *cq = container_of(mcq, struct mlx4_en_cq, mcq); | struct mlx4_en_cq *cq = container_of(mcq, struct mlx4_en_cq, mcq); | ||||
struct mlx4_en_priv *priv = netdev_priv(cq->dev); | struct mlx4_en_priv *priv = mlx4_netdev_priv(cq->dev); | ||||
int done; | int done; | ||||
// Shoot one within the irq context | // Shoot one within the irq context | ||||
// Because there is no NAPI in freeBSD | // Because there is no NAPI in freeBSD | ||||
done = mlx4_en_poll_rx_cq(cq, MLX4_EN_RX_BUDGET); | done = mlx4_en_poll_rx_cq(cq, MLX4_EN_RX_BUDGET); | ||||
if (priv->port_up && (done == MLX4_EN_RX_BUDGET) ) { | if (priv->port_up && (done == MLX4_EN_RX_BUDGET) ) { | ||||
cq->curr_poll_rx_cpu_id = curcpu; | cq->curr_poll_rx_cpu_id = curcpu; | ||||
taskqueue_enqueue(cq->tq, &cq->cq_task); | taskqueue_enqueue(cq->tq, &cq->cq_task); | ||||
▲ Show 20 Lines • Show All 243 Lines • Show Last 20 Lines |