* Initialize Rx subsystem. * * Called at device (re)configuration stage when number of receive queues is * specified together with other device level receive configuration. * * It should be used to allocate NUMA-unaware resources. */
| 1750 | * It should be used to allocate NUMA-unaware resources. |
| 1751 | */ |
| 1752 | int |
| 1753 | sfc_rx_configure(struct sfc_adapter *sa) |
| 1754 | { |
| 1755 | struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); |
| 1756 | struct sfc_rss *rss = &sas->rss; |
| 1757 | struct rte_eth_conf *dev_conf = &sa->eth_dev->data->dev_conf; |
| 1758 | const unsigned int nb_rx_queues = sa->eth_dev->data->nb_rx_queues; |
| 1759 | const unsigned int nb_rsrv_rx_queues = sfc_nb_reserved_rxq(sas); |
| 1760 | const unsigned int nb_rxq_total = nb_rx_queues + nb_rsrv_rx_queues; |
| 1761 | bool reconfigure; |
| 1762 | int rc; |
| 1763 | |
| 1764 | sfc_log_init(sa, "nb_rx_queues=%u (old %u)", |
| 1765 | nb_rx_queues, sas->ethdev_rxq_count); |
| 1766 | |
| 1767 | rc = sfc_rx_check_mode(sa, &dev_conf->rxmode); |
| 1768 | if (rc != 0) |
| 1769 | goto fail_check_mode; |
| 1770 | |
| 1771 | if (nb_rxq_total == sas->rxq_count) { |
| 1772 | reconfigure = true; |
| 1773 | goto configure_rss; |
| 1774 | } |
| 1775 | |
| 1776 | if (sas->rxq_info == NULL) { |
| 1777 | reconfigure = false; |
| 1778 | rc = ENOMEM; |
| 1779 | sas->rxq_info = rte_calloc_socket("sfc-rxqs", nb_rxq_total, |
| 1780 | sizeof(sas->rxq_info[0]), 0, |
| 1781 | sa->socket_id); |
| 1782 | if (sas->rxq_info == NULL) |
| 1783 | goto fail_rxqs_alloc; |
| 1784 | |
| 1785 | /* |
| 1786 | * Allocate primary process only RxQ control from heap |
| 1787 | * since it should not be shared. |
| 1788 | */ |
| 1789 | rc = ENOMEM; |
| 1790 | sa->rxq_ctrl = calloc(nb_rxq_total, sizeof(sa->rxq_ctrl[0])); |
| 1791 | if (sa->rxq_ctrl == NULL) |
| 1792 | goto fail_rxqs_ctrl_alloc; |
| 1793 | } else { |
| 1794 | struct sfc_rxq_info *new_rxq_info; |
| 1795 | struct sfc_rxq *new_rxq_ctrl; |
| 1796 | |
| 1797 | reconfigure = true; |
| 1798 | |
| 1799 | /* Do not uninitialize reserved queues */ |
| 1800 | if (nb_rx_queues < sas->ethdev_rxq_count) |
| 1801 | sfc_rx_fini_queues(sa, nb_rx_queues); |
| 1802 | |
| 1803 | rc = ENOMEM; |
| 1804 | new_rxq_info = |
| 1805 | rte_realloc(sas->rxq_info, |
| 1806 | nb_rxq_total * sizeof(sas->rxq_info[0]), 0); |
| 1807 | if (new_rxq_info == NULL && nb_rxq_total > 0) |
| 1808 | goto fail_rxqs_realloc; |
| 1809 |
no test coverage detected