summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-11-30 13:33:12 +0200
committerIdo Barnea <ibarnea@cisco.com>2016-11-30 13:33:12 +0200
commit2ded6e3d81538e2b0e016463ab8a56b08c075cbd (patch)
tree041003abd7d842252b469895dc6b3d437e0e2ba4 /src
parent36e8a41f68941fbc40f3854654d38c95bd678318 (diff)
Support receive all mode for 82599 10G card
Signed-off-by: Ido Barnea <ibarnea@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c6
-rw-r--r--src/main_dpdk.cpp47
2 files changed, 49 insertions, 4 deletions
diff --git a/src/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c b/src/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c
index d478a159..72963a89 100644
--- a/src/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/src/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5784,13 +5784,17 @@ ixgbe_add_del_ethertype_filter(struct rte_eth_dev *dev,
if (filter->queue >= IXGBE_MAX_RX_QUEUE_NUM)
return -EINVAL;
-
+#define TREX_PATCH
+#ifndef TREX_PATCH
+ // no real reason to block this.
+ // We configure rules using FDIR and ethertype that point to same queue, so there are no race condition issues.
if (filter->ether_type == ETHER_TYPE_IPv4 ||
filter->ether_type == ETHER_TYPE_IPv6) {
PMD_DRV_LOG(ERR, "unsupported ether_type(0x%04x) in"
" ethertype filter.", filter->ether_type);
return -EINVAL;
}
+#endif
if (filter->flags & RTE_ETHTYPE_FLAGS_MAC) {
PMD_DRV_LOG(ERR, "mac compare is unsupported.");
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index 540ec88e..86edd1f9 100644
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -316,7 +316,8 @@ public:
| TrexPlatformApi::IF_STAT_PAYLOAD;
}
virtual CFlowStatParser *get_flow_stat_parser();
- virtual int set_rcv_all(CPhyEthIF * _if, bool set_on) {return 0;}
+ int add_del_eth_filter(CPhyEthIF * _if, bool is_add, uint16_t ethertype);
+ virtual int set_rcv_all(CPhyEthIF * _if, bool set_on);
};
class CTRexExtendedDriverBase40G : public CTRexExtendedDriverBase10G {
@@ -6017,6 +6018,7 @@ void CTRexExtendedDriverBase10G::update_configuration(port_cfg_t * cfg){
}
int CTRexExtendedDriverBase10G::configure_rx_filter_rules(CPhyEthIF * _if) {
+ set_rcv_all(_if, false);
if ( get_is_stateless() ) {
return configure_rx_filter_rules_stateless(_if);
} else {
@@ -6047,7 +6049,7 @@ int CTRexExtendedDriverBase10G::configure_rx_filter_rules_stateless(CPhyEthIF *
res = rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, RTE_ETH_FILTER_ADD, &fdir_filter);
if (res != 0) {
- rte_exit(EXIT_FAILURE, " ERROR rte_eth_dev_filter_ctrl : %d\n",res);
+ rte_exit(EXIT_FAILURE, "Error: rte_eth_dev_filter_ctrl in configure_rx_filter_rules_stateless: %d\n",res);
}
}
@@ -6116,12 +6118,51 @@ int CTRexExtendedDriverBase10G::configure_rx_filter_rules_statefull(CPhyEthIF *
res = rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, RTE_ETH_FILTER_ADD, &fdir_filter);
if (res != 0) {
- rte_exit(EXIT_FAILURE, " ERROR rte_eth_dev_filter_ctrl : %d\n",res);
+ rte_exit(EXIT_FAILURE, "Error: rte_eth_dev_filter_ctrl in configure_rx_filter_rules_statefull: %d\n",res);
}
}
return (0);
}
+int CTRexExtendedDriverBase10G::add_del_eth_filter(CPhyEthIF * _if, bool is_add, uint16_t ethertype) {
+ int res = 0;
+ uint8_t port_id=_if->get_rte_port_id();
+ struct rte_eth_ethertype_filter filter;
+ enum rte_filter_op op;
+
+ memset(&filter, 0, sizeof(filter));
+ filter.ether_type = ethertype;
+ res = rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_ETHERTYPE, RTE_ETH_FILTER_GET, &filter);
+
+ if (is_add && (res >= 0))
+ return 0;
+ if ((! is_add) && (res == -ENOENT))
+ return 0;
+
+ if (is_add) {
+ op = RTE_ETH_FILTER_ADD;
+ } else {
+ op = RTE_ETH_FILTER_DELETE;
+ }
+
+ filter.queue = 1;
+ res = rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_ETHERTYPE, op, &filter);
+ if (res != 0) {
+ printf("Error: %s L2 filter for ethertype 0x%04x returned %d\n", is_add ? "Adding":"Deleting", ethertype, res);
+ exit(1);
+ }
+ return 0;
+}
+
+int CTRexExtendedDriverBase10G::set_rcv_all(CPhyEthIF * _if, bool set_on) {
+ int res = 0;
+ res = add_del_eth_filter(_if, set_on, ETHER_TYPE_ARP);
+ res |= add_del_eth_filter(_if, set_on, ETHER_TYPE_IPv4);
+ res |= add_del_eth_filter(_if, set_on, ETHER_TYPE_IPv6);
+
+ return res;
+}
+
void CTRexExtendedDriverBase10G::get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats){
int i;