Remove extra parenthesis from return statements.
Signed-off-by: Ferruh Yigit <ferruhy@gmail.com>
errno = 0;
o[i] = strtoul(a, &end, 16);
if (errno != 0 || end == a || (end[0] != ':' && end[0] != 0))
- return (NULL);
+ return NULL;
a = end + 1;
} while (++i != sizeof (o) / sizeof (o[0]) && end[0] != 0);
/* Junk at the end of line */
if (end[0] != 0)
- return (NULL);
+ return NULL;
/* Support the format XX:XX:XX:XX:XX:XX */
if (i == ETHER_ADDR_LEN) {
while (i-- != 0) {
if (o[i] > UINT8_MAX)
- return (NULL);
+ return NULL;
ether_addr.ea_oct[i] = (uint8_t)o[i];
}
/* Support the format XXXX:XXXX:XXXX */
} else if (i == ETHER_ADDR_LEN / 2) {
while (i-- != 0) {
if (o[i] > UINT16_MAX)
- return (NULL);
+ return NULL;
ether_addr.ea_oct[i * 2] = (uint8_t)(o[i] >> 8);
ether_addr.ea_oct[i * 2 + 1] = (uint8_t)(o[i] & 0xff);
}
/* unknown format */
} else
- return (NULL);
+ return NULL;
return (struct ether_addr *)ðer_addr;
}
{
switch (af) {
case AF_INET:
- return (inet_pton4(src, dst));
+ return inet_pton4(src, dst);
case AF_INET6:
- return (inet_pton6(src, dst));
+ return inet_pton6(src, dst);
default:
errno = EAFNOSUPPORT;
- return (-1);
+ return -1;
}
/* NOTREACHED */
}
unsigned int new = *tp * 10 + (pch - digits);
if (new > 255)
- return (0);
+ return 0;
if (! saw_digit) {
if (++octets > 4)
- return (0);
+ return 0;
saw_digit = 1;
}
*tp = (unsigned char)new;
} else if (ch == '.' && saw_digit) {
if (octets == 4)
- return (0);
+ return 0;
*++tp = 0;
saw_digit = 0;
} else
- return (0);
+ return 0;
}
if (octets < 4)
- return (0);
+ return 0;
memcpy(dst, tmp, INADDRSZ);
- return (1);
+ return 1;
}
/* int
/* Leading :: requires some special handling. */
if (*src == ':')
if (*++src != ':')
- return (0);
+ return 0;
curtok = src;
saw_xdigit = count_xdigit = 0;
val = 0;
pch = strchr((xdigits = xdigits_u), ch);
if (pch != NULL) {
if (count_xdigit >= 4)
- return (0);
+ return 0;
val <<= 4;
val |= (pch - xdigits);
if (val > 0xffff)
- return (0);
+ return 0;
saw_xdigit = 1;
count_xdigit++;
continue;
curtok = src;
if (!saw_xdigit) {
if (colonp)
- return (0);
+ return 0;
colonp = tp;
continue;
} else if (*src == '\0') {
- return (0);
+ return 0;
}
if (tp + sizeof(int16_t) > endp)
- return (0);
+ return 0;
*tp++ = (unsigned char) ((val >> 8) & 0xff);
*tp++ = (unsigned char) (val & 0xff);
saw_xdigit = 0;
dbloct_count += 2;
break; /* '\0' was seen by inet_pton4(). */
}
- return (0);
+ return 0;
}
if (saw_xdigit) {
if (tp + sizeof(int16_t) > endp)
- return (0);
+ return 0;
*tp++ = (unsigned char) ((val >> 8) & 0xff);
*tp++ = (unsigned char) (val & 0xff);
dbloct_count++;
tp = endp;
}
if (tp != endp)
- return (0);
+ return 0;
memcpy(dst, tmp, IN6ADDRSZ);
- return (1);
+ return 1;
}
int
case BIN_OK:
if ( nd.type == INT8 && res1 <= INT8_MAX ) {
if (res) *(int8_t *)res = (int8_t) res1;
- return (buf-srcbuf);
+ return buf-srcbuf;
}
else if ( nd.type == INT16 && res1 <= INT16_MAX ) {
if (res) *(int16_t *)res = (int16_t) res1;
- return (buf-srcbuf);
+ return buf-srcbuf;
}
else if ( nd.type == INT32 && res1 <= INT32_MAX ) {
if (res) *(int32_t *)res = (int32_t) res1;
- return (buf-srcbuf);
+ return buf-srcbuf;
}
else if ( nd.type == INT64 && res1 <= INT64_MAX ) {
if (res) *(int64_t *)res = (int64_t) res1;
- return (buf-srcbuf);
+ return buf-srcbuf;
}
else if ( nd.type == UINT8 && res1 <= UINT8_MAX ) {
if (res) *(uint8_t *)res = (uint8_t) res1;
- return (buf-srcbuf);
+ return buf-srcbuf;
}
else if (nd.type == UINT16 && res1 <= UINT16_MAX ) {
if (res) *(uint16_t *)res = (uint16_t) res1;
- return (buf-srcbuf);
+ return buf-srcbuf;
}
else if ( nd.type == UINT32 && res1 <= UINT32_MAX ) {
if (res) *(uint32_t *)res = (uint32_t) res1;
- return (buf-srcbuf);
+ return buf-srcbuf;
}
else if ( nd.type == UINT64 ) {
if (res) *(uint64_t *)res = res1;
- return (buf-srcbuf);
+ return buf-srcbuf;
}
else {
return -1;
case DEC_NEG_OK:
if ( nd.type == INT8 && res1 <= INT8_MAX + 1 ) {
if (res) *(int8_t *)res = (int8_t) (-res1);
- return (buf-srcbuf);
+ return buf-srcbuf;
}
else if ( nd.type == INT16 && res1 <= (uint16_t)INT16_MAX + 1 ) {
if (res) *(int16_t *)res = (int16_t) (-res1);
- return (buf-srcbuf);
+ return buf-srcbuf;
}
else if ( nd.type == INT32 && res1 <= (uint32_t)INT32_MAX + 1 ) {
if (res) *(int32_t *)res = (int32_t) (-res1);
- return (buf-srcbuf);
+ return buf-srcbuf;
}
else if ( nd.type == INT64 && res1 <= (uint64_t)INT64_MAX + 1 ) {
if (res) *(int64_t *)res = (int64_t) (-res1);
- return (buf-srcbuf);
+ return buf-srcbuf;
}
else {
return -1;
ps = strtoul(first, &end, 10);
if (errno != 0 || end == first ||
(end[0] != '-' && end[0] != 0 && end != last))
- return (-1);
+ return -1;
/* Support for N-M portlist format */
if (end[0] == '-') {
pe = strtoul(first, &end, 10);
if (errno != 0 || end == first ||
(end[0] != 0 && end != last))
- return (-1);
+ return -1;
} else {
pe = ps;
}
if (ps > pe || pe >= sizeof (pl->map) * 8)
- return (-1);
+ return -1;
parse_set_list(pl, ps, pe);
}
- return (0);
+ return 0;
}
int
cmdline_portlist_t *pl;
if (!buf || ! *buf)
- return (-1);
+ return -1;
if (res && ressize < sizeof(cmdline_portlist_t))
return -1;
token_len++;
if (token_len >= PORTLIST_TOKEN_SIZE)
- return (-1);
+ return -1;
snprintf(portlist_str, token_len+1, "%s", buf);
if (strcmp("all", portlist_str) == 0)
pl->map = UINT32_MAX;
else if (parse_ports(pl, portlist_str) != 0)
- return (-1);
+ return -1;
}
return token_len;
dprintf("open() failed\n");
return NULL;
}
- return (cmdline_new(ctx, prompt, fd, -1));
+ return cmdline_new(ctx, prompt, fd, -1);
}
struct cmdline *
break;
}
- return (error);
+ return error;
}
moduledata_t contigmem_mod = {
if (contigmem_num_buffers > RTE_CONTIGMEM_MAX_NUM_BUFS) {
printf("%d buffers requested is greater than %d allowed\n",
contigmem_num_buffers, RTE_CONTIGMEM_MAX_NUM_BUFS);
- return (EINVAL);
+ return EINVAL;
}
if (contigmem_buffer_size < PAGE_SIZE ||
(contigmem_buffer_size & (contigmem_buffer_size - 1)) != 0) {
printf("buffer size 0x%lx is not greater than PAGE_SIZE and "
"power of two\n", contigmem_buffer_size);
- return (EINVAL);
+ return EINVAL;
}
for (i = 0; i < contigmem_num_buffers; i++) {
if (contigmem_buffers[i] == NULL) {
printf("contigmalloc failed for buffer %d\n", i);
- return (ENOMEM);
+ return ENOMEM;
}
printf("%2u: virt=%p phys=%p\n", i, contigmem_buffers[i],
contigmem_cdev = make_dev_credf(0, &contigmem_ops, 0, NULL, UID_ROOT,
GID_WHEEL, 0600, "contigmem");
- return (0);
+ return 0;
}
static int
contigfree(contigmem_buffers[i], contigmem_buffer_size,
M_CONTIGMEM);
- return (0);
+ return 0;
}
static int
int index = (int)(uintptr_t)arg1;
physaddr = (uint64_t)vtophys(contigmem_buffers[index]);
- return (sysctl_handle_64(oidp, &physaddr, 0, req));
+ return sysctl_handle_64(oidp, &physaddr, 0, req);
}
static int
contigmem_open(struct cdev *cdev, int fflags, int devtype,
struct thread *td)
{
- return (0);
+ return 0;
}
static int
{
*paddr = offset;
- return (0);
+ return 0;
}
static int
* app.
*/
if ((*offset/PAGE_SIZE) >= contigmem_num_buffers)
- return (EINVAL);
+ return EINVAL;
*offset = (vm_ooffset_t)vtophys(contigmem_buffers[*offset/PAGE_SIZE]);
*obj = vm_pager_allocate(OBJT_DEVICE, cdev, size, nprot, *offset,
curthread->td_ucred);
- return (0);
+ return 0;
}
enum rte_lcore_role_t
rte_eal_lcore_role(unsigned lcore_id)
{
- return (rte_config.lcore_role[lcore_id]);
+ return rte_config.lcore_role[lcore_id];
}
enum rte_proc_type_t
rte_eal_process_type(void)
{
- return (rte_config.process_type);
+ return rte_config.process_type;
}
!= uio_res->maps[i].addr) {
RTE_LOG(ERR, EAL,
"Cannot mmap device resource\n");
- return (-1);
+ return -1;
}
}
- return (0);
+ return 0;
}
RTE_LOG(ERR, EAL, "Cannot find resource for device\n");
/* secondary processes - use already recorded details */
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
- return (pci_uio_map_secondary(dev));
+ return pci_uio_map_secondary(dev);
snprintf(devname, sizeof(devname), "/dev/uio@pci:%u:%u:%u",
dev->addr.bus, dev->addr.devid, dev->addr.function);
if ((uio_res = rte_zmalloc("UIO_RES", sizeof (*uio_res), 0)) == NULL) {
RTE_LOG(ERR, EAL,
"%s(): cannot store uio mmap details\n", __func__);
- return (-1);
+ return -1;
}
snprintf(uio_res->path, sizeof(uio_res->path), "%s", devname);
(size_t)maps[j].size)
) == NULL) {
rte_free(uio_res);
- return (-1);
+ return -1;
}
maps[j].addr = mapaddr;
TAILQ_INSERT_TAIL(uio_res_list, uio_res, next);
- return (0);
+ return 0;
}
/* Scan one pci sysfs entry, and fill the devices list from it. */
int prot, vm_memattr_t *memattr)
{
*paddr = offset;
- return (0);
+ return 0;
}
static int
pci_get_device(dev) == devices[i].dev) {
device_set_desc(dev, "Intel(R) DPDK PCI Device");
- return (BUS_PROBE_SPECIFIC);
+ return BUS_PROBE_SPECIFIC;
}
- return (ENXIO);
+ return ENXIO;
}
static int
static int
nic_uio_shutdown(void)
{
- return (0);
+ return 0;
}
static int
break;
}
- return (0);
+ return 0;
}
addr_offset = start - ms->phys_addr;
}
- return (addr_offset);
+ return addr_offset;
}
static const struct rte_memzone *
static inline uint32_t
rte_bsf32(uint32_t v)
{
- return (__builtin_ctz(v));
+ return __builtin_ctz(v);
}
#ifndef offsetof
errno = 0; \
val = strtoul((in), &end, 16); \
if (errno != 0 || end[0] != (dlm) || val > (lim)) \
- return (-EINVAL); \
+ return -EINVAL; \
(fd) = (typeof (fd))val; \
(in) = end + 1; \
} while(0)
GET_PCIADDR_FIELD(input, dev_addr->bus, UINT8_MAX, ':');
GET_PCIADDR_FIELD(input, dev_addr->devid, UINT8_MAX, '.');
GET_PCIADDR_FIELD(input, dev_addr->function, UINT8_MAX, 0);
- return (0);
+ return 0;
}
/**
GET_PCIADDR_FIELD(input, dev_addr->bus, UINT8_MAX, ':');
GET_PCIADDR_FIELD(input, dev_addr->devid, UINT8_MAX, '.');
GET_PCIADDR_FIELD(input, dev_addr->function, UINT8_MAX, 0);
- return (0);
+ return 0;
}
#undef GET_PCIADDR_FIELD
enum rte_lcore_role_t
rte_eal_lcore_role(unsigned lcore_id)
{
- return (rte_config.lcore_role[lcore_id]);
+ return rte_config.lcore_role[lcore_id];
}
enum rte_proc_type_t
rte_eal_process_type(void)
{
- return (rte_config.process_type);
+ return rte_config.process_type;
}
int rte_eal_has_hugepages(void)
if (write(intr_pipe.writefd, "1", 1) < 0)
return -EPIPE;
- return (ret);
+ return ret;
}
int
ret = -EPIPE;
}
- return (ret);
+ return ret;
}
int
size += hpi->hugepage_sz * hpi->num_pages[socket];
}
- return (size);
+ return size;
}
/*
"of memory.\n",
i, nr_hugefiles, RTE_STR(CONFIG_RTE_MAX_MEMSEG),
RTE_MAX_MEMSEG);
- return (-ENOMEM);
+ return -ENOMEM;
}
return 0;
{
igb_top_dir = proc_mkdir("driver/igb", NULL);
if (igb_top_dir == NULL)
- return (-ENOMEM);
+ return -ENOMEM;
return 0;
}
req.if_up = 1;
ret = kni_net_process_request(kni, &req);
- return (ret == 0 ? req.result : ret);
+ return (ret == 0) ? req.result : ret;
}
static int
req.if_up = 0;
ret = kni_net_process_request(kni, &req);
- return (ret == 0 ? req.result : ret);
+ return (ret == 0) ? req.result : ret;
}
/*
if (ret == 0 && req.result == 0)
dev->mtu = new_mtu;
- return (ret == 0 ? req.result : ret);
+ return (ret == 0) ? req.result : ret;
}
/*
memcpy(eth->h_dest, daddr ? daddr : dev->dev_addr, dev->addr_len);
eth->h_proto = htons(type);
- return (dev->hard_header_len);
+ return dev->hard_header_len;
}
ip_frag_key_invalidate(&fp->key);
IP_FRAG_MBUF2DR(dr, mb);
- return (NULL);
+ return NULL;
}
fp->frags[idx].ofs = ofs;
/* not all fragments are collected yet. */
if (likely (fp->frag_size < fp->total_size)) {
- return (mb);
+ return mb;
/* if we collected all fragments, then try to reassemble. */
} else if (fp->frag_size == fp->total_size &&
/* we are done with that entry, invalidate it. */
ip_frag_key_invalidate(&fp->key);
- return (mb);
+ return mb;
}
IP_FRAG_TBL_STAT_UPDATE(&tbl->stat, fail_total, (pkt == NULL));
tbl->last = pkt;
- return (pkt);
+ return pkt;
}
struct ip_frag_pkt *
assoc = tbl->bucket_entries;
if (tbl->last != NULL && ip_frag_key_cmp(key, &tbl->last->key) == 0)
- return (tbl->last);
+ return tbl->last;
/* different hashing methods for IPv4 and IPv6 */
if (key->key_len == IPV4_KEYLEN)
*free = empty;
*stale = old;
- return (NULL);
+ return NULL;
}
nb_entries > UINT32_MAX || nb_entries == 0 ||
nb_entries < max_entries) {
RTE_LOG(ERR, USER1, "%s: invalid input parameter\n", __func__);
- return (NULL);
+ return NULL;
}
sz = sizeof (*tbl) + nb_entries * sizeof (tbl->pkt[0]);
RTE_LOG(ERR, USER1,
"%s: allocation of %zu bytes at socket %d failed do\n",
__func__, sz, socket_id);
- return (NULL);
+ return NULL;
}
RTE_LOG(INFO, USER1, "%s: allocated of %zu bytes at socket %d\n",
tbl->entry_mask = (tbl->nb_entries - 1) & ~(tbl->bucket_entries - 1);
TAILQ_INIT(&(tbl->lru));
- return (tbl);
+ return tbl;
}
/* dump frag table statistics to file */
/* error - hole in the packet. */
if (m == prev) {
- return (NULL);
+ return NULL;
}
}
rte_cpu_to_be_16(IPV4_HDR_DF_FLAG));
ip_hdr->hdr_checksum = 0;
- return (m);
+ return m;
}
/*
/* try to find/add entry into the fragment's table. */
if ((fp = ip_frag_find(tbl, dr, &key, tms)) == NULL) {
IP_FRAG_MBUF2DR(dr, mb);
- return (NULL);
+ return NULL;
}
IP_FRAG_LOG(DEBUG, "%s:%d:\n"
fp, fp->key.src_dst[0], fp->key.id, fp->start,
fp->total_size, fp->frag_size, fp->last_idx);
- return (mb);
+ return mb;
}
/* Check that pkts_out is big enough to hold all fragments */
if (unlikely (frag_size * nb_pkts_out <
(uint16_t)(pkt_in->pkt_len - sizeof (struct ipv6_hdr))))
- return (-EINVAL);
+ return -EINVAL;
in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv6_hdr *);
out_pkt = rte_pktmbuf_alloc(pool_direct);
if (unlikely(out_pkt == NULL)) {
__free_fragments(pkts_out, out_pkt_pos);
- return (-ENOMEM);
+ return -ENOMEM;
}
/* Reserve space for the IP header that will be built later */
if (unlikely(out_seg == NULL)) {
rte_pktmbuf_free(out_pkt);
__free_fragments(pkts_out, out_pkt_pos);
- return (-ENOMEM);
+ return -ENOMEM;
}
out_seg_prev->next = out_seg;
out_seg_prev = out_seg;
out_pkt_pos ++;
}
- return (out_pkt_pos);
+ return out_pkt_pos;
}
for (rule_index = rule_gindex; rule_index < last_rule; rule_index++) {
/* If rule is found return the rule index. */
if (lpm->rules_tbl[rule_index].ip == ip_masked)
- return (rule_index);
+ return rule_index;
}
/* If rule is not found return -EINVAL. */
m = (struct rte_mbuf *)mb;
RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0);
rte_mbuf_refcnt_set(m, 1);
- return (m);
+ return m;
}
/**
static inline int
rte_is_ctrlmbuf(struct rte_mbuf *m)
{
- return (!!(m->ol_flags & CTRL_MBUF_FLAG));
+ return !!(m->ol_flags & CTRL_MBUF_FLAG);
}
/* Operations on pkt mbuf */
struct rte_mbuf *m;
if ((m = __rte_mbuf_raw_alloc(mp)) != NULL)
rte_pktmbuf_reset(m);
- return (m);
+ return m;
}
/**
if (rte_mbuf_refcnt_update(md, -1) == 0)
__rte_mbuf_raw_free(md);
}
- return(m);
+ return m;
}
- return (NULL);
+ return NULL;
}
/**
uint8_t nseg;
if (unlikely ((mc = rte_pktmbuf_alloc(mp)) == NULL))
- return (NULL);
+ return NULL;
mi = mc;
prev = &mi->next;
/* Allocation of new indirect segment failed */
if (unlikely (mi == NULL)) {
rte_pktmbuf_free(mc);
- return (NULL);
+ return NULL;
}
__rte_mbuf_sanity_check(mc, 1);
- return (mc);
+ return mc;
}
/**
free(pa);
- return (mp);
+ return mp;
}
}
}
- return (i);
+ return i;
}
/*
/* this is the size of an object, including header and trailer */
sz->total_size = sz->header_size + sz->elt_size + sz->trailer_size;
- return (sz->total_size);
+ return sz->total_size;
}
sz = RTE_ALIGN_CEIL(elt_sz, pg_sz) * elt_num;
}
- return (sz);
+ return sz;
}
/*
if ((n = rte_mempool_obj_iter(vaddr, elt_num, elt_sz, 1,
paddr, pg_num, pg_shift, mempool_lelem_iter,
&uv)) != elt_num) {
- return (-(ssize_t)n);
+ return -(ssize_t)n;
}
uv = RTE_ALIGN_CEIL(uv, pg_sz);
usz = uv - va;
- return (usz);
+ return usz;
}
/* create the mempool */
int socket_id, unsigned flags)
{
#ifdef RTE_LIBRTE_XEN_DOM0
- return (rte_dom0_mempool_create(name, n, elt_size,
+ return rte_dom0_mempool_create(name, n, elt_size,
cache_size, private_data_size,
mp_init, mp_init_arg,
obj_init, obj_init_arg,
- socket_id, flags));
+ socket_id, flags);
#else
- return (rte_mempool_xmem_create(name, n, elt_size,
+ return rte_mempool_xmem_create(name, n, elt_size,
cache_size, private_data_size,
mp_init, mp_init_arg,
obj_init, obj_init_arg,
socket_id, flags,
- NULL, NULL, MEMPOOL_PG_NUM_DEFAULT, MEMPOOL_PG_SHIFT_MAX));
+ NULL, NULL, MEMPOOL_PG_NUM_DEFAULT, MEMPOOL_PG_SHIFT_MAX);
#endif
}
{
uint16_t cksum;
cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct ipv4_hdr));
- return ((cksum == 0xffff) ? cksum : ~cksum);
+ return (cksum == 0xffff) ? cksum : ~cksum;
}
/**