mirror of
https://github.com/xcat2/xNBA.git
synced 2024-12-14 15:21:32 +00:00
Rename pkb_available() to pkb_tailroom() for consistency with Linux's
skb_tailroom(). Add pkb_headroom().
This commit is contained in:
parent
b7fcfe8ece
commit
18e5353bed
@ -437,10 +437,10 @@ static void undinet_poll ( struct net_device *netdev ) {
|
||||
/* Fragment will be dropped */
|
||||
goto done;
|
||||
}
|
||||
if ( frag_len > pkb_available ( pkb ) ) {
|
||||
if ( frag_len > pkb_tailroom ( pkb ) ) {
|
||||
DBGC ( undinic, "UNDINIC %p fragment too "
|
||||
"large\n", undinic );
|
||||
frag_len = pkb_available ( pkb );
|
||||
frag_len = pkb_tailroom ( pkb );
|
||||
}
|
||||
copy_from_real ( pkb_put ( pkb, frag_len ),
|
||||
undi_isr.Frame.segment,
|
||||
|
@ -137,12 +137,22 @@ static inline size_t pkb_len ( struct pk_buff *pkb ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate available space in a packet buffer
|
||||
* Calculate available space at start of a packet buffer
|
||||
*
|
||||
* @v pkb Packet buffer
|
||||
* @ret len Length of data available in buffer
|
||||
* @ret len Length of data available at start of buffer
|
||||
*/
|
||||
static inline size_t pkb_available ( struct pk_buff *pkb ) {
|
||||
static inline size_t pkb_headroom ( struct pk_buff *pkb ) {
|
||||
return ( pkb->data - pkb->head );
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate available space at end of a packet buffer
|
||||
*
|
||||
* @v pkb Packet buffer
|
||||
* @ret len Length of data available at end of buffer
|
||||
*/
|
||||
static inline size_t pkb_tailroom ( struct pk_buff *pkb ) {
|
||||
return ( pkb->end - pkb->tail );
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ static int tcp_senddata_conn ( struct tcp_connection *conn, int force_send ) {
|
||||
if ( TCP_CAN_SEND_DATA ( conn->tcp_state ) &&
|
||||
app && app->tcp_op->senddata ) {
|
||||
conn->tx_pkb = pkb;
|
||||
app->tcp_op->senddata ( app, pkb->data, pkb_available ( pkb ));
|
||||
app->tcp_op->senddata ( app, pkb->data, pkb_tailroom ( pkb ) );
|
||||
conn->tx_pkb = NULL;
|
||||
}
|
||||
|
||||
@ -364,8 +364,8 @@ int tcp_send ( struct tcp_application *app, const void *data, size_t len ) {
|
||||
}
|
||||
|
||||
/* Truncate length to fit packet buffer */
|
||||
if ( len > pkb_available ( pkb ) )
|
||||
len = pkb_available ( pkb );
|
||||
if ( len > pkb_tailroom ( pkb ) )
|
||||
len = pkb_tailroom ( pkb );
|
||||
|
||||
/* Copy payload */
|
||||
memmove ( pkb_put ( pkb, len ), data, len );
|
||||
|
@ -104,7 +104,7 @@ int udp_senddata ( struct udp_connection *conn ) {
|
||||
}
|
||||
pkb_reserve ( conn->tx_pkb, UDP_MAX_HLEN );
|
||||
rc = conn->udp_op->senddata ( conn, conn->tx_pkb->data,
|
||||
pkb_available ( conn->tx_pkb ) );
|
||||
pkb_tailroom ( conn->tx_pkb ) );
|
||||
if ( conn->tx_pkb )
|
||||
free_pkb ( conn->tx_pkb );
|
||||
return rc;
|
||||
@ -137,8 +137,8 @@ int udp_sendto ( struct udp_connection *conn, struct sockaddr_tcpip *peer,
|
||||
conn->tx_pkb = NULL;
|
||||
|
||||
/* Avoid overflowing TX buffer */
|
||||
if ( len > pkb_available ( pkb ) )
|
||||
len = pkb_available ( pkb );
|
||||
if ( len > pkb_tailroom ( pkb ) )
|
||||
len = pkb_tailroom ( pkb );
|
||||
|
||||
/* Copy payload */
|
||||
memmove ( pkb_put ( pkb, len ), data, len );
|
||||
|
Loading…
Reference in New Issue
Block a user