Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rds: add transport specific tos_map hook

RDMA transport maps user tos to underline virtual lanes(VL)
for IB or DSCP values. RDMA CM transport abstract thats for
RDS. TCP transport makes use of default priority 0 and maps
all user tos values to it.

Reviewed-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
[yanjun.zhu@oracle.com: Adapted original patch with ipv6 changes]
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>

+24 -4
+6 -4
net/rds/af_rds.c
··· 255 255 static int rds_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) 256 256 { 257 257 struct rds_sock *rs = rds_sk_to_rs(sock->sk); 258 - rds_tos_t tos; 258 + rds_tos_t utos, tos = 0; 259 259 260 260 switch (cmd) { 261 261 case SIOCRDSSETTOS: 262 - if (get_user(tos, (rds_tos_t __user *)arg)) 262 + if (get_user(utos, (rds_tos_t __user *)arg)) 263 263 return -EFAULT; 264 264 265 265 if (rs->rs_transport && 266 - rs->rs_transport->t_type == RDS_TRANS_TCP) 267 - tos = 0; 266 + rs->rs_transport->get_tos_map) 267 + tos = rs->rs_transport->get_tos_map(utos); 268 + else 269 + return -ENOIOCTLCMD; 268 270 269 271 spin_lock_bh(&rds_sock_lock); 270 272 if (rs->rs_tos || rs->rs_conn) {
+10
net/rds/ib.c
··· 515 515 rds_ib_mr_exit(); 516 516 } 517 517 518 + static u8 rds_ib_get_tos_map(u8 tos) 519 + { 520 + /* 1:1 user to transport map for RDMA transport. 521 + * In future, if custom map is desired, hook can export 522 + * user configurable map. 523 + */ 524 + return tos; 525 + } 526 + 518 527 struct rds_transport rds_ib_transport = { 519 528 .laddr_check = rds_ib_laddr_check, 520 529 .xmit_path_complete = rds_ib_xmit_path_complete, ··· 546 537 .sync_mr = rds_ib_sync_mr, 547 538 .free_mr = rds_ib_free_mr, 548 539 .flush_mrs = rds_ib_flush_mrs, 540 + .get_tos_map = rds_ib_get_tos_map, 549 541 .t_owner = THIS_MODULE, 550 542 .t_name = "infiniband", 551 543 .t_unloading = rds_ib_is_unloading,
+1
net/rds/rds.h
··· 574 574 void (*free_mr)(void *trans_private, int invalidate); 575 575 void (*flush_mrs)(void); 576 576 bool (*t_unloading)(struct rds_connection *conn); 577 + u8 (*get_tos_map)(u8 tos); 577 578 }; 578 579 579 580 /* Bind hash table key length. It is the sum of the size of a struct
+7
net/rds/tcp.c
··· 453 453 454 454 static void rds_tcp_exit(void); 455 455 456 + static u8 rds_tcp_get_tos_map(u8 tos) 457 + { 458 + /* all user tos mapped to default 0 for TCP transport */ 459 + return 0; 460 + } 461 + 456 462 struct rds_transport rds_tcp_transport = { 457 463 .laddr_check = rds_tcp_laddr_check, 458 464 .xmit_path_prepare = rds_tcp_xmit_path_prepare, ··· 473 467 .inc_free = rds_tcp_inc_free, 474 468 .stats_info_copy = rds_tcp_stats_info_copy, 475 469 .exit = rds_tcp_exit, 470 + .get_tos_map = rds_tcp_get_tos_map, 476 471 .t_owner = THIS_MODULE, 477 472 .t_name = "tcp", 478 473 .t_type = RDS_TRANS_TCP,