Due to a difference in the IB LND vs TCP LND header sizes, some
hard-coded offsets in the LNet dissector will not believe that the
payload is lustre. As such, the lustre protocol may not be decoded
under Infiniband.
This patch addresses this by adding a variable to applicable offsets
which is set to 0 for TCP, and 24 (extra bytes in IB LND header)
for Infiniband.
Signed-off-by: Doug Oucharek <doug.s.oucharek@intel.com>
Change-Id: I3783bbb563df109e160752d246db9bc5148cf132
Reviewed-on: http://review.whamcloud.com/6045
Tested-by: Hudson
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
#include <epan/dissectors/packet-tcp.h>
#include <epan/dissectors/packet-infiniband.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/dissectors/packet-infiniband.h>
+/* This value inidcates whether we are processing an Infiniband packet, or
+ TCP. It gets set to the extra bytes the IB header requires if IB,
+ or zero if TCP. */
+static guint ib_lnd_extra_bytes;
+
/* How much data has at least to be available to be able to determine the
* length of the lnet message.
* Note: This is only used for TCP-based LNet packets. Not used for Infiniband.
*/
#define LNET_HEADER_LEN 52
/* How much data has at least to be available to be able to determine the
* length of the lnet message.
* Note: This is only used for TCP-based LNet packets. Not used for Infiniband.
*/
#define LNET_HEADER_LEN 52
-#define LNET_NID_DEST_OFFSET 24
-#define LNET_NID_SRC_OFFSET 32
-#define LNET_MSG_TYPE_OFFSET 48
-#define LNET_PTL_INDEX_OFFSET_PUT 88
+#define LNET_NID_DEST_OFFSET (24 + ib_lnd_extra_bytes)
+#define LNET_NID_SRC_OFFSET (32 + ib_lnd_extra_bytes)
+#define LNET_MSG_TYPE_OFFSET (48 + ib_lnd_extra_bytes)
+#define LNET_PTL_INDEX_OFFSET_PUT (88 + ib_lnd_extra_bytes)
+
+#define EXTRA_IB_HEADER_SIZE 24
/* TCP ports used for LNet. */
static guint global_lnet_tcp_port = 988;
static guint lnet_tcp_port = 988;
/* TCP ports used for LNet. */
static guint global_lnet_tcp_port = 988;
static guint lnet_tcp_port = 988;
-/* This boolean inidcates whether we are processing an Infiniband packet, or
- TCP. */
-static guint ib_packet;
-
void proto_reg_handoff_lnet(void);
/* Define the lnet proto */
void proto_reg_handoff_lnet(void);
/* Define the lnet proto */
if (!csum)
proto_tree_add_text(tree, tvb, offset, 4, "Checksum Disabled");
else {
if (!csum)
proto_tree_add_text(tree, tvb, offset, 4, "Checksum Disabled");
else {
+ if (ib_lnd_extra_bytes)
proto_tree_add_item(tree, hf_lnet_ib_csum, tvb, offset,
4, little_endian);
else
proto_tree_add_item(tree, hf_lnet_ib_csum, tvb, offset,
4, little_endian);
else
guint32 plen;
/* Get the payload length */
guint32 plen;
/* Get the payload length */
- plen = tvb_get_letohl(tvb,offset+28+24); /* 24 = ksm header,
+ plen = tvb_get_letohl(tvb, offset + 28 + 24 + ib_lnd_extra_bytes);
+ /* 24 = ksm header,
28 = the rest of the
headers */
/* That length doesn't include the header; add that in. */
28 = the rest of the
headers */
/* That length doesn't include the header; add that in. */
- return plen + 72 +24 ; /* +24 == ksock msg header.. :D */
+ return plen + 72 + 24 + ib_lnd_extra_bytes; /* +24 == ksock msg
+ header.. :D */
/* TODO : correct this, now we do a difference between packet with
NOOP and others .. but I don't find how to use pdu_dissect with
a variable length<=LNET_HEADER_LEN */
/* TODO : correct this, now we do a difference between packet with
NOOP and others .. but I don't find how to use pdu_dissect with
a variable length<=LNET_HEADER_LEN */
+ ib_lnd_extra_bytes = 0;
switch(tvb_get_letohl(tvb,0)){
case KSOCK_MSG_NOOP:
switch(tvb_get_letohl(tvb,0)){
case KSOCK_MSG_NOOP:
- /*g_print("ksock noop %d \n", pinfo->fd->num);*/
tcp_dissect_pdus(tvb,pinfo,tree,TRUE,0, get_noop_message_len,dissect_ksock_msg_noop);
break;
case KSOCK_MSG_LNET:
tcp_dissect_pdus(tvb,pinfo,tree,TRUE,0, get_noop_message_len,dissect_ksock_msg_noop);
break;
case KSOCK_MSG_LNET:
- ib_packet = 1;
- dissect_lnet_message(tvb, pinfo, tree);
+ ib_lnd_extra_bytes = EXTRA_IB_HEADER_SIZE;
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, LNET_HEADER_LEN,
+ get_lnet_message_len, dissect_lnet_message);
return tvb_length(tvb);
}
return tvb_length(tvb);
}
lnet_tree = proto_item_add_subtree(ti,ett_lnet); /* add the subtree*/
lnet_tree = proto_item_add_subtree(ti,ett_lnet); /* add the subtree*/
+ if (ib_lnd_extra_bytes) {
offset = dissect_ib_msg(tvb, lnet_tree, offset);
if (offset == 0) {
/* There was no LNet payload, only ob2lnd. */
offset = dissect_ib_msg(tvb, lnet_tree, offset);
if (offset == 0) {
/* There was no LNet payload, only ob2lnd. */
- msg_filler_length = 72 - offset + 24 ;
+ msg_filler_length = 72 - offset + 24 + ib_lnd_extra_bytes;
if ( msg_filler_length > 72)
return ;
/* +24 : ksosck_message take 24bytes, and allready in offset */
if ( msg_filler_length > 72)
return ;
/* +24 : ksosck_message take 24bytes, and allready in offset */