rte_eth_dev_info_get() should be called prior to this function */
| 1245 | |
| 1246 | /* rte_eth_dev_info_get() should be called prior to this function */ |
| 1247 | static int |
| 1248 | eth_dev_validate_mtu(uint16_t port_id, struct rte_eth_dev_info *dev_info, |
| 1249 | uint16_t mtu) |
| 1250 | { |
| 1251 | uint32_t overhead_len; |
| 1252 | uint32_t frame_size; |
| 1253 | |
| 1254 | if (mtu < dev_info->min_mtu) { |
| 1255 | RTE_ETHDEV_LOG(ERR, |
| 1256 | "MTU (%u) < device min MTU (%u) for port_id %u\n", |
| 1257 | mtu, dev_info->min_mtu, port_id); |
| 1258 | return -EINVAL; |
| 1259 | } |
| 1260 | if (mtu > dev_info->max_mtu) { |
| 1261 | RTE_ETHDEV_LOG(ERR, |
| 1262 | "MTU (%u) > device max MTU (%u) for port_id %u\n", |
| 1263 | mtu, dev_info->max_mtu, port_id); |
| 1264 | return -EINVAL; |
| 1265 | } |
| 1266 | |
| 1267 | overhead_len = eth_dev_get_overhead_len(dev_info->max_rx_pktlen, |
| 1268 | dev_info->max_mtu); |
| 1269 | frame_size = mtu + overhead_len; |
| 1270 | if (frame_size < RTE_ETHER_MIN_LEN) { |
| 1271 | RTE_ETHDEV_LOG(ERR, |
| 1272 | "Frame size (%u) < min frame size (%u) for port_id %u\n", |
| 1273 | frame_size, RTE_ETHER_MIN_LEN, port_id); |
| 1274 | return -EINVAL; |
| 1275 | } |
| 1276 | |
| 1277 | if (frame_size > dev_info->max_rx_pktlen) { |
| 1278 | RTE_ETHDEV_LOG(ERR, |
| 1279 | "Frame size (%u) > device max frame size (%u) for port_id %u\n", |
| 1280 | frame_size, dev_info->max_rx_pktlen, port_id); |
| 1281 | return -EINVAL; |
| 1282 | } |
| 1283 | |
| 1284 | return 0; |
| 1285 | } |
| 1286 | |
| 1287 | int |
| 1288 | rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, |
no test coverage detected