From bac97eb979e5048b065f01c6b5e7d63ffc3abf48 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sat, 29 Apr 2006 17:17:43 +0000 Subject: Change semantics of network API so that packet-absorbing calls *always* take ownership of the packet, rather than doing so only if they return success. This breaks semantic compatibility with Linux's hard_start_xmit() method, but means that we don't have to worry so much about error cases. Split mechanism of processing received packets (net_rx_process()) out from policy (net_step()), preparatory to putting net_step() in a separate object. --- src/include/gpxe/netdevice.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/include') diff --git a/src/include/gpxe/netdevice.h b/src/include/gpxe/netdevice.h index 6db95bbb6..1879bf1ba 100644 --- a/src/include/gpxe/netdevice.h +++ b/src/include/gpxe/netdevice.h @@ -103,15 +103,14 @@ struct net_protocol { int ( * route ) ( const struct pk_buff *pkb, struct net_header *nethdr ); /** - * Handle received packets + * Process received packet * * @v pkb Packet buffer * @ret rc Return status code * - * If this method returns success, it has taken ownership of - * the packet buffer. + * This method takes ownership of the packet buffer. */ - int ( * rx ) ( struct pk_buff *pkb ); + int ( * rx_process ) ( struct pk_buff *pkb ); /** * Transcribe network-layer address * @@ -240,9 +239,9 @@ struct net_device { * This method should cause the hardware to initiate * transmission of the packet buffer. * - * If the method returns success, ownership of the packet - * buffer is transferred to the @c net_device, which must - * eventually call free_pkb() to release the buffer. + * Ownership of the packet buffer is transferred to the @c + * net_device, which must eventually call free_pkb() to + * release the buffer. */ int ( * transmit ) ( struct net_device *netdev, struct pk_buff *pkb ); /** Poll for received packet @@ -332,9 +331,8 @@ free_netdev ( struct net_device *netdev __attribute__ (( unused )) ) { * @ret rc Return status code * * Transmits the packet via the specified network device. The - * link-layer header must already have been filled in. If this - * function returns success, it has taken ownership of the packet - * buffer. + * link-layer header must already have been filled in. This function + * takes ownership of the packet buffer. */ static inline int netdev_transmit ( struct net_device *netdev, struct pk_buff *pkb ) { @@ -375,5 +373,6 @@ extern int net_transmit_via ( struct pk_buff *pkb, struct net_device *netdev ); extern int net_transmit ( struct pk_buff *pkb ); extern int net_poll ( void ); extern struct pk_buff * net_rx_dequeue ( void ); +extern int net_rx_process ( struct pk_buff *pkb ); #endif /* _GPXE_NETDEVICE_H */ -- cgit v1.2.3-55-g7522