summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2007-09-13 15:43:12 +0200
committerMichael Brown2007-09-13 15:43:12 +0200
commit30a19c3f1c51ff404d8de3196c4355fba3083c8e (patch)
tree013ebc0cb2c2249f9e0e0f6ea9740f97a4f89705
parentDump received packet, including GRH. (diff)
downloadipxe-30a19c3f1c51ff404d8de3196c4355fba3083c8e.tar.gz
ipxe-30a19c3f1c51ff404d8de3196c4355fba3083c8e.tar.xz
ipxe-30a19c3f1c51ff404d8de3196c4355fba3083c8e.zip
Can now both send and receive packets. LL header format not yet
fixed; still using a quick hack-up just to be able to pass through data.
-rw-r--r--src/drivers/net/mlx_ipoib/ib_mt25218.c2
-rw-r--r--src/drivers/net/mlx_ipoib/mt25218.c17
-rw-r--r--src/include/gpxe/infiniband.h37
-rw-r--r--src/net/infiniband.c11
4 files changed, 60 insertions, 7 deletions
diff --git a/src/drivers/net/mlx_ipoib/ib_mt25218.c b/src/drivers/net/mlx_ipoib/ib_mt25218.c
index 631a95cba..dcd49e45d 100644
--- a/src/drivers/net/mlx_ipoib/ib_mt25218.c
+++ b/src/drivers/net/mlx_ipoib/ib_mt25218.c
@@ -1587,12 +1587,14 @@ static void prep_send_wqe_buf(void *qph,
}
snd_wqe->mpointer[0].byte_count = cpu_to_be32(len);
+#if 0
DBG ( "prep_send_wqe_buf()\n" );
DBG ( "snd_wqe:\n" );
DBG_HD ( snd_wqe, sizeof ( *snd_wqe ) );
DBG ( "packet:\n" );
DBG_HD ( bus_to_virt(be32_to_cpu(snd_wqe->mpointer[0].local_addr_l)),
len );
+#endif
}
static void *alloc_ud_av(void)
diff --git a/src/drivers/net/mlx_ipoib/mt25218.c b/src/drivers/net/mlx_ipoib/mt25218.c
index de91dac65..a468f160e 100644
--- a/src/drivers/net/mlx_ipoib/mt25218.c
+++ b/src/drivers/net/mlx_ipoib/mt25218.c
@@ -248,13 +248,13 @@ static void mlx_poll ( struct net_device *netdev ) {
}
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 );
@@ -392,6 +392,7 @@ static int mlx_probe ( struct pci_device *pci,
const struct pci_device_id *id __unused ) {
struct net_device *netdev;
struct mlx_nic *mlx;
+ struct ib_mac *mac;
int rc;
/* Allocate net device */
@@ -410,7 +411,9 @@ static int mlx_probe ( struct pci_device *pci,
/* 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 )
diff --git a/src/include/gpxe/infiniband.h b/src/include/gpxe/infiniband.h
index 126113a74..11cec1894 100644
--- a/src/include/gpxe/infiniband.h
+++ b/src/include/gpxe/infiniband.h
@@ -14,6 +14,43 @@
#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
diff --git a/src/net/infiniband.c b/src/net/infiniband.c
index bcfac292d..c7fabd0ee 100644
--- a/src/net/infiniband.c
+++ b/src/net/infiniband.c
@@ -70,6 +70,17 @@ static int ib_tx ( struct io_buffer *iobuf, struct net_device *netdev,
* 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 */