}
buf = get_rcv_wqe_buf(ib_cqe.wqe, 1);
memcpy ( iob_put ( iobuf, len ), buf, len );
- DBG ( "Received packet header:\n" );
- struct recv_wqe_st *rcv_wqe = ib_cqe.wqe;
- DBG_HD ( get_rcv_wqe_buf(ib_cqe.wqe, 0),
- be32_to_cpu(rcv_wqe->mpointer[0].byte_count) );
+ // DBG ( "Received packet header:\n" );
+ // struct recv_wqe_st *rcv_wqe = ib_cqe.wqe;
+ // DBG_HD ( get_rcv_wqe_buf(ib_cqe.wqe, 0),
+ // be32_to_cpu(rcv_wqe->mpointer[0].byte_count) );
- DBG ( "Received packet:\n" );
- DBG_HD ( iobuf->data, iob_len ( iobuf ) );
+ // DBG ( "Received packet:\n" );
+ // DBG_HD ( iobuf->data, iob_len ( iobuf ) );
netdev_rx ( netdev, iobuf );
const struct pci_device_id *id __unused ) {
struct net_device *netdev;
struct mlx_nic *mlx;
+ struct ib_mac *mac;
int rc;
/* Allocate net device */
/* Initialise hardware */
if ( ( rc = ipoib_init ( pci ) ) != 0 )
goto err_ipoib_init;
- memcpy ( netdev->ll_addr, ipoib_data.port_gid_raw, IB_ALEN );
+ mac = ( ( struct ib_mac * ) netdev->ll_addr );
+ mac->qpn = htonl ( ipoib_data.ipoib_qpn );
+ memcpy ( &mac->gid, ipoib_data.port_gid_raw, sizeof ( mac->gid ) );
/* Register network device */
if ( ( rc = register_netdev ( netdev ) ) != 0 )
#define IB_ALEN 20
#define IB_HLEN 24
+/** An Infiniband Global Identifier */
+struct ib_gid {
+ uint8_t bytes[16];
+};
+
+/** An Infiniband Global Route Header */
+struct ib_global_route_header {
+ /** IP version, traffic class, and flow label
+ *
+ * 4 bits : Version of the GRH
+ * 8 bits : Traffic class
+ * 20 bits : Flow label
+ */
+ uint32_t ipver_tclass_flowlabel;
+ /** Payload length */
+ uint16_t paylen;
+ /** Next header */
+ uint8_t nxthdr;
+ /** Hop limit */
+ uint8_t hoplmt;
+ /** Source GID */
+ struct ib_gid sgid;
+ /** Destiniation GID */
+ struct ib_gid dgid;
+} __attribute__ (( packed ));
+
+/** An Infiniband MAC address */
+struct ib_mac {
+ /** Queue pair number
+ *
+ * MSB must be zero; QPNs are only 24-bit.
+ */
+ uint32_t qpn;
+ /** Port GID */
+ struct ib_gid gid;
+} __attribute__ (( packed ));
+
/** An Infiniband header
*
* This data structure doesn't represent the on-wire format, but does
* network-layer protocol.
*/
static int ib_rx ( struct io_buffer *iobuf, struct net_device *netdev ) {
+
+ struct {
+ uint16_t proto;
+ uint16_t reserved;
+ } * header = iobuf->data;
+
+ iob_pull ( iobuf, sizeof ( *header ) );
+ return net_rx ( iobuf, netdev, header->proto, NULL );
+
+
+
struct ibhdr *ibhdr = iobuf->data;
/* Sanity check */