diff options
author | Michael Brown | 2010-10-07 17:03:16 +0200 |
---|---|---|
committer | Michael Brown | 2010-10-07 20:15:04 +0200 |
commit | 88dd921e24af0893734d4e197d646cfc7732ed54 (patch) | |
tree | 8ecbe7ef1e5d84b2243894769a9ab1251d5c56de /src/net/netdevice.c | |
parent | [int13] Fix typo in debug message (diff) | |
download | ipxe-88dd921e24af0893734d4e197d646cfc7732ed54.tar.gz ipxe-88dd921e24af0893734d4e197d646cfc7732ed54.tar.xz ipxe-88dd921e24af0893734d4e197d646cfc7732ed54.zip |
[netdevice] Pass both link-layer addresses in net_tx() and net_rx()
FCoE requires the use of fabric-provided MAC addresses, which breaks
the assumption that the net device's MAC address is implicitly the
source address for net_tx() and the (unicast) destination address for
net_rx().
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/netdevice.c')
-rw-r--r-- | src/net/netdevice.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/net/netdevice.c b/src/net/netdevice.c index bb8a5b28..894b7e79 100644 --- a/src/net/netdevice.c +++ b/src/net/netdevice.c @@ -607,6 +607,7 @@ struct net_device * last_opened_netdev ( void ) { * @v netdev Network device * @v net_protocol Network-layer protocol * @v ll_dest Destination link-layer address + * @v ll_source Source link-layer address * @ret rc Return status code * * Prepends link-layer headers to the I/O buffer and transmits the @@ -614,7 +615,8 @@ struct net_device * last_opened_netdev ( void ) { * ownership of the I/O buffer. */ int net_tx ( struct io_buffer *iobuf, struct net_device *netdev, - struct net_protocol *net_protocol, const void *ll_dest ) { + struct net_protocol *net_protocol, const void *ll_dest, + const void *ll_source ) { struct ll_protocol *ll_protocol = netdev->ll_protocol; int rc; @@ -626,7 +628,7 @@ int net_tx ( struct io_buffer *iobuf, struct net_device *netdev, netdev_poll ( netdev ); /* Add link-layer header */ - if ( ( rc = ll_protocol->push ( netdev, iobuf, ll_dest, netdev->ll_addr, + if ( ( rc = ll_protocol->push ( netdev, iobuf, ll_dest, ll_source, net_protocol->net_proto ) ) != 0 ) { free_iob ( iobuf ); return rc; @@ -642,17 +644,19 @@ int net_tx ( struct io_buffer *iobuf, struct net_device *netdev, * @v iobuf I/O buffer * @v netdev Network device * @v net_proto Network-layer protocol, in network-byte order + * @v ll_dest Destination link-layer address * @v ll_source Source link-layer address * @ret rc Return status code */ int net_rx ( struct io_buffer *iobuf, struct net_device *netdev, - uint16_t net_proto, const void *ll_source ) { + uint16_t net_proto, const void *ll_dest, const void *ll_source ) { struct net_protocol *net_protocol; /* Hand off to network-layer protocol, if any */ for_each_table_entry ( net_protocol, NET_PROTOCOLS ) { if ( net_protocol->net_proto == net_proto ) - return net_protocol->rx ( iobuf, netdev, ll_source ); + return net_protocol->rx ( iobuf, netdev, ll_dest, + ll_source ); } DBGC ( netdev, "NETDEV %p unknown network protocol %04x\n", @@ -707,7 +711,8 @@ static void net_step ( struct process *process __unused ) { /* Hand packet to network layer */ if ( ( rc = net_rx ( iob_disown ( iobuf ), netdev, - net_proto, ll_source ) ) != 0 ) { + net_proto, ll_dest, + ll_source ) ) != 0 ) { /* Record error for diagnosis */ netdev_rx_err ( netdev, NULL, rc ); } |