Lines Matching defs:rx

191 	struct bnxt_dmamem	*rx_ring_mem;	/* rx and ag */
667 struct bnxt_rx_queue *rx = &bq->q_rx;
673 rx->rx_softc = sc;
674 rx->rx_ifiq = ifiq;
675 timeout_set(&rx->rx_refill, bnxt_refill, bq);
676 ifiq->ifiq_softc = rx;
763 * are based on the minimum rx ring size of 32.
784 struct bnxt_rx_queue *rx = &bq->q_rx;
796 rx->rx_ring_mem = bnxt_dmamem_alloc(sc, PAGE_SIZE * 2);
797 if (rx->rx_ring_mem == NULL) {
798 printf("%s: failed to allocate rx ring %d\n", DEVNAME(sc), bq->q_index);
853 rx->rx_ring.phys_id = (uint16_t)HWRM_NA_SIGNATURE;
854 rx->rx_ring.id = BNXT_RX_RING_ID_BASE + bq->q_index;
855 rx->rx_ring.doorbell = rx->rx_ring.id * 0x80;
856 rx->rx_ring.ring_size = PAGE_SIZE / sizeof(struct rx_prod_pkt_bd);
857 rx->rx_ring.vaddr = BNXT_DMA_KVA(rx->rx_ring_mem);
858 rx->rx_ring.paddr = BNXT_DMA_DVA(rx->rx_ring_mem);
860 &rx->rx_ring, cp->ring.phys_id, HWRM_NA_SIGNATURE, 1) != 0) {
861 printf("%s: failed to set up rx ring\n",
865 bnxt_write_rx_doorbell(sc, &rx->rx_ring, 0);
867 rx->rx_ag_ring.phys_id = (uint16_t)HWRM_NA_SIGNATURE;
868 rx->rx_ag_ring.id = BNXT_AG_RING_ID_BASE + bq->q_index;
869 rx->rx_ag_ring.doorbell = rx->rx_ag_ring.id * 0x80;
870 rx->rx_ag_ring.ring_size = PAGE_SIZE / sizeof(struct rx_prod_pkt_bd);
871 rx->rx_ag_ring.vaddr = BNXT_DMA_KVA(rx->rx_ring_mem) + PAGE_SIZE;
872 rx->rx_ag_ring.paddr = BNXT_DMA_DVA(rx->rx_ring_mem) + PAGE_SIZE;
874 &rx->rx_ag_ring, cp->ring.phys_id, HWRM_NA_SIGNATURE, 1) != 0) {
875 printf("%s: failed to set up rx ag ring\n",
879 bnxt_write_rx_doorbell(sc, &rx->rx_ag_ring, 0);
883 rg->rx_ring_id = rx->rx_ring.phys_id;
884 rg->ag_ring_id = rx->rx_ag_ring.phys_id;
892 rx->rx_slots = mallocarray(sizeof(*bs), rx->rx_ring.ring_size,
894 if (rx->rx_slots == NULL) {
895 printf("%s: failed to allocate rx slots\n", DEVNAME(sc));
899 for (i = 0; i < rx->rx_ring.ring_size; i++) {
900 bs = &rx->rx_slots[i];
903 printf("%s: failed to allocate rx dma maps\n",
909 rx->rx_ag_slots = mallocarray(sizeof(*bs), rx->rx_ag_ring.ring_size,
911 if (rx->rx_ag_slots == NULL) {
912 printf("%s: failed to allocate rx ag slots\n", DEVNAME(sc));
916 for (i = 0; i < rx->rx_ag_ring.ring_size; i++) {
917 bs = &rx->rx_ag_slots[i];
921 printf("%s: failed to allocate rx ag dma maps\n",
946 * initially, the rx ring must be filled at least some distance beyond
952 if_rxr_init(&rx->rxr[0], 32, rx->rx_ring.ring_size - 1);
953 if_rxr_init(&rx->rxr[1], 32, rx->rx_ag_ring.ring_size - 1);
954 rx->rx_prod = 0;
955 rx->rx_cons = 0;
956 rx->rx_ag_prod = 0;
957 rx->rx_ag_cons = 0;
973 i = rx->rx_ag_ring.ring_size;
975 bnxt_free_slots(sc, rx->rx_ag_slots, i, rx->rx_ag_ring.ring_size);
976 rx->rx_ag_slots = NULL;
978 i = rx->rx_ring.ring_size;
980 bnxt_free_slots(sc, rx->rx_slots, i, rx->rx_ring.ring_size);
981 rx->rx_slots = NULL;
986 &rx->rx_ag_ring);
992 &rx->rx_ring);
996 bnxt_dmamem_free(sc, rx->rx_ring_mem);
997 rx->rx_ring_mem = NULL;
1008 struct bnxt_rx_queue *rx = &bq->q_rx;
1015 bnxt_free_slots(sc, rx->rx_ag_slots, rx->rx_ag_ring.ring_size,
1016 rx->rx_ag_ring.ring_size);
1017 rx->rx_ag_slots = NULL;
1019 bnxt_free_slots(sc, rx->rx_slots, rx->rx_ring.ring_size,
1020 rx->rx_ring.ring_size);
1021 rx->rx_slots = NULL;
1031 &rx->rx_ag_ring);
1033 &rx->rx_ring);
1044 bnxt_dmamem_free(sc, rx->rx_ring_mem);
1045 rx->rx_ring_mem = NULL;
1066 printf("%s: failed to allocate rx config buffer\n",
1596 struct bnxt_rx_queue *rx = &q->q_rx;
1618 rollback = bnxt_rx(sc, rx, cpr, &ml, &rxfree,
1647 rx->rx_cons += rxfree;
1648 if (rx->rx_cons >= rx->rx_ring.ring_size)
1649 rx->rx_cons -= rx->rx_ring.ring_size;
1651 rx->rx_ag_cons += agfree;
1652 if (rx->rx_ag_cons >= rx->rx_ag_ring.ring_size)
1653 rx->rx_ag_cons -= rx->rx_ag_ring.ring_size;
1655 if_rxr_put(&rx->rxr[0], rxfree);
1656 if_rxr_put(&rx->rxr[1], agfree);
1658 if (ifiq_input(rx->rx_ifiq, &ml)) {
1659 if_rxr_livelocked(&rx->rxr[0]);
1660 if_rxr_livelocked(&rx->rxr[1]);
1665 if ((rx->rx_cons == rx->rx_prod) ||
1666 (rx->rx_ag_cons == rx->rx_ag_prod))
1667 timeout_add(&rx->rx_refill, 0);
2224 struct bnxt_rx_queue *rx = &q->q_rx;
2229 slots = if_rxr_get(&rx->rxr[0], rx->rx_ring.ring_size);
2231 slots = bnxt_rx_fill_slots(sc, &rx->rx_ring,
2232 BNXT_DMA_KVA(rx->rx_ring_mem), rx->rx_slots,
2233 &rx->rx_prod, MCLBYTES,
2235 if_rxr_put(&rx->rxr[0], slots);
2245 struct bnxt_rx_queue *rx = &q->q_rx;
2250 slots = if_rxr_get(&rx->rxr[1], rx->rx_ag_ring.ring_size);
2252 slots = bnxt_rx_fill_slots(sc, &rx->rx_ag_ring,
2253 BNXT_DMA_KVA(rx->rx_ring_mem) + PAGE_SIZE,
2254 rx->rx_ag_slots, &rx->rx_ag_prod,
2257 if_rxr_put(&rx->rxr[1], slots);
2268 struct bnxt_rx_queue *rx = &q->q_rx;
2270 if (rx->rx_cons == rx->rx_prod)
2273 if (rx->rx_ag_cons == rx->rx_ag_prod)
2276 if ((rx->rx_cons == rx->rx_prod) ||
2277 (rx->rx_ag_cons == rx->rx_ag_prod))
2278 timeout_add(&rx->rx_refill, 1);
2282 bnxt_rx(struct bnxt_softc *sc, struct bnxt_rx_queue *rx,
2294 /* second part of the rx completion */
2309 bs = &rx->rx_slots[rxlo->opaque];
2345 bs = &rx->rx_ag_slots[ag->opaque];