18c3e34a4SDavid Howells /* RxRPC packet transmission 28c3e34a4SDavid Howells * 38c3e34a4SDavid Howells * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. 48c3e34a4SDavid Howells * Written by David Howells (dhowells@redhat.com) 58c3e34a4SDavid Howells * 68c3e34a4SDavid Howells * This program is free software; you can redistribute it and/or 78c3e34a4SDavid Howells * modify it under the terms of the GNU General Public License 88c3e34a4SDavid Howells * as published by the Free Software Foundation; either version 98c3e34a4SDavid Howells * 2 of the License, or (at your option) any later version. 108c3e34a4SDavid Howells */ 118c3e34a4SDavid Howells 128c3e34a4SDavid Howells #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 138c3e34a4SDavid Howells 148c3e34a4SDavid Howells #include <linux/net.h> 158c3e34a4SDavid Howells #include <linux/gfp.h> 168c3e34a4SDavid Howells #include <linux/skbuff.h> 178c3e34a4SDavid Howells #include <linux/export.h> 188c3e34a4SDavid Howells #include <net/sock.h> 198c3e34a4SDavid Howells #include <net/af_rxrpc.h> 208c3e34a4SDavid Howells #include "ar-internal.h" 218c3e34a4SDavid Howells 228d94aa38SDavid Howells struct rxrpc_pkt_buffer { 238d94aa38SDavid Howells struct rxrpc_wire_header whdr; 248d94aa38SDavid Howells union { 258d94aa38SDavid Howells struct { 268d94aa38SDavid Howells struct rxrpc_ackpacket ack; 278d94aa38SDavid Howells u8 acks[255]; 288d94aa38SDavid Howells u8 pad[3]; 298d94aa38SDavid Howells }; 308d94aa38SDavid Howells __be32 abort_code; 318d94aa38SDavid Howells }; 328d94aa38SDavid Howells struct rxrpc_ackinfo ackinfo; 338d94aa38SDavid Howells }; 348d94aa38SDavid Howells 358d94aa38SDavid Howells /* 368d94aa38SDavid Howells * Fill out an ACK packet. 378d94aa38SDavid Howells */ 388d94aa38SDavid Howells static size_t rxrpc_fill_out_ack(struct rxrpc_call *call, 398d94aa38SDavid Howells struct rxrpc_pkt_buffer *pkt) 408d94aa38SDavid Howells { 41f3639df2SDavid Howells rxrpc_serial_t serial; 42248f219cSDavid Howells rxrpc_seq_t hard_ack, top, seq; 43248f219cSDavid Howells int ix; 448d94aa38SDavid Howells u32 mtu, jmax; 458d94aa38SDavid Howells u8 *ackp = pkt->acks; 468d94aa38SDavid Howells 47248f219cSDavid Howells /* Barrier against rxrpc_input_data(). */ 48f3639df2SDavid Howells serial = call->ackr_serial; 49248f219cSDavid Howells hard_ack = READ_ONCE(call->rx_hard_ack); 50248f219cSDavid Howells top = smp_load_acquire(&call->rx_top); 51248f219cSDavid Howells 528d94aa38SDavid Howells pkt->ack.bufferSpace = htons(8); 53248f219cSDavid Howells pkt->ack.maxSkew = htons(call->ackr_skew); 54248f219cSDavid Howells pkt->ack.firstPacket = htonl(hard_ack + 1); 558d94aa38SDavid Howells pkt->ack.previousPacket = htonl(call->ackr_prev_seq); 56f3639df2SDavid Howells pkt->ack.serial = htonl(serial); 57248f219cSDavid Howells pkt->ack.reason = call->ackr_reason; 58248f219cSDavid Howells pkt->ack.nAcks = top - hard_ack; 598d94aa38SDavid Howells 608e83134dSDavid Howells if (pkt->ack.reason == RXRPC_ACK_PING) 618e83134dSDavid Howells pkt->whdr.flags |= RXRPC_REQUEST_ACK; 628e83134dSDavid Howells 63248f219cSDavid Howells if (after(top, hard_ack)) { 64248f219cSDavid Howells seq = hard_ack + 1; 65248f219cSDavid Howells do { 66248f219cSDavid Howells ix = seq & RXRPC_RXTX_BUFF_MASK; 67248f219cSDavid Howells if (call->rxtx_buffer[ix]) 68248f219cSDavid Howells *ackp++ = RXRPC_ACK_TYPE_ACK; 69248f219cSDavid Howells else 70248f219cSDavid Howells *ackp++ = RXRPC_ACK_TYPE_NACK; 71248f219cSDavid Howells seq++; 72248f219cSDavid Howells } while (before_eq(seq, top)); 73248f219cSDavid Howells } 74248f219cSDavid Howells 75248f219cSDavid Howells mtu = call->conn->params.peer->if_mtu; 76248f219cSDavid Howells mtu -= call->conn->params.peer->hdrsize; 7775e42126SDavid Howells jmax = (call->nr_jumbo_bad > 3) ? 1 : rxrpc_rx_jumbo_max; 788d94aa38SDavid Howells pkt->ackinfo.rxMTU = htonl(rxrpc_rx_mtu); 798d94aa38SDavid Howells pkt->ackinfo.maxMTU = htonl(mtu); 8075e42126SDavid Howells pkt->ackinfo.rwind = htonl(call->rx_winsize); 818d94aa38SDavid Howells pkt->ackinfo.jumbo_max = htonl(jmax); 828d94aa38SDavid Howells 83f3639df2SDavid Howells trace_rxrpc_tx_ack(call, hard_ack + 1, serial, call->ackr_reason, 84f3639df2SDavid Howells top - hard_ack); 85f3639df2SDavid Howells 868d94aa38SDavid Howells *ackp++ = 0; 878d94aa38SDavid Howells *ackp++ = 0; 888d94aa38SDavid Howells *ackp++ = 0; 89248f219cSDavid Howells return top - hard_ack + 3; 908d94aa38SDavid Howells } 918d94aa38SDavid Howells 928d94aa38SDavid Howells /* 93248f219cSDavid Howells * Send an ACK or ABORT call packet. 948d94aa38SDavid Howells */ 958d94aa38SDavid Howells int rxrpc_send_call_packet(struct rxrpc_call *call, u8 type) 968d94aa38SDavid Howells { 978d94aa38SDavid Howells struct rxrpc_connection *conn = NULL; 988d94aa38SDavid Howells struct rxrpc_pkt_buffer *pkt; 998d94aa38SDavid Howells struct msghdr msg; 1008d94aa38SDavid Howells struct kvec iov[2]; 1018d94aa38SDavid Howells rxrpc_serial_t serial; 1028d94aa38SDavid Howells size_t len, n; 1038e83134dSDavid Howells bool ping = false; 1048d94aa38SDavid Howells int ioc, ret; 1058d94aa38SDavid Howells u32 abort_code; 1068d94aa38SDavid Howells 1078d94aa38SDavid Howells _enter("%u,%s", call->debug_id, rxrpc_pkts[type]); 1088d94aa38SDavid Howells 1098d94aa38SDavid Howells spin_lock_bh(&call->lock); 1108d94aa38SDavid Howells if (call->conn) 1118d94aa38SDavid Howells conn = rxrpc_get_connection_maybe(call->conn); 1128d94aa38SDavid Howells spin_unlock_bh(&call->lock); 1138d94aa38SDavid Howells if (!conn) 1148d94aa38SDavid Howells return -ECONNRESET; 1158d94aa38SDavid Howells 1168d94aa38SDavid Howells pkt = kzalloc(sizeof(*pkt), GFP_KERNEL); 1178d94aa38SDavid Howells if (!pkt) { 1188d94aa38SDavid Howells rxrpc_put_connection(conn); 1198d94aa38SDavid Howells return -ENOMEM; 1208d94aa38SDavid Howells } 1218d94aa38SDavid Howells 1228d94aa38SDavid Howells serial = atomic_inc_return(&conn->serial); 1238d94aa38SDavid Howells 1248d94aa38SDavid Howells msg.msg_name = &call->peer->srx.transport; 1258d94aa38SDavid Howells msg.msg_namelen = call->peer->srx.transport_len; 1268d94aa38SDavid Howells msg.msg_control = NULL; 1278d94aa38SDavid Howells msg.msg_controllen = 0; 1288d94aa38SDavid Howells msg.msg_flags = 0; 1298d94aa38SDavid Howells 1308d94aa38SDavid Howells pkt->whdr.epoch = htonl(conn->proto.epoch); 1318d94aa38SDavid Howells pkt->whdr.cid = htonl(call->cid); 1328d94aa38SDavid Howells pkt->whdr.callNumber = htonl(call->call_id); 1338d94aa38SDavid Howells pkt->whdr.seq = 0; 1348d94aa38SDavid Howells pkt->whdr.serial = htonl(serial); 1358d94aa38SDavid Howells pkt->whdr.type = type; 1368d94aa38SDavid Howells pkt->whdr.flags = conn->out_clientflag; 1378d94aa38SDavid Howells pkt->whdr.userStatus = 0; 1388d94aa38SDavid Howells pkt->whdr.securityIndex = call->security_ix; 1398d94aa38SDavid Howells pkt->whdr._rsvd = 0; 1408d94aa38SDavid Howells pkt->whdr.serviceId = htons(call->service_id); 1418d94aa38SDavid Howells 1428d94aa38SDavid Howells iov[0].iov_base = pkt; 1438d94aa38SDavid Howells iov[0].iov_len = sizeof(pkt->whdr); 1448d94aa38SDavid Howells len = sizeof(pkt->whdr); 1458d94aa38SDavid Howells 1468d94aa38SDavid Howells switch (type) { 1478d94aa38SDavid Howells case RXRPC_PACKET_TYPE_ACK: 1488d94aa38SDavid Howells spin_lock_bh(&call->lock); 14927d0fc43SDavid Howells if (!call->ackr_reason) { 15027d0fc43SDavid Howells spin_unlock_bh(&call->lock); 15127d0fc43SDavid Howells ret = 0; 15227d0fc43SDavid Howells goto out; 15327d0fc43SDavid Howells } 1548e83134dSDavid Howells ping = (call->ackr_reason == RXRPC_ACK_PING); 1558d94aa38SDavid Howells n = rxrpc_fill_out_ack(call, pkt); 1568d94aa38SDavid Howells call->ackr_reason = 0; 1578d94aa38SDavid Howells 1588d94aa38SDavid Howells spin_unlock_bh(&call->lock); 1598d94aa38SDavid Howells 1608d94aa38SDavid Howells _proto("Tx ACK %%%u { m=%hu f=#%u p=#%u s=%%%u r=%s n=%u }", 1618d94aa38SDavid Howells serial, 1628d94aa38SDavid Howells ntohs(pkt->ack.maxSkew), 1638d94aa38SDavid Howells ntohl(pkt->ack.firstPacket), 1648d94aa38SDavid Howells ntohl(pkt->ack.previousPacket), 1658d94aa38SDavid Howells ntohl(pkt->ack.serial), 1668d94aa38SDavid Howells rxrpc_acks(pkt->ack.reason), 1678d94aa38SDavid Howells pkt->ack.nAcks); 1688d94aa38SDavid Howells 1698d94aa38SDavid Howells iov[0].iov_len += sizeof(pkt->ack) + n; 1708d94aa38SDavid Howells iov[1].iov_base = &pkt->ackinfo; 1718d94aa38SDavid Howells iov[1].iov_len = sizeof(pkt->ackinfo); 1728d94aa38SDavid Howells len += sizeof(pkt->ack) + n + sizeof(pkt->ackinfo); 1738d94aa38SDavid Howells ioc = 2; 1748d94aa38SDavid Howells break; 1758d94aa38SDavid Howells 1768d94aa38SDavid Howells case RXRPC_PACKET_TYPE_ABORT: 1778d94aa38SDavid Howells abort_code = call->abort_code; 1788d94aa38SDavid Howells pkt->abort_code = htonl(abort_code); 1798d94aa38SDavid Howells _proto("Tx ABORT %%%u { %d }", serial, abort_code); 1808d94aa38SDavid Howells iov[0].iov_len += sizeof(pkt->abort_code); 1818d94aa38SDavid Howells len += sizeof(pkt->abort_code); 1828d94aa38SDavid Howells ioc = 1; 1838d94aa38SDavid Howells break; 1848d94aa38SDavid Howells 1858d94aa38SDavid Howells default: 1868d94aa38SDavid Howells BUG(); 1878d94aa38SDavid Howells ret = -ENOANO; 1888d94aa38SDavid Howells goto out; 1898d94aa38SDavid Howells } 1908d94aa38SDavid Howells 1918e83134dSDavid Howells if (ping) { 1928e83134dSDavid Howells call->ackr_ping = serial; 1938e83134dSDavid Howells smp_wmb(); 1948e83134dSDavid Howells /* We need to stick a time in before we send the packet in case 1958e83134dSDavid Howells * the reply gets back before kernel_sendmsg() completes - but 1968e83134dSDavid Howells * asking UDP to send the packet can take a relatively long 1978e83134dSDavid Howells * time, so we update the time after, on the assumption that 1988e83134dSDavid Howells * the packet transmission is more likely to happen towards the 1998e83134dSDavid Howells * end of the kernel_sendmsg() call. 2008e83134dSDavid Howells */ 2018e83134dSDavid Howells call->ackr_ping_time = ktime_get_real(); 2028e83134dSDavid Howells set_bit(RXRPC_CALL_PINGING, &call->flags); 2038e83134dSDavid Howells trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_ping, serial); 2048e83134dSDavid Howells } 2058d94aa38SDavid Howells ret = kernel_sendmsg(conn->params.local->socket, 2068d94aa38SDavid Howells &msg, iov, ioc, len); 2078e83134dSDavid Howells if (ping) 2088e83134dSDavid Howells call->ackr_ping_time = ktime_get_real(); 2098d94aa38SDavid Howells 210248f219cSDavid Howells if (ret < 0 && call->state < RXRPC_CALL_COMPLETE) { 2112311e327SDavid Howells switch (type) { 212248f219cSDavid Howells case RXRPC_PACKET_TYPE_ACK: 2138e83134dSDavid Howells clear_bit(RXRPC_CALL_PINGING, &call->flags); 214248f219cSDavid Howells rxrpc_propose_ACK(call, pkt->ack.reason, 215248f219cSDavid Howells ntohs(pkt->ack.maxSkew), 216248f219cSDavid Howells ntohl(pkt->ack.serial), 217248f219cSDavid Howells true, true); 218248f219cSDavid Howells break; 219248f219cSDavid Howells case RXRPC_PACKET_TYPE_ABORT: 220248f219cSDavid Howells break; 221248f219cSDavid Howells } 222248f219cSDavid Howells } 223248f219cSDavid Howells 2248d94aa38SDavid Howells out: 2258d94aa38SDavid Howells rxrpc_put_connection(conn); 2268d94aa38SDavid Howells kfree(pkt); 2278d94aa38SDavid Howells return ret; 2288d94aa38SDavid Howells } 2298d94aa38SDavid Howells 2308c3e34a4SDavid Howells /* 2318c3e34a4SDavid Howells * send a packet through the transport endpoint 2328c3e34a4SDavid Howells */ 2335a924b89SDavid Howells int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb) 2348c3e34a4SDavid Howells { 2355a924b89SDavid Howells struct rxrpc_connection *conn = call->conn; 2365a924b89SDavid Howells struct rxrpc_wire_header whdr; 2375a924b89SDavid Howells struct rxrpc_skb_priv *sp = rxrpc_skb(skb); 2388c3e34a4SDavid Howells struct msghdr msg; 2395a924b89SDavid Howells struct kvec iov[2]; 2405a924b89SDavid Howells rxrpc_serial_t serial; 2415a924b89SDavid Howells size_t len; 2428c3e34a4SDavid Howells int ret, opt; 2438c3e34a4SDavid Howells 2448c3e34a4SDavid Howells _enter(",{%d}", skb->len); 2458c3e34a4SDavid Howells 2465a924b89SDavid Howells /* Each transmission of a Tx packet needs a new serial number */ 2475a924b89SDavid Howells serial = atomic_inc_return(&conn->serial); 2488c3e34a4SDavid Howells 2495a924b89SDavid Howells whdr.epoch = htonl(conn->proto.epoch); 2505a924b89SDavid Howells whdr.cid = htonl(call->cid); 2515a924b89SDavid Howells whdr.callNumber = htonl(call->call_id); 2525a924b89SDavid Howells whdr.seq = htonl(sp->hdr.seq); 2535a924b89SDavid Howells whdr.serial = htonl(serial); 2545a924b89SDavid Howells whdr.type = RXRPC_PACKET_TYPE_DATA; 2555a924b89SDavid Howells whdr.flags = sp->hdr.flags; 2565a924b89SDavid Howells whdr.userStatus = 0; 2575a924b89SDavid Howells whdr.securityIndex = call->security_ix; 2585a924b89SDavid Howells whdr._rsvd = htons(sp->hdr._rsvd); 2595a924b89SDavid Howells whdr.serviceId = htons(call->service_id); 2605a924b89SDavid Howells 2615a924b89SDavid Howells iov[0].iov_base = &whdr; 2625a924b89SDavid Howells iov[0].iov_len = sizeof(whdr); 2635a924b89SDavid Howells iov[1].iov_base = skb->head; 2645a924b89SDavid Howells iov[1].iov_len = skb->len; 2655a924b89SDavid Howells len = iov[0].iov_len + iov[1].iov_len; 2665a924b89SDavid Howells 2675a924b89SDavid Howells msg.msg_name = &call->peer->srx.transport; 2685a924b89SDavid Howells msg.msg_namelen = call->peer->srx.transport_len; 2698c3e34a4SDavid Howells msg.msg_control = NULL; 2708c3e34a4SDavid Howells msg.msg_controllen = 0; 2718c3e34a4SDavid Howells msg.msg_flags = 0; 2728c3e34a4SDavid Howells 2738a681c36SDavid Howells if (IS_ENABLED(CONFIG_AF_RXRPC_INJECT_LOSS)) { 2748a681c36SDavid Howells static int lose; 2758a681c36SDavid Howells if ((lose++ & 7) == 7) { 2768a681c36SDavid Howells rxrpc_lose_skb(skb, rxrpc_skb_tx_lost); 2778a681c36SDavid Howells _leave(" = 0 [lose]"); 2788a681c36SDavid Howells return 0; 2798a681c36SDavid Howells } 2808a681c36SDavid Howells } 2818a681c36SDavid Howells 2825a924b89SDavid Howells _proto("Tx DATA %%%u { #%u }", serial, sp->hdr.seq); 2835a924b89SDavid Howells 2848c3e34a4SDavid Howells /* send the packet with the don't fragment bit set if we currently 2858c3e34a4SDavid Howells * think it's small enough */ 2865a924b89SDavid Howells if (iov[1].iov_len >= call->peer->maxdata) 2875a924b89SDavid Howells goto send_fragmentable; 2885a924b89SDavid Howells 289985a5c82SDavid Howells down_read(&conn->params.local->defrag_sem); 2908c3e34a4SDavid Howells /* send the packet by UDP 2918c3e34a4SDavid Howells * - returns -EMSGSIZE if UDP would have to fragment the packet 2928c3e34a4SDavid Howells * to go out of the interface 2938c3e34a4SDavid Howells * - in which case, we'll have processed the ICMP error 2948c3e34a4SDavid Howells * message and update the peer record 2958c3e34a4SDavid Howells */ 2965a924b89SDavid Howells ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); 2978c3e34a4SDavid Howells 298985a5c82SDavid Howells up_read(&conn->params.local->defrag_sem); 2998c3e34a4SDavid Howells if (ret == -EMSGSIZE) 3008c3e34a4SDavid Howells goto send_fragmentable; 3018c3e34a4SDavid Howells 3025a924b89SDavid Howells done: 3035a924b89SDavid Howells if (ret == 0) { 3045a924b89SDavid Howells sp->resend_at = jiffies + rxrpc_resend_timeout; 3055a924b89SDavid Howells sp->hdr.serial = serial; 3068c3e34a4SDavid Howells } 3075a924b89SDavid Howells _leave(" = %d [%u]", ret, call->peer->maxdata); 3085a924b89SDavid Howells return ret; 3098c3e34a4SDavid Howells 3108c3e34a4SDavid Howells send_fragmentable: 3118c3e34a4SDavid Howells /* attempt to send this message with fragmentation enabled */ 3128c3e34a4SDavid Howells _debug("send fragment"); 3138c3e34a4SDavid Howells 314985a5c82SDavid Howells down_write(&conn->params.local->defrag_sem); 315985a5c82SDavid Howells 316985a5c82SDavid Howells switch (conn->params.local->srx.transport.family) { 317985a5c82SDavid Howells case AF_INET: 3188c3e34a4SDavid Howells opt = IP_PMTUDISC_DONT; 319985a5c82SDavid Howells ret = kernel_setsockopt(conn->params.local->socket, 320985a5c82SDavid Howells SOL_IP, IP_MTU_DISCOVER, 3218c3e34a4SDavid Howells (char *)&opt, sizeof(opt)); 3228c3e34a4SDavid Howells if (ret == 0) { 3235a924b89SDavid Howells ret = kernel_sendmsg(conn->params.local->socket, &msg, 3245a924b89SDavid Howells iov, 2, len); 3258c3e34a4SDavid Howells 3268c3e34a4SDavid Howells opt = IP_PMTUDISC_DO; 327985a5c82SDavid Howells kernel_setsockopt(conn->params.local->socket, SOL_IP, 328985a5c82SDavid Howells IP_MTU_DISCOVER, 329985a5c82SDavid Howells (char *)&opt, sizeof(opt)); 330985a5c82SDavid Howells } 331985a5c82SDavid Howells break; 33275b54cb5SDavid Howells 333d1912747SDavid Howells #ifdef CONFIG_AF_RXRPC_IPV6 33475b54cb5SDavid Howells case AF_INET6: 33575b54cb5SDavid Howells opt = IPV6_PMTUDISC_DONT; 33675b54cb5SDavid Howells ret = kernel_setsockopt(conn->params.local->socket, 33775b54cb5SDavid Howells SOL_IPV6, IPV6_MTU_DISCOVER, 33875b54cb5SDavid Howells (char *)&opt, sizeof(opt)); 33975b54cb5SDavid Howells if (ret == 0) { 34075b54cb5SDavid Howells ret = kernel_sendmsg(conn->params.local->socket, &msg, 34175b54cb5SDavid Howells iov, 1, iov[0].iov_len); 34275b54cb5SDavid Howells 34375b54cb5SDavid Howells opt = IPV6_PMTUDISC_DO; 34475b54cb5SDavid Howells kernel_setsockopt(conn->params.local->socket, 34575b54cb5SDavid Howells SOL_IPV6, IPV6_MTU_DISCOVER, 34675b54cb5SDavid Howells (char *)&opt, sizeof(opt)); 34775b54cb5SDavid Howells } 34875b54cb5SDavid Howells break; 349d1912747SDavid Howells #endif 3508c3e34a4SDavid Howells } 3518c3e34a4SDavid Howells 352985a5c82SDavid Howells up_write(&conn->params.local->defrag_sem); 3535a924b89SDavid Howells goto done; 3548c3e34a4SDavid Howells } 355248f219cSDavid Howells 356248f219cSDavid Howells /* 357248f219cSDavid Howells * reject packets through the local endpoint 358248f219cSDavid Howells */ 359248f219cSDavid Howells void rxrpc_reject_packets(struct rxrpc_local *local) 360248f219cSDavid Howells { 3611c2bc7b9SDavid Howells struct sockaddr_rxrpc srx; 362248f219cSDavid Howells struct rxrpc_skb_priv *sp; 363248f219cSDavid Howells struct rxrpc_wire_header whdr; 364248f219cSDavid Howells struct sk_buff *skb; 365248f219cSDavid Howells struct msghdr msg; 366248f219cSDavid Howells struct kvec iov[2]; 367248f219cSDavid Howells size_t size; 368248f219cSDavid Howells __be32 code; 369248f219cSDavid Howells 370248f219cSDavid Howells _enter("%d", local->debug_id); 371248f219cSDavid Howells 372248f219cSDavid Howells iov[0].iov_base = &whdr; 373248f219cSDavid Howells iov[0].iov_len = sizeof(whdr); 374248f219cSDavid Howells iov[1].iov_base = &code; 375248f219cSDavid Howells iov[1].iov_len = sizeof(code); 376248f219cSDavid Howells size = sizeof(whdr) + sizeof(code); 377248f219cSDavid Howells 3781c2bc7b9SDavid Howells msg.msg_name = &srx.transport; 379248f219cSDavid Howells msg.msg_control = NULL; 380248f219cSDavid Howells msg.msg_controllen = 0; 381248f219cSDavid Howells msg.msg_flags = 0; 382248f219cSDavid Howells 383248f219cSDavid Howells memset(&whdr, 0, sizeof(whdr)); 384248f219cSDavid Howells whdr.type = RXRPC_PACKET_TYPE_ABORT; 385248f219cSDavid Howells 386248f219cSDavid Howells while ((skb = skb_dequeue(&local->reject_queue))) { 38771f3ca40SDavid Howells rxrpc_see_skb(skb, rxrpc_skb_rx_seen); 388248f219cSDavid Howells sp = rxrpc_skb(skb); 3891c2bc7b9SDavid Howells 3901c2bc7b9SDavid Howells if (rxrpc_extract_addr_from_skb(&srx, skb) == 0) { 3911c2bc7b9SDavid Howells msg.msg_namelen = srx.transport_len; 3921c2bc7b9SDavid Howells 393248f219cSDavid Howells code = htonl(skb->priority); 394248f219cSDavid Howells 395248f219cSDavid Howells whdr.epoch = htonl(sp->hdr.epoch); 396248f219cSDavid Howells whdr.cid = htonl(sp->hdr.cid); 397248f219cSDavid Howells whdr.callNumber = htonl(sp->hdr.callNumber); 398248f219cSDavid Howells whdr.serviceId = htons(sp->hdr.serviceId); 399248f219cSDavid Howells whdr.flags = sp->hdr.flags; 400248f219cSDavid Howells whdr.flags ^= RXRPC_CLIENT_INITIATED; 401248f219cSDavid Howells whdr.flags &= RXRPC_CLIENT_INITIATED; 402248f219cSDavid Howells 403248f219cSDavid Howells kernel_sendmsg(local->socket, &msg, iov, 2, size); 404248f219cSDavid Howells } 405248f219cSDavid Howells 40671f3ca40SDavid Howells rxrpc_free_skb(skb, rxrpc_skb_rx_freed); 407248f219cSDavid Howells } 408248f219cSDavid Howells 409248f219cSDavid Howells _leave(""); 410248f219cSDavid Howells } 411