Lines Matching refs:cb
75 static void cbuf_add(struct cbuf *cb, int n) in cbuf_add() argument
77 cb->len += n; in cbuf_add()
80 static int cbuf_data(struct cbuf *cb) in cbuf_data() argument
82 return ((cb->base + cb->len) & cb->mask); in cbuf_data()
85 static void cbuf_init(struct cbuf *cb, int size) in cbuf_init() argument
87 cb->base = cb->len = 0; in cbuf_init()
88 cb->mask = size-1; in cbuf_init()
91 static void cbuf_eat(struct cbuf *cb, int n) in cbuf_eat() argument
93 cb->len -= n; in cbuf_eat()
94 cb->base += n; in cbuf_eat()
95 cb->base &= cb->mask; in cbuf_eat()
98 static bool cbuf_empty(struct cbuf *cb) in cbuf_empty() argument
100 return cb->len == 0; in cbuf_empty()
120 struct cbuf cb; member
598 cbuf_init(&con->cb, PAGE_CACHE_SIZE); in receive_from_sock()
605 iov[0].iov_len = con->cb.base - cbuf_data(&con->cb); in receive_from_sock()
606 iov[0].iov_base = page_address(con->rx_page) + cbuf_data(&con->cb); in receive_from_sock()
614 if (cbuf_data(&con->cb) >= con->cb.base) { in receive_from_sock()
615 iov[0].iov_len = PAGE_CACHE_SIZE - cbuf_data(&con->cb); in receive_from_sock()
616 iov[1].iov_len = con->cb.base; in receive_from_sock()
629 cbuf_add(&con->cb, ret); in receive_from_sock()
632 con->cb.base, con->cb.len, in receive_from_sock()
636 page_address(con->rx_page), con->cb.base, in receive_from_sock()
637 con->cb.len, r); in receive_from_sock()
641 cbuf_eat(&con->cb, ret); in receive_from_sock()
643 if (cbuf_empty(&con->cb) && !call_again_soon) { in receive_from_sock()