diff options
author | Nicolas Morey-Chaisemartin <nmorey@kalray.eu> | 2015-08-13 15:03:49 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-08-18 18:59:22 +0300 |
commit | 3779e7edd4047cf74858b3b53e6c664e9a48cd1b (patch) | |
tree | 754909735659c417af7e72382a0ec4e0e885a10e | |
parent | b81c7d800ac35866553779743ec766f69cc9f8c2 (diff) |
linux-generic: pktio: remove basic socket implementation
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu>
Reviewed-and-Tested-by: Stuart Haslam <stuart.haslam@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r-- | example/generator/odp_generator.c | 1 | ||||
-rw-r--r-- | example/ipsec/odp_ipsec.c | 1 | ||||
-rw-r--r-- | example/packet/odp_pktio.c | 1 | ||||
-rw-r--r-- | platform/linux-generic/include/odp_packet_io_internal.h | 1 | ||||
-rw-r--r-- | platform/linux-generic/pktio/io_ops.c | 1 | ||||
-rw-r--r-- | platform/linux-generic/pktio/socket.c | 137 | ||||
-rwxr-xr-x | platform/linux-generic/test/pktio/pktio_run | 4 | ||||
-rw-r--r-- | test/performance/odp_l2fwd.c | 1 |
8 files changed, 2 insertions, 145 deletions
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index bdee222..ab34658 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -1046,7 +1046,6 @@ static void usage(char *progname) " -h, --help Display help and exit.\n" " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n" " ODP_PKTIO_DISABLE_SOCKET_MMSG\n" - " ODP_PKTIO_DISABLE_SOCKET_BASIC\n" " can be used to advanced pkt I/O selection for linux-generic\n" "\n", NO_PATH(progname), NO_PATH(progname) ); diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 91c7fad..104d29a 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1578,7 +1578,6 @@ static void usage(char *progname) " -h, --help Display help and exit.\n" " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n" " ODP_PKTIO_DISABLE_SOCKET_MMSG\n" - " ODP_PKTIO_DISABLE_SOCKET_BASIC\n" " can be used to advanced pkt I/O selection for linux-generic\n" " ODP_IPSEC_USE_POLL_QUEUES\n" " to enable use of poll queues instead of scheduled (default)\n" diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 0db5a60..278cdc9 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -677,7 +677,6 @@ static void usage(char *progname) " -h, --help Display help and exit.\n" " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n" " ODP_PKTIO_DISABLE_SOCKET_MMSG\n" - " ODP_PKTIO_DISABLE_SOCKET_BASIC\n" " can be used to advanced pkt I/O selection for linux-generic\n" "\n", NO_PATH(progname), NO_PATH(progname) ); diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index f5a5824..a5d324e 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -104,7 +104,6 @@ static inline pktio_entry_t *get_pktio_entry(odp_pktio_t pktio) int pktin_poll(pktio_entry_t *entry); -extern const pktio_if_ops_t sock_basic_pktio_ops; extern const pktio_if_ops_t sock_mmsg_pktio_ops; extern const pktio_if_ops_t sock_mmap_pktio_ops; extern const pktio_if_ops_t loopback_pktio_ops; diff --git a/platform/linux-generic/pktio/io_ops.c b/platform/linux-generic/pktio/io_ops.c index 6cd3d00..1d47e74 100644 --- a/platform/linux-generic/pktio/io_ops.c +++ b/platform/linux-generic/pktio/io_ops.c @@ -14,6 +14,5 @@ const pktio_if_ops_t * const pktio_if_ops[] = { &loopback_pktio_ops, &sock_mmap_pktio_ops, &sock_mmsg_pktio_ops, - &sock_basic_pktio_ops, NULL }; diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index 55c3594..4d92011 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -89,7 +89,6 @@ int sendmmsg(int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags) sizeof(uint32_t)) + ETHBUF_OFFSET) /* - * ODP_PACKET_SOCKET_BASIC: * ODP_PACKET_SOCKET_MMSG: * ODP_PACKET_SOCKET_MMAP: */ @@ -108,7 +107,6 @@ int mtu_get_fd(int fd, const char *name) } /* - * ODP_PACKET_SOCKET_BASIC: * ODP_PACKET_SOCKET_MMSG: * ODP_PACKET_SOCKET_MMAP: */ @@ -138,7 +136,6 @@ int promisc_mode_set_fd(int fd, const char *name, int enable) } /* - * ODP_PACKET_SOCKET_BASIC: * ODP_PACKET_SOCKET_MMSG: * ODP_PACKET_SOCKET_MMAP: */ @@ -158,7 +155,6 @@ int promisc_mode_get_fd(int fd, const char *name) } /* - * ODP_PACKET_SOCKET_BASIC: * ODP_PACKET_SOCKET_MMSG: */ static int sock_close(pktio_entry_t *pktio_entry) @@ -174,7 +170,6 @@ static int sock_close(pktio_entry_t *pktio_entry) } /* - * ODP_PACKET_SOCKET_BASIC: * ODP_PACKET_SOCKET_MMSG: */ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const char *netdev, @@ -257,18 +252,6 @@ error: } /* - * ODP_PACKET_SOCKET_BASIC: - */ -static int sock_basic_open(odp_pktio_t id ODP_UNUSED, - pktio_entry_t *pktio_entry, - const char *devname, odp_pool_t pool) -{ - if (getenv("ODP_PKTIO_DISABLE_SOCKET_BASIC")) - return -1; - return sock_setup_pkt(pktio_entry, devname, pool); -} - -/* * ODP_PACKET_SOCKET_MMSG: */ static int sock_mmsg_open(odp_pktio_t id ODP_UNUSED, @@ -281,109 +264,6 @@ static int sock_mmsg_open(odp_pktio_t id ODP_UNUSED, } /* - * ODP_PACKET_SOCKET_BASIC: - */ -static int sock_basic_recv(pktio_entry_t *pktio_entry, - odp_packet_t pkt_table[], unsigned len) -{ - pkt_sock_t *pkt_sock = &pktio_entry->s.pkt_sock; - ssize_t recv_bytes; - unsigned i; - struct sockaddr_ll sll; - socklen_t addrlen = sizeof(sll); - int const sockfd = pkt_sock->sockfd; - odp_packet_t pkt = ODP_PACKET_INVALID; - uint8_t *pkt_buf; - int nb_rx = 0; - - /* recvfrom: - * If the address argument is not a null pointer - * and the protocol does not provide the source address of - * messages, the the value stored in the object pointed to - * by address is unspecified. - */ - memset(&sll, 0, sizeof(sll)); - - for (i = 0; i < len; i++) { - if (odp_likely(pkt == ODP_PACKET_INVALID)) { - pkt = odp_packet_alloc(pkt_sock->pool, - pkt_sock->max_frame_len); - if (odp_unlikely(pkt == ODP_PACKET_INVALID)) - break; - } - - pkt_buf = odp_packet_data(pkt); - - recv_bytes = recvfrom(sockfd, pkt_buf, - pkt_sock->max_frame_len, MSG_DONTWAIT, - (struct sockaddr *)&sll, &addrlen); - /* no data or error: free recv buf and break out of loop */ - if (odp_unlikely(recv_bytes < 1)) - break; - /* frame not explicitly for us, reuse pkt buf for next frame */ - if (odp_unlikely(sll.sll_pkttype == PACKET_OUTGOING)) - continue; - - /* Parse and set packet header data */ - odp_packet_pull_tail(pkt, pkt_sock->max_frame_len - recv_bytes); - _odp_packet_reset_parse(pkt); - - pkt_table[nb_rx] = pkt; - pkt = ODP_PACKET_INVALID; - nb_rx++; - } /* end for() */ - - if (odp_unlikely(pkt != ODP_PACKET_INVALID)) - odp_packet_free(pkt); - - return nb_rx; -} - -/* - * ODP_PACKET_SOCKET_BASIC: - */ -static int sock_basic_send(pktio_entry_t *pktio_entry, - odp_packet_t pkt_table[], unsigned len) -{ - pkt_sock_t *pkt_sock = &pktio_entry->s.pkt_sock; - odp_packet_t pkt; - uint8_t *frame; - uint32_t frame_len; - unsigned i; - unsigned flags; - int sockfd; - unsigned nb_tx; - int ret; - - sockfd = pkt_sock->sockfd; - flags = MSG_DONTWAIT; - i = 0; - while (i < len) { - pkt = pkt_table[i]; - - frame = odp_packet_l2_ptr(pkt, &frame_len); - - ret = send(sockfd, frame, frame_len, flags); - if (odp_unlikely(ret == -1)) { - if (odp_likely(errno == EAGAIN)) { - flags = 0; /* blocking for next rounds */ - continue; /* resend buffer */ - } else { - break; - } - } - - i++; - } /* end while */ - nb_tx = i; - - for (i = 0; i < nb_tx; i++) - odp_packet_free(pkt_table[i]); - - return nb_tx; -} - -/* * ODP_PACKET_SOCKET_MMSG: */ static int sock_mmsg_recv(pktio_entry_t *pktio_entry, @@ -494,7 +374,6 @@ static int sock_mmsg_send(pktio_entry_t *pktio_entry, } /* - * ODP_PACKET_SOCKET_BASIC: * ODP_PACKET_SOCKET_MMSG: */ static int sock_mtu_get(pktio_entry_t *pktio_entry) @@ -503,7 +382,6 @@ static int sock_mtu_get(pktio_entry_t *pktio_entry) } /* - * ODP_PACKET_SOCKET_BASIC: * ODP_PACKET_SOCKET_MMSG: */ static int sock_mac_addr_get(pktio_entry_t *pktio_entry, @@ -514,7 +392,6 @@ static int sock_mac_addr_get(pktio_entry_t *pktio_entry, } /* - * ODP_PACKET_SOCKET_BASIC: * ODP_PACKET_SOCKET_MMSG: */ static int sock_promisc_mode_set(pktio_entry_t *pktio_entry, @@ -525,7 +402,6 @@ static int sock_promisc_mode_set(pktio_entry_t *pktio_entry, } /* - * ODP_PACKET_SOCKET_BASIC: * ODP_PACKET_SOCKET_MMSG: */ static int sock_promisc_mode_get(pktio_entry_t *pktio_entry) @@ -534,19 +410,6 @@ static int sock_promisc_mode_get(pktio_entry_t *pktio_entry) pktio_entry->s.name); } -const pktio_if_ops_t sock_basic_pktio_ops = { - .init = NULL, - .term = NULL, - .open = sock_basic_open, - .close = sock_close, - .recv = sock_basic_recv, - .send = sock_basic_send, - .mtu_get = sock_mtu_get, - .promisc_mode_set = sock_promisc_mode_set, - .promisc_mode_get = sock_promisc_mode_get, - .mac_get = sock_mac_addr_get -}; - const pktio_if_ops_t sock_mmsg_pktio_ops = { .init = NULL, .term = NULL, diff --git a/platform/linux-generic/test/pktio/pktio_run b/platform/linux-generic/test/pktio/pktio_run index 9a70ac4..76a8419 100755 --- a/platform/linux-generic/test/pktio/pktio_run +++ b/platform/linux-generic/test/pktio/pktio_run @@ -49,11 +49,11 @@ run_test() # the linux-generic implementation uses environment variables to # control which socket method is used, so try each combination to # ensure decent coverage. - for distype in MMAP MMSG BASIC; do + for distype in MMAP MMSG; do unset ODP_PKTIO_DISABLE_SOCKET_${distype} done - for distype in SKIP MMAP MMSG; do + for distype in SKIP MMAP; do if [ "$disabletype" != "SKIP" ]; then export ODP_PKTIO_DISABLE_SOCKET_${distype}=y fi diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index b34df89..e6d7ea3 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -697,7 +697,6 @@ static void usage(char *progname) " -h, --help Display help and exit.\n\n" " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n" " ODP_PKTIO_DISABLE_SOCKET_MMSG\n" - " ODP_PKTIO_DISABLE_SOCKET_BASIC\n" " can be used to advanced pkt I/O selection for linux-generic\n" "\n", NO_PATH(progname), NO_PATH(progname) ); |