Lines Matching refs:zc

1222 	bool zc = false;  in tcp_sendmsg_locked()  local
1233 zc = sk->sk_route_caps & NETIF_F_SG; in tcp_sendmsg_locked()
1240 zc = sk->sk_route_caps & NETIF_F_SG; in tcp_sendmsg_locked()
1241 if (!zc) in tcp_sendmsg_locked()
1347 if (!zc) { in tcp_sendmsg_locked()
1949 struct tcp_zerocopy_receive *zc, in tcp_zerocopy_set_hint_for_skb() argument
1957 zc->recv_skip_hint = skb->len - offset; in tcp_zerocopy_set_hint_for_skb()
1973 zc->recv_skip_hint -= partial_frag_remainder; in tcp_zerocopy_set_hint_for_skb()
1981 mappable_offset = find_next_mappable_frag(frag, zc->recv_skip_hint); in tcp_zerocopy_set_hint_for_skb()
1982 zc->recv_skip_hint = mappable_offset + partial_frag_remainder; in tcp_zerocopy_set_hint_for_skb()
1989 struct tcp_zerocopy_receive *zc, int inq, in receive_fallback_to_copy() argument
1992 unsigned long copy_address = (unsigned long)zc->copybuf_address; in receive_fallback_to_copy()
1997 zc->length = 0; in receive_fallback_to_copy()
1998 zc->recv_skip_hint = 0; in receive_fallback_to_copy()
2000 if (copy_address != zc->copybuf_address) in receive_fallback_to_copy()
2009 tss, &zc->msg_flags); in receive_fallback_to_copy()
2013 zc->copybuf_len = err; in receive_fallback_to_copy()
2014 if (likely(zc->copybuf_len)) { in receive_fallback_to_copy()
2020 tcp_zerocopy_set_hint_for_skb(sk, zc, skb, offset); in receive_fallback_to_copy()
2025 static int tcp_copy_straggler_data(struct tcp_zerocopy_receive *zc, in tcp_copy_straggler_data() argument
2029 unsigned long copy_address = (unsigned long)zc->copybuf_address; in tcp_copy_straggler_data()
2034 if (copy_address != zc->copybuf_address) in tcp_copy_straggler_data()
2044 zc->recv_skip_hint -= copylen; in tcp_copy_straggler_data()
2050 static int tcp_zc_handle_leftover(struct tcp_zerocopy_receive *zc, in tcp_zc_handle_leftover() argument
2057 u32 offset, copylen = min_t(u32, copybuf_len, zc->recv_skip_hint); in tcp_zc_handle_leftover()
2068 zc->msg_flags |= TCP_CMSG_TS; in tcp_zc_handle_leftover()
2072 zc->copybuf_len = tcp_copy_straggler_data(zc, skb, copylen, &offset, in tcp_zc_handle_leftover()
2074 return zc->copybuf_len < 0 ? 0 : copylen; in tcp_zc_handle_leftover()
2083 struct tcp_zerocopy_receive *zc, in tcp_zerocopy_vm_insert_batch_error() argument
2089 zc->flags & TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT) { in tcp_zerocopy_vm_insert_batch_error()
2120 zc->recv_skip_hint += bytes_not_mapped; in tcp_zerocopy_vm_insert_batch_error()
2131 struct tcp_zerocopy_receive *zc, in tcp_zerocopy_vm_insert_batch() argument
2153 pages_remaining, address, length, seq, zc, total_bytes_to_map, in tcp_zerocopy_vm_insert_batch()
2159 struct tcp_zerocopy_receive *zc, in tcp_zc_finalize_rx_tstamp() argument
2165 msg_control_addr = (unsigned long)zc->msg_control; in tcp_zc_finalize_rx_tstamp()
2168 (__kernel_size_t)zc->msg_controllen; in tcp_zc_finalize_rx_tstamp()
2172 zc->msg_flags = 0; in tcp_zc_finalize_rx_tstamp()
2173 if (zc->msg_control == msg_control_addr && in tcp_zc_finalize_rx_tstamp()
2174 zc->msg_controllen == cmsg_dummy.msg_controllen) { in tcp_zc_finalize_rx_tstamp()
2176 zc->msg_control = (__u64) in tcp_zc_finalize_rx_tstamp()
2178 zc->msg_controllen = in tcp_zc_finalize_rx_tstamp()
2180 zc->msg_flags = (__u32)cmsg_dummy.msg_flags; in tcp_zc_finalize_rx_tstamp()
2186 struct tcp_zerocopy_receive *zc, in tcp_zerocopy_receive() argument
2190 unsigned long address = (unsigned long)zc->address; in tcp_zerocopy_receive()
2192 s32 copybuf_len = zc->copybuf_len; in tcp_zerocopy_receive()
2203 zc->copybuf_len = 0; in tcp_zerocopy_receive()
2204 zc->msg_flags = 0; in tcp_zerocopy_receive()
2206 if (address & (PAGE_SIZE - 1) || address != zc->address) in tcp_zerocopy_receive()
2215 return receive_fallback_to_copy(sk, zc, inq, tss); in tcp_zerocopy_receive()
2218 zc->length = 0; in tcp_zerocopy_receive()
2219 zc->recv_skip_hint = inq; in tcp_zerocopy_receive()
2232 vma_len = min_t(unsigned long, zc->length, vma->vm_end - address); in tcp_zerocopy_receive()
2236 if (!(zc->flags & TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT)) in tcp_zerocopy_receive()
2238 zc->length = total_bytes_to_map; in tcp_zerocopy_receive()
2239 zc->recv_skip_hint = 0; in tcp_zerocopy_receive()
2241 zc->length = avail_len; in tcp_zerocopy_receive()
2242 zc->recv_skip_hint = avail_len; in tcp_zerocopy_receive()
2245 while (length + PAGE_SIZE <= zc->length) { in tcp_zerocopy_receive()
2249 if (zc->recv_skip_hint < PAGE_SIZE) { in tcp_zerocopy_receive()
2253 if (zc->recv_skip_hint > 0) in tcp_zerocopy_receive()
2263 zc->msg_flags |= TCP_CMSG_TS; in tcp_zerocopy_receive()
2265 zc->recv_skip_hint = skb->len - offset; in tcp_zerocopy_receive()
2272 zc->recv_skip_hint); in tcp_zerocopy_receive()
2274 zc->recv_skip_hint = mappable_offset; in tcp_zerocopy_receive()
2281 zc->recv_skip_hint -= PAGE_SIZE; in tcp_zerocopy_receive()
2284 zc->recv_skip_hint < PAGE_SIZE) { in tcp_zerocopy_receive()
2291 &seq, zc, in tcp_zerocopy_receive()
2301 zc, total_bytes_to_map); in tcp_zerocopy_receive()
2307 copylen = tcp_zc_handle_leftover(zc, sk, skb, &seq, copybuf_len, tss); in tcp_zerocopy_receive()
2317 if (length == zc->length) in tcp_zerocopy_receive()
2318 zc->recv_skip_hint = 0; in tcp_zerocopy_receive()
2320 if (!zc->recv_skip_hint && sock_flag(sk, SOCK_DONE)) in tcp_zerocopy_receive()
2323 zc->length = length; in tcp_zerocopy_receive()
4309 struct tcp_zerocopy_receive zc = {}; in do_tcp_getsockopt() local
4317 if (unlikely(len > sizeof(zc))) { in do_tcp_getsockopt()
4318 err = check_zeroed_sockptr(optval, sizeof(zc), in do_tcp_getsockopt()
4319 len - sizeof(zc)); in do_tcp_getsockopt()
4322 len = sizeof(zc); in do_tcp_getsockopt()
4326 if (copy_from_sockptr(&zc, optval, len)) in do_tcp_getsockopt()
4328 if (zc.reserved) in do_tcp_getsockopt()
4330 if (zc.msg_flags & ~(TCP_VALID_ZC_MSG_FLAGS)) in do_tcp_getsockopt()
4333 err = tcp_zerocopy_receive(sk, &zc, &tss); in do_tcp_getsockopt()
4335 &zc, &len, err); in do_tcp_getsockopt()
4356 if (zc.msg_flags & TCP_CMSG_TS) in do_tcp_getsockopt()
4357 tcp_zc_finalize_rx_tstamp(sk, &zc, &tss); in do_tcp_getsockopt()
4359 zc.msg_flags = 0; in do_tcp_getsockopt()
4362 zc.err = sock_error(sk); in do_tcp_getsockopt()
4364 zc.inq = tcp_inq_hint(sk); in do_tcp_getsockopt()
4366 if (!err && copy_to_sockptr(optval, &zc, len)) in do_tcp_getsockopt()