summaryrefslogtreecommitdiffstats
path: root/src/net/netdevice.c
diff options
context:
space:
mode:
authorMichael Brown2008-10-15 05:17:48 +0200
committerMichael Brown2008-10-16 06:13:40 +0200
commit3a505dfc350cc9c720c170660f0c779ec32a4bfd (patch)
tree15616d0540523e1f43f22ca67f4e0bba46923359 /src/net/netdevice.c
parent[netdevice] Split multicast hashing out into an mc_hash method (diff)
downloadipxe-3a505dfc350cc9c720c170660f0c779ec32a4bfd.tar.gz
ipxe-3a505dfc350cc9c720c170660f0c779ec32a4bfd.tar.xz
ipxe-3a505dfc350cc9c720c170660f0c779ec32a4bfd.zip
[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/net/netdevice.c')
-rw-r--r--src/net/netdevice.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/net/netdevice.c b/src/net/netdevice.c
index 3721b334..6ea90b41 100644
--- a/src/net/netdevice.c
+++ b/src/net/netdevice.c
@@ -439,6 +439,7 @@ struct net_device * find_netdev_by_location ( unsigned int bus_type,
*/
int net_tx ( struct io_buffer *iobuf, struct net_device *netdev,
struct net_protocol *net_protocol, const void *ll_dest ) {
+ struct ll_protocol *ll_protocol = netdev->ll_protocol;
int rc;
/* Force a poll on the netdevice to (potentially) clear any
@@ -449,8 +450,8 @@ int net_tx ( struct io_buffer *iobuf, struct net_device *netdev,
netdev_poll ( netdev );
/* Add link-layer header */
- if ( ( rc = netdev->ll_protocol->push ( iobuf, netdev, net_protocol,
- ll_dest ) ) != 0 ) {
+ if ( ( rc = ll_protocol->push ( iobuf, ll_dest, netdev->ll_addr,
+ net_protocol->net_proto ) ) != 0 ) {
free_iob ( iobuf );
return rc;
}
@@ -495,8 +496,9 @@ static void net_step ( struct process *process __unused ) {
struct net_device *netdev;
struct io_buffer *iobuf;
struct ll_protocol *ll_protocol;
- uint16_t net_proto;
+ const void *ll_dest;
const void *ll_source;
+ uint16_t net_proto;
int rc;
/* Poll and process each network device */
@@ -519,9 +521,9 @@ static void net_step ( struct process *process __unused ) {
/* Remove link-layer header */
ll_protocol = netdev->ll_protocol;
- if ( ( rc = ll_protocol->pull ( iobuf, netdev,
- &net_proto,
- &ll_source ) ) != 0 ) {
+ if ( ( rc = ll_protocol->pull ( iobuf, &ll_dest,
+ &ll_source,
+ &net_proto ) ) != 0 ) {
free_iob ( iobuf );
continue;
}