Lines Matching +full:auto +full:- +full:negotiation

4  * SPDX-License-Identifier: Apache-2.0
82 struct eth_fake_context *ctx = dev->data; in eth_fake_iface_init()
84 ctx->iface = iface; in eth_fake_iface_init()
86 net_if_set_link_addr(iface, ctx->mac_address, in eth_fake_iface_init()
87 sizeof(ctx->mac_address), in eth_fake_iface_init()
112 if (ctx->link_100bt) { in eth_fake_get_total_bandwidth()
116 if (ctx->link_10bt) { in eth_fake_get_total_bandwidth()
131 for (i = 0; i < ARRAY_SIZE(ctx->priority_queues); ++i) { in eth_fake_recalc_qav_delta_bandwidth()
133 ctx->priority_queues[i].delta_bandwidth = 0; in eth_fake_recalc_qav_delta_bandwidth()
135 ctx->priority_queues[i].delta_bandwidth = in eth_fake_recalc_qav_delta_bandwidth()
136 (ctx->priority_queues[i].idle_slope * 100); in eth_fake_recalc_qav_delta_bandwidth()
138 ctx->priority_queues[i].delta_bandwidth /= bw; in eth_fake_recalc_qav_delta_bandwidth()
150 for (i = 0; i < ARRAY_SIZE(ctx->priority_queues); ++i) { in eth_fake_recalc_qav_idle_slopes()
151 ctx->priority_queues[i].idle_slope = in eth_fake_recalc_qav_idle_slopes()
152 (ctx->priority_queues[i].delta_bandwidth * bw) / 100; in eth_fake_recalc_qav_idle_slopes()
160 struct eth_fake_context *ctx = dev->data; in eth_fake_set_config()
161 int priority_queues_num = ARRAY_SIZE(ctx->priority_queues); in eth_fake_set_config()
162 int ports_num = ARRAY_SIZE(ctx->ports); in eth_fake_set_config()
171 if (config->auto_negotiation == ctx->auto_negotiation) { in eth_fake_set_config()
172 return -EALREADY; in eth_fake_set_config()
175 ctx->auto_negotiation = config->auto_negotiation; in eth_fake_set_config()
179 if ((config->l.link_10bt && ctx->link_10bt) || in eth_fake_set_config()
180 (config->l.link_100bt && ctx->link_100bt)) { in eth_fake_set_config()
181 return -EALREADY; in eth_fake_set_config()
184 if (config->l.link_10bt) { in eth_fake_set_config()
185 ctx->link_10bt = true; in eth_fake_set_config()
186 ctx->link_100bt = false; in eth_fake_set_config()
188 ctx->link_10bt = false; in eth_fake_set_config()
189 ctx->link_100bt = true; in eth_fake_set_config()
196 if (config->full_duplex == ctx->full_duplex) { in eth_fake_set_config()
197 return -EALREADY; in eth_fake_set_config()
200 ctx->full_duplex = config->full_duplex; in eth_fake_set_config()
204 memcpy(ctx->mac_address, config->mac_address.addr, 6); in eth_fake_set_config()
206 net_if_set_link_addr(ctx->iface, ctx->mac_address, in eth_fake_set_config()
207 sizeof(ctx->mac_address), in eth_fake_set_config()
211 queue_id = config->qav_param.queue_id; in eth_fake_set_config()
212 qav_param_type = config->qav_param.type; in eth_fake_set_config()
215 return -EINVAL; in eth_fake_set_config()
220 ctx->priority_queues[queue_id].qav_enabled = in eth_fake_set_config()
221 config->qav_param.enabled; in eth_fake_set_config()
224 ctx->priority_queues[queue_id].idle_slope = in eth_fake_set_config()
225 config->qav_param.idle_slope; in eth_fake_set_config()
230 ctx->priority_queues[queue_id].delta_bandwidth = in eth_fake_set_config()
231 config->qav_param.delta_bandwidth; in eth_fake_set_config()
236 return -ENOTSUP; in eth_fake_set_config()
241 port_id = config->qbv_param.port_id; in eth_fake_set_config()
242 qbv_param_type = config->qbv_param.type; in eth_fake_set_config()
245 return -EINVAL; in eth_fake_set_config()
250 ctx->ports[port_id].qbv_enabled = in eth_fake_set_config()
251 config->qbv_param.enabled; in eth_fake_set_config()
254 memcpy(&ctx->ports[port_id].cycle_time, in eth_fake_set_config()
255 &config->qbv_param.cycle_time, in eth_fake_set_config()
256 sizeof(ctx->ports[port_id].cycle_time)); in eth_fake_set_config()
257 ctx->ports[port_id].extension_time = in eth_fake_set_config()
258 config->qbv_param.extension_time; in eth_fake_set_config()
259 memcpy(&ctx->ports[port_id].base_time, in eth_fake_set_config()
260 &config->qbv_param.base_time, in eth_fake_set_config()
261 sizeof(ctx->ports[port_id].base_time)); in eth_fake_set_config()
264 ctx->ports[port_id].gate_control.gate_status[0] = in eth_fake_set_config()
265 config->qbv_param.gate_control.gate_status[0]; in eth_fake_set_config()
266 ctx->ports[port_id].gate_control.gate_status[1] = in eth_fake_set_config()
267 config->qbv_param.gate_control.gate_status[1]; in eth_fake_set_config()
270 ctx->ports[port_id].gate_control_list_len = in eth_fake_set_config()
271 config->qbv_param.gate_control_list_len; in eth_fake_set_config()
274 return -ENOTSUP; in eth_fake_set_config()
279 port_id = config->qbu_param.port_id; in eth_fake_set_config()
280 qbu_param_type = config->qbu_param.type; in eth_fake_set_config()
283 return -EINVAL; in eth_fake_set_config()
288 ctx->ports[port_id].qbu_enabled = in eth_fake_set_config()
289 config->qbu_param.enabled; in eth_fake_set_config()
292 ctx->ports[port_id].release_advance = in eth_fake_set_config()
293 config->qbu_param.release_advance; in eth_fake_set_config()
296 ctx->ports[port_id].hold_advance = in eth_fake_set_config()
297 config->qbu_param.hold_advance; in eth_fake_set_config()
300 ctx->ports[port_id].link_partner_status = in eth_fake_set_config()
301 config->qbu_param.link_partner_status; in eth_fake_set_config()
304 ctx->ports[port_id].additional_fragment_size = in eth_fake_set_config()
305 config->qbu_param.additional_fragment_size; in eth_fake_set_config()
308 memcpy(&ctx->ports[port_id].frame_preempt_statuses, in eth_fake_set_config()
309 &config->qbu_param.frame_preempt_statuses, in eth_fake_set_config()
310 sizeof(ctx->ports[port_id].frame_preempt_statuses)); in eth_fake_set_config()
313 return -ENOTSUP; in eth_fake_set_config()
318 queue_id = config->txtime_param.queue_id; in eth_fake_set_config()
319 txtime_param_type = config->txtime_param.type; in eth_fake_set_config()
322 return -EINVAL; in eth_fake_set_config()
327 ctx->txtime_statuses[queue_id] = in eth_fake_set_config()
328 config->txtime_param.enable_txtime; in eth_fake_set_config()
331 return -ENOTSUP; in eth_fake_set_config()
336 if (config->promisc_mode == ctx->promisc_mode) { in eth_fake_set_config()
337 return -EALREADY; in eth_fake_set_config()
340 ctx->promisc_mode = config->promisc_mode; in eth_fake_set_config()
344 return -ENOTSUP; in eth_fake_set_config()
354 struct eth_fake_context *ctx = dev->data; in eth_fake_get_config()
355 int priority_queues_num = ARRAY_SIZE(ctx->priority_queues); in eth_fake_get_config()
356 int ports_num = ARRAY_SIZE(ctx->ports); in eth_fake_get_config()
365 config->priority_queues_num = ARRAY_SIZE(ctx->priority_queues); in eth_fake_get_config()
368 config->ports_num = ARRAY_SIZE(ctx->ports); in eth_fake_get_config()
371 queue_id = config->qav_param.queue_id; in eth_fake_get_config()
372 qav_param_type = config->qav_param.type; in eth_fake_get_config()
375 return -EINVAL; in eth_fake_get_config()
380 config->qav_param.enabled = in eth_fake_get_config()
381 ctx->priority_queues[queue_id].qav_enabled; in eth_fake_get_config()
386 config->qav_param.idle_slope = in eth_fake_get_config()
387 ctx->priority_queues[queue_id].idle_slope; in eth_fake_get_config()
390 config->qav_param.delta_bandwidth = in eth_fake_get_config()
391 ctx->priority_queues[queue_id].delta_bandwidth; in eth_fake_get_config()
394 /* Default TC for BE - it doesn't really matter here */ in eth_fake_get_config()
395 config->qav_param.traffic_class = in eth_fake_get_config()
399 return -ENOTSUP; in eth_fake_get_config()
404 port_id = config->qbv_param.port_id; in eth_fake_get_config()
405 qbv_param_type = config->qbv_param.type; in eth_fake_get_config()
408 return -EINVAL; in eth_fake_get_config()
413 config->qbv_param.enabled = in eth_fake_get_config()
414 ctx->ports[port_id].qbv_enabled; in eth_fake_get_config()
417 memcpy(&config->qbv_param.base_time, in eth_fake_get_config()
418 &ctx->ports[port_id].base_time, in eth_fake_get_config()
419 sizeof(config->qbv_param.base_time)); in eth_fake_get_config()
420 memcpy(&config->qbv_param.cycle_time, in eth_fake_get_config()
421 &ctx->ports[port_id].cycle_time, in eth_fake_get_config()
422 sizeof(config->qbv_param.cycle_time)); in eth_fake_get_config()
423 config->qbv_param.extension_time = in eth_fake_get_config()
424 ctx->ports[port_id].extension_time; in eth_fake_get_config()
427 config->qbv_param.gate_control_list_len = in eth_fake_get_config()
428 ctx->ports[port_id].gate_control_list_len; in eth_fake_get_config()
431 memcpy(&config->qbv_param.gate_control, in eth_fake_get_config()
432 &ctx->ports[port_id].gate_control, in eth_fake_get_config()
433 sizeof(config->qbv_param.gate_control)); in eth_fake_get_config()
436 return -ENOTSUP; in eth_fake_get_config()
441 port_id = config->qbu_param.port_id; in eth_fake_get_config()
442 qbu_param_type = config->qbu_param.type; in eth_fake_get_config()
445 return -EINVAL; in eth_fake_get_config()
450 config->qbu_param.enabled = in eth_fake_get_config()
451 ctx->ports[port_id].qbu_enabled; in eth_fake_get_config()
454 config->qbu_param.release_advance = in eth_fake_get_config()
455 ctx->ports[port_id].release_advance; in eth_fake_get_config()
458 config->qbu_param.hold_advance = in eth_fake_get_config()
459 ctx->ports[port_id].hold_advance; in eth_fake_get_config()
462 config->qbu_param.link_partner_status = in eth_fake_get_config()
463 ctx->ports[port_id].link_partner_status; in eth_fake_get_config()
466 config->qbu_param.additional_fragment_size = in eth_fake_get_config()
467 ctx->ports[port_id].additional_fragment_size; in eth_fake_get_config()
470 memcpy(&config->qbu_param.frame_preempt_statuses, in eth_fake_get_config()
471 &ctx->ports[port_id].frame_preempt_statuses, in eth_fake_get_config()
472 sizeof(config->qbu_param.frame_preempt_statuses)); in eth_fake_get_config()
475 return -ENOTSUP; in eth_fake_get_config()
480 queue_id = config->txtime_param.queue_id; in eth_fake_get_config()
481 txtime_param_type = config->txtime_param.type; in eth_fake_get_config()
484 return -EINVAL; in eth_fake_get_config()
489 config->txtime_param.enable_txtime = in eth_fake_get_config()
490 ctx->txtime_statuses[queue_id]; in eth_fake_get_config()
493 return -ENOTSUP; in eth_fake_get_config()
498 return -ENOTSUP; in eth_fake_get_config()
515 struct eth_fake_context *ctx = dev->data; in eth_fake_init()
518 ctx->auto_negotiation = true; in eth_fake_init()
519 ctx->full_duplex = true; in eth_fake_init()
520 ctx->link_10bt = true; in eth_fake_init()
521 ctx->link_100bt = false; in eth_fake_init()
523 memcpy(ctx->mac_address, mac_addr_init, 6); in eth_fake_init()
526 for (i = 0; i < ARRAY_SIZE(ctx->priority_queues); ++i) { in eth_fake_init()
527 ctx->priority_queues[i].qav_enabled = true; in eth_fake_init()
528 if (i + 1 == ARRAY_SIZE(ctx->priority_queues)) { in eth_fake_init()
530 ctx->priority_queues[i].delta_bandwidth = 75; in eth_fake_init()
533 ctx->priority_queues[i].delta_bandwidth = 0; in eth_fake_init()
620 ret = memcmp(net_if_get_link_addr(iface)->addr, mac_addr_change, in change_mac_when_down()
645 zassert_equal(ret, 0, "invalid auto negotiation change"); in change_auto_neg()
660 "invalid change to already auto negotiation"); in change_to_same_auto_neg()
773 struct eth_fake_context *ctx = dev->data; in ZTEST()
791 ARRAY_SIZE(ctx->priority_queues), in ZTEST()
807 /* Invert it to make sure the read-back value is proper */ in ZTEST()
819 /* Re-enable Qav for queue */ in ZTEST()
827 /* Invert it to make sure the read-back value is proper */ in ZTEST()
849 /* Reset local value - read-back and verify it */ in ZTEST()
868 /* Reset local value - read-back and verify it */ in ZTEST()
892 params.qav_param.delta_bandwidth = -10; in ZTEST()
909 /* Try to set read-only parameters */ in ZTEST()
949 struct eth_fake_context *ctx = dev->data; in ZTEST()
967 ARRAY_SIZE(ctx->ports), in ZTEST()
984 /* Invert it to make sure the read-back value is proper */ in ZTEST()
996 /* Re-enable Qbv for queue */ in ZTEST()
1004 /* Invert it to make sure the read-back value is proper */ in ZTEST()
1032 /* Reset local value - read-back and verify it */ in ZTEST()
1069 /* Reset local value - read-back and verify it */ in ZTEST()
1086 /* Reset local value - read-back and verify it */ in ZTEST()
1099 /* Try to set read-only parameters */ in ZTEST()
1126 struct eth_fake_context *ctx = dev->data; in ZTEST()
1143 ARRAY_SIZE(ctx->ports), in ZTEST()
1160 /* Invert it to make sure the read-back value is proper */ in ZTEST()
1172 /* Re-enable Qbu for queue */ in ZTEST()
1180 /* Invert it to make sure the read-back value is proper */ in ZTEST()
1203 /* Reset local value - read-back and verify it */ in ZTEST()
1223 /* Reset local value - read-back and verify it */ in ZTEST()
1240 zassert_equal(ret, -EINVAL, in ZTEST()
1243 /* Reset local value - read-back and verify it */ in ZTEST()
1264 /* Reset local value - read-back and verify it */ in ZTEST()
1295 /* Reset local value - read-back and verify it */ in ZTEST()
1327 struct eth_fake_context *ctx = dev->data; in ZTEST()
1345 ARRAY_SIZE(ctx->priority_queues), in ZTEST()
1357 zassert_equal(ret, -EACCES, "could disable TXTIME for queue 0 (%d)", in ZTEST()
1376 /* Invert it to make sure the read-back value is proper */ in ZTEST()
1387 /* Re-enable TXTIME for queue */ in ZTEST()
1394 /* Invert it to make sure the read-back value is proper */ in ZTEST()
1442 zassert_equal(ret, -EALREADY, in change_to_same_promisc_mode()