*
* @v iob I/O buffer containing packet payload
* @v netdev Network device from which packet was received
- * @v ll_source Source link-layer address from which packet was received
+ * @V ll_dest Destination link-layer address
+ * @v ll_source Source link-layer address
* @ret rc Return status code
*
* The I/O buffer will have the EAPOL header pulled off it, so
* This function takes ownership of the I/O buffer passed to it.
*/
int ( * rx ) ( struct io_buffer *iob, struct net_device *netdev,
- const void *ll_source );
+ const void *ll_dest, const void *ll_source );
};
#define EAPOL_HANDLERS __table ( struct eapol_handler, "eapol_handlers" )
*
* @v iobuf I/O buffer
* @v netdev Network device
+ * @v ll_dest Link-layer destination address
* @v ll_source Link-layer source address
*
* This method takes ownership of the I/O buffer.
*/
int ( * rx ) ( struct io_buffer *iobuf, struct net_device *netdev,
- const void *ll_source );
+ const void *ll_dest, const void *ll_source );
/**
* Transcribe network-layer address
*
unsigned int location );
extern struct net_device * last_opened_netdev ( void );
extern 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 );
extern 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 );
/**
* Complete network transmission
pkt->mic );
return net_tx ( iob, ctx->dev->netdev, &eapol_protocol,
- ctx->dev->bssid );
+ ctx->dev->bssid, ctx->dev->netdev->ll_addr );
}
*
* @v iob I/O buffer
* @v netdev Network device
+ * @v ll_dest Link-layer destination address
* @v ll_source Source link-layer address
*/
static int eapol_key_rx ( struct io_buffer *iob, struct net_device *netdev,
+ const void *ll_dest __unused,
const void *ll_source )
{
struct net80211_device *dev = net80211_get ( netdev );
*/
static int aoecmd_tx ( struct aoe_command *aoecmd ) {
struct aoe_device *aoedev = aoecmd->aoedev;
+ struct net_device *netdev = aoedev->netdev;
struct io_buffer *iobuf;
struct aoehdr *aoehdr;
size_t cmd_len;
int rc;
/* Sanity check */
- assert ( aoedev->netdev != NULL );
+ assert ( netdev != NULL );
/* If we are transmitting anything that requires a response,
* start the retransmission timer. Do this before attempting
aoecmd->type->cmd ( aoecmd, iobuf->data, iob_len ( iobuf ) );
/* Send packet */
- if ( ( rc = net_tx ( iobuf, aoedev->netdev, &aoe_protocol,
- aoedev->target ) ) != 0 ) {
+ if ( ( rc = net_tx ( iobuf, netdev, &aoe_protocol, aoedev->target,
+ netdev->ll_addr ) ) != 0 ) {
DBGC ( aoedev, "AoE %s/%08x could not transmit: %s\n",
aoedev_name ( aoedev ), aoecmd->tag,
strerror ( rc ) );
*
* @v iobuf I/O buffer
* @v netdev Network device
+ * @v ll_dest Link-layer destination address
* @v ll_source Link-layer source address
* @ret rc Return status code
*
*/
static int aoe_rx ( struct io_buffer *iobuf,
struct net_device *netdev __unused,
+ const void *ll_dest __unused,
const void *ll_source ) {
struct aoehdr *aoehdr = iobuf->data;
struct aoe_command *aoecmd;
dest_net_addr, net_protocol->net_addr_len );
/* Transmit ARP request */
- if ( ( rc = net_tx ( iobuf, netdev, &arp_protocol,
- netdev->ll_broadcast ) ) != 0 )
+ if ( ( rc = net_tx ( iobuf, netdev, &arp_protocol,
+ netdev->ll_broadcast, netdev->ll_addr ) ) != 0 )
return rc;
return -ENOENT;
* details.
*/
static int arp_rx ( struct io_buffer *iobuf, struct net_device *netdev,
+ const void *ll_dest __unused,
const void *ll_source __unused ) {
struct arphdr *arphdr = iobuf->data;
struct arp_net_protocol *arp_net_protocol;
/* Send reply */
net_tx ( iob_disown ( iobuf ), netdev, &arp_protocol,
- arp_target_ha ( arphdr ) );
+ arp_target_ha ( arphdr ), netdev->ll_addr );
done:
free_iob ( iobuf );
*
* @v iob I/O buffer
* @v netdev Network device
+ * @v ll_dest Link-layer destination address
* @v ll_source Link-layer source address
*
* This function takes ownership of the I/O buffer passed to it.
*/
static int eapol_rx ( struct io_buffer *iob, struct net_device *netdev,
- const void *ll_source )
-{
+ const void *ll_dest, const void *ll_source ) {
struct eapol_frame *eapol = iob->data;
struct eapol_handler *handler;
for_each_table_entry ( handler, EAPOL_HANDLERS ) {
if ( handler->type == eapol->type ) {
iob_pull ( iob, EAPOL_HDR_LEN );
- return handler->rx ( iob, netdev, ll_source );
+ return handler->rx ( iob, netdev, ll_dest, ll_source );
}
}
/* Send response */
eth_slow_lacp_dump ( iobuf, netdev, "TX" );
- return net_tx ( iobuf, netdev, ð_slow_protocol, eth_slow_address );
+ return net_tx ( iobuf, netdev, ð_slow_protocol, eth_slow_address,
+ netdev->ll_addr );
}
/**
marker->marker.tlv.type = ETH_SLOW_TLV_MARKER_RESPONSE;
eth_slow_marker_dump ( iobuf, netdev, "TX" );
return net_tx ( iobuf, netdev, ð_slow_protocol,
- eth_slow_address );
+ eth_slow_address, netdev->ll_addr );
} else {
/* Discard all other marker packets */
free_iob ( iobuf );
*
* @v iobuf I/O buffer
* @v netdev Network device
+ * @v ll_dest Link-layer destination address
* @v ll_source Link-layer source address
* @ret rc Return status code
*/
static int eth_slow_rx ( struct io_buffer *iobuf,
struct net_device *netdev,
+ const void *ll_dest __unused,
const void *ll_source __unused ) {
union eth_slow_packet *eth_slow = iobuf->data;
/* Transmit packet */
if ( ( rc = net_tx ( iob_disown ( iobuf ), fcoe->netdev, &fcoe_protocol,
- fcoe->fcf_ll_addr ) ) != 0 ) {
+ fcoe->fcf_ll_addr, fcoe->netdev->ll_addr )) != 0){
DBGC ( fcoe, "FCoE %s could not transmit: %s\n",
fcoe->netdev->name, strerror ( rc ) );
goto done;
*
* @v iobuf I/O buffer
* @v netdev Network device
+ * @v ll_dest Link-layer destination address
* @v ll_source Link-layer source address
* @ret rc Return status code
*/
-static int fcoe_rx ( struct io_buffer *iobuf,
- struct net_device *netdev,
- const void *ll_source ) {
+static int fcoe_rx ( struct io_buffer *iobuf, struct net_device *netdev,
+ const void *ll_dest __unused, const void *ll_source ) {
struct fcoe_header *fcoehdr;
struct fcoe_footer *fcoeftr;
struct fcoe_port *fcoe;
ntohs ( iphdr->ident ), ntohs ( iphdr->chksum ) );
/* Hand off to link layer */
- if ( ( rc = net_tx ( iobuf, netdev, &ipv4_protocol, ll_dest ) ) != 0 ) {
+ if ( ( rc = net_tx ( iobuf, netdev, &ipv4_protocol, ll_dest,
+ netdev->ll_addr ) ) != 0 ) {
DBG ( "IPv4 could not transmit packet via %s: %s\n",
netdev->name, strerror ( rc ) );
return rc;
*
* @v iobuf I/O buffer
* @v netdev Network device
+ * @v ll_dest Link-layer destination address
* @v ll_source Link-layer destination source
*
* This function expects an IP4 network datagram. It processes the headers
* and sends it to the transport layer.
*/
-static int ipv4_rx ( struct io_buffer *iobuf, struct net_device *netdev __unused,
+static int ipv4_rx ( struct io_buffer *iobuf,
+ struct net_device *netdev __unused,
+ const void *ll_dest __unused,
const void *ll_source __unused ) {
struct iphdr *iphdr = iobuf->data;
size_t hdrlen;
}
/* Transmit packet */
- return net_tx ( iobuf, netdev, &ipv6_protocol, ll_dest );
+ return net_tx ( iobuf, netdev, &ipv6_protocol, ll_dest,
+ netdev->ll_addr );
err:
free_iob ( iobuf );
*
* @v iobuf I/O buffer
* @v netdev Network device
+ * @v ll_dest Link-layer destination address
* @v ll_source Link-layer source address
*
* This function processes a IPv6 packet
*/
static int ipv6_rx ( struct io_buffer *iobuf,
__unused struct net_device *netdev,
+ __unused const void *ll_dest,
__unused const void *ll_source ) {
struct ip6_header *ip6hdr = iobuf->data;
* @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
* 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;
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;
* @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",
/* 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 );
}
*
* @v iobuf I/O buffer
* @v netdev Network device
+ * @v ll_dest Link-layer destination address
* @v ll_source Link-layer source address
* @ret rc Return status code
*
*/
static int rarp_rx ( struct io_buffer *iobuf,
struct net_device *netdev __unused,
+ const void *ll_dest __unused,
const void *ll_source __unused ) {
free_iob ( iobuf );
return 0;
*
* @v iobuf I/O buffer
* @v netdev Network device
+ * @v ll_dest Link-layer destination address
* @v ll_source Link-layer source address
* @ret rc Return status code
*/
static int lotest_rx ( struct io_buffer *iobuf,
struct net_device *netdev __unused,
+ const void *ll_dest __unused,
const void *ll_source __unused ) {
free_iob ( iobuf );
return -ENOTSUP;
/* Transmit packet */
if ( ( rc = net_tx ( iob_disown ( iobuf ), sender,
- &lotest_protocol,
- receiver->ll_addr ) ) != 0 ) {
+ &lotest_protocol, receiver->ll_addr,
+ sender->ll_addr ) ) != 0 ) {
printf ( "\nFailed to transmit packet: %s",
strerror ( rc ) );
goto done;