2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-14 07:11:32 +00:00

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.
This commit is contained in:
Michael Brown 2007-09-13 14:43:12 +01:00
parent 03c90e183f
commit 30a19c3f1c
4 changed files with 60 additions and 7 deletions

View File

@ -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)

View File

@ -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 )

View File

@ -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

View File

@ -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 */