examples-bond
网卡信息
[root@localhost bond]# ./build/app/bond_app EAL: Detected 128 lcore(s) EAL: Detected 4 NUMA nodes EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: No available hugepages reported in hugepages-2048kB EAL: Probing VFIO support... EAL: VFIO support initialized EAL: PCI device 0000:05:00.0 on NUMA socket 0 EAL: probe driver: 19e5:200 net_hinic EAL: using IOMMU type 1 (Type 1) net_hinic: Initializing pf hinic-0000:05:00.0 in primary process net_hinic: Device 0000:05:00.0 hwif attribute: net_hinic: func_idx:0, p2p_idx:0, pciintf_idx:0, vf_in_pf:0, ppf_idx:0, global_vf_id:15, func_type:2 net_hinic: num_aeqs:4, num_ceqs:4, num_irqs:32, dma_attr:2 net_hinic: Get public resource capability: net_hinic: host_id: 0x0, ep_id: 0x0, intr_type: 0x0, max_cos_id: 0x7, er_id: 0x0, port_id: 0x0 net_hinic: host_total_function: 0xf2, host_oq_id_mask_val: 0x8, max_vf: 0x78 net_hinic: pf_num: 0x2, pf_id_start: 0x0, vf_num: 0xf0, vf_id_start: 0x10 net_hinic: Get share resource capability: net_hinic: host_pctxs: 0x0, host_cctxs: 0x0, host_scqs: 0x0, host_srqs: 0x0, host_mpts: 0x0 net_hinic: Get l2nic resource capability: net_hinic: max_sqs: 0x10, max_rqs: 0x10, vf_max_sqs: 0x4, vf_max_rqs: 0x4 net_hinic: Initialize 0000:05:00.0 in primary successfully EAL: PCI device 0000:06:00.0 on NUMA socket 0 EAL: probe driver: 19e5:200 net_hinic net_hinic: Initializing pf hinic-0000:06:00.0 in primary process net_hinic: Device 0000:06:00.0 hwif attribute: net_hinic: func_idx:1, p2p_idx:1, pciintf_idx:0, vf_in_pf:0, ppf_idx:0, global_vf_id:135, func_type:0 net_hinic: num_aeqs:4, num_ceqs:4, num_irqs:32, dma_attr:2 net_hinic: Get public resource capability: net_hinic: host_id: 0x0, ep_id: 0x1, intr_type: 0x0, max_cos_id: 0x7, er_id: 0x1, port_id: 0x1 net_hinic: host_total_function: 0xf2, host_oq_id_mask_val: 0x8, max_vf: 0x78 net_hinic: pf_num: 0x2, pf_id_start: 0x0, vf_num: 0xf0, vf_id_start: 0x10 net_hinic: Get l2nic resource capability: net_hinic: max_sqs: 0x10, max_rqs: 0x10, vf_max_sqs: 0x4, vf_max_rqs: 0x4 net_hinic: Initialize 0000:06:00.0 in primary successfully EAL: PCI device 0000:7d:00.0 on NUMA socket 0 EAL: probe driver: 19e5:a222 net_hns3 EAL: PCI device 0000:7d:00.1 on NUMA socket 0 EAL: probe driver: 19e5:a221 net_hns3 EAL: PCI device 0000:7d:00.2 on NUMA socket 0 EAL: probe driver: 19e5:a222 net_hns3 EAL: PCI device 0000:7d:00.3 on NUMA socket 0 EAL: probe driver: 19e5:a221 net_hns3 User device list: Port 0 modified RSS hash function based on hardware support,requested:0xa38c configured:0x830c net_hinic: Disable vlan filter succeed, device: hinic-0000:05:00.0, port_id: 0 net_hinic: Disable vlan strip succeed, device: hinic-0000:05:00.0, port_id: 0 net_hinic: Set new mac address 44:a1:91:a4:9c:0b net_hinic: Disable promiscuous, nic_dev: hinic-0000:05:00.0, port_id: 0, promisc: 0 net_hinic: Disable allmulticast succeed, nic_dev: hinic-0000:05:00.0, port_id: 0 Port 0 MAC: 44:a1:91:a4:9c:0b Port 1 modified RSS hash function based on hardware support,requested:0xa38c configured:0x830c net_hinic: Disable vlan filter succeed, device: hinic-0000:06:00.0, port_id: 1 net_hinic: Disable vlan strip succeed, device: hinic-0000:06:00.0, port_id: 1 net_hinic: Set new mac address 44:a1:91:a4:9c:0c net_hinic: Disable promiscuous, nic_dev: hinic-0000:06:00.0, port_id: 1, promisc: 0 net_hinic: Disable allmulticast succeed, nic_dev: hinic-0000:06:00.0, port_id: 1 Port 1 MAC: 44:a1:91:a4:9c:0c before create rte_eth_dev_count_avail is 2 after create rte_eth_dev_count_avail is 3 net_hinic: Set new mac address 44:a1:91:a4:9c:0b net_hinic: Set new mac address 44:a1:91:a4:9c:0b net_hinic: Set new mac address 44:a1:91:a4:9c:0c net_hinic: Set port mtu, port_id: 0, mtu: 1500, max_pkt_len: 1518 net_hinic: Disable vlan filter succeed, device: hinic-0000:05:00.0, port_id: 0 net_hinic: Disable vlan strip succeed, device: hinic-0000:05:00.0, port_id: 0 net_hinic: Set new mac address 44:a1:91:a4:9c:0b net_hinic: Disable promiscuous, nic_dev: hinic-0000:05:00.0, port_id: 0, promisc: 0 net_hinic: Disable allmulticast succeed, nic_dev: hinic-0000:05:00.0, port_id: 0 net_hinic: Set port mtu, port_id: 1, mtu: 1500, max_pkt_len: 1518 net_hinic: Disable vlan filter succeed, device: hinic-0000:06:00.0, port_id: 1 net_hinic: Disable vlan strip succeed, device: hinic-0000:06:00.0, port_id: 1 net_hinic: Set new mac address 44:a1:91:a4:9c:0c net_hinic: Disable promiscuous, nic_dev: hinic-0000:06:00.0, port_id: 1, promisc: 0 net_hinic: Disable allmulticast succeed, nic_dev: hinic-0000:06:00.0, port_id: 1 net_hinic: Set new mac address 44:a1:91:a4:9c:0b net_hinic: Set new mac address 44:a1:91:a4:9c:0c Waiting for slaves to become active...net_hinic: Hilink info report after link down net_hinic: Cable information: Vendor: LUXSHARE-ICT, QSFP, Direct Attach Copper, length: 5m, max_speed: 100Gbps net_hinic: Link information: antoneg: on net_hinic: TX_FFE: PRE2=-4; PRE1=0; MAIN=61; POST1=-1; POST1X=0 net_hinic: RX_CTLE: Gain1~3=5 7 7; Boost1~3=5 2 2; Zero1~3=5 1 0; Squelch1~3=2 2 2 net_hinic: PMA ctrl: on, MAC tx enable, MAC rx enable, PMA debug inforeg: 0x0, PMA signal ok reg: 0x1, RF/LF status reg: 0x1 net_hinic: alos: 0, rx_los: 0, PCS block counter reg: 0x1001,PCS link: 0x2, MAC link: 0x2 PCS_err_cnt: 0x0 net_hinic: Hilink info report after link down net_hinic: Cable information: Vendor: LUXSHARE-ICT, QSFP, Direct Attach Copper, length: 5m, max_speed: 100Gbps net_hinic: Link information: antoneg: on net_hinic: TX_FFE: PRE2=-4; PRE1=0; MAIN=61; POST1=-1; POST1X=0 net_hinic: RX_CTLE: Gain1~3=4 7 7; Boost1~3=4 2 2; Zero1~3=5 1 0; Squelch1~3=2 2 2 net_hinic: PMA ctrl: on, MAC tx enable, MAC rx disable, PMA debug inforeg: 0x0, PMA signal ok reg: 0x1, RF/LF status reg: 0x1 net_hinic: alos: 0, rx_los: 0, PCS block counter reg: 0x1001,PCS link: 0x2, MAC link: 0x2 PCS_err_cnt: 0x0 ......net_hinic: Link status event report, dev_name: 0000:05:00.0, port_id: 0, link_status: UP net_hinic: Set new mac address 44:a1:91:a4:9c:0b net_hinic: Set new mac address 44:a1:91:a4:9c:0c net_hinic: Link status event report, dev_name: 0000:06:00.0, port_id: 1, link_status: UP net_hinic: Hilink info report after link up net_hinic: Cable information: Vendor: LUXSHARE-ICT, QSFP, Direct Attach Copper, length: 5m, max_speed: 100Gbps net_hinic: Link information: speed 40Gbps, BASE-FEC, autoneg on net_hinic: TX_FFE: PRE2=-4; PRE1=0; MAIN=61; POST1=-1; POST1X=0 net_hinic: RX_CTLE: Gain1~3=5 7 7; Boost1~3=4 2 2; Zero1~3=5 1 0; Squelch1~3=2 2 2 net_hinic: Hilink info report after link up net_hinic: Cable information: Vendor: LUXSHARE-ICT, QSFP, Direct Attach Copper, length: 5m, max_speed: 100Gbps net_hinic: Link information: speed 40Gbps, BASE-FEC, autoneg on net_hinic: TX_FFE: PRE2=-4; PRE1=0; MAIN=61; POST1=-1; POST1X=0 net_hinic: RX_CTLE: Gain1~3=5 7 7; Boost1~3=3 2 2; Zero1~3=5 1 0; Squelch1~3=2 2 2 ... net_hinic: Enable promiscuous, nic_dev: hinic-0000:05:00.0, port_id: 0, promisc: 0 Port 2 MAC: 44:a1:91:a4:9c:0b Starting lcore_main on core 1:0 Our IP:7.0.0.10 bond6>
rte_eth_bond_create
before create rte_eth_dev_count_avail is 2 after create rte_eth_dev_count_avail is 3
mac
Bond Port 2 MAC: 44:a1:91:a4:9c:0b
Slave Port 0 MAC: 44:a1:91:a4:9c:0b
Slave Port 1 MAC: 44:a1:91:a4:9c:0c
初始化
先初始化slave,后初始化bond
/* initialize all ports */ slaves_count = nb_ports; RTE_ETH_FOREACH_DEV(i) { slave_port_init(i, mbuf_pool); slaves[i] = i; } bond_port_init(mbuf_pool);
在一个节点上ping bondIP
[root@bogon ~]# ip a sh enahisic2i2 4: enahisic2i2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 48:57:02:64:ea:1d brd ff:ff:ff:ff:ff:ff inet 10.10.101.81/24 scope global enahisic2i2 valid_lft forever preferred_lft forever inet 10.10.104.81/24 scope global enahisic2i2 valid_lft forever preferred_lft forever inet 7.0.0.11/24 scope global enahisic2i2 valid_lft forever preferred_lft forever [root@bogon ~]# ip a sh enahisic2i3 5: enahisic2i3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 48:57:02:64:ea:1e brd ff:ff:ff:ff:ff:ff inet 10.10.103.81/24 scope global enahisic2i3 valid_lft forever preferred_lft forever inet 7.0.0.12/24 scope global enahisic2i3 valid_lft forever preferred_lft forever [root@bogon ~]#
网卡1
[root@bogon ~]# ip a add 7.0.0.11/24 dev enahisic2i2
[root@bogon ~]# ping 7.0.0.10 PING 7.0.0.10 (7.0.0.10) 56(84) bytes of data. 64 bytes from 7.0.0.10: icmp_seq=1 ttl=64 time=0.231 ms 64 bytes from 7.0.0.10: icmp_seq=2 ttl=64 time=0.191 ms 64 bytes from 7.0.0.10: icmp_seq=3 ttl=64 time=0.137 ms ^C --- 7.0.0.10 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2095ms rtt min/avg/max/mdev = 0.137/0.186/0.231/0.040 ms [root@bogon ~]#
[root@bogon ~]# tcpdump -i enahisic2i2 icmp or arp and host 7.0.0.10 -env tcpdump: listening on enahisic2i2, link-type EN10MB (Ethernet), capture size 262144 bytes 17:21:47.317330 48:57:02:64:ea:1d > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15761, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.11 > 7.0.0.10: ICMP echo request, id 25127, seq 1, length 64 17:21:47.317408 44:a1:91:a4:9c:0b > 48:57:02:64:ea:1d, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15761, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.11: ICMP echo request, id 25127, seq 1, length 64 17:21:47.317476 48:57:02:64:ea:1d > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15762, offset 0, flags [none], proto ICMP (1), length 84) 7.0.0.11 > 7.0.0.10: ICMP echo reply, id 25127, seq 1, length 64 17:21:47.317524 44:a1:91:a4:9c:0b > 48:57:02:64:ea:1d, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15762, offset 0, flags [none], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.11: ICMP echo reply, id 25127, seq 1, length 64 17:21:48.372493 48:57:02:64:ea:1d > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15867, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.11 > 7.0.0.10: ICMP echo request, id 25127, seq 2, length 64 17:21:48.372558 44:a1:91:a4:9c:0b > 48:57:02:64:ea:1d, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15867, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.11: ICMP echo request, id 25127, seq 2, length 64 17:21:48.372584 48:57:02:64:ea:1d > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15868, offset 0, flags [none], proto ICMP (1), length 84) 7.0.0.11 > 7.0.0.10: ICMP echo reply, id 25127, seq 2, length 64 17:21:48.372656 44:a1:91:a4:9c:0b > 48:57:02:64:ea:1d, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15868, offset 0, flags [none], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.11: ICMP echo reply, id 25127, seq 2, length 64 17:21:49.412488 48:57:02:64:ea:1d > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15943, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.11 > 7.0.0.10: ICMP echo request, id 25127, seq 3, length 64 17:21:49.412546 44:a1:91:a4:9c:0b > 48:57:02:64:ea:1d, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15943, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.11: ICMP echo request, id 25127, seq 3, length 64 17:21:49.412567 48:57:02:64:ea:1d > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15944, offset 0, flags [none], proto ICMP (1), length 84) 7.0.0.11 > 7.0.0.10: ICMP echo reply, id 25127, seq 3, length 64 17:21:49.412605 44:a1:91:a4:9c:0b > 48:57:02:64:ea:1d, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15944, offset 0, flags [none], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.11: ICMP echo reply, id 25127, seq 3, length 64 ^C 12 packets captured 12 packets received by filter 0 packets dropped by kernel [root@bogon ~]#
网卡2
无法ping 通, 两张网卡在不同vlan
[root@bogon ~]# ip a add 7.0.0.12/24 dev enahisic2i3 [root@bogon ~]# ping 7.0.0.10 -I enahisic2i3 PING 7.0.0.10 (7.0.0.10) from 7.0.0.12 enahisic2i3: 56(84) bytes of data. ^C --- 7.0.0.10 ping statistics --- 35 packets transmitted, 0 received, 100% packet loss, time 35345ms [root@bogon ~]#
[root@bogon ~]# tcpdump -i enahisic2i3 icmp or arp and host 7.0.0.10 -env tcpdump: listening on enahisic2i3, link-type EN10MB (Ethernet), capture size 262144 bytes 17:24:24.946716 48:57:02:64:ea:1e > Broadcast, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 7.0.0.10 tell 7.0.0.12, length 28 17:24:24.946791 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 64: vlan 20, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 7.0.0.10 is-at 44:a1:91:a4:9c:0c, length 46 17:24:25.972450 48:57:02:64:ea:1e > Broadcast, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 7.0.0.10 tell 7.0.0.12, length 28 17:24:25.972488 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 64: vlan 20, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 7.0.0.10 is-at 44:a1:91:a4:9c:0c, length 46 17:24:25.972490 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 64: vlan 20, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 7.0.0.10 is-at 44:a1:91:a4:9c:0c, length 46 17:24:27.012456 48:57:02:64:ea:1e > Broadcast, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 7.0.0.10 tell 7.0.0.12, length 28 17:24:27.012496 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 64: vlan 20, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 7.0.0.10 is-at 44:a1:91:a4:9c:0c, length 46 17:24:27.012499 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 64: vlan 20, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 7.0.0.10 is-at 44:a1:91:a4:9c:0c, length 46 17:24:28.052486 48:57:02:64:ea:1e > Broadcast, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 7.0.0.10 tell 7.0.0.12, length 28 17:24:28.052562 44:a1:91:a4:9c:0b > 48:57:02:64:ea:1e, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Reply 7.0.0.10 is-at 44:a1:91:a4:9c:0b, length 46 17:24:28.052592 44:a1:91:a4:9c:0b > 48:57:02:64:ea:1e, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Reply 7.0.0.10 is-at 44:a1:91:a4:9c:0b, length 46 17:24:29.092490 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15854, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 5, length 64 17:24:29.092543 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 15854, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 5, length 64 17:24:30.132488 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15887, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 6, length 64 17:24:30.132529 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 15887, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 6, length 64 17:24:31.172480 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 15979, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 7, length 64 17:24:31.172514 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 15979, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 7, length 64 17:24:32.212500 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 16056, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 8, length 64 17:24:32.212550 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 16056, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 8, length 64 17:24:33.252488 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 16088, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 9, length 64 17:24:33.252564 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 16088, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 9, length 64 17:24:34.292487 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 16183, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 10, length 64 17:24:34.292579 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 16183, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 10, length 64 17:24:35.332466 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 16243, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 11, length 64 17:24:35.332519 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 16243, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 11, length 64 17:24:36.372497 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 16328, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 12, length 64 17:24:36.372562 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 16328, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 12, length 64 17:24:37.412487 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 16415, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 13, length 64 17:24:37.412551 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 16415, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 13, length 64 17:24:38.452494 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 16435, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 14, length 64 17:24:38.452542 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 16435, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 14, length 64 17:24:39.492485 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 16528, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 15, length 64 17:24:39.492569 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 16528, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 15, length 64 17:24:40.532489 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 16602, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 16, length 64 17:24:40.532581 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 16602, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 16, length 64 17:24:41.572494 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 16668, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 17, length 64 17:24:41.572577 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 16668, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 17, length 64 17:24:42.612498 48:57:02:64:ea:1e > 44:a1:91:a4:9c:0b, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 16721, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.12 > 7.0.0.10: ICMP echo request, id 25403, seq 18, length 64 17:24:42.612581 44:a1:91:a4:9c:0c > 48:57:02:64:ea:1e, ethertype 802.1Q (0x8100), length 102: vlan 20, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 16721, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.12: ICMP echo request, id 25403, seq 18, length 64 ^C 39 packets captured 40 packets received by filter 0 packets dropped by kernel 35 packets dropped by interface [root@bogon ~]#
[root@bogon ~]# ping 7.0.0.10 -I enahisic2i3 PING 7.0.0.10 (7.0.0.10) from 7.0.0.12 enahisic2i3: 56(84) bytes of data. 64 bytes from 7.0.0.10: icmp_seq=35 ttl=64 time=0.206 ms 64 bytes from 7.0.0.10: icmp_seq=58 ttl=64 time=0.146 ms 64 bytes from 7.0.0.10: icmp_seq=70 ttl=64 time=0.148 ms 64 bytes from 7.0.0.10: icmp_seq=80 ttl=64 time=0.147 ms 64 bytes from 7.0.0.10: icmp_seq=84 ttl=64 time=0.142 ms 64 bytes from 7.0.0.10: icmp_seq=180 ttl=64 time=0.186 ms 64 bytes from 7.0.0.10: icmp_seq=220 ttl=64 time=0.176 ms 64 bytes from 7.0.0.10: icmp_seq=222 ttl=64 time=0.127 ms 64 bytes from 7.0.0.10: icmp_seq=223 ttl=64 time=0.151 ms ^C --- 7.0.0.10 ping statistics --- 230 packets transmitted, 9 received, 96% packet loss, time 238193ms rtt min/avg/max/mdev = 0.127/0.158/0.206/0.028 ms [root@bogon ~]#
两个节点ping
82节点
root@ubuntu:~/dpvs# ping 7.0.0.10 -I enahisic2i3 PING 7.0.0.10 (7.0.0.10) from 7.0.0.82 enahisic2i3: 56(84) bytes of data. 64 bytes from 7.0.0.10: icmp_seq=1 ttl=64 time=0.238 ms ^C --- 7.0.0.10 ping statistics --- 13 packets transmitted, 1 received, 92% packet loss, time 12287ms rtt min/avg/max/mdev = 0.238/0.238/0.238/0.000 ms root@ubuntu:~/dpvs# ip a sh enahisic2i3 5: enahisic2i3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 48:57:02:64:e7:ae brd ff:ff:ff:ff:ff:ff inet 7.0.0.82/24 scope global enahisic2i3 valid_lft forever preferred_lft forever inet6 fe80::4a57:2ff:fe64:e7ae/64 scope link valid_lft forever preferred_lft forever root@ubuntu:~/dpvs#
bond接收
bond6>src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b
81 节点
[root@bogon ~]# ip a sh enahisic2i2 4: enahisic2i2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 48:57:02:64:ea:1d brd ff:ff:ff:ff:ff:ff inet 7.0.0.81/24 scope global enahisic2i2 valid_lft forever preferred_lft forever [root@bogon ~]#
[root@bogon ~]# ping 7.0.0.10 -I enahisic2i2 PING 7.0.0.10 (7.0.0.10) from 7.0.0.81 enahisic2i2: 56(84) bytes of data. 64 bytes from 7.0.0.10: icmp_seq=1 ttl=64 time=0.227 ms 64 bytes from 7.0.0.10: icmp_seq=2 ttl=64 time=0.156 ms ^C --- 7.0.0.10 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1014ms rtt min/avg/max/mdev = 0.156/0.191/0.227/0.038 ms [root@bogon ~]#
bond6>src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b
dst mac 都是44:a1:91:a4:9c:0b
Bond Port 2 MAC: 44:a1:91:a4:9c:0b
采用的是 BONDING_MODE_ALB,
retval = rte_eth_bond_create("net_bonding0", BONDING_MODE_ALB,
0 /*SOCKET_ID_ANY*/);
MODE BONDING_MODE_ROUND_ROBIN
retval = rte_eth_bond_create("net_bonding0", BONDING_MODE_ROUND_ROBIN, 0 /*SOCKET_ID_ANY*/);
81节点
[root@bogon ~]# ip a sh enahisic2i2 4: enahisic2i2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 48:57:02:64:ea:1d brd ff:ff:ff:ff:ff:ff inet 7.0.0.81/24 scope global enahisic2i2 valid_lft forever preferred_lft forever [root@bogon ~]# ping 7.0.0.10 -I enahisic2i2 PING 7.0.0.10 (7.0.0.10) from 7.0.0.81 enahisic2i2: 56(84) bytes of data. 64 bytes from 7.0.0.10: icmp_seq=1 ttl=64 time=0.227 ms 64 bytes from 7.0.0.10: icmp_seq=2 ttl=64 time=0.156 ms ^C --- 7.0.0.10 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1014ms rtt min/avg/max/mdev = 0.156/0.191/0.227/0.038 ms [root@bogon ~]# ping 7.0.0.10 -I enahisic2i2 PING 7.0.0.10 (7.0.0.10) from 7.0.0.81 enahisic2i2: 56(84) bytes of data. ^C --- 7.0.0.10 ping statistics --- 6 packets transmitted, 0 received, 100% packet loss, time 5201ms You have mail in /var/spool/mail/root
没有ping 因为,采用轮询的方式,bond server 从enahisic2i3 这个网络平面发报文
[root@bogon ~]# tcpdump -i enahisic2i3 icmp or arp and host 7.0.0.10 -env tcpdump: listening on enahisic2i3, link-type EN10MB (Ethernet), capture size 262144 bytes 19:56:39.926071 44:a1:91:a4:9c:0b > 48:57:02:64:ea:1d, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 52916, offset 0, flags [DF], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.81: ICMP echo request, id 39350, seq 1, length 64 19:56:40.932682 44:a1:91:a4:9c:0b > 48:57:02:64:ea:1d, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 53004, offset 0, flags [none], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.81: ICMP echo reply, id 39350, seq 2, length 64 19:56:41.972632 44:a1:91:a4:9c:0b > 48:57:02:64:ea:1d, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 53067, offset 0, flags [none], proto ICMP (1), length 84) 7.0.0.10 > 7.0.0.81: ICMP echo reply, id 39350, seq 3, length 64
Bond Port 2 MAC: 44:a1:91:a4:9c:0b Starting lcore_main on core 1:0 Our IP:7.0.0.10 bond6>src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b
82节点
root@ubuntu:~/dpvs# ip a sh enahisic2i3 5: enahisic2i3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 48:57:02:64:e7:ae brd ff:ff:ff:ff:ff:ff inet 7.0.0.82/24 scope global enahisic2i3 valid_lft forever preferred_lft forever inet6 fe80::4a57:2ff:fe64:e7ae/64 scope link valid_lft forever preferred_lft forever
valid_lft forever preferred_lft forever root@ubuntu:~/dpvs# ping 7.0.0.10 -I enahisic2i3 PING 7.0.0.10 (7.0.0.10) from 7.0.0.82 enahisic2i3: 56(84) bytes of data. ^C --- 7.0.0.10 ping statistics --- 24 packets transmitted, 0 received, 100% packet loss, time 23529ms root@ubuntu:~/dpvs#
dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b bond6>
mbuf->port
else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4)) { if (rte_spinlock_trylock(&global_flag_stru_p->lock) == 1) { global_flag_stru_p->port_packets[2]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } ipv4_hdr = (struct rte_ipv4_hdr *)((char *)(eth_hdr + 1) + offset); if (ipv4_hdr->dst_addr == bond_ip) { printf("src mac is : "); PRINT_MAC(eth_hdr->s_addr); printf("\n"); printf("dst mac is : "); PRINT_MAC(eth_hdr->d_addr); printf("\n"); printf("mbuf->port %d \n", pkts[i]->port); rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_ether_addr_copy(&bond_mac_addr, ð_hdr->s_addr); ipv4_hdr->dst_addr = ipv4_hdr->src_addr; ipv4_hdr->src_addr = bond_ip; rte_eth_tx_burst(BOND_PORT, 0, &pkts[i], 1); }
bond6>src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b mbuf->port 1 src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b mbuf->port 1 src mac is : 48:57:02:64:ea:1d dst mac is : 44:a1:91:a4:9c:0b mbuf->port 1 src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b
换个节点ping mbuf->port 0 src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b mbuf->port 0 src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b mbuf->port 0 src mac is : 48:57:02:64:e7:ae dst mac is : 44:a1:91:a4:9c:0b mbuf->port 0