xref: /openbmc/linux/net/rxrpc/output.c (revision 5a924b89)
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 
60248f219cSDavid Howells 	if (after(top, hard_ack)) {
61248f219cSDavid Howells 		seq = hard_ack + 1;
62248f219cSDavid Howells 		do {
63248f219cSDavid Howells 			ix = seq & RXRPC_RXTX_BUFF_MASK;
64248f219cSDavid Howells 			if (call->rxtx_buffer[ix])
65248f219cSDavid Howells 				*ackp++ = RXRPC_ACK_TYPE_ACK;
66248f219cSDavid Howells 			else
67248f219cSDavid Howells 				*ackp++ = RXRPC_ACK_TYPE_NACK;
68248f219cSDavid Howells 			seq++;
69248f219cSDavid Howells 		} while (before_eq(seq, top));
70248f219cSDavid Howells 	}
71248f219cSDavid Howells 
72248f219cSDavid Howells 	mtu = call->conn->params.peer->if_mtu;
73248f219cSDavid Howells 	mtu -= call->conn->params.peer->hdrsize;
7475e42126SDavid Howells 	jmax = (call->nr_jumbo_bad > 3) ? 1 : rxrpc_rx_jumbo_max;
758d94aa38SDavid Howells 	pkt->ackinfo.rxMTU	= htonl(rxrpc_rx_mtu);
768d94aa38SDavid Howells 	pkt->ackinfo.maxMTU	= htonl(mtu);
7775e42126SDavid Howells 	pkt->ackinfo.rwind	= htonl(call->rx_winsize);
788d94aa38SDavid Howells 	pkt->ackinfo.jumbo_max	= htonl(jmax);
798d94aa38SDavid Howells 
80f3639df2SDavid Howells 	trace_rxrpc_tx_ack(call, hard_ack + 1, serial, call->ackr_reason,
81f3639df2SDavid Howells 			   top - hard_ack);
82f3639df2SDavid Howells 
838d94aa38SDavid Howells 	*ackp++ = 0;
848d94aa38SDavid Howells 	*ackp++ = 0;
858d94aa38SDavid Howells 	*ackp++ = 0;
86248f219cSDavid Howells 	return top - hard_ack + 3;
878d94aa38SDavid Howells }
888d94aa38SDavid Howells 
898d94aa38SDavid Howells /*
90248f219cSDavid Howells  * Send an ACK or ABORT call packet.
918d94aa38SDavid Howells  */
928d94aa38SDavid Howells int rxrpc_send_call_packet(struct rxrpc_call *call, u8 type)
938d94aa38SDavid Howells {
948d94aa38SDavid Howells 	struct rxrpc_connection *conn = NULL;
958d94aa38SDavid Howells 	struct rxrpc_pkt_buffer *pkt;
968d94aa38SDavid Howells 	struct msghdr msg;
978d94aa38SDavid Howells 	struct kvec iov[2];
988d94aa38SDavid Howells 	rxrpc_serial_t serial;
998d94aa38SDavid Howells 	size_t len, n;
1008d94aa38SDavid Howells 	int ioc, ret;
1018d94aa38SDavid Howells 	u32 abort_code;
1028d94aa38SDavid Howells 
1038d94aa38SDavid Howells 	_enter("%u,%s", call->debug_id, rxrpc_pkts[type]);
1048d94aa38SDavid Howells 
1058d94aa38SDavid Howells 	spin_lock_bh(&call->lock);
1068d94aa38SDavid Howells 	if (call->conn)
1078d94aa38SDavid Howells 		conn = rxrpc_get_connection_maybe(call->conn);
1088d94aa38SDavid Howells 	spin_unlock_bh(&call->lock);
1098d94aa38SDavid Howells 	if (!conn)
1108d94aa38SDavid Howells 		return -ECONNRESET;
1118d94aa38SDavid Howells 
1128d94aa38SDavid Howells 	pkt = kzalloc(sizeof(*pkt), GFP_KERNEL);
1138d94aa38SDavid Howells 	if (!pkt) {
1148d94aa38SDavid Howells 		rxrpc_put_connection(conn);
1158d94aa38SDavid Howells 		return -ENOMEM;
1168d94aa38SDavid Howells 	}
1178d94aa38SDavid Howells 
1188d94aa38SDavid Howells 	serial = atomic_inc_return(&conn->serial);
1198d94aa38SDavid Howells 
1208d94aa38SDavid Howells 	msg.msg_name	= &call->peer->srx.transport;
1218d94aa38SDavid Howells 	msg.msg_namelen	= call->peer->srx.transport_len;
1228d94aa38SDavid Howells 	msg.msg_control	= NULL;
1238d94aa38SDavid Howells 	msg.msg_controllen = 0;
1248d94aa38SDavid Howells 	msg.msg_flags	= 0;
1258d94aa38SDavid Howells 
1268d94aa38SDavid Howells 	pkt->whdr.epoch		= htonl(conn->proto.epoch);
1278d94aa38SDavid Howells 	pkt->whdr.cid		= htonl(call->cid);
1288d94aa38SDavid Howells 	pkt->whdr.callNumber	= htonl(call->call_id);
1298d94aa38SDavid Howells 	pkt->whdr.seq		= 0;
1308d94aa38SDavid Howells 	pkt->whdr.serial	= htonl(serial);
1318d94aa38SDavid Howells 	pkt->whdr.type		= type;
1328d94aa38SDavid Howells 	pkt->whdr.flags		= conn->out_clientflag;
1338d94aa38SDavid Howells 	pkt->whdr.userStatus	= 0;
1348d94aa38SDavid Howells 	pkt->whdr.securityIndex	= call->security_ix;
1358d94aa38SDavid Howells 	pkt->whdr._rsvd		= 0;
1368d94aa38SDavid Howells 	pkt->whdr.serviceId	= htons(call->service_id);
1378d94aa38SDavid Howells 
1388d94aa38SDavid Howells 	iov[0].iov_base	= pkt;
1398d94aa38SDavid Howells 	iov[0].iov_len	= sizeof(pkt->whdr);
1408d94aa38SDavid Howells 	len = sizeof(pkt->whdr);
1418d94aa38SDavid Howells 
1428d94aa38SDavid Howells 	switch (type) {
1438d94aa38SDavid Howells 	case RXRPC_PACKET_TYPE_ACK:
1448d94aa38SDavid Howells 		spin_lock_bh(&call->lock);
14527d0fc43SDavid Howells 		if (!call->ackr_reason) {
14627d0fc43SDavid Howells 			spin_unlock_bh(&call->lock);
14727d0fc43SDavid Howells 			ret = 0;
14827d0fc43SDavid Howells 			goto out;
14927d0fc43SDavid Howells 		}
1508d94aa38SDavid Howells 		n = rxrpc_fill_out_ack(call, pkt);
1518d94aa38SDavid Howells 		call->ackr_reason = 0;
1528d94aa38SDavid Howells 
1538d94aa38SDavid Howells 		spin_unlock_bh(&call->lock);
1548d94aa38SDavid Howells 
1558d94aa38SDavid Howells 		_proto("Tx ACK %%%u { m=%hu f=#%u p=#%u s=%%%u r=%s n=%u }",
1568d94aa38SDavid Howells 		       serial,
1578d94aa38SDavid Howells 		       ntohs(pkt->ack.maxSkew),
1588d94aa38SDavid Howells 		       ntohl(pkt->ack.firstPacket),
1598d94aa38SDavid Howells 		       ntohl(pkt->ack.previousPacket),
1608d94aa38SDavid Howells 		       ntohl(pkt->ack.serial),
1618d94aa38SDavid Howells 		       rxrpc_acks(pkt->ack.reason),
1628d94aa38SDavid Howells 		       pkt->ack.nAcks);
1638d94aa38SDavid Howells 
1648d94aa38SDavid Howells 		iov[0].iov_len += sizeof(pkt->ack) + n;
1658d94aa38SDavid Howells 		iov[1].iov_base = &pkt->ackinfo;
1668d94aa38SDavid Howells 		iov[1].iov_len	= sizeof(pkt->ackinfo);
1678d94aa38SDavid Howells 		len += sizeof(pkt->ack) + n + sizeof(pkt->ackinfo);
1688d94aa38SDavid Howells 		ioc = 2;
1698d94aa38SDavid Howells 		break;
1708d94aa38SDavid Howells 
1718d94aa38SDavid Howells 	case RXRPC_PACKET_TYPE_ABORT:
1728d94aa38SDavid Howells 		abort_code = call->abort_code;
1738d94aa38SDavid Howells 		pkt->abort_code = htonl(abort_code);
1748d94aa38SDavid Howells 		_proto("Tx ABORT %%%u { %d }", serial, abort_code);
1758d94aa38SDavid Howells 		iov[0].iov_len += sizeof(pkt->abort_code);
1768d94aa38SDavid Howells 		len += sizeof(pkt->abort_code);
1778d94aa38SDavid Howells 		ioc = 1;
1788d94aa38SDavid Howells 		break;
1798d94aa38SDavid Howells 
1808d94aa38SDavid Howells 	default:
1818d94aa38SDavid Howells 		BUG();
1828d94aa38SDavid Howells 		ret = -ENOANO;
1838d94aa38SDavid Howells 		goto out;
1848d94aa38SDavid Howells 	}
1858d94aa38SDavid Howells 
1868d94aa38SDavid Howells 	ret = kernel_sendmsg(conn->params.local->socket,
1878d94aa38SDavid Howells 			     &msg, iov, ioc, len);
1888d94aa38SDavid Howells 
189248f219cSDavid Howells 	if (ret < 0 && call->state < RXRPC_CALL_COMPLETE) {
1902311e327SDavid Howells 		switch (type) {
191248f219cSDavid Howells 		case RXRPC_PACKET_TYPE_ACK:
192248f219cSDavid Howells 			rxrpc_propose_ACK(call, pkt->ack.reason,
193248f219cSDavid Howells 					  ntohs(pkt->ack.maxSkew),
194248f219cSDavid Howells 					  ntohl(pkt->ack.serial),
195248f219cSDavid Howells 					  true, true);
196248f219cSDavid Howells 			break;
197248f219cSDavid Howells 		case RXRPC_PACKET_TYPE_ABORT:
198248f219cSDavid Howells 			break;
199248f219cSDavid Howells 		}
200248f219cSDavid Howells 	}
201248f219cSDavid Howells 
2028d94aa38SDavid Howells out:
2038d94aa38SDavid Howells 	rxrpc_put_connection(conn);
2048d94aa38SDavid Howells 	kfree(pkt);
2058d94aa38SDavid Howells 	return ret;
2068d94aa38SDavid Howells }
2078d94aa38SDavid Howells 
2088c3e34a4SDavid Howells /*
2098c3e34a4SDavid Howells  * send a packet through the transport endpoint
2108c3e34a4SDavid Howells  */
2115a924b89SDavid Howells int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb)
2128c3e34a4SDavid Howells {
2135a924b89SDavid Howells 	struct rxrpc_connection *conn = call->conn;
2145a924b89SDavid Howells 	struct rxrpc_wire_header whdr;
2155a924b89SDavid Howells 	struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
2168c3e34a4SDavid Howells 	struct msghdr msg;
2175a924b89SDavid Howells 	struct kvec iov[2];
2185a924b89SDavid Howells 	rxrpc_serial_t serial;
2195a924b89SDavid Howells 	size_t len;
2208c3e34a4SDavid Howells 	int ret, opt;
2218c3e34a4SDavid Howells 
2228c3e34a4SDavid Howells 	_enter(",{%d}", skb->len);
2238c3e34a4SDavid Howells 
2245a924b89SDavid Howells 	/* Each transmission of a Tx packet needs a new serial number */
2255a924b89SDavid Howells 	serial = atomic_inc_return(&conn->serial);
2268c3e34a4SDavid Howells 
2275a924b89SDavid Howells 	whdr.epoch	= htonl(conn->proto.epoch);
2285a924b89SDavid Howells 	whdr.cid	= htonl(call->cid);
2295a924b89SDavid Howells 	whdr.callNumber	= htonl(call->call_id);
2305a924b89SDavid Howells 	whdr.seq	= htonl(sp->hdr.seq);
2315a924b89SDavid Howells 	whdr.serial	= htonl(serial);
2325a924b89SDavid Howells 	whdr.type	= RXRPC_PACKET_TYPE_DATA;
2335a924b89SDavid Howells 	whdr.flags	= sp->hdr.flags;
2345a924b89SDavid Howells 	whdr.userStatus	= 0;
2355a924b89SDavid Howells 	whdr.securityIndex = call->security_ix;
2365a924b89SDavid Howells 	whdr._rsvd	= htons(sp->hdr._rsvd);
2375a924b89SDavid Howells 	whdr.serviceId	= htons(call->service_id);
2385a924b89SDavid Howells 
2395a924b89SDavid Howells 	iov[0].iov_base = &whdr;
2405a924b89SDavid Howells 	iov[0].iov_len = sizeof(whdr);
2415a924b89SDavid Howells 	iov[1].iov_base = skb->head;
2425a924b89SDavid Howells 	iov[1].iov_len = skb->len;
2435a924b89SDavid Howells 	len = iov[0].iov_len + iov[1].iov_len;
2445a924b89SDavid Howells 
2455a924b89SDavid Howells 	msg.msg_name = &call->peer->srx.transport;
2465a924b89SDavid Howells 	msg.msg_namelen = call->peer->srx.transport_len;
2478c3e34a4SDavid Howells 	msg.msg_control = NULL;
2488c3e34a4SDavid Howells 	msg.msg_controllen = 0;
2498c3e34a4SDavid Howells 	msg.msg_flags = 0;
2508c3e34a4SDavid Howells 
2518a681c36SDavid Howells 	if (IS_ENABLED(CONFIG_AF_RXRPC_INJECT_LOSS)) {
2528a681c36SDavid Howells 		static int lose;
2538a681c36SDavid Howells 		if ((lose++ & 7) == 7) {
2548a681c36SDavid Howells 			rxrpc_lose_skb(skb, rxrpc_skb_tx_lost);
2558a681c36SDavid Howells 			_leave(" = 0 [lose]");
2568a681c36SDavid Howells 			return 0;
2578a681c36SDavid Howells 		}
2588a681c36SDavid Howells 	}
2598a681c36SDavid Howells 
2605a924b89SDavid Howells 	_proto("Tx DATA %%%u { #%u }", serial, sp->hdr.seq);
2615a924b89SDavid Howells 
2628c3e34a4SDavid Howells 	/* send the packet with the don't fragment bit set if we currently
2638c3e34a4SDavid Howells 	 * think it's small enough */
2645a924b89SDavid Howells 	if (iov[1].iov_len >= call->peer->maxdata)
2655a924b89SDavid Howells 		goto send_fragmentable;
2665a924b89SDavid Howells 
267985a5c82SDavid Howells 	down_read(&conn->params.local->defrag_sem);
2688c3e34a4SDavid Howells 	/* send the packet by UDP
2698c3e34a4SDavid Howells 	 * - returns -EMSGSIZE if UDP would have to fragment the packet
2708c3e34a4SDavid Howells 	 *   to go out of the interface
2718c3e34a4SDavid Howells 	 *   - in which case, we'll have processed the ICMP error
2728c3e34a4SDavid Howells 	 *     message and update the peer record
2738c3e34a4SDavid Howells 	 */
2745a924b89SDavid Howells 	ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len);
2758c3e34a4SDavid Howells 
276985a5c82SDavid Howells 	up_read(&conn->params.local->defrag_sem);
2778c3e34a4SDavid Howells 	if (ret == -EMSGSIZE)
2788c3e34a4SDavid Howells 		goto send_fragmentable;
2798c3e34a4SDavid Howells 
2805a924b89SDavid Howells done:
2815a924b89SDavid Howells 	if (ret == 0) {
2825a924b89SDavid Howells 		sp->resend_at = jiffies + rxrpc_resend_timeout;
2835a924b89SDavid Howells 		sp->hdr.serial = serial;
2848c3e34a4SDavid Howells 	}
2855a924b89SDavid Howells 	_leave(" = %d [%u]", ret, call->peer->maxdata);
2865a924b89SDavid Howells 	return ret;
2878c3e34a4SDavid Howells 
2888c3e34a4SDavid Howells send_fragmentable:
2898c3e34a4SDavid Howells 	/* attempt to send this message with fragmentation enabled */
2908c3e34a4SDavid Howells 	_debug("send fragment");
2918c3e34a4SDavid Howells 
292985a5c82SDavid Howells 	down_write(&conn->params.local->defrag_sem);
293985a5c82SDavid Howells 
294985a5c82SDavid Howells 	switch (conn->params.local->srx.transport.family) {
295985a5c82SDavid Howells 	case AF_INET:
2968c3e34a4SDavid Howells 		opt = IP_PMTUDISC_DONT;
297985a5c82SDavid Howells 		ret = kernel_setsockopt(conn->params.local->socket,
298985a5c82SDavid Howells 					SOL_IP, IP_MTU_DISCOVER,
2998c3e34a4SDavid Howells 					(char *)&opt, sizeof(opt));
3008c3e34a4SDavid Howells 		if (ret == 0) {
3015a924b89SDavid Howells 			ret = kernel_sendmsg(conn->params.local->socket, &msg,
3025a924b89SDavid Howells 					     iov, 2, len);
3038c3e34a4SDavid Howells 
3048c3e34a4SDavid Howells 			opt = IP_PMTUDISC_DO;
305985a5c82SDavid Howells 			kernel_setsockopt(conn->params.local->socket, SOL_IP,
306985a5c82SDavid Howells 					  IP_MTU_DISCOVER,
307985a5c82SDavid Howells 					  (char *)&opt, sizeof(opt));
308985a5c82SDavid Howells 		}
309985a5c82SDavid Howells 		break;
31075b54cb5SDavid Howells 
311d1912747SDavid Howells #ifdef CONFIG_AF_RXRPC_IPV6
31275b54cb5SDavid Howells 	case AF_INET6:
31375b54cb5SDavid Howells 		opt = IPV6_PMTUDISC_DONT;
31475b54cb5SDavid Howells 		ret = kernel_setsockopt(conn->params.local->socket,
31575b54cb5SDavid Howells 					SOL_IPV6, IPV6_MTU_DISCOVER,
31675b54cb5SDavid Howells 					(char *)&opt, sizeof(opt));
31775b54cb5SDavid Howells 		if (ret == 0) {
31875b54cb5SDavid Howells 			ret = kernel_sendmsg(conn->params.local->socket, &msg,
31975b54cb5SDavid Howells 					     iov, 1, iov[0].iov_len);
32075b54cb5SDavid Howells 
32175b54cb5SDavid Howells 			opt = IPV6_PMTUDISC_DO;
32275b54cb5SDavid Howells 			kernel_setsockopt(conn->params.local->socket,
32375b54cb5SDavid Howells 					  SOL_IPV6, IPV6_MTU_DISCOVER,
32475b54cb5SDavid Howells 					  (char *)&opt, sizeof(opt));
32575b54cb5SDavid Howells 		}
32675b54cb5SDavid Howells 		break;
327d1912747SDavid Howells #endif
3288c3e34a4SDavid Howells 	}
3298c3e34a4SDavid Howells 
330985a5c82SDavid Howells 	up_write(&conn->params.local->defrag_sem);
3315a924b89SDavid Howells 	goto done;
3328c3e34a4SDavid Howells }
333248f219cSDavid Howells 
334248f219cSDavid Howells /*
335248f219cSDavid Howells  * reject packets through the local endpoint
336248f219cSDavid Howells  */
337248f219cSDavid Howells void rxrpc_reject_packets(struct rxrpc_local *local)
338248f219cSDavid Howells {
3391c2bc7b9SDavid Howells 	struct sockaddr_rxrpc srx;
340248f219cSDavid Howells 	struct rxrpc_skb_priv *sp;
341248f219cSDavid Howells 	struct rxrpc_wire_header whdr;
342248f219cSDavid Howells 	struct sk_buff *skb;
343248f219cSDavid Howells 	struct msghdr msg;
344248f219cSDavid Howells 	struct kvec iov[2];
345248f219cSDavid Howells 	size_t size;
346248f219cSDavid Howells 	__be32 code;
347248f219cSDavid Howells 
348248f219cSDavid Howells 	_enter("%d", local->debug_id);
349248f219cSDavid Howells 
350248f219cSDavid Howells 	iov[0].iov_base = &whdr;
351248f219cSDavid Howells 	iov[0].iov_len = sizeof(whdr);
352248f219cSDavid Howells 	iov[1].iov_base = &code;
353248f219cSDavid Howells 	iov[1].iov_len = sizeof(code);
354248f219cSDavid Howells 	size = sizeof(whdr) + sizeof(code);
355248f219cSDavid Howells 
3561c2bc7b9SDavid Howells 	msg.msg_name = &srx.transport;
357248f219cSDavid Howells 	msg.msg_control = NULL;
358248f219cSDavid Howells 	msg.msg_controllen = 0;
359248f219cSDavid Howells 	msg.msg_flags = 0;
360248f219cSDavid Howells 
361248f219cSDavid Howells 	memset(&whdr, 0, sizeof(whdr));
362248f219cSDavid Howells 	whdr.type = RXRPC_PACKET_TYPE_ABORT;
363248f219cSDavid Howells 
364248f219cSDavid Howells 	while ((skb = skb_dequeue(&local->reject_queue))) {
36571f3ca40SDavid Howells 		rxrpc_see_skb(skb, rxrpc_skb_rx_seen);
366248f219cSDavid Howells 		sp = rxrpc_skb(skb);
3671c2bc7b9SDavid Howells 
3681c2bc7b9SDavid Howells 		if (rxrpc_extract_addr_from_skb(&srx, skb) == 0) {
3691c2bc7b9SDavid Howells 			msg.msg_namelen = srx.transport_len;
3701c2bc7b9SDavid Howells 
371248f219cSDavid Howells 			code = htonl(skb->priority);
372248f219cSDavid Howells 
373248f219cSDavid Howells 			whdr.epoch	= htonl(sp->hdr.epoch);
374248f219cSDavid Howells 			whdr.cid	= htonl(sp->hdr.cid);
375248f219cSDavid Howells 			whdr.callNumber	= htonl(sp->hdr.callNumber);
376248f219cSDavid Howells 			whdr.serviceId	= htons(sp->hdr.serviceId);
377248f219cSDavid Howells 			whdr.flags	= sp->hdr.flags;
378248f219cSDavid Howells 			whdr.flags	^= RXRPC_CLIENT_INITIATED;
379248f219cSDavid Howells 			whdr.flags	&= RXRPC_CLIENT_INITIATED;
380248f219cSDavid Howells 
381248f219cSDavid Howells 			kernel_sendmsg(local->socket, &msg, iov, 2, size);
382248f219cSDavid Howells 		}
383248f219cSDavid Howells 
38471f3ca40SDavid Howells 		rxrpc_free_skb(skb, rxrpc_skb_rx_freed);
385248f219cSDavid Howells 	}
386248f219cSDavid Howells 
387248f219cSDavid Howells 	_leave("");
388248f219cSDavid Howells }
389