summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/packet_utils.c
AgeCommit message (Collapse)AuthorFilesLines
2020-09-21Added support for multiple vlans in ipv4 vdev modeXavier Simonart1-24/+23
When the following conditions are met: - ipv4 - vdev enabled Then multiple vlans are supported. Multiple vlans can be configured using the vlan_tag option within the port section of the config file. Multiple (different) local_ipv4/prefix must then also be configured within the same section. Note that for ipv6 multiple vlans are not supported (yet) Also, when vdev is not enabled, multiple vlans are also not (yet) supported. Change-Id: I38b6cd98ff2a0f484d1bf0910b15413ba21ae6d6 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-09-21Improve performance in IPv6 generatorXavier Simonart1-41/+23
Change-Id: I3abc92652402162d15249e345446debdeb778176 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-09-21Added support for VLAN in IPv6Xavier Simonart1-3/+3
Change-Id: Ib1b3d54f9cb8e4284eee7ed0998e96370762a17e Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-09-21Added support for gateway ipv6 & cmd for sending unsollicited neighbor ↵Xavier Simonart1-15/+43
advertisement Change-Id: Iae35d3fa19ad7cf90d8c2e0c104b0e798ac34787 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-09-21Added support for reporting packet (mis)order.Xavier Simonart1-3/+3
The "Latency" screen has been updated with 3 columns: - mis-ordered Count the number of mis-ordered packets. - extent: Gives an indication of how mis-ordered the packets are. Receiving packet "x - 5" after receiving packet "x" will cause an extent of 5. - duplicate: Count number of duplicate packets. Following commands have been added for the impair mode: - proba no drop: replaces the former "probability" command. Percentage of forwarded packets. So 99.5 means 0.5% of packet drop. - proba delay Percentage of delayed packets for the impair mode. - proba duplicate Percentage of duplicate packets. Similar parameters are supported within the config files: - proba no drop - proba delay - proba duplicate Note: it is recommanded to use the signature when measuring packet misorder, as otherwise unexpected packet would cause miscounts. Change-Id: I037f606f264d6e2bd7f123df5ed57ab7df8386d7 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-07-10Fix gateway l3 wrongly inserting VLANsXavier Simonart1-1/+20
Change-Id: I187ed4f282c6332a7e906bc03b51d26295a475ac Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-05-29VLAN support with vdev devices + few other changesXavier Simonart1-9/+24
- vdev devices now support VLAN. - kernel tap device can be configured with a netmask (/24 was always used in previous version). - when sending a (fake) packet to the kernel, this packet will now not be routed by the kernel (i.e. it will leave through the interface configured by PROX). This might change in the futture when PROX supports multiple VLANs per port. But today it prevents ARP being sent on management interfaces. - Log error in case kernel unable to send packet. - Added support for comments (';') in lua sections. - Prevent duplication of local_ipv4 - should now be configured in port section local_ipv4 in core section still supported Change-Id: I8f9a40fe6ad6f3013ff91b58b44627c7f34081e6 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-05-29Added initial support for NDP (IPv6)Xavier Simonart1-82/+379
Following messages are now handled by PROX - router_solicitation - neighbour_solicitation - router_advertisement - neighbour_advertisement The following parameters are supported (through the PROX config file) - sub mode=ndp This will enable handling of router and neighbour solicitation and advertisement. - local ipv6=xxxx:xxxx:xxxxx:xxxx:xxxx:xxxx:xxxx:xxxx This will configure the local IPv6 address of the port. This parameter is optional. If not specified, the local IPv6 will be calculated from the EUI. - global ipv6=xxxx:xxxx:xxxxx:xxxx:xxxx:xxxx:xxxx:xxxx This will configure the global IPv6 address of the port. This parameter is optional. If not specified, the global IPv6 will be calculated from the EUI and the router prefix received from the router. - ipv6 router=yes This will cause the core to behave as an IPv6 router i.e. it will generate Router Advertisement messages This is only useful in back to back cases, when no real IPv6 router is present in the setup. - router prefix=xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx The router prefix usedin the router advertisement The prefix will be used by the node to build an IPv6 global address in cases none were configured. "Unsollicited NA" parameter has been added within the core/task section. If set to yes (Unsollicited NA=yes), then an unsollicited neighbour Advertisement is sent at startup A same core/task cannot support both l3 and ndp mode. Those messages will be generated or handled when submode is set to "ndp": - neighbour sollicitation - neighbour advertisement - router sollicitation - router advertisement An example configuration is provided: config/ipv6.cfg in which port 0 / core 1 plays the role of the generator and port 1 / core 2 plays the role of the swap. Change-Id: Id0ab32d384448b4cf767fb4a1c486fc023f4f395 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-05-29Fix mbuf leak and stop sending pseudo packetXavier Simonart1-10/+47
In addition to a mmbuf leak when receiving netlink routes packets this commit prevents sending the PROX pseudo packet i.e. the packet PROX sends to the kernel socket to have it generate an ARP request. Change-Id: Iabbdecbe412e4b90ac0df7e30fa36d096c5326f0 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-05-29Improve performance in l3 submodeXavier Simonart1-11/+14
Two cases where performance has been improved - When using a gateway from a routing table (l3 submode), store the mac within the next hop table, to avoid a hash_lookup. This gives ~10% improvement. - Read tsc only once per bulk (of up to 64 packets). This gives ~10% improvement to swap, 4% to gen. In addition a small fix has been added, preventig "No route" Error to be written too aften. Change-Id: I8a7ab74a32f09c8ff47f751ee91e84afee1b2147 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-05-29Added initial support for BGPXavier Simonart1-62/+224
Through this commit BGP messages are forwarded to tap device Netlink messages are enabled to receive route Updates. In addition, generating tasks can also specify a routing table which will be used when sending packets The routes initialized by the routing table can be changed through the reception of BGP messages Change-Id: I187ba9a921885cbc9b209aae5fb654309e3388b8 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-05-29Improve ctrlplane performanceXavier Simonart1-7/+13
The crlplane performance has been improved. This is necessary when handling many IP in L3 mode (i.e. many ARP Requests/Replies). Before this change, arp timer was updated as soon as an arp request was tentativaly sent to the master. This means that, if the request failed to be sent (e.g. ring full) we had to wait arp_update_time (default 1sec) before trying again. Now arp_update_time is only used when an arp reply is received. If a request has been successfully sent, then the arp timer is updated by 1 second (i.e. we will not send any arp reuest for this IP within this second) If we failed to send the request, then the timer is updated by 100 msec which means we will wait 100 msec before trying again. A too high value here would have meant that we have to wait a long time before trying again. A too short value overload the master ring with request to transmit ARP requests, so that master is unable to handle arp replies. arp_update_time is now also partly randomized to avoid all IPs to request arp request at the beginning of the test. So if arp_update_time is 10 sec then the configuration sets it to 5 to 15 sec. As a final note the following parameter (already implemented before) can be changed to improve ctrlplane performance (at the cost of dataplane) ctrl path polling frequency=10000 Change-Id: I9660458a22e7442eaa0c83aaa0c9893a15069f98 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-05-29Added support for netlinkXavier Simonart1-4/+40
Through this commit ARP and ICMP messages are forwarded to the kernel when vdev tap devices are enabled, as well as PROX l3 mode. ICMP support has also been added to master (i.e. PROX L3 mode) and to swap (so when L3 submode is not enabled). Change-Id: Ie6bf52cbae7171bfca041ff18651d4ec866f44cd Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-05-29Add support for vdev tap devicesXavier Simonart1-1/+3
This commit adds support for the creation of tap devices. To create a tap device, and associate it with a DPDK port, add within the port section: vdev=<tap_name> local ipv4=<ip_assigned_to_port> <tap_name> will appear as a kernel network device, with an IP <ip_assigned_to_port> ARP packets received from the network on the DPDK interface will be forwarded to the kernel. 1st packet which needs to be generated to a new IP will cause an IP packet to be sent to the kernel (using socket sendto) forcing the kernel to send an ARP_REQUEST. In this commit, there is no notification from the kernel about ARP table changes. This is subject to further commits. Two config files, gen_tap.cfg and swap_tap.cfg have been created. They work one against each other. *** Note however that they do not work if running within the same host (with the port being connected back to back) *** This is due to the fact that the kernel would bypass the ports and use local interface... Change-Id: Iadeec0d99e3c693472ea44bdb9163a3bf97df2fa Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-04-29Fix configuration of arp_timeout and arp_update_timeXavier Simonart1-2/+2
Change-Id: I9e90c9bdd4d6e83ce0533fd38e1980dca1841bdb Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2020-01-29Prepare for DPDK 19.08 supportXavier Simonart1-17/+17
This commit prepares PROX for supporting changes from DPDK 19.08 Mainly, the "sed" listed below were run. In addition, - some forward definition have been removed, - prox_compat.h has been updated - prox_compat.h has been included where necessary. Hence such a commit is rather easy to review and to reapply on other branches if necessary. sed -i 's/struct ether_hdr/prox_rte_ether_hdr/g' *.h sed -i 's/struct ether_hdr/prox_rte_ether_hdr/g' *.c sed -i 's/struct ether_addr/prox_rte_ether_addr/g' *.c sed -i 's/struct ether_addr/prox_rte_ether_addr/g' *.h sed -i 's/prox_rte_ether_addr_port/struct ether_addr_port/g' *.c sed -i 's/prox_rte_ether_addr_port/struct ether_addr_port/g' *.h sed -i 's/struct vlan_hdr/prox_rte_vlan_hdr/g' *.c sed -i 's/struct vlan_hdr/prox_rte_vlan_hdr/g' *.h sed -i 's/struct ipv4_hdr/prox_rte_ipv4_hdr/g' *.h sed -i 's/struct ipv4_hdr/prox_rte_ipv4_hdr/g' *.c sed -i 's/struct ipv6_hdr/prox_rte_ipv6_hdr/g' *.c sed -i 's/struct ipv6_hdr/prox_rte_ipv6_hdr/g' *.h sed -i 's/struct udp_hdr/prox_rte_udp_hdr/g' *.c sed -i 's/struct udp_hdr/prox_rte_udp_hdr/g' *.h sed -i 's/struct tcp_hdr/prox_rte_tcp_hdr/g' *.c sed -i 's/struct tcp_hdr/prox_rte_tcp_hdr/g' *.h sed -i 's/struct prox_rte_ether_addr_copy/ether_addr_copy/g' *.c sed -i 's/struct prox_rte_ether_addr_copy/ether_addr_copy/g' *.h sed -i 's/struct prox_rte_ether_addr_copy/prox_rte_ether_addr_copy/g' *.c sed -i 's/struct prox_rte_ether_addr_copy/ether_addr_copy/g' *.h sed -i 's/prox_rte_ether_addr_copy/ether_addr_copy/g' *.h sed -i 's/prox_rte_ether_addr_copy/ether_addr_copy/g' *.c sed -i 's/ether_addr_copy/prox_rte_ether_addr_copy/g' *.c sed -i 's/ether_addr_copy/prox_rte_ether_addr_copy/g' *.h sed -i 's/prox_rte_ether_hdr_arp/struct ether_hdr_arp/g' *.h sed -i 's/prox_rte_ether_hdr_arp/struct ether_hdr_arp/g' *.c sed -i 's/struct vxlan_gpe_hdr/prox_rte_vxlan_gpe_hdr/g' *.h sed -i 's/struct vxlan_gpe_hdr/prox_rte_vxlan_gpe_hdr/g' *.c sed -i 's/eth_random_addr/prox_rte_eth_random_addr/g' *.c sed -i 's/eth_random_addr/prox_rte_eth_random_addr/g' *.h sed -i 's/ETHER_CRC_LEN/PROX_RTE_ETHER_CRC_LEN/g' *.c sed -i 's/ETHER_CRC_LEN/PROX_RTE_ETHER_CRC_LEN/g' *.h sed -i 's/ETHER_HDR_LEN/PROX_RTE_ETHER_HDR_LEN/g' *.c sed -i 's/ETHER_HDR_LEN/PROX_RTE_ETHER_HDR_LEN/g' *.h sed -i 's/ETHER_MAX_LEN/PROX_RTE_ETHER_MAX_LEN/g' *.c sed -i 's/ETHER_MAX_LEN/PROX_RTE_ETHER_MAX_LEN/g' *.h sed -i 's/ETHER_MIN_LEN/PROX_RTE_ETHER_MIN_LEN/g' *.c sed -i 's/ETHER_MIN_LEN/PROX_RTE_ETHER_MIN_LEN/g' *.h sed -i 's/TCP_SYN_FLAG/PROX_RTE_TCP_SYN_FLAG/g' *.c sed -i 's/TCP_RST_FLAG/PROX_RTE_TCP_RST_FLAG/g' *.c sed -i 's/TCP_FIN_FLAG/PROX_RTE_TCP_FIN_FLAG/g' *.c sed -i 's/TCP_ACK_FLAG/PROX_RTE_TCP_ACK_FLAG/g' *.c Change-Id: I4dfe8be68e618c94dcaae28754579fbeb571bb00 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2019-02-07Fixed typo in setting up ARP timersXavier Simonart1-1/+0
Change-Id: I5b550a42b27d697f77c4bafab890ba57279f8d13 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2019-02-07Merge "Fix memory leak in L3 submode"Deepak S1-1/+1
2019-02-07Merge changes from topic 'fix_non_dataplane_pkt_count'Deepak S1-2/+3
* changes: Prevent dropping ARP packets Do not add count of non dataplane packets to dropped count
2019-01-30Fix memory leak in L3 submodeXavier Simonart1-1/+1
In L3 submodes, there were two memory leaks - when a L3 core was restarted, causing around 2MB leak and a potential issue after 256 start/stop - a potential mbuf leak when handling arp replies Those have been fixed Change-Id: I348478fa5967936297850432e93667e12b0adac4 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2019-01-28Add support for configurable arp timers in L3 modeXavier Simonart1-7/+16
L3 mode supports two timers: - arp_update_time, defaulted to 1 second, which makes PROX to send arp request every second for active flows - arp_timeout, previously defaulted to 30 seconds, which makes PROX consider a MAC address as invalid if no arp_reply was received within those 30 seconds. Those timers values were hardcoded. They can now be configured through the configuration file (within the core section), using resp. "arp update time" and "arp timeout" keywords. Unit is milli seconds. The default becomes respectively 1 second and 2 weeks. Change-Id: I35e46e97df32ca44c2cdfae85a20ee015de5d6e1 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2019-01-03Prevent dropping ARP packetsXavier Simonart1-2/+3
JIRA: SAMPLEVNF-152 When system is overloaded, ARP packets were sometimes dropped, as any other packets. This was causing two issues: - The count of TX non dataplane packets was wrong - If many consecutive ARP packets were dropped, the underlying switch might see its ARP timer expiring, causing performance degradation (packets being broadcasted). ARP packets are now always sent as no-drop. Change-Id: I9a86cbf8c4b56a178f86bc789153f1fa49ddf73f Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2018-12-13Add support for zero packet loss in PROX L3 mode.Xavier Simonart1-21/+82
In L3 mode, prox is extracting IP destination address in the packets. It uses this destination address to find the MAC address. If the MAC address is not found, it sends a ARP request. It also sends ARP request when it realizes that some timeout expired. However, PROX was using the mbuf of the existing packets (to be forwarded) to send the ARP. This resulted in packet loss. Now PROX is generating ARP requests using mbuf from an ARP mempool. Some clean up was also done. Change-Id: Icb6083a8cdf88789553ad23c32ca12d6b7ba7f08 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2018-12-13Clean up debugging messagesXavier Simonart1-2/+0
Print IP address in a.b.c.d format instead of one 32-bit number. Better align debugging information in log file Change-Id: Icfab30836ba83d53f700fcfbdfbd7cf238ed7bf8 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2018-10-28Add support for counting non dataplane related packetsXavier Simonart1-0/+1
When performing some zero packet loss performance testing on dataplane, it is important (not) to count non dataplane packets. For instance, one might receive uexpected packets from a switch, or ARP packets. Or one might need to transmit ARP packets. Such packets should not be counted as dataplane packets as for thse packets there is no 1:1 mapping between transmitted packets and received packets. To support this, the counters reporting numbers of transmitted and received packets remain unchanged but two new counters have been added to PROX, counting respectively number of received and number of transmitted non-dataplane packets. On RX side, packets are counsidered as non-dataplane if being ARP or if they do not countain the proper signature On TX side, ARP packets are not considered as dataplane packets. This feature requires configuration of signature. "dp core stats" command has been added Change-Id: I98e113cd02f36d540383d343a433592867ad86a9 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
2018-03-30Add support for multiple GEN tasks running on the same coreIgor Shaula1-1/+1
resolve memory allocation issue Change-Id: I90bbf711a6a7a4869e5024c061470d9779839a60 Signed-off-by: Igor Shaula <igor.shaula@intel.com>
2017-10-25Merge changes from PROX-v041Patrice Buriez1-0/+274
Change-Id: Ie6d4e7ce22c27967117a446626f5923643397812 Signed-off-by: Patrice Buriez <patrice.buriez@intel.com>