| 870 | } |
| 871 | |
| 872 | int |
| 873 | sfc_repr_proxy_attach(struct sfc_adapter *sa) |
| 874 | { |
| 875 | struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); |
| 876 | struct sfc_repr_proxy *rp = &sa->repr_proxy; |
| 877 | struct rte_service_spec service; |
| 878 | uint32_t cid; |
| 879 | uint32_t sid; |
| 880 | int rc; |
| 881 | |
| 882 | sfc_log_init(sa, "entry"); |
| 883 | |
| 884 | if (!sfc_repr_available(sas)) { |
| 885 | sfc_log_init(sa, "representors not supported - skip"); |
| 886 | return 0; |
| 887 | } |
| 888 | |
| 889 | rc = sfc_repr_proxy_rxq_attach(sa); |
| 890 | if (rc != 0) |
| 891 | goto fail_rxq_attach; |
| 892 | |
| 893 | rc = sfc_repr_proxy_txq_attach(sa); |
| 894 | if (rc != 0) |
| 895 | goto fail_txq_attach; |
| 896 | |
| 897 | rc = sfc_repr_proxy_ports_init(sa); |
| 898 | if (rc != 0) |
| 899 | goto fail_ports_init; |
| 900 | |
| 901 | cid = sfc_get_service_lcore(sa->socket_id); |
| 902 | if (cid == RTE_MAX_LCORE && sa->socket_id != SOCKET_ID_ANY) { |
| 903 | /* Warn and try to allocate on any NUMA node */ |
| 904 | sfc_warn(sa, |
| 905 | "repr proxy: unable to get service lcore at socket %d", |
| 906 | sa->socket_id); |
| 907 | |
| 908 | cid = sfc_get_service_lcore(SOCKET_ID_ANY); |
| 909 | } |
| 910 | if (cid == RTE_MAX_LCORE) { |
| 911 | rc = ENOTSUP; |
| 912 | sfc_err(sa, "repr proxy: failed to get service lcore"); |
| 913 | goto fail_get_service_lcore; |
| 914 | } |
| 915 | |
| 916 | memset(&service, 0, sizeof(service)); |
| 917 | snprintf(service.name, sizeof(service.name), |
| 918 | "net_sfc_%hu_repr_proxy", sfc_sa2shared(sa)->port_id); |
| 919 | service.socket_id = rte_lcore_to_socket_id(cid); |
| 920 | service.callback = sfc_repr_proxy_routine; |
| 921 | service.callback_userdata = rp; |
| 922 | |
| 923 | rc = rte_service_component_register(&service, &sid); |
| 924 | if (rc != 0) { |
| 925 | rc = ENOEXEC; |
| 926 | sfc_err(sa, "repr proxy: failed to register service component"); |
| 927 | goto fail_register; |
| 928 | } |
| 929 |
no test coverage detected