diff options
author | Nicolas Morey-Chaisemartin <nmorey@kalray.eu> | 2015-07-15 18:18:03 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-07-16 13:47:51 +0300 |
commit | 048601a880fb067ae7836fb1e8649aa10252d334 (patch) | |
tree | 697ce757a749779e5e1405f87507a8d9c63678f4 /platform | |
parent | 4bbfda68b7558fd11e0935754aa0d5b84913f1df (diff) |
linux-generic: packet_socket: rename odp_packet_socket.c to pktio/socket.c
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu>
Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform')
-rw-r--r-- | platform/linux-generic/Makefile.am | 2 | ||||
-rw-r--r-- | platform/linux-generic/pktio/socket.c (renamed from platform/linux-generic/odp_packet_socket.c) | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 34db0b1..5fcab42 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -140,7 +140,7 @@ __LIB__libodp_la_SOURCES = \ odp_packet.c \ odp_packet_flags.c \ odp_packet_io.c \ - odp_packet_socket.c \ + pktio/socket.c \ odp_pool.c \ odp_queue.c \ odp_rwlock.c \ diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/pktio/socket.c index a41291d..b547a1b 100644 --- a/platform/linux-generic/odp_packet_socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -47,7 +47,8 @@ * As it is implemented as a weak symbol, it has zero effect on systems * with both. */ -int sendmmsg(int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags) __attribute__((weak)); +int sendmmsg(int fd, struct mmsghdr *vmessages, unsigned int vlen, + int flags) __attribute__((weak)); int sendmmsg(int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags) { #ifdef SYS_sendmmsg @@ -87,7 +88,6 @@ int sendmmsg(int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags) #define ETHBUF_ALIGN(buf_ptr) ((uint8_t *)ODP_ALIGN_ROUNDUP_PTR((buf_ptr), \ sizeof(uint32_t)) + ETHBUF_OFFSET) - static void ethaddr_copy(unsigned char mac_dst[], unsigned char mac_src[]) { memcpy(mac_dst, mac_src, ETH_ALEN); @@ -106,7 +106,7 @@ static int set_pkt_sock_fanout_mmap(pkt_sock_mmap_t *const pkt_sock, int err; uint16_t fanout_group; - fanout_group = (uint16_t) (sock_group_idx & 0xffff); + fanout_group = (uint16_t)(sock_group_idx & 0xffff); val = (PACKET_FANOUT_HASH << 16) | fanout_group; err = setsockopt(sockfd, SOL_PACKET, PACKET_FANOUT, &val, sizeof(val)); @@ -395,6 +395,7 @@ int send_pkt_sock_mmsg(pkt_sock_t *const pkt_sock, for (i = 0; i < len; i++) { uint32_t seglen; + iovecs[i].iov_base = odp_packet_l2_ptr(pkt_table[i], &seglen); iovecs[i].iov_len = seglen; msgvec[i].msg_hdr.msg_iov = &iovecs[i]; @@ -433,6 +434,7 @@ static int mmap_pkt_socket(void) int ver = TPACKET_V2; int ret, sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); + if (sock == -1) { __odp_errno = errno; ODP_ERR("socket(SOCK_RAW): %s\n", strerror(errno)); @@ -665,7 +667,7 @@ static int mmap_setup_ring(int sock, struct ring *ring, int type, ring->rd_len = ring->rd_num * sizeof(*ring->rd); ring->rd = malloc(ring->rd_len); - if (ring->rd == NULL) { + if (!ring->rd) { __odp_errno = errno; ODP_ERR("malloc(): %s\n", strerror(errno)); return -1; |