diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ipcpd/eth/eth.c | 6 | ||||
| -rw-r--r-- | src/ipcpd/udp/udp.c | 2 | ||||
| -rw-r--r-- | src/ipcpd/unicast/dt.c | 4 | ||||
| -rw-r--r-- | src/lib/dev.c | 14 | ||||
| -rw-r--r-- | src/lib/frct.c | 4 | ||||
| -rw-r--r-- | src/lib/ssm/pool.c | 16 | ||||
| -rw-r--r-- | src/lib/ssm/tests/pool_test.c | 12 |
7 files changed, 29 insertions, 29 deletions
diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c index e47e8689..70dc54d9 100644 --- a/src/ipcpd/eth/eth.c +++ b/src/ipcpd/eth/eth.c @@ -1182,7 +1182,7 @@ static void * eth_ipcp_packet_reader(void * o) FETCH_ADD_RELAXED(ð_data.stat.n_buf_f, 1); continue; } - buf = ssm_pk_buff_head_alloc(spb, ETH_HEADER_TOT_SIZE); + buf = ssm_pk_buff_push(spb, ETH_HEADER_TOT_SIZE); if (buf == NULL) { log_dbg("Failed to allocate header."); ipcp_spb_release(spb); @@ -1347,7 +1347,7 @@ static void * eth_ipcp_packet_reader(void * o) pthread_rwlock_unlock(ð_data.flows_lock); #ifndef HAVE_NETMAP - ssm_pk_buff_head_release(spb, ETH_HEADER_TOT_SIZE); + ssm_pk_buff_pop(spb, ETH_HEADER_TOT_SIZE); ssm_pk_buff_truncate(spb, length); #else if (ipcp_spb_reserve(&spb, length)) @@ -1418,7 +1418,7 @@ static void * eth_ipcp_packet_writer(void * o) len = ssm_pk_buff_len(spb); - if (ssm_pk_buff_head_alloc(spb, ETH_HEADER_TOT_SIZE) + if (ssm_pk_buff_push(spb, ETH_HEADER_TOT_SIZE) == NULL) { log_dbg("Failed to allocate header."); ipcp_spb_release(spb); diff --git a/src/ipcpd/udp/udp.c b/src/ipcpd/udp/udp.c index 8fba5a77..05f69c21 100644 --- a/src/ipcpd/udp/udp.c +++ b/src/ipcpd/udp/udp.c @@ -605,7 +605,7 @@ static void * udp_ipcp_packet_writer(void * o) continue; } - buf = ssm_pk_buff_head_alloc(spb, OUR_HEADER_LEN); + buf = ssm_pk_buff_push(spb, OUR_HEADER_LEN); if (buf == NULL) { log_dbg("Failed to allocate header."); ipcp_spb_release(spb); diff --git a/src/ipcpd/unicast/dt.c b/src/ipcpd/unicast/dt.c index 9f51b41f..cc54efa1 100644 --- a/src/ipcpd/unicast/dt.c +++ b/src/ipcpd/unicast/dt.c @@ -139,7 +139,7 @@ static void dt_pci_shrink(struct ssm_pk_buff * spb) { assert(spb); - ssm_pk_buff_head_release(spb, dt_pci_info.head_size); + ssm_pk_buff_pop(spb, dt_pci_info.head_size); } struct { @@ -849,7 +849,7 @@ int dt_write_packet(uint64_t dst_addr, return -EPERM; } - head = ssm_pk_buff_head_alloc(spb, dt_pci_info.head_size); + head = ssm_pk_buff_push(spb, dt_pci_info.head_size); if (head == NULL) { log_dbg("Failed to allocate DT header."); goto fail_write; diff --git a/src/lib/dev.c b/src/lib/dev.c index bf09c8a4..b202a85c 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -272,11 +272,11 @@ static int spb_encrypt(struct flow * flow, if (crypt_encrypt(flow->crypt, in, &out) < 0) goto fail_encrypt; - head = ssm_pk_buff_head_alloc(spb, flow->headsz); + head = ssm_pk_buff_push(spb, flow->headsz); if (head == NULL) goto fail_alloc; - tail = ssm_pk_buff_tail_alloc(spb, flow->tailsz); + tail = ssm_pk_buff_push_tail(spb, flow->tailsz); if (tail == NULL) goto fail_alloc; @@ -308,8 +308,8 @@ static int spb_decrypt(struct flow * flow, return -ENOMEM; - head = ssm_pk_buff_head_release(spb, flow->headsz) + flow->headsz; - ssm_pk_buff_tail_release(spb, flow->tailsz); + head = ssm_pk_buff_pop(spb, flow->headsz) + flow->headsz; + ssm_pk_buff_pop_tail(spb, flow->tailsz); memcpy(head, out.data, out.len); @@ -1245,7 +1245,7 @@ static int chk_crc(struct ssm_pk_buff * spb) { uint32_t crc; uint8_t * head = ssm_pk_buff_head(spb); - uint8_t * tail = ssm_pk_buff_tail_release(spb, CRCLEN); + uint8_t * tail = ssm_pk_buff_pop_tail(spb, CRCLEN); mem_hash(HASH_CRC32, &crc, head, tail - head); @@ -1257,7 +1257,7 @@ static int add_crc(struct ssm_pk_buff * spb) uint8_t * head; uint8_t * tail; - tail = ssm_pk_buff_tail_alloc(spb, CRCLEN); + tail = ssm_pk_buff_push_tail(spb, CRCLEN); if (tail == NULL) return -ENOMEM; @@ -1522,7 +1522,7 @@ ssize_t flow_read(int fd, } else { if (partrd) { memcpy(buf, packet, count); - ssm_pk_buff_head_release(spb, n); + ssm_pk_buff_pop(spb, n); pthread_rwlock_wrlock(&proc.lock); flow->part_idx = idx; diff --git a/src/lib/frct.c b/src/lib/frct.c index 4d14362e..c0fdd703 100644 --- a/src/lib/frct.c +++ b/src/lib/frct.c @@ -700,7 +700,7 @@ static int __frcti_snd(struct frcti * frcti, timerwheel_move(); - pci = (struct frct_pci *) ssm_pk_buff_head_alloc(spb, FRCT_PCILEN); + pci = (struct frct_pci *) ssm_pk_buff_push(spb, FRCT_PCILEN); if (pci == NULL) return -ENOMEM; @@ -813,7 +813,7 @@ static void __frcti_rcv(struct frcti * frcti, clock_gettime(PTHREAD_COND_CLOCK, &now); - pci = (struct frct_pci *) ssm_pk_buff_head_release(spb, FRCT_PCILEN); + pci = (struct frct_pci *) ssm_pk_buff_pop(spb, FRCT_PCILEN); idx = ssm_pk_buff_get_off(spb); seqno = ntoh32(pci->seqno); diff --git a/src/lib/ssm/pool.c b/src/lib/ssm/pool.c index 5265fb4d..5607a360 100644 --- a/src/lib/ssm/pool.c +++ b/src/lib/ssm/pool.c @@ -811,8 +811,8 @@ size_t ssm_pk_buff_len(const struct ssm_pk_buff * spb) return spb->pk_tail - spb->pk_head; } -uint8_t * ssm_pk_buff_head_alloc(struct ssm_pk_buff * spb, - size_t size) +uint8_t * ssm_pk_buff_push(struct ssm_pk_buff * spb, + size_t size) { assert(spb != NULL); @@ -824,8 +824,8 @@ uint8_t * ssm_pk_buff_head_alloc(struct ssm_pk_buff * spb, return spb->data + spb->pk_head; } -uint8_t * ssm_pk_buff_tail_alloc(struct ssm_pk_buff * spb, - size_t size) +uint8_t * ssm_pk_buff_push_tail(struct ssm_pk_buff * spb, + size_t size) { uint8_t * buf; @@ -841,8 +841,8 @@ uint8_t * ssm_pk_buff_tail_alloc(struct ssm_pk_buff * spb, return buf; } -uint8_t * ssm_pk_buff_head_release(struct ssm_pk_buff * spb, - size_t size) +uint8_t * ssm_pk_buff_pop(struct ssm_pk_buff * spb, + size_t size) { uint8_t * buf; @@ -856,8 +856,8 @@ uint8_t * ssm_pk_buff_head_release(struct ssm_pk_buff * spb, return buf; } -uint8_t * ssm_pk_buff_tail_release(struct ssm_pk_buff * spb, - size_t size) +uint8_t * ssm_pk_buff_pop_tail(struct ssm_pk_buff * spb, + size_t size) { assert(spb != NULL); assert(!(size > spb->pk_tail - spb->pk_head)); diff --git a/src/lib/ssm/tests/pool_test.c b/src/lib/ssm/tests/pool_test.c index 3fc19cd5..0f9db24d 100644 --- a/src/lib/ssm/tests/pool_test.c +++ b/src/lib/ssm/tests/pool_test.c @@ -741,14 +741,14 @@ static int test_ssm_pk_buff_operations(void) memcpy(head, data, dlen); - tail = ssm_pk_buff_tail_alloc(spb, 32); + tail = ssm_pk_buff_push_tail(spb, 32); if (tail == NULL) { - printf("Tail_alloc failed.\n"); + printf("push_tail failed.\n"); goto fail_ops; } if (ssm_pk_buff_len(spb) != POOL_256 + 32) { - printf("Length after tail_alloc: %zu.\n", + printf("Length after push_tail: %zu.\n", ssm_pk_buff_len(spb)); goto fail_ops; } @@ -758,14 +758,14 @@ static int test_ssm_pk_buff_operations(void) goto fail_ops; } - tail = ssm_pk_buff_tail_release(spb, 32); + tail = ssm_pk_buff_pop_tail(spb, 32); if (tail == NULL) { - printf("Tail_release failed.\n"); + printf("pop_tail failed.\n"); goto fail_ops; } if (ssm_pk_buff_len(spb) != POOL_256) { - printf("Length after tail_release: %zu.\n", + printf("Length after pop_tail: %zu.\n", ssm_pk_buff_len(spb)); goto fail_ops; } |
