sdp keepalive functionality differ a bit from tcp socket functionality.
in sdp only accepted or connected socket can trigger this functionality
as the keepalive is implemented as rdma write with zero length and this
require ib connection. due to this sdp behaviour you cannot set keepalive
on listening server socket or on non connected client socket. apps can
use sdp in 2 ways. binary apps that use tcp sockets can use the libsdp
to direct all the socket calls to sdp and new apps can open and use sdp
sockets directly w/o the need for libsdp. when using sdp socket directly
please follow the below rules:
- define: AF_INET_SDP = SOL_SDP = 27
- create the socket as follow:
socket(AF_INET_SDP, SOCK_STREAM, 0)
- get the sdp socket keepalive as follow:
getsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &optval, &optlen)
- set the sdp socket keepalive as follow:
setsockopt(fd, SOL_SDP, SO_KEEPALIVE, &optval, optlen)
when you load the sdp module;
- set the keepalive time. this is the max period in sec of no data before
sdp start to send the probes. you should take to account that more
then one probe is needed till sdp detect that the remote hca is gone.
echo <time sec> > /sys/module/ib_sdp/parameters/sdp_keepalive_time
- zero the probes counter. this counter is incremented any time sdp send probe.
probes are sent only if there is no tx/rx on this queue pair for the
keepalive time period.
echo 0 > /sys/module/ib_sdp/parameters/sdp_keepalive_probes_sent
on server socket:
- set keepalive only on accepted socket
on client socket:
- set keepalive only on socket after connect
Orabug:
18728784
Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com>
Signed-off-by: Vadim Makhervaks <vadim.makhervaks@oracle.com>
Signed-off-by: Guangyu Sun <guangyu.sun@oracle.com>
{
struct sdp_sock *ssk = sdp_sk(sk);
- sdp_dbg(sk, "%s\n", __func__);
-
ssk->keepalive_tx_head = ring_head(ssk->tx_ring);
ssk->keepalive_rx_head = ring_head(ssk->rx_ring);
struct sock *sk = (struct sock *)data;
struct sdp_sock *ssk = sdp_sk(sk);
- sdp_dbg(sk, "%s\n", __func__);
SDPSTATS_COUNTER_INC(keepalive_timer);
/* Only process if the socket is not in use */
static void sdp_set_keepalive(struct sock *sk, int val)
{
- sdp_dbg(sk, "%s %d\n", __func__, val);
-
if ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))
return;
#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
+#include <linux/ratelimit.h>
#include <rdma/ib_verbs.h>
#include <rdma/rdma_cm.h>
#include "sdp.h"
{
int rc;
struct ib_send_wr wr, *bad_wr;
-
- sdp_dbg(sk_ssk(ssk), "%s\n", __func__);
+ static DEFINE_RATELIMIT_STATE(_rs,
+ DEFAULT_RATELIMIT_INTERVAL,
+ DEFAULT_RATELIMIT_BURST);
memset(&wr, 0, sizeof(wr));
wr.sg_list = NULL;
wr.num_sge = 0;
wr.opcode = IB_WR_RDMA_WRITE;
+ wr.send_flags = IB_SEND_SIGNALED;
rc = ib_post_send(ssk->qp, &wr, &bad_wr);
if (rc) {
- sdp_dbg(sk_ssk(ssk),
- "ib_post_keepalive failed with status %d.\n", rc);
- sdp_set_error(sk_ssk(ssk), -ECONNRESET);
+ if (__ratelimit(&_rs))
+ sdp_warn(sk_ssk(ssk),
+ "ib_post_keepalive "
+ "failed with status %d.\n", rc);
+ } else {
+ sdp_cnt(sdp_keepalive_probes_sent);
}
- sdp_cnt(sdp_keepalive_probes_sent);
+ sdp_xmit_poll(ssk, 1);
}
static void sdp_tx_cq_event_handler(struct ib_event *event, void *data)