* Validate offloads that are requested through rte_eth_dev_configure against * the offloads successfully set by the Ethernet device. * * @param port_id * The port identifier of the Ethernet device. * @param req_offloads * The offloads that have been requested through `rte_eth_dev_configure`. * @param set_offloads * The offloads successfully set by the Ethernet device. * @param offlo
| 1199 | * - (-EINVAL) if requested offload has been silently disabled. |
| 1200 | */ |
| 1201 | static int |
| 1202 | eth_dev_validate_offloads(uint16_t port_id, uint64_t req_offloads, |
| 1203 | uint64_t set_offloads, const char *offload_type, |
| 1204 | const char *(*offload_name)(uint64_t)) |
| 1205 | { |
| 1206 | uint64_t offloads_diff = req_offloads ^ set_offloads; |
| 1207 | uint64_t offload; |
| 1208 | int ret = 0; |
| 1209 | |
| 1210 | while (offloads_diff != 0) { |
| 1211 | /* Check if any offload is requested but not enabled. */ |
| 1212 | offload = RTE_BIT64(rte_ctz64(offloads_diff)); |
| 1213 | if (offload & req_offloads) { |
| 1214 | RTE_ETHDEV_LOG(ERR, |
| 1215 | "Port %u failed to enable %s offload %s\n", |
| 1216 | port_id, offload_type, offload_name(offload)); |
| 1217 | ret = -EINVAL; |
| 1218 | } |
| 1219 | |
| 1220 | /* Check if offload couldn't be disabled. */ |
| 1221 | if (offload & set_offloads) { |
| 1222 | RTE_ETHDEV_LOG(DEBUG, |
| 1223 | "Port %u %s offload %s is not requested but enabled\n", |
| 1224 | port_id, offload_type, offload_name(offload)); |
| 1225 | } |
| 1226 | |
| 1227 | offloads_diff &= ~offload; |
| 1228 | } |
| 1229 | |
| 1230 | return ret; |
| 1231 | } |
| 1232 | |
| 1233 | static uint32_t |
| 1234 | eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu) |
no test coverage detected