Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(c) 2022 Red Hat, Inc. 3 : : */ 4 : : 5 : : #include <errno.h> 6 : : #include <unistd.h> 7 : : 8 : : #include <rte_debug.h> 9 : : 10 : : #include "eal_private.h" 11 : : 12 : : int 13 : 193 : eal_thread_wake_worker(unsigned int worker_id) 14 : : { 15 : 193 : int m2w = lcore_config[worker_id].pipe_main2worker[1]; 16 : 193 : int w2m = lcore_config[worker_id].pipe_worker2main[0]; 17 : 193 : char c = 0; 18 : : int n; 19 : : 20 : : do { 21 : 193 : n = write(m2w, &c, 1); 22 [ - + - + : 193 : } while (n == 0 || (n < 0 && errno == EINTR)); - - ] 23 [ + - ]: 193 : if (n < 0) 24 : : return -EPIPE; 25 : : 26 : : do { 27 : 193 : n = read(w2m, &c, 1); 28 [ - + - - ]: 193 : } while (n < 0 && errno == EINTR); 29 [ - + ]: 193 : if (n <= 0) 30 : 0 : return -EPIPE; 31 : : return 0; 32 : : } 33 : : 34 : : void 35 : 320 : eal_thread_wait_command(void) 36 : : { 37 : : unsigned int lcore_id = rte_lcore_id(); 38 : : int m2w; 39 : : char c; 40 : : int n; 41 : : 42 : 320 : m2w = lcore_config[lcore_id].pipe_main2worker[0]; 43 : : do { 44 : 193 : n = read(m2w, &c, 1); 45 [ - + - - ]: 193 : } while (n < 0 && errno == EINTR); 46 [ - + ]: 193 : if (n <= 0) 47 : 0 : rte_panic("cannot read on configuration pipe\n"); 48 : 193 : } 49 : : 50 : : void 51 : 193 : eal_thread_ack_command(void) 52 : : { 53 : : unsigned int lcore_id = rte_lcore_id(); 54 : 193 : char c = 0; 55 : : int w2m; 56 : : int n; 57 : : 58 : 193 : w2m = lcore_config[lcore_id].pipe_worker2main[1]; 59 : : do { 60 : 193 : n = write(w2m, &c, 1); 61 [ - + - + : 193 : } while (n == 0 || (n < 0 && errno == EINTR)); - - ] 62 [ - + ]: 193 : if (n < 0) 63 : 0 : rte_panic("cannot write on configuration pipe\n"); 64 : 193 : }