summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2021-03-29 18:22:22 +0200
committerFlorin Coras <florin.coras@gmail.com>2021-03-31 15:10:12 +0000
commit6b88aa287133797cb66f73374bbfade7637dab55 (patch)
tree96175f304f97cacd7132e9a2234259773a197734 /src
parent7b9b19d7bb6d72bf56ab8f1e0c2f35b15f79b983 (diff)
avf: improve capabilities handling
Type: improvement Change-Id: If35b40168414807e928cb3026633ae9d2fa703ed Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/avf/avf.h3
-rw-r--r--src/plugins/avf/device.c52
-rw-r--r--src/plugins/avf/flow.c2
-rw-r--r--src/plugins/avf/format.c28
-rw-r--r--src/plugins/avf/virtchnl.h10
5 files changed, 56 insertions, 39 deletions
diff --git a/src/plugins/avf/avf.h b/src/plugins/avf/avf.h
index 51a81c65e29..2ca31434b8b 100644
--- a/src/plugins/avf/avf.h
+++ b/src/plugins/avf/avf.h
@@ -236,7 +236,7 @@ typedef struct
virtchnl_pf_event_t *events;
u16 vsi_id;
- u32 feature_bitmap;
+ u32 cap_flags;
u8 hwaddr[6];
u16 num_queue_pairs;
u16 max_vectors;
@@ -348,6 +348,7 @@ clib_error_t *avf_program_flow (u32 dev_instance, int is_add, u8 *rule,
format_function_t format_avf_device;
format_function_t format_avf_device_name;
format_function_t format_avf_input_trace;
+format_function_t format_avf_vf_cap_flags;
vnet_flow_dev_ops_function_t avf_flow_ops_fn;
static_always_inline avf_device_t *
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index 4418dfdefbe..78a211f5d17 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -466,11 +466,10 @@ retry:
if (d->v_opcode != op)
{
- err =
- clib_error_return (0,
- "unexpected message receiver [v_opcode = %u, "
- "expected %u, v_retval %d]", d->v_opcode, op,
- d->v_retval);
+ err = clib_error_return (0,
+ "unexpected message received [v_opcode = %u, "
+ "expected %u, v_retval %d]",
+ d->v_opcode, op, d->v_retval);
goto done;
}
@@ -556,29 +555,29 @@ avf_op_get_vf_resources (vlib_main_t * vm, avf_device_t * ad,
VIRTCHNL_VF_OFFLOAD_RX_POLLING | VIRTCHNL_VF_CAP_ADV_LINK_SPEED |
VIRTCHNL_VF_OFFLOAD_FDIR_PF | VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF);
- avf_log_debug (ad, "get_vf_reqources: bitmap 0x%x", bitmap);
+ avf_log_debug (ad, "get_vf_resources: bitmap 0x%x (%U)", bitmap,
+ format_avf_vf_cap_flags, bitmap);
err = avf_send_to_pf (vm, ad, VIRTCHNL_OP_GET_VF_RESOURCES, &bitmap,
sizeof (u32), res, sizeof (virtchnl_vf_resource_t));
if (err == 0)
{
int i;
- avf_log_debug (ad, "get_vf_reqources: num_vsis %u num_queue_pairs %u "
- "max_vectors %u max_mtu %u vf_offload_flags 0x%04x "
+ avf_log_debug (ad,
+ "get_vf_resources: num_vsis %u num_queue_pairs %u "
+ "max_vectors %u max_mtu %u vf_cap_flags 0x%x (%U) "
"rss_key_size %u rss_lut_size %u",
res->num_vsis, res->num_queue_pairs, res->max_vectors,
- res->max_mtu, res->vf_offload_flags, res->rss_key_size,
- res->rss_lut_size);
+ res->max_mtu, res->vf_cap_flags, format_avf_vf_cap_flags,
+ res->vf_cap_flags, res->rss_key_size, res->rss_lut_size);
for (i = 0; i < res->num_vsis; i++)
- avf_log_debug (ad, "get_vf_reqources_vsi[%u]: vsi_id %u "
- "num_queue_pairs %u vsi_type %u qset_handle %u "
- "default_mac_addr %U", i,
- res->vsi_res[i].vsi_id,
- res->vsi_res[i].num_queue_pairs,
- res->vsi_res[i].vsi_type,
- res->vsi_res[i].qset_handle,
- format_ethernet_address,
- res->vsi_res[i].default_mac_addr);
+ avf_log_debug (
+ ad,
+ "get_vf_resources_vsi[%u]: vsi_id %u num_queue_pairs %u vsi_type %u "
+ "qset_handle %u default_mac_addr %U",
+ i, res->vsi_res[i].vsi_id, res->vsi_res[i].num_queue_pairs,
+ res->vsi_res[i].vsi_type, res->vsi_res[i].qset_handle,
+ format_ethernet_address, res->vsi_res[i].default_mac_addr);
}
return err;
@@ -948,13 +947,13 @@ avf_device_init (vlib_main_t * vm, avf_main_t * am, avf_device_t * ad,
return clib_error_return (0, "unexpected GET_VF_RESOURCE reply received");
ad->vsi_id = res.vsi_res[0].vsi_id;
- ad->feature_bitmap = res.vf_offload_flags;
+ ad->cap_flags = res.vf_cap_flags;
ad->num_queue_pairs = res.num_queue_pairs;
ad->max_vectors = res.max_vectors;
ad->max_mtu = res.max_mtu;
ad->rss_key_size = res.rss_key_size;
ad->rss_lut_size = res.rss_lut_size;
- wb_on_itr = (ad->feature_bitmap & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) != 0;
+ wb_on_itr = (ad->cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) != 0;
clib_memcpy_fast (ad->hwaddr, res.vsi_res[0].default_mac_addr, 6);
@@ -994,12 +993,11 @@ avf_device_init (vlib_main_t * vm, avf_main_t * am, avf_device_t * ad,
else
ad->n_rx_irqs = 1;
-
- if ((ad->feature_bitmap & VIRTCHNL_VF_OFFLOAD_RSS_PF) &&
+ if ((ad->cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) &&
(error = avf_op_config_rss_lut (vm, ad)))
return error;
- if ((ad->feature_bitmap & VIRTCHNL_VF_OFFLOAD_RSS_PF) &&
+ if ((ad->cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) &&
(error = avf_op_config_rss_key (vm, ad)))
return error;
@@ -1077,12 +1075,12 @@ avf_process_one_device (vlib_main_t * vm, avf_device_t * ad, int is_irq)
u32 flags = 0;
u32 mbps = 0;
- if (ad->feature_bitmap & VIRTCHNL_VF_CAP_ADV_LINK_SPEED)
+ if (ad->cap_flags & VIRTCHNL_VF_CAP_ADV_LINK_SPEED)
link_up = e->event_data.link_event_adv.link_status;
else
link_up = e->event_data.link_event.link_status;
- if (ad->feature_bitmap & VIRTCHNL_VF_CAP_ADV_LINK_SPEED)
+ if (ad->cap_flags & VIRTCHNL_VF_CAP_ADV_LINK_SPEED)
mbps = e->event_data.link_event_adv.link_speed;
if (speed == VIRTCHNL_LINK_SPEED_40GB)
mbps = 40000;
@@ -1740,7 +1738,7 @@ avf_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid,
{
if (rxq->int_mode == 0)
return 0;
- if (ad->feature_bitmap & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR)
+ if (ad->cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR)
avf_irq_n_set_state (ad, qid, AVF_IRQ_STATE_WB_ON_ITR);
else
avf_irq_n_set_state (ad, qid, AVF_IRQ_STATE_ENABLED);
diff --git a/src/plugins/avf/flow.c b/src/plugins/avf/flow.c
index 64eeea08eea..7a80da6910f 100644
--- a/src/plugins/avf/flow.c
+++ b/src/plugins/avf/flow.c
@@ -468,7 +468,7 @@ avf_flow_ops_fn (vnet_main_t *vm, vnet_flow_dev_op_t op, u32 dev_instance,
avf_flow_lookup_entry_t *fle = NULL;
int rv = 0;
- if ((ad->feature_bitmap & VIRTCHNL_VF_OFFLOAD_FDIR_PF) == 0)
+ if ((ad->cap_flags & VIRTCHNL_VF_OFFLOAD_FDIR_PF) == 0)
{
rv = VNET_FLOW_ERROR_NOT_SUPPORTED;
goto done;
diff --git a/src/plugins/avf/format.c b/src/plugins/avf/format.c
index 9bdf4a5e428..5dbfae2b378 100644
--- a/src/plugins/avf/format.c
+++ b/src/plugins/avf/format.c
@@ -57,14 +57,26 @@ u8 *
format_avf_vf_cap_flags (u8 * s, va_list * args)
{
u32 flags = va_arg (*args, u32);
- u8 *t = 0;
+ int not_first = 0;
-#define _(a, b, c) if (flags & (1 << a)) \
- t = format (t, "%s%s", t ? " ":"", c);
- foreach_avf_vf_cap_flag;
+ char *strs[32] = {
+#define _(a, b, c) [a] = c,
+ foreach_avf_vf_cap_flag
#undef _
- s = format (s, "%v", t);
- vec_free (t);
+ };
+
+ for (int i = 0; i < 32; i++)
+ {
+ if ((flags & (1 << i)) == 0)
+ continue;
+ if (not_first)
+ s = format (s, " ");
+ if (strs[i])
+ s = format (s, "%s", strs[i]);
+ else
+ s = format (s, "unknown(%u)", i);
+ not_first = 1;
+ }
return s;
}
@@ -100,8 +112,8 @@ format_avf_device (u8 * s, va_list * args)
AVF_QUEUE_SZ_MIN, AVF_QUEUE_SZ_MAX);
s = format (s, "\n%Uflags: %U", format_white_space, indent,
format_avf_device_flags, ad);
- s = format (s, "\n%Uoffload features: %U", format_white_space, indent,
- format_avf_vf_cap_flags, ad->feature_bitmap);
+ s = format (s, "\n%Ucapability flags: %U", format_white_space, indent,
+ format_avf_vf_cap_flags, ad->cap_flags);
s = format (s, "\n%Unum-queue-pairs %d max-vectors %u max-mtu %u "
"rss-key-size %u rss-lut-size %u", format_white_space, indent,
diff --git a/src/plugins/avf/virtchnl.h b/src/plugins/avf/virtchnl.h
index 48ecab07059..01c8510f542 100644
--- a/src/plugins/avf/virtchnl.h
+++ b/src/plugins/avf/virtchnl.h
@@ -130,6 +130,8 @@ typedef enum
_ (5, OFFLOAD_WB_ON_ITR, "wb-on-itr") \
_ (6, OFFLOAD_REQ_QUEUES, "req-queues") \
_ (7, CAP_ADV_LINK_SPEED, "adv-link-speed") \
+ _ (9, LARGE_NUM_QPAIRS, "large-num-qpairs") \
+ _ (15, OFFLOAD_VLAN_V2, "vlan-v2") \
_ (16, OFFLOAD_VLAN, "vlan") \
_ (17, OFFLOAD_RX_POLLING, "rx-polling") \
_ (18, OFFLOAD_RSS_PCTYPE_V2, "rss-pctype-v2") \
@@ -138,8 +140,12 @@ typedef enum
_ (21, OFFLOAD_ENCAP_CSUM, "encap-csum") \
_ (22, OFFLOAD_RX_ENCAP_CSUM, "rx-encap-csum") \
_ (23, OFFLOAD_ADQ, "offload-adq") \
+ _ (24, OFFLOAD_ADQ_v2, "offload-adq-v2") \
+ _ (25, OFFLOAD_USO, "offload-uso") \
+ _ (26, OFFLOAD_RX_FLEX_DESC, "offload-rx-flex-desc") \
_ (27, OFFLOAD_ADV_RSS_PF, "offload-adv-rss-pf") \
- _ (28, OFFLOAD_FDIR_PF, "offload-fdir-pf")
+ _ (28, OFFLOAD_FDIR_PF, "offload-fdir-pf") \
+ _ (30, CAP_DCF, "dcf")
typedef enum
{
@@ -176,7 +182,7 @@ typedef struct
u16 num_queue_pairs;
u16 max_vectors;
u16 max_mtu;
- u32 vf_offload_flags;
+ u32 vf_cap_flags;
u32 rss_key_size;
u32 rss_lut_size;
virtchnl_vsi_resource_t vsi_res[1];