1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
/* SPDX-License-Identifier: Apache-2.0
* Copyright (c) 2023 Cisco Systems, Inc.
*/
#include <vnet/vnet.h>
#include <vnet/dev/dev.h>
#include <dev_ena/ena.h>
#include <dev_ena/ena_inlines.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/plugin/plugin.h>
#include <vpp/app/version.h>
VLIB_REGISTER_LOG_CLASS (ena_log, static) = {
.class_name = "ena",
.subclass_name = "port",
};
vnet_dev_rv_t
ena_port_init (vlib_main_t *vm, vnet_dev_port_t *port)
{
vnet_dev_t *dev = port->dev;
log_debug (dev, "port %u", port->port_id);
return VNET_DEV_OK;
}
vnet_dev_rv_t
ena_port_start (vlib_main_t *vm, vnet_dev_port_t *port)
{
vnet_dev_t *dev = port->dev;
vnet_dev_rv_t rv;
log_debug (dev, "port start: port %u", port->port_id);
if (ena_aq_feature_is_supported (dev, ENA_ADMIN_FEAT_ID_MTU))
{
ena_aq_feat_mtu_t mtu = { .mtu = port->max_rx_frame_size };
if ((rv = ena_aq_set_feature (vm, dev, ENA_ADMIN_FEAT_ID_MTU, &mtu)))
return rv;
}
if ((rv = vnet_dev_port_start_all_rx_queues (vm, port)))
return rv;
if ((rv = vnet_dev_port_start_all_tx_queues (vm, port)))
return rv;
return VNET_DEV_OK;
}
void
ena_port_stop (vlib_main_t *vm, vnet_dev_port_t *port)
{
log_debug (port->dev, "port stop: port %u", port->port_id);
}
vnet_dev_rv_t
ena_port_cfg_change_validate (vlib_main_t *vm, vnet_dev_port_t *port,
vnet_dev_port_cfg_change_req_t *req)
{
vnet_dev_rv_t rv = VNET_DEV_OK;
switch (req->type)
{
case VNET_DEV_PORT_CFG_MAX_RX_FRAME_SIZE:
if (port->started)
rv = VNET_DEV_ERR_PORT_STARTED;
break;
default:
rv = VNET_DEV_ERR_NOT_SUPPORTED;
};
return rv;
}
vnet_dev_rv_t
ena_port_cfg_change (vlib_main_t *vm, vnet_dev_port_t *port,
vnet_dev_port_cfg_change_req_t *req)
{
vnet_dev_rv_t rv = VNET_DEV_OK;
switch (req->type)
{
case VNET_DEV_PORT_CFG_MAX_RX_FRAME_SIZE:
break;
default:
return VNET_DEV_ERR_NOT_SUPPORTED;
};
return rv;
}
|