Skip to content

Commit 985a5c8

Browse files
committed
rxrpc: Make rxrpc_send_packet() take a connection not a transport
Make rxrpc_send_packet() take a connection not a transport as part of the phasing out of the rxrpc_transport struct. Whilst we're at it, rename the function to rxrpc_send_data_packet() to differentiate it from the other packet sending functions. Signed-off-by: David Howells <[email protected]>
1 parent f4e7da8 commit 985a5c8

File tree

3 files changed

+31
-24
lines changed

3 files changed

+31
-24
lines changed

net/rxrpc/ar-internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ extern const char *rxrpc_acks(u8 reason);
670670
*/
671671
extern unsigned int rxrpc_resend_timeout;
672672

673-
int rxrpc_send_packet(struct rxrpc_transport *, struct sk_buff *);
673+
int rxrpc_send_data_packet(struct rxrpc_connection *, struct sk_buff *);
674674
int rxrpc_do_sendmsg(struct rxrpc_sock *, struct msghdr *, size_t);
675675

676676
/*

net/rxrpc/call_event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static void rxrpc_resend(struct rxrpc_call *call)
187187

188188
_proto("Tx DATA %%%u { #%d }",
189189
sp->hdr.serial, sp->hdr.seq);
190-
if (rxrpc_send_packet(call->conn->trans, txb) < 0) {
190+
if (rxrpc_send_data_packet(call->conn, txb) < 0) {
191191
stop = true;
192192
sp->resend_at = jiffies + 3;
193193
} else {

net/rxrpc/output.c

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ EXPORT_SYMBOL(rxrpc_kernel_abort_call);
338338
/*
339339
* send a packet through the transport endpoint
340340
*/
341-
int rxrpc_send_packet(struct rxrpc_transport *trans, struct sk_buff *skb)
341+
int rxrpc_send_data_packet(struct rxrpc_connection *conn, struct sk_buff *skb)
342342
{
343343
struct kvec iov[1];
344344
struct msghdr msg;
@@ -349,52 +349,59 @@ int rxrpc_send_packet(struct rxrpc_transport *trans, struct sk_buff *skb)
349349
iov[0].iov_base = skb->head;
350350
iov[0].iov_len = skb->len;
351351

352-
msg.msg_name = &trans->peer->srx.transport.sin;
353-
msg.msg_namelen = sizeof(trans->peer->srx.transport.sin);
352+
msg.msg_name = &conn->params.peer->srx.transport;
353+
msg.msg_namelen = conn->params.peer->srx.transport_len;
354354
msg.msg_control = NULL;
355355
msg.msg_controllen = 0;
356356
msg.msg_flags = 0;
357357

358358
/* send the packet with the don't fragment bit set if we currently
359359
* think it's small enough */
360-
if (skb->len - sizeof(struct rxrpc_wire_header) < trans->peer->maxdata) {
361-
down_read(&trans->local->defrag_sem);
360+
if (skb->len - sizeof(struct rxrpc_wire_header) < conn->params.peer->maxdata) {
361+
down_read(&conn->params.local->defrag_sem);
362362
/* send the packet by UDP
363363
* - returns -EMSGSIZE if UDP would have to fragment the packet
364364
* to go out of the interface
365365
* - in which case, we'll have processed the ICMP error
366366
* message and update the peer record
367367
*/
368-
ret = kernel_sendmsg(trans->local->socket, &msg, iov, 1,
368+
ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 1,
369369
iov[0].iov_len);
370370

371-
up_read(&trans->local->defrag_sem);
371+
up_read(&conn->params.local->defrag_sem);
372372
if (ret == -EMSGSIZE)
373373
goto send_fragmentable;
374374

375-
_leave(" = %d [%u]", ret, trans->peer->maxdata);
375+
_leave(" = %d [%u]", ret, conn->params.peer->maxdata);
376376
return ret;
377377
}
378378

379379
send_fragmentable:
380380
/* attempt to send this message with fragmentation enabled */
381381
_debug("send fragment");
382382

383-
down_write(&trans->local->defrag_sem);
384-
opt = IP_PMTUDISC_DONT;
385-
ret = kernel_setsockopt(trans->local->socket, SOL_IP, IP_MTU_DISCOVER,
386-
(char *) &opt, sizeof(opt));
387-
if (ret == 0) {
388-
ret = kernel_sendmsg(trans->local->socket, &msg, iov, 1,
389-
iov[0].iov_len);
390-
391-
opt = IP_PMTUDISC_DO;
392-
kernel_setsockopt(trans->local->socket, SOL_IP,
393-
IP_MTU_DISCOVER, (char *) &opt, sizeof(opt));
383+
down_write(&conn->params.local->defrag_sem);
384+
385+
switch (conn->params.local->srx.transport.family) {
386+
case AF_INET:
387+
opt = IP_PMTUDISC_DONT;
388+
ret = kernel_setsockopt(conn->params.local->socket,
389+
SOL_IP, IP_MTU_DISCOVER,
390+
(char *)&opt, sizeof(opt));
391+
if (ret == 0) {
392+
ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 1,
393+
iov[0].iov_len);
394+
395+
opt = IP_PMTUDISC_DO;
396+
kernel_setsockopt(conn->params.local->socket, SOL_IP,
397+
IP_MTU_DISCOVER,
398+
(char *)&opt, sizeof(opt));
399+
}
400+
break;
394401
}
395402

396-
up_write(&trans->local->defrag_sem);
397-
_leave(" = %d [frag %u]", ret, trans->peer->maxdata);
403+
up_write(&conn->params.local->defrag_sem);
404+
_leave(" = %d [frag %u]", ret, conn->params.peer->maxdata);
398405
return ret;
399406
}
400407

@@ -506,7 +513,7 @@ static void rxrpc_queue_packet(struct rxrpc_call *call, struct sk_buff *skb,
506513
if (try_to_del_timer_sync(&call->ack_timer) >= 0) {
507514
/* the packet may be freed by rxrpc_process_call() before this
508515
* returns */
509-
ret = rxrpc_send_packet(call->conn->trans, skb);
516+
ret = rxrpc_send_data_packet(call->conn, skb);
510517
_net("sent skb %p", skb);
511518
} else {
512519
_debug("failed to delete ACK timer");

0 commit comments

Comments
 (0)