aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/net
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2008-10-15 04:17:48 +0100
committerMichael Brown <mcb30@etherboot.org>2008-10-16 05:13:40 +0100
commit3a505dfc350cc9c720c170660f0c779ec32a4bfd (patch)
tree15616d0540523e1f43f22ca67f4e0bba46923359 /src/drivers/net
parent6b9cc2555688e716387c02ecfe4569d2a73a7208 (diff)
downloadipxe-3a505dfc350cc9c720c170660f0c779ec32a4bfd.tar.gz
[netdevice] Change link-layer push() and pull() methods to take raw types
EFI requires us to be able to specify the source address for individual transmitted packets, and to be able to extract the destination address on received packets. Take advantage of this to rationalise the push() and pull() methods so that push() takes a (dest,source,proto) tuple and pull() returns a (dest,source,proto) tuple.
Diffstat (limited to 'src/drivers/net')
-rw-r--r--src/drivers/net/ipoib.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/drivers/net/ipoib.c b/src/drivers/net/ipoib.c
index 47090bb27..812c11c95 100644
--- a/src/drivers/net/ipoib.c
+++ b/src/drivers/net/ipoib.c
@@ -153,21 +153,20 @@ static struct ipoib_mac ipoib_broadcast = {
* Add IPoIB link-layer header
*
* @v iobuf I/O buffer
- * @v netdev Network device
- * @v net_protocol Network-layer protocol
* @v ll_dest Link-layer destination address
+ * @v ll_source Source link-layer address
+ * @v net_proto Network-layer protocol, in network-byte order
+ * @ret rc Return status code
*/
-static int ipoib_push ( struct io_buffer *iobuf,
- struct net_device *netdev __unused,
- struct net_protocol *net_protocol,
- const void *ll_dest ) {
+static int ipoib_push ( struct io_buffer *iobuf, const void *ll_dest,
+ const void *ll_source __unused, uint16_t net_proto ) {
struct ipoib_hdr *ipoib_hdr =
iob_push ( iobuf, sizeof ( *ipoib_hdr ) );
/* Build IPoIB header */
memcpy ( &ipoib_hdr->pseudo.peer, ll_dest,
sizeof ( ipoib_hdr->pseudo.peer ) );
- ipoib_hdr->real.proto = net_protocol->net_proto;
+ ipoib_hdr->real.proto = net_proto;
ipoib_hdr->real.reserved = 0;
return 0;
@@ -177,14 +176,13 @@ static int ipoib_push ( struct io_buffer *iobuf,
* Remove IPoIB link-layer header
*
* @v iobuf I/O buffer
- * @v netdev Network device
- * @v net_proto Network-layer protocol, in network-byte order
- * @v ll_source Source link-layer address
+ * @ret ll_dest Link-layer destination address
+ * @ret ll_source Source link-layer address
+ * @ret net_proto Network-layer protocol, in network-byte order
* @ret rc Return status code
*/
-static int ipoib_pull ( struct io_buffer *iobuf,
- struct net_device *netdev __unused,
- uint16_t *net_proto, const void **ll_source ) {
+static int ipoib_pull ( struct io_buffer *iobuf, const void **ll_dest,
+ const void **ll_source, uint16_t *net_proto ) {
struct ipoib_hdr *ipoib_hdr = iobuf->data;
/* Sanity check */
@@ -198,8 +196,9 @@ static int ipoib_pull ( struct io_buffer *iobuf,
iob_pull ( iobuf, sizeof ( *ipoib_hdr ) );
/* Fill in required fields */
- *net_proto = ipoib_hdr->real.proto;
+ *ll_dest = &ipoib_broadcast; /* Doesn't really exist in packet */
*ll_source = &ipoib_hdr->pseudo.peer;
+ *net_proto = ipoib_hdr->real.proto;
return 0;
}