From eb3ca2a36f0c613aea5c2f02762bc608d5ec785c Mon Sep 17 00:00:00 2001 From: Joshua Oreman Date: Mon, 15 Jun 2009 11:37:43 -0700 Subject: [netdevice] Add netdev argument to link-layer push and pull handlers In order to construct outgoing link-layer frames or parse incoming ones properly, some protocols (such as 802.11) need more state than is available in the existing variables passed to the link-layer protocol handlers. To remedy this, add struct net_device *netdev as the first argument to each of these functions, so that more information can be fetched from the link layer-private part of the network device. Updated all three call sites (netdevice.c, efi_snp.c, pxe_undi.c) and both implementations (ethernet.c, ipoib.c) of ll_protocol to use the new argument. Signed-off-by: Michael Brown --- src/net/ethernet.c | 8 ++++++-- src/net/netdevice.c | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/net') diff --git a/src/net/ethernet.c b/src/net/ethernet.c index 812da8647..6c5f7879d 100644 --- a/src/net/ethernet.c +++ b/src/net/ethernet.c @@ -43,13 +43,15 @@ static uint8_t eth_broadcast[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; /** * Add Ethernet link-layer header * + * @v netdev Network device * @v iobuf I/O buffer * @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 eth_push ( struct io_buffer *iobuf, const void *ll_dest, +static int eth_push ( struct net_device *netdev __unused, + struct io_buffer *iobuf, const void *ll_dest, const void *ll_source, uint16_t net_proto ) { struct ethhdr *ethhdr = iob_push ( iobuf, sizeof ( *ethhdr ) ); @@ -64,13 +66,15 @@ static int eth_push ( struct io_buffer *iobuf, const void *ll_dest, /** * Remove Ethernet link-layer header * + * @v netdev Network device * @v iobuf I/O buffer * @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 eth_pull ( struct io_buffer *iobuf, const void **ll_dest, +static int eth_pull ( struct net_device *netdev __unused, + struct io_buffer *iobuf, const void **ll_dest, const void **ll_source, uint16_t *net_proto ) { struct ethhdr *ethhdr = iobuf->data; diff --git a/src/net/netdevice.c b/src/net/netdevice.c index 77edbcd37..c3551ea42 100644 --- a/src/net/netdevice.c +++ b/src/net/netdevice.c @@ -509,7 +509,7 @@ int net_tx ( struct io_buffer *iobuf, struct net_device *netdev, netdev_poll ( netdev ); /* Add link-layer header */ - if ( ( rc = ll_protocol->push ( iobuf, ll_dest, netdev->ll_addr, + if ( ( rc = ll_protocol->push ( netdev, iobuf, ll_dest, netdev->ll_addr, net_protocol->net_proto ) ) != 0 ) { free_iob ( iobuf ); return rc; @@ -581,8 +581,8 @@ static void net_step ( struct process *process __unused ) { /* Remove link-layer header */ ll_protocol = netdev->ll_protocol; - if ( ( rc = ll_protocol->pull ( iobuf, &ll_dest, - &ll_source, + if ( ( rc = ll_protocol->pull ( netdev, iobuf, + &ll_dest, &ll_source, &net_proto ) ) != 0 ) { free_iob ( iobuf ); continue; -- cgit v1.2.3-55-g7522