Skip to content

Commit 5fda5d2

Browse files
committed
ON-14783: Add additional NIC flags for X3522
This commit adds two additional NIC flags for use with X3522 NICs. These being ZF_RES_NIC_FLAG_SHARED_RXQ and ZF_RES_NIC_FLAG_CTPIO_ONLY. These are then used to set up the stack.
1 parent 787182e commit 5fda5d2

File tree

2 files changed

+32
-11
lines changed

2 files changed

+32
-11
lines changed

src/include/zf_internal/private/zf_stack_def.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ struct zf_stack {
181181
#define ZF_RES_NIC_FLAG_VLAN_FILTERS 0x1
182182
#define ZF_RES_NIC_FLAG_RX_LL 0x2
183183
#define ZF_RES_NIC_FLAG_TX_LL 0x4
184+
#define ZF_RES_NIC_FLAG_SHARED_RXQ 0x8
185+
#define ZF_RES_NIC_FLAG_CTPIO_ONLY 0x10
184186

185187
#include <onload/version.h>
186188
#define ZF_VERSION_LENGTH_MAX OO_VER_STR_LEN

src/lib/zf/private/stack_alloc.c

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,12 @@ static int zf_stack_init_pio(struct zf_stack_impl* sti, struct zf_attr* attr,
243243
struct zf_stack_res_nic* sti_nic = &sti->nic[nicno];
244244
ef_vi* vi = zf_stack_nic_tx_vi(st_nic);
245245

246-
if( st_nic->vi.nic_type.arch == EF_VI_ARCH_EFCT &&
246+
if( sti_nic->flags & ZF_RES_NIC_FLAG_CTPIO_ONLY &&
247247
attr->pio >= PIO_MUST_USE ) {
248248
zf_log_stack_warn(st,
249-
"PIO not supported by efct interface but pio=%d. "
249+
"PIO not supported by %s but pio=%d. "
250250
"Not attempting to allocate PIO buffer.\n",
251-
attr->pio);
251+
sti_nic->if_name, attr->pio);
252252
st_nic->pio.busy = 3;
253253
return 0;
254254
}
@@ -492,15 +492,24 @@ static int zf_stack_init_nic_capabilities(struct zf_stack* st, int nicno)
492492
{
493493
struct zf_stack_impl* sti = ZF_CONTAINER(struct zf_stack_impl, st, st);
494494
unsigned long vlan_filters;
495-
unsigned long variant;
495+
unsigned long variant, variant2;
496496
ef_driver_handle dh = sti->nic[nicno].dh;
497497
ef_pd* pd = &sti->nic[nicno].pd;
498498
int rc;
499499

500500
sti->nic[nicno].flags = 0;
501501

502502
rc = ef_pd_capabilities_get(dh, pd, dh, EF_VI_CAP_RX_FW_VARIANT, &variant);
503-
if( rc != 0 ) {
503+
if( rc == -EOPNOTSUPP ) {
504+
rc = ef_pd_capabilities_get(dh, pd, dh, EF_VI_CAP_RX_SHARED, &variant2);
505+
if( rc != 0 ) {
506+
zf_log_stack_err(st, "Unknown RX mode for interface %s (rc %d)\n",
507+
sti->nic[nicno].if_name, rc);
508+
return -EOPNOTSUPP;
509+
}
510+
sti->nic[nicno].flags |= ZF_RES_NIC_FLAG_SHARED_RXQ;
511+
}
512+
else if ( rc != 0 ) {
504513
zf_log_stack_err(st, "Failed to query RX mode for interface %s (rc %d)\n",
505514
sti->nic[nicno].if_name, rc);
506515
return rc;
@@ -515,7 +524,16 @@ static int zf_stack_init_nic_capabilities(struct zf_stack* st, int nicno)
515524
sti->nic[nicno].flags |= ZF_RES_NIC_FLAG_RX_LL;
516525

517526
rc = ef_pd_capabilities_get(dh, pd, dh, EF_VI_CAP_TX_FW_VARIANT, &variant);
518-
if( rc != 0 ) {
527+
if( rc == -EOPNOTSUPP ) {
528+
rc = ef_pd_capabilities_get(dh, pd, dh, EF_VI_CAP_CTPIO_ONLY, &variant2);
529+
if( rc != 0 ) {
530+
zf_log_stack_err(st, "Unknown TX mode for interface %s (rc %d)\n",
531+
sti->nic[nicno].if_name, rc);
532+
return -EOPNOTSUPP;
533+
}
534+
sti->nic[nicno].flags |= ZF_RES_NIC_FLAG_CTPIO_ONLY;
535+
}
536+
else if( rc != 0 ) {
519537
zf_log_stack_err(st, "Failed to query TX mode for interface %s (rc %d)\n",
520538
sti->nic[nicno].if_name, rc);
521539
return rc;
@@ -574,8 +592,9 @@ int zf_stack_init_nic_resources(struct zf_stack_impl* sti,
574592
if( rc < 0 )
575593
goto fail1;
576594

577-
if( !(sti->nic[nicno].flags & ZF_RES_NIC_FLAG_RX_LL) ||
578-
!(sti->nic[nicno].flags & ZF_RES_NIC_FLAG_TX_LL) ) {
595+
if( (!(sti_nic->flags & ZF_RES_NIC_FLAG_RX_LL) ||
596+
!(sti_nic->flags & ZF_RES_NIC_FLAG_TX_LL)) &&
597+
!(sti_nic->flags & ZF_RES_NIC_FLAG_SHARED_RXQ) ) {
579598
zf_log_stack_warn(st, "Interface %s is not in low latency mode.\n",
580599
sti->nic[nicno].if_name);
581600
zf_log_stack_warn(st, "Low latency mode is recommended for best "
@@ -636,9 +655,9 @@ int zf_stack_init_nic_resources(struct zf_stack_impl* sti,
636655
);
637656

638657
if ( attr->rx_ring_max != 0 ) {
639-
/* For EFCT, we store the timestamp in a fake prefix when copying from
640-
* the shared rx buffer into our own packet buffer. */
641-
if( st_nic->vi.nic_type.arch == EF_VI_ARCH_EFCT )
658+
/* For shared rxqs, we store the timestamp in a fake prefix when copying
659+
* from the shared rx buffer into our own packet buffer. */
660+
if( sti_nic->flags & ZF_RES_NIC_FLAG_SHARED_RXQ )
642661
st_nic->rx_prefix_len = ES_DZ_RX_PREFIX_SIZE;
643662
else
644663
st_nic->rx_prefix_len = ef_vi_receive_prefix_len(&st_nic->vi);

0 commit comments

Comments
 (0)