Lines Matching defs:cb
69 static void cbuf_add(struct cbuf *cb, int n)
71 cb->len += n;
74 static int cbuf_data(struct cbuf *cb)
76 return ((cb->base + cb->len) & cb->mask);
79 static void cbuf_init(struct cbuf *cb, int size)
81 cb->base = cb->len = 0;
82 cb->mask = size-1;
85 static void cbuf_eat(struct cbuf *cb, int n)
87 cb->len -= n;
88 cb->base += n;
89 cb->base &= cb->mask;
92 static bool cbuf_empty(struct cbuf *cb)
94 return cb->len == 0;
112 struct cbuf cb;
553 cbuf_init(&con->cb, PAGE_CACHE_SIZE);
563 * point (cb.base + cb.len) and the end of the buffer.
565 iov[0].iov_len = con->cb.base - cbuf_data(&con->cb);
566 iov[0].iov_base = page_address(con->rx_page) + cbuf_data(&con->cb);
572 * buffer and the start of the currently used section (cb.base)
574 if (cbuf_data(&con->cb) >= con->cb.base) {
575 iov[0].iov_len = PAGE_CACHE_SIZE - cbuf_data(&con->cb);
576 iov[1].iov_len = con->cb.base;
593 page_address(con->rx_page) + con->cb.base);
601 cbuf_add(&con->cb, ret);
604 con->cb.base, con->cb.len,
609 page_address(con->rx_page), con->cb.base, con->cb.len,
614 cbuf_eat(&con->cb, ret);
616 if (cbuf_empty(&con->cb) && !call_again_soon) {