* For the RSS forwarding test all streams distributed over lcores. Each stream * being composed of a RX queue to poll on a RX port for input messages, * associated with a TX queue of a TX port where to send forwarded packets. */
| 4785 | * associated with a TX queue of a TX port where to send forwarded packets. |
| 4786 | */ |
| 4787 | static void |
| 4788 | rss_fwd_config_setup(void) |
| 4789 | { |
| 4790 | portid_t rxp; |
| 4791 | portid_t txp; |
| 4792 | queueid_t rxq; |
| 4793 | queueid_t nb_q; |
| 4794 | streamid_t sm_id; |
| 4795 | int start; |
| 4796 | |
| 4797 | nb_q = nb_rxq; |
| 4798 | if (nb_q > nb_txq) |
| 4799 | nb_q = nb_txq; |
| 4800 | cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores; |
| 4801 | cur_fwd_config.nb_fwd_ports = nb_fwd_ports; |
| 4802 | cur_fwd_config.nb_fwd_streams = |
| 4803 | (streamid_t) (nb_q / num_procs * cur_fwd_config.nb_fwd_ports); |
| 4804 | |
| 4805 | if (cur_fwd_config.nb_fwd_streams < cur_fwd_config.nb_fwd_lcores) |
| 4806 | cur_fwd_config.nb_fwd_lcores = |
| 4807 | (lcoreid_t)cur_fwd_config.nb_fwd_streams; |
| 4808 | |
| 4809 | /* reinitialize forwarding streams */ |
| 4810 | init_fwd_streams(); |
| 4811 | |
| 4812 | setup_fwd_config_of_each_lcore(&cur_fwd_config); |
| 4813 | |
| 4814 | if (proc_id > 0 && nb_q % num_procs != 0) |
| 4815 | printf("Warning! queue numbers should be multiple of processes, or packet loss will happen.\n"); |
| 4816 | |
| 4817 | /** |
| 4818 | * In multi-process, All queues are allocated to different |
| 4819 | * processes based on num_procs and proc_id. For example: |
| 4820 | * if supports 4 queues(nb_q), 2 processes(num_procs), |
| 4821 | * the 0~1 queue for primary process. |
| 4822 | * the 2~3 queue for secondary process. |
| 4823 | */ |
| 4824 | start = proc_id * nb_q / num_procs; |
| 4825 | rxp = 0; |
| 4826 | rxq = start; |
| 4827 | for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) { |
| 4828 | struct fwd_stream *fs; |
| 4829 | |
| 4830 | fs = fwd_streams[sm_id]; |
| 4831 | txp = fwd_topology_tx_port_get(rxp); |
| 4832 | fs->rx_port = fwd_ports_ids[rxp]; |
| 4833 | fs->rx_queue = rxq; |
| 4834 | fs->tx_port = fwd_ports_ids[txp]; |
| 4835 | fs->tx_queue = rxq; |
| 4836 | fs->peer_addr = fs->tx_port; |
| 4837 | fs->retry_enabled = retry_enabled; |
| 4838 | rxp++; |
| 4839 | if (rxp < nb_fwd_ports) |
| 4840 | continue; |
| 4841 | rxp = 0; |
| 4842 | rxq++; |
| 4843 | } |
| 4844 | } |
no test coverage detected