This patch covers the header file changes necessary to support iWARP:

The addr.h change specifies an inline function for extracting an iWARP
"gid" from a dev_addr structure. 

The ib_device.h change adds: a reference to an iw_cm_verbs provider
interface for iWARP devices, and a few device capability flags.

The iw_cm.h file specifies the interface to the iWARP CM.

Signed-off-by: Tom Tucker <[EMAIL PROTECTED]>

Index: rdma/ib_verbs.h
===================================================================
--- rdma/ib_verbs.h     (revision 5460)
+++ rdma/ib_verbs.h     (working copy)
@@ -101,6 +101,9 @@
        IB_DEVICE_RC_RNR_NAK_GEN        = (1<<12),
        IB_DEVICE_SRQ_RESIZE            = (1<<13),
        IB_DEVICE_N_NOTIFY_CQ           = (1<<14),
+       IB_DEVICE_ZERO_STAG             = (1<<15),
+       IB_DEVICE_MEM_WINDOW            = (1<<16),
+       IB_DEVICE_SEND_W_INV            = (1<<17),
 };
 
 enum ib_atomic_cap {
@@ -824,6 +827,7 @@
        struct ib_gid_cache   **gid_cache;
 };
 
+struct iw_cm_verbs;
 struct ib_device {
        struct device                *dma_device;
 
@@ -840,6 +844,8 @@
 
        u32                           flags;
 
+       struct iw_cm_verbs*           iwcm;
+
        int                        (*query_device)(struct ib_device *device,
                                                   struct ib_device_attr 
*device_attr);
        int                        (*query_port)(struct ib_device *device,
Index: rdma/iw_cm.h
===================================================================
--- rdma/iw_cm.h        (revision 0)
+++ rdma/iw_cm.h        (revision 0)
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2005 Network Appliance, Inc. All rights reserved.
+ * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#if !defined(IW_CM_H)
+#define IW_CM_H
+
+#include <linux/in.h>
+#include <rdma/ib_cm.h>
+
+struct iw_cm_id;
+struct iw_cm_event;
+
+enum iw_cm_event_type {
+       IW_CM_EVENT_CONNECT_REQUEST = 1, /* connect request received */
+       IW_CM_EVENT_CONNECT_REPLY,       /* reply from active connect request */
+       IW_CM_EVENT_ESTABLISHED,
+       IW_CM_EVENT_LLP_DISCONNECT,
+       IW_CM_EVENT_LLP_RESET,
+       IW_CM_EVENT_LLP_TIMEOUT,
+       IW_CM_EVENT_CLOSE
+};
+
+struct iw_cm_event {
+       enum iw_cm_event_type event;
+       int status;
+       u32 provider_id;
+       struct sockaddr_in local_addr;
+       struct sockaddr_in remote_addr;
+       void *private_data;
+       u8  private_data_len;
+};
+
+typedef int (*iw_cm_handler)(struct iw_cm_id *cm_id,
+                            struct iw_cm_event *event);
+
+enum iw_cm_state {
+       IW_CM_STATE_IDLE,             /* unbound, inactive */
+       IW_CM_STATE_LISTEN,           /* listen waiting for connect */
+       IW_CM_STATE_CONN_SENT,        /* outbound waiting for peer accept */
+       IW_CM_STATE_CONN_RECV,        /* inbound waiting for user accept */
+       IW_CM_STATE_ESTABLISHED,      /* established */
+};
+
+typedef void (*iw_event_handler)(struct iw_cm_id* cm_id,
+                                struct iw_cm_event* event);
+struct iw_cm_id {
+       iw_cm_handler           cm_handler;      /* client callback function */
+       void                    *context;        /* context to provide to 
client cb */
+       enum iw_cm_state        state;
+       struct ib_device        *device;         
+       struct ib_qp            *qp;
+       struct sockaddr_in      local_addr;
+       struct sockaddr_in      remote_addr;
+       u64                     provider_id;     /* device handle for this 
conn. */
+       iw_event_handler        event_handler;   /* callback for IW CM Provider 
events */
+};
+
+/**
+ * iw_create_cm_id - Allocate a communication identifier.
+ * @device: Device associated with the cm_id.  All related communication will
+ * be associated with the specified device.
+ * @cm_handler: Callback invoked to notify the user of CM events.
+ * @context: User specified context associated with the communication
+ *   identifier.
+ *
+ * Communication identifiers are used to track connection states, 
+ * addr resolution requests, and listen requests.
+ */
+struct iw_cm_id *iw_create_cm_id(struct ib_device *device,
+                                iw_cm_handler cm_handler,
+                                void *context);
+
+/* This is provided in the event generated when 
+ * a remote peer accepts our connect request
+ */
+
+struct iw_cm_verbs {
+       int                        (*connect)(struct iw_cm_id* cm_id,
+                                             const void* private_data,
+                                             u8 private_data_len);
+       
+       int                        (*disconnect)(struct iw_cm_id* cm_id, 
+                                                int abrupt);
+
+       int                        (*accept)(struct iw_cm_id*,
+                                            const void *private_data, 
+                                            u8 pdata_data_len); 
+
+       int                        (*reject)(struct iw_cm_id* cm_id, 
+                                            const void* private_data, 
+                                            u8 private_data_len); 
+
+       int                        (*getpeername)(struct iw_cm_id* cm_id,
+                                                 struct sockaddr_in* 
local_addr,
+                                                 struct sockaddr_in* 
remote_addr);
+
+       int                        (*create_listen)(struct iw_cm_id* cm_id,
+                                                    int backlog);
+
+       int                        (*destroy_listen)(struct iw_cm_id* cm_id);
+
+};
+
+struct iw_cm_id *iw_create_cm_id(struct ib_device *device,
+                                iw_cm_handler cm_handler,
+                                void *context);
+void iw_destroy_cm_id(struct iw_cm_id *cm_id);
+int iw_cm_listen(struct iw_cm_id *cm_id, int backlog);
+int iw_cm_getpeername(struct iw_cm_id *cm_id,
+                     struct sockaddr_in* local_add,
+                     struct sockaddr_in* remote_addr);
+int iw_cm_reject(struct iw_cm_id *cm_id, 
+                const void *private_data,
+                u8 private_data_len);
+int iw_cm_accept(struct iw_cm_id *cm_id,
+                const void *private_data,
+                u8 private_data_len);
+int iw_cm_connect(struct iw_cm_id *cm_id, 
+                 const void* pdata, u8 pdata_len);
+int iw_cm_disconnect(struct iw_cm_id *cm_id); 
+int iw_cm_bind_qp(struct iw_cm_id* cm_id, struct ib_qp* qp);
+
+#endif /* IW_CM_H */
Index: rdma/ib_addr.h
===================================================================
--- rdma/ib_addr.h      (revision 5460)
+++ rdma/ib_addr.h      (working copy)
@@ -113,5 +113,15 @@
        memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid);
 }
 
+static inline union ib_gid* iw_addr_get_sgid(struct rdma_dev_addr* rda)
+{
+       return (union ib_gid*)rda->src_dev_addr;
+}
+
+static inline union ib_gid* iw_addr_get_dgid(struct rdma_dev_addr* rda)
+{
+       return (union ib_gid*)rda->dst_dev_addr;
+}
+
 #endif /* IB_ADDR_H */
 

_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to