[openib-general] ib_mad: Implement snoop_mad in receive handler for locally generated traps
Hal Rosenstock
halr at voltaire.com
Wed Oct 13 11:31:19 PDT 2004
ib_mad: Implement snoop_mad in receive handler for locally generated
traps
Index: include/ib_verbs.h
===================================================================
--- include/ib_verbs.h (revision 970)
+++ include/ib_verbs.h (working copy)
@@ -638,10 +638,14 @@
enum ib_mad_result {
IB_MAD_RESULT_FAILURE = 0, /* (!SUCCESS is the important
flag) */
IB_MAD_RESULT_SUCCESS = 1 << 0, /* MAD was successfully
processed */
- IB_MAD_RESULT_REPLY = 1 << 1, /* Reply packet needs to be
sent */
- IB_MAD_RESULT_CONSUMED = 1 << 2 /* Packet consumed: stop
processing */
+ IB_MAD_RESULT_REPLY = 1 << 1 /* Reply packet needs to be
sent */
};
+enum ib_snoop_mad_result {
+ IB_SNOOP_MAD_IGNORED,
+ IB_SNOOP_MAD_CONSUMED
+};
+
#define IB_DEVICE_NAME_MAX 64
struct ib_device {
@@ -760,6 +764,10 @@
u16 source_lid,
struct ib_mad *in_mad,
struct ib_mad *out_mad);
+ int (*snoop_mad)(struct ib_device *device,
+ u8 port_num,
+ u16 source_lid,
+ struct ib_mad *mad);
struct class_device class_dev;
u8 node_type;
Index: access/ib_mad.c
===================================================================
--- access/ib_mad.c (revision 984)
+++ access/ib_mad.c (working copy)
@@ -926,6 +926,16 @@
if (!validate_mad(recv->header.recv_buf.mad, qp_num))
goto ret;
+ /* Snoop MAD ? */
+ if (port_priv->device->snoop_mad) {
+ if (port_priv->device->snoop_mad(port_priv->device,
+ port_priv->port_num,
+ wc->slid,
+
recv->header.recv_buf.mad)) {
+ goto ret;
+ }
+ }
+
spin_lock_irqsave(&port_priv->reg_lock, flags);
/* Determine corresponding MAD agent for incoming receive MAD */
solicited = solicited_mad(recv->header.recv_buf.mad);
More information about the general
mailing list