Commit 6038178e authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Philipp Reisner

drbd: Change how the "handshake" packets are called

Packets of type P_HAND_SHAKE define which protocol versions and features
a node supports.  For clarity, call those packets P_CONNECTION_FEATURES
instead.

(This does not determine the features that a specific drbd device
supports, such as drbd protocol A, B, C.)
Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent e5d6f33a
...@@ -235,7 +235,7 @@ enum drbd_packet { ...@@ -235,7 +235,7 @@ enum drbd_packet {
P_INITIAL_META = 0xfff1, /* First Packet on the MetaSock */ P_INITIAL_META = 0xfff1, /* First Packet on the MetaSock */
P_INITIAL_DATA = 0xfff2, /* First Packet on the Socket */ P_INITIAL_DATA = 0xfff2, /* First Packet on the Socket */
P_HAND_SHAKE = 0xfffe /* FIXED for the next century! */ P_CONNECTION_FEATURES = 0xfffe /* FIXED for the next century! */
}; };
extern const char *cmdname(enum drbd_packet cmd); extern const char *cmdname(enum drbd_packet cmd);
...@@ -374,14 +374,14 @@ struct p_block_req { ...@@ -374,14 +374,14 @@ struct p_block_req {
/* /*
* commands with their own struct for additional fields: * commands with their own struct for additional fields:
* P_HAND_SHAKE * P_CONNECTION_FEATURES
* P_BARRIER * P_BARRIER
* P_BARRIER_ACK * P_BARRIER_ACK
* P_SYNC_PARAM * P_SYNC_PARAM
* ReportParams * ReportParams
*/ */
struct p_handshake { struct p_connection_features {
struct p_header head; /* Note: vnr will be ignored */ struct p_header head; /* Note: vnr will be ignored */
u32 protocol_min; u32 protocol_min;
u32 feature_flags; u32 feature_flags;
......
...@@ -2497,7 +2497,7 @@ int __init drbd_init(void) ...@@ -2497,7 +2497,7 @@ int __init drbd_init(void)
int err; int err;
BUILD_BUG_ON(sizeof(struct p_header80) != sizeof(struct p_header95)); BUILD_BUG_ON(sizeof(struct p_header80) != sizeof(struct p_header95));
BUILD_BUG_ON(sizeof(struct p_handshake) != 80); BUILD_BUG_ON(sizeof(struct p_connection_features) != 80);
if (minor_count < DRBD_MINOR_COUNT_MIN || minor_count > DRBD_MINOR_COUNT_MAX) { if (minor_count < DRBD_MINOR_COUNT_MIN || minor_count > DRBD_MINOR_COUNT_MAX) {
printk(KERN_ERR printk(KERN_ERR
...@@ -3149,8 +3149,8 @@ const char *cmdname(enum drbd_packet cmd) ...@@ -3149,8 +3149,8 @@ const char *cmdname(enum drbd_packet cmd)
return "InitialMeta"; return "InitialMeta";
if (cmd == P_INITIAL_DATA) if (cmd == P_INITIAL_DATA)
return "InitialData"; return "InitialData";
if (cmd == P_HAND_SHAKE) if (cmd == P_CONNECTION_FEATURES)
return "HandShake"; return "ConnectionFeatures";
if (cmd >= ARRAY_SIZE(cmdnames)) if (cmd >= ARRAY_SIZE(cmdnames))
return "Unknown"; return "Unknown";
return cmdnames[cmd]; return cmdnames[cmd];
......
...@@ -60,7 +60,7 @@ enum finish_epoch { ...@@ -60,7 +60,7 @@ enum finish_epoch {
FE_RECYCLED, FE_RECYCLED,
}; };
static int drbd_do_handshake(struct drbd_tconn *tconn); static int drbd_do_features(struct drbd_tconn *tconn);
static int drbd_do_auth(struct drbd_tconn *tconn); static int drbd_do_auth(struct drbd_tconn *tconn);
static int drbd_disconnected(int vnr, void *p, void *data); static int drbd_disconnected(int vnr, void *p, void *data);
...@@ -913,7 +913,7 @@ static int drbd_connect(struct drbd_tconn *tconn) ...@@ -913,7 +913,7 @@ static int drbd_connect(struct drbd_tconn *tconn)
/* NOT YET ... /* NOT YET ...
* sock->sk->sk_sndtimeo = tconn->net_conf->timeout*HZ/10; * sock->sk->sk_sndtimeo = tconn->net_conf->timeout*HZ/10;
* sock->sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; * sock->sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT;
* first set it to the P_HAND_SHAKE timeout, * first set it to the P_CONNECTION_FEATURES timeout,
* which we set to 4x the configured ping_timeout. */ * which we set to 4x the configured ping_timeout. */
sock->sk->sk_sndtimeo = sock->sk->sk_sndtimeo =
sock->sk->sk_rcvtimeo = tconn->net_conf->ping_timeo*4*HZ/10; sock->sk->sk_rcvtimeo = tconn->net_conf->ping_timeo*4*HZ/10;
...@@ -928,7 +928,7 @@ static int drbd_connect(struct drbd_tconn *tconn) ...@@ -928,7 +928,7 @@ static int drbd_connect(struct drbd_tconn *tconn)
tconn->last_received = jiffies; tconn->last_received = jiffies;
h = drbd_do_handshake(tconn); h = drbd_do_features(tconn);
if (h <= 0) if (h <= 0)
return h; return h;
...@@ -4176,10 +4176,10 @@ static int drbd_disconnected(int vnr, void *p, void *data) ...@@ -4176,10 +4176,10 @@ static int drbd_disconnected(int vnr, void *p, void *data)
* *
* for now, they are expected to be zero, but ignored. * for now, they are expected to be zero, but ignored.
*/ */
static int drbd_send_handshake(struct drbd_tconn *tconn) static int drbd_send_features(struct drbd_tconn *tconn)
{ {
/* ASSERT current == mdev->tconn->receiver ... */ /* ASSERT current == mdev->tconn->receiver ... */
struct p_handshake *p = tconn->data.sbuf; struct p_connection_features *p = tconn->data.sbuf;
int err; int err;
if (mutex_lock_interruptible(&tconn->data.mutex)) { if (mutex_lock_interruptible(&tconn->data.mutex)) {
...@@ -4195,7 +4195,7 @@ static int drbd_send_handshake(struct drbd_tconn *tconn) ...@@ -4195,7 +4195,7 @@ static int drbd_send_handshake(struct drbd_tconn *tconn)
memset(p, 0, sizeof(*p)); memset(p, 0, sizeof(*p));
p->protocol_min = cpu_to_be32(PRO_VERSION_MIN); p->protocol_min = cpu_to_be32(PRO_VERSION_MIN);
p->protocol_max = cpu_to_be32(PRO_VERSION_MAX); p->protocol_max = cpu_to_be32(PRO_VERSION_MAX);
err = _conn_send_cmd(tconn, 0, &tconn->data, P_HAND_SHAKE, err = _conn_send_cmd(tconn, 0, &tconn->data, P_CONNECTION_FEATURES,
&p->head, sizeof(*p), 0); &p->head, sizeof(*p), 0);
mutex_unlock(&tconn->data.mutex); mutex_unlock(&tconn->data.mutex);
return err; return err;
...@@ -4208,15 +4208,15 @@ static int drbd_send_handshake(struct drbd_tconn *tconn) ...@@ -4208,15 +4208,15 @@ static int drbd_send_handshake(struct drbd_tconn *tconn)
* -1 peer talks different language, * -1 peer talks different language,
* no point in trying again, please go standalone. * no point in trying again, please go standalone.
*/ */
static int drbd_do_handshake(struct drbd_tconn *tconn) static int drbd_do_features(struct drbd_tconn *tconn)
{ {
/* ASSERT current == tconn->receiver ... */ /* ASSERT current == tconn->receiver ... */
struct p_handshake *p = tconn->data.rbuf; struct p_connection_features *p = tconn->data.rbuf;
const int expect = sizeof(struct p_handshake) - sizeof(struct p_header80); const int expect = sizeof(struct p_connection_features) - sizeof(struct p_header80);
struct packet_info pi; struct packet_info pi;
int err; int err;
err = drbd_send_handshake(tconn); err = drbd_send_features(tconn);
if (err) if (err)
return 0; return 0;
...@@ -4224,14 +4224,14 @@ static int drbd_do_handshake(struct drbd_tconn *tconn) ...@@ -4224,14 +4224,14 @@ static int drbd_do_handshake(struct drbd_tconn *tconn)
if (err) if (err)
return 0; return 0;
if (pi.cmd != P_HAND_SHAKE) { if (pi.cmd != P_CONNECTION_FEATURES) {
conn_err(tconn, "expected HandShake packet, received: %s (0x%04x)\n", conn_err(tconn, "expected ConnectionFeatures packet, received: %s (0x%04x)\n",
cmdname(pi.cmd), pi.cmd); cmdname(pi.cmd), pi.cmd);
return -1; return -1;
} }
if (pi.size != expect) { if (pi.size != expect) {
conn_err(tconn, "expected HandShake length: %u, received: %u\n", conn_err(tconn, "expected ConnectionFeatures length: %u, received: %u\n",
expect, pi.size); expect, pi.size);
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment