mirror of
https://github.com/ipxe/ipxe
synced 2026-04-16 03:00:10 +03:00
[netdevice] Allow link layer to report broadcast/multicast packets via pull()
Allow the link layer to directly report whether or not a packet is multicast or broadcast at the time of calling pull(), rather than relying on heuristics to determine this at a later stage. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
+8
-4
@@ -678,17 +678,19 @@ int net_tx ( struct io_buffer *iobuf, struct net_device *netdev,
|
||||
* @v net_proto Network-layer protocol, in network-byte order
|
||||
* @v ll_dest Destination link-layer address
|
||||
* @v ll_source Source link-layer address
|
||||
* @v flags Packet flags
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int net_rx ( struct io_buffer *iobuf, struct net_device *netdev,
|
||||
uint16_t net_proto, const void *ll_dest, const void *ll_source ) {
|
||||
uint16_t net_proto, const void *ll_dest, const void *ll_source,
|
||||
unsigned int flags ) {
|
||||
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_dest,
|
||||
ll_source );
|
||||
ll_source, flags );
|
||||
}
|
||||
|
||||
DBGC ( netdev, "NETDEV %s unknown network protocol %04x\n",
|
||||
@@ -710,6 +712,7 @@ void net_poll ( void ) {
|
||||
const void *ll_dest;
|
||||
const void *ll_source;
|
||||
uint16_t net_proto;
|
||||
unsigned int flags;
|
||||
int rc;
|
||||
|
||||
/* Poll and process each network device */
|
||||
@@ -743,7 +746,8 @@ void net_poll ( void ) {
|
||||
ll_protocol = netdev->ll_protocol;
|
||||
if ( ( rc = ll_protocol->pull ( netdev, iobuf,
|
||||
&ll_dest, &ll_source,
|
||||
&net_proto ) ) != 0 ) {
|
||||
&net_proto,
|
||||
&flags ) ) != 0 ) {
|
||||
free_iob ( iobuf );
|
||||
continue;
|
||||
}
|
||||
@@ -751,7 +755,7 @@ void net_poll ( void ) {
|
||||
/* Hand packet to network layer */
|
||||
if ( ( rc = net_rx ( iob_disown ( iobuf ), netdev,
|
||||
net_proto, ll_dest,
|
||||
ll_source ) ) != 0 ) {
|
||||
ll_source, flags ) ) != 0 ) {
|
||||
/* Record error for diagnosis */
|
||||
netdev_rx_err ( netdev, NULL, rc );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user