diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-08-04 17:07:45 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-08-04 17:07:45 +0200 |
commit | 51bb7c6f315dba4044eb2ece5c1312362674d7fb (patch) | |
tree | fff3eeadb6eb04edee21340ecdcdfc13da3115b4 /src/ipcpd/shim-eth-llc/main.c | |
parent | 44b55f0b03ffc6aff4f1c290b5687d5ac95ddbf9 (diff) | |
parent | 4931526cf9b5e40294e043deab856f25bf56c7cf (diff) | |
download | ouroboros-51bb7c6f315dba4044eb2ece5c1312362674d7fb.tar.gz ouroboros-51bb7c6f315dba4044eb2ece5c1312362674d7fb.zip |
Merged in dstaesse/ouroboros/be-blocking (pull request #185)
lib: Revise blocking I/O
Diffstat (limited to 'src/ipcpd/shim-eth-llc/main.c')
-rw-r--r-- | src/ipcpd/shim-eth-llc/main.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c index 9e315335..f98799a5 100644 --- a/src/ipcpd/shim-eth-llc/main.c +++ b/src/ipcpd/shim-eth-llc/main.c @@ -386,7 +386,7 @@ static int eth_llc_ipcp_send_frame(uint8_t dst_addr[MAC_SIZE], shim_data(_ipcp)->tx_offset = (shim_data(_ipcp)->tx_offset + 1) - & (SHM_BLOCKS_IN_MAP -1); + & (SHM_BUFFER_SIZE -1); #else device = (shim_data(_ipcp))->device; @@ -719,7 +719,7 @@ static void * eth_llc_ipcp_sdu_reader(void * o) MAC_SIZE) && memcmp(br_addr, &llc_frame->dst_hwaddr, MAC_SIZE)) { #if defined(PACKET_RX_RING) && defined(PACKET_TX_RING) - offset = (offset + 1) & (SHM_BLOCKS_IN_MAP - 1); + offset = (offset + 1) & (SHM_BUFFER_SIZE - 1); header->tp_status = TP_STATUS_KERNEL; #endif continue; @@ -730,7 +730,7 @@ static void * eth_llc_ipcp_sdu_reader(void * o) if (ntohs(length) > SHIM_ETH_LLC_MAX_SDU_SIZE) { /* Not an LLC packet. */ #if defined(PACKET_RX_RING) && defined(PACKET_TX_RING) - offset = (offset + 1) & (SHM_BLOCKS_IN_MAP - 1); + offset = (offset + 1) & (SHM_BUFFER_SIZE - 1); header->tp_status = TP_STATUS_KERNEL; #endif continue; @@ -758,7 +758,7 @@ static void * eth_llc_ipcp_sdu_reader(void * o) pthread_rwlock_unlock(&_ipcp->state_lock); #if defined(PACKET_RX_RING) && defined(PACKET_TX_RING) offset = (offset + 1) - & (SHM_BLOCKS_IN_MAP - 1); + & (SHM_BUFFER_SIZE - 1); header->tp_status = TP_STATUS_KERNEL; #endif continue; @@ -784,7 +784,7 @@ static void * eth_llc_ipcp_sdu_reader(void * o) pthread_rwlock_unlock(&_ipcp->state_lock); } #if defined(PACKET_RX_RING) && defined(PACKET_TX_RING) - offset = (offset + 1) & (SHM_BLOCKS_IN_MAP -1); + offset = (offset + 1) & (SHM_BUFFER_SIZE -1); header->tp_status = TP_STATUS_KERNEL; #endif } @@ -1009,8 +1009,8 @@ static int eth_llc_ipcp_bootstrap(struct dif_config * conf) req.tp_block_size = SHM_DU_BUFF_BLOCK_SIZE; req.tp_frame_size = SHM_DU_BUFF_BLOCK_SIZE; - req.tp_block_nr = SHM_BLOCKS_IN_MAP; - req.tp_frame_nr = SHM_BLOCKS_IN_MAP; + req.tp_block_nr = SHM_BUFFER_SIZE; + req.tp_frame_nr = SHM_BUFFER_SIZE; if (setsockopt(fd, SOL_PACKET, PACKET_RX_RING, (void *) &req, sizeof(req))) { @@ -1036,7 +1036,7 @@ static int eth_llc_ipcp_bootstrap(struct dif_config * conf) #if defined(PACKET_RX_RING) && defined(PACKET_TX_RING) shim_data(_ipcp)->rx_ring = mmap(NULL, 2 * SHM_DU_BUFF_BLOCK_SIZE - * SHM_BLOCKS_IN_MAP, + * SHM_BUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (shim_data(_ipcp)->rx_ring == NULL) { @@ -1045,7 +1045,7 @@ static int eth_llc_ipcp_bootstrap(struct dif_config * conf) return -1; } shim_data(_ipcp)->tx_ring = shim_data(_ipcp)->rx_ring - + (SHM_DU_BUFF_BLOCK_SIZE * SHM_BLOCKS_IN_MAP); + + (SHM_DU_BUFF_BLOCK_SIZE * SHM_BUFFER_SIZE); #endif |