1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2016 XSKY <haomai@xsky.com>
8 * Author: Haomai Wang <haomaiwang@gmail.com>
10 * This is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License version 2.1, as published by the Free Software
13 * Foundation. See file COPYING.
17 #ifndef CEPH_MSG_RDMA_CONNECTED_SOCKET_TCP_H
18 #define CEPH_MSG_RDMA_CONNECTED_SOCKET_TCP_H
20 #include "common/ceph_context.h"
21 #include "common/debug.h"
22 #include "common/errno.h"
23 #include "msg/async/Stack.h"
24 #include "Infiniband.h"
25 #include "RDMAConnectedSocketImpl.h"
30 struct RDMAConnTCPInfo
{
34 class RDMAConnTCP
: public RDMAConnMgr
{
35 class C_handle_connection
: public EventCallback
{
39 C_handle_connection(RDMAConnTCP
*w
): cst(w
), active(true) {};
40 void do_request(int fd
) {
42 cst
->handle_connection();
51 EventCallbackRef con_handler
;
55 void handle_connection();
56 int send_msg(CephContext
*cct
, int sd
, IBSYNMsg
& msg
);
57 int recv_msg(CephContext
*cct
, int sd
, IBSYNMsg
& msg
);
59 void wire_gid_to_gid(const char *wgid
, union ibv_gid
*gid
);
60 void gid_to_wire_gid(const union ibv_gid
*gid
, char wgid
[]);
63 RDMAConnTCP(CephContext
*cct
, RDMAConnectedSocketImpl
*sock
,
64 Infiniband
* ib
, RDMADispatcher
* s
, RDMAWorker
*w
,
66 virtual ~RDMAConnTCP();
68 virtual ostream
&print(ostream
&out
) const override
;
70 void set_accept_fd(int sd
);
72 virtual void cleanup() override
;
73 virtual int try_connect(const entity_addr_t
&, const SocketOptions
&opt
) override
;
76 class RDMAServerConnTCP
: public RDMAServerSocketImpl
{
78 int server_setup_socket
;
81 RDMAServerConnTCP(CephContext
*cct
, Infiniband
* i
, RDMADispatcher
*s
, RDMAWorker
*w
, entity_addr_t
& a
);
83 int listen(entity_addr_t
&sa
, const SocketOptions
&opt
);
84 virtual int accept(ConnectedSocket
*s
, const SocketOptions
&opts
, entity_addr_t
*out
, Worker
*w
) override
;
85 virtual void abort_accept() override
;
86 virtual int fd() const override
{ return server_setup_socket
; }