Lines Matching full:dr
49 static inline u32 vnet_tx_dring_avail(struct vio_dring_state *dr) in vnet_tx_dring_avail() argument
51 return vio_dring_avail(dr, VNET_TX_RING_SIZE); in vnet_tx_dring_avail()
263 struct vio_dring_state *dr; in sunvnet_handshake_complete_common() local
265 dr = &vio->drings[VIO_DRIVER_RX_RING]; in sunvnet_handshake_complete_common()
266 dr->rcv_nxt = 1; in sunvnet_handshake_complete_common()
267 dr->snd_nxt = 1; in sunvnet_handshake_complete_common()
269 dr = &vio->drings[VIO_DRIVER_TX_RING]; in sunvnet_handshake_complete_common()
270 dr->rcv_nxt = 1; in sunvnet_handshake_complete_common()
271 dr->snd_nxt = 1; in sunvnet_handshake_complete_common()
470 static int vnet_send_ack(struct vnet_port *port, struct vio_dring_state *dr, in vnet_send_ack() argument
480 .dring_ident = dr->ident, in vnet_send_ack()
488 hdr.seq = dr->snd_nxt; in vnet_send_ack()
493 dr->snd_nxt++; in vnet_send_ack()
520 struct vio_dring_state *dr, in get_rx_desc() argument
526 err = ldc_get_dring_entry(port->vio.lp, desc, dr->entry_size, in get_rx_desc()
527 (index * dr->entry_size), in get_rx_desc()
528 dr->cookies, dr->ncookies); in get_rx_desc()
536 struct vio_dring_state *dr, in put_rx_desc() argument
542 err = ldc_put_dring_entry(port->vio.lp, desc, dr->entry_size, in put_rx_desc()
543 (index * dr->entry_size), in put_rx_desc()
544 dr->cookies, dr->ncookies); in put_rx_desc()
552 struct vio_dring_state *dr, in vnet_walk_rx_one() argument
555 struct vio_net_desc *desc = get_rx_desc(port, dr, index); in vnet_walk_rx_one()
580 err = put_rx_desc(port, dr, desc, index); in vnet_walk_rx_one()
587 static int vnet_walk_rx(struct vnet_port *port, struct vio_dring_state *dr, in vnet_walk_rx() argument
594 end = (end == (u32)-1) ? vio_dring_prev(dr, start) in vnet_walk_rx()
595 : vio_dring_next(dr, end); in vnet_walk_rx()
600 int ack = 0, err = vnet_walk_rx_one(port, dr, start, &ack); in vnet_walk_rx()
610 start = vio_dring_next(dr, start); in vnet_walk_rx()
612 err = vnet_send_ack(port, dr, ack_start, ack_end, in vnet_walk_rx()
624 ack_end = vio_dring_prev(dr, start); in vnet_walk_rx()
632 return vnet_send_ack(port, dr, ack_start, ack_end, in vnet_walk_rx()
648 struct vio_dring_state *dr = &port->vio.drings[VIO_DRIVER_RX_RING]; in vnet_rx() local
652 pkt->tag.stype_env, pkt->seq, dr->rcv_nxt); in vnet_rx()
656 if (unlikely(pkt->seq != dr->rcv_nxt)) { in vnet_rx()
658 pkt->seq, dr->rcv_nxt); in vnet_rx()
663 dr->rcv_nxt++; in vnet_rx()
667 return vnet_walk_rx(port, dr, pkt->start_idx, pkt->end_idx, in vnet_rx()
671 static int idx_is_pending(struct vio_dring_state *dr, u32 end) in idx_is_pending() argument
673 u32 idx = dr->cons; in idx_is_pending()
676 while (idx != dr->prod) { in idx_is_pending()
681 idx = vio_dring_next(dr, idx); in idx_is_pending()
688 struct vio_dring_state *dr = &port->vio.drings[VIO_DRIVER_TX_RING]; in vnet_ack() local
701 if (unlikely(!idx_is_pending(dr, end))) { in vnet_ack()
711 dr->cons = vio_dring_next(dr, end); in vnet_ack()
712 desc = vio_dring_entry(dr, dr->cons); in vnet_ack()
718 if (__vnet_tx_trigger(port, dr->cons) > 0) in vnet_ack()
729 vnet_tx_dring_avail(dr) >= VNET_TX_WAKEUP_THRESH(dr))) in vnet_ack()
845 struct vio_dring_state *dr = in vnet_event_napi() local
851 pkt->seq = dr->rcv_nxt; in vnet_event_napi()
852 pkt->start_idx = vio_dring_next(dr, in vnet_event_napi()
942 struct vio_dring_state *dr = &port->vio.drings[VIO_DRIVER_TX_RING]; in __vnet_tx_trigger() local
950 .dring_ident = dr->ident, in __vnet_tx_trigger()
969 hdr.seq = dr->snd_nxt; in __vnet_tx_trigger()
974 dr->snd_nxt++; in __vnet_tx_trigger()
992 struct vio_dring_state *dr = &port->vio.drings[VIO_DRIVER_TX_RING]; in vnet_clean_tx_ring() local
998 txi = dr->prod; in vnet_clean_tx_ring()
1006 d = vio_dring_entry(dr, txi); in vnet_clean_tx_ring()
1226 struct vio_dring_state *dr = &port->vio.drings[VIO_DRIVER_TX_RING]; in vnet_handle_offloads() local
1257 if (unlikely(vnet_tx_dring_avail(dr) < gso_segs)) { in vnet_handle_offloads()
1262 if (vnet_tx_dring_avail(dr) < skb_shinfo(skb)->gso_segs) in vnet_handle_offloads()
1329 struct vio_dring_state *dr; in sunvnet_start_xmit_common() local
1378 dr = &port->vio.drings[VIO_DRIVER_TX_RING]; in sunvnet_start_xmit_common()
1381 if (unlikely(vnet_tx_dring_avail(dr) < 1)) { in sunvnet_start_xmit_common()
1393 d = vio_dring_cur(dr); in sunvnet_start_xmit_common()
1395 txi = dr->prod; in sunvnet_start_xmit_common()
1452 /* Exactly one ldc "start" trigger (for dr->cons) needs to be sent in sunvnet_start_xmit_common()
1455 * a DRING_STOPPED is received from the consumer. The dr->cons field in sunvnet_start_xmit_common()
1474 port->vio._peer_sid, dr->cons); in sunvnet_start_xmit_common()
1478 err = __vnet_tx_trigger(port, dr->cons); in sunvnet_start_xmit_common()
1496 dr->prod = (dr->prod + 1) & (VNET_TX_RING_SIZE - 1); in sunvnet_start_xmit_common()
1497 if (unlikely(vnet_tx_dring_avail(dr) < 1)) { in sunvnet_start_xmit_common()
1500 if (vnet_tx_dring_avail(dr) > VNET_TX_WAKEUP_THRESH(dr)) in sunvnet_start_xmit_common()
1673 struct vio_dring_state *dr; in sunvnet_port_free_tx_bufs_common() local
1676 dr = &port->vio.drings[VIO_DRIVER_TX_RING]; in sunvnet_port_free_tx_bufs_common()
1678 if (!dr->base) in sunvnet_port_free_tx_bufs_common()
1688 d = vio_dring_entry(dr, i); in sunvnet_port_free_tx_bufs_common()
1697 ldc_free_exp_dring(port->vio.lp, dr->base, in sunvnet_port_free_tx_bufs_common()
1698 (dr->entry_size * dr->num_entries), in sunvnet_port_free_tx_bufs_common()
1699 dr->cookies, dr->ncookies); in sunvnet_port_free_tx_bufs_common()
1700 dr->base = NULL; in sunvnet_port_free_tx_bufs_common()
1701 dr->entry_size = 0; in sunvnet_port_free_tx_bufs_common()
1702 dr->num_entries = 0; in sunvnet_port_free_tx_bufs_common()
1703 dr->pending = 0; in sunvnet_port_free_tx_bufs_common()
1704 dr->ncookies = 0; in sunvnet_port_free_tx_bufs_common()
1720 struct vio_dring_state *dr; in vnet_port_alloc_tx_ring() local
1725 dr = &port->vio.drings[VIO_DRIVER_TX_RING]; in vnet_port_alloc_tx_ring()
1735 dr->cookies, &ncookies, in vnet_port_alloc_tx_ring()
1744 dr->base = dring; in vnet_port_alloc_tx_ring()
1745 dr->entry_size = elen; in vnet_port_alloc_tx_ring()
1746 dr->num_entries = VNET_TX_RING_SIZE; in vnet_port_alloc_tx_ring()
1747 dr->prod = 0; in vnet_port_alloc_tx_ring()
1748 dr->cons = 0; in vnet_port_alloc_tx_ring()
1750 dr->pending = VNET_TX_RING_SIZE; in vnet_port_alloc_tx_ring()
1751 dr->ncookies = ncookies; in vnet_port_alloc_tx_ring()
1756 d = vio_dring_entry(dr, i); in vnet_port_alloc_tx_ring()