Skip to content

Commit 0cac013

Browse files
committed
DAG: vDAG Tx streams are not supported. [skip ci]
vDAG is different enough to require different code to work properly. Before that code is implemented, avoid a failure to fail: reject vDAG Tx streams in dag_activate_tx() and omit them in dag_findalldevs().
1 parent fec0628 commit 0cac013

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

doc/README.dag.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ number of the required interface before calling **pcap_activate**(). For
128128
example, `ERF_TX_INTERFACE=1` uses port B.
129129

130130
This feature has been tested on DAG 7.5G2 and DAG 9.2X2, other models may or
131-
may not work.
131+
may not work. It does not support vDAG devices.
132132

133133
## Other considerations
134134

pcap-dag.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -824,13 +824,20 @@ dag_activate_tx(pcap_t *p)
824824
}
825825
pd->tx_iface = (uint8_t)iface;
826826

827-
// Determine the correct alignment/padding size for the card.
828827
const dag_card_inf_t *inf = dag_pciinfo(p->fd);
829828
if (! inf) {
830829
pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
831830
errno, "dag_pciinfo");
832831
return PCAP_ERROR;
833832
}
833+
834+
if (inf->device_code == PCI_DEVICE_ID_VDAG) {
835+
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
836+
"vDAG Tx streams are not supported");
837+
return PCAP_ERROR;
838+
}
839+
840+
// Determine the correct alignment/padding size for the card.
834841
switch(inf->device_code) {
835842
case PCI_DEVICE_ID_DAG9_2X2:
836843
case PCI_DEVICE_ID_DAG9_2SX2:
@@ -841,11 +848,6 @@ dag_activate_tx(pcap_t *p)
841848
}
842849

843850
// Read the TERF FCS size for later use by dag_inject().
844-
if (inf->device_code == PCI_DEVICE_ID_VDAG) {
845-
// vDAG does not have a notion of FCS.
846-
pd->terf_fcs_bytes = 0;
847-
return 0;
848-
}
849851
dag_component_t cfg_comp = dag_component_get_subcomponent(
850852
pd->dag_root, kComponentTerf, 0);
851853
if (! cfg_comp) {
@@ -1461,7 +1463,8 @@ dag_findalldevs(pcap_if_list_t *devlistp, char *errbuf)
14611463
if (bufsize < 0)
14621464
continue; // Does not exist.
14631465
// Only streams with buffer memory are usable.
1464-
if (bufsize > 0) {
1466+
if (bufsize > 0 &&
1467+
(RX_ONLY(stream) || inf->device_code != PCI_DEVICE_ID_VDAG)) {
14651468
description = dag_device_description (c);
14661469
// a conditional shorthand device
14671470
if (stream == 0 &&

0 commit comments

Comments
 (0)