1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2015 Intel Corporation
5 #ifndef RTE_ETH_BOND_ALB_H_
6 #define RTE_ETH_BOND_ALB_H_
11 #define ALB_HASH_TABLE_SIZE 256
12 #define ALB_NULL_INDEX 0xFFFFFFFF
15 /** ARP data of single client */
16 struct ether_addr app_mac;
17 /**< MAC address of application running DPDK */
19 /**< IP address of application running DPDK */
20 struct ether_addr cli_mac;
21 /**< Client MAC address */
23 /**< Client IP address */
26 /**< Index of slave on which we connect with that client */
28 /**< Flag indicating if entry in client table is currently used */
30 /**< Flag indicating if we need to send update to this client on next tx */
32 struct vlan_hdr vlan[2];
33 /**< Content of vlan headers */
35 /**< Number of nested vlan headers */
38 struct mode_alb_private {
39 struct client_data client_table[ALB_HASH_TABLE_SIZE];
40 /**< Hash table storing ARP data of every client connected */
41 struct rte_mempool *mempool;
42 /**< Mempool for creating ARP update packets */
44 /**< Flag indicating if we need to send update to any client on next tx */
46 /**< Index of last used slave in client table */
51 * ALB mode initialization.
53 * @param bond_dev Pointer to bonding device.
56 * Error code - 0 on success.
59 bond_mode_alb_enable(struct rte_eth_dev *bond_dev);
62 * Function handles ARP packet reception. If received ARP request, it is
63 * forwarded to application without changes. If it is ARP reply, client table
66 * @param eth_h ETH header of received packet.
67 * @param offset Vlan header offset.
68 * @param internals Bonding data.
71 bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset,
72 struct bond_dev_private *internals);
75 * Function handles ARP packet transmission. It also decides on which slave
76 * send that packet. If packet is ARP Request, it is send on primary slave.
77 * If it is ARP Reply, it is send on slave stored in client table for that
78 * connection. On Reply function also updates data in client table.
80 * @param eth_h ETH header of transmitted packet.
81 * @param offset Vlan header offset.
82 * @param internals Bonding data.
85 * Index of slave on which packet should be sent.
88 bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset,
89 struct bond_dev_private *internals);
92 * Function fills packet with ARP data from client_info.
94 * @param client_info Data of client to which packet is sent.
95 * @param pkt Pointer to packet which is sent.
96 * @param internals Bonding data.
99 * Index of slawe on which packet should be sent.
102 bond_mode_alb_arp_upd(struct client_data *client_info,
103 struct rte_mbuf *pkt, struct bond_dev_private *internals);
106 * Function updates slave indexes of active connections.
108 * @param bond_dev Pointer to bonded device struct.
111 bond_mode_alb_client_list_upd(struct rte_eth_dev *bond_dev);
113 #endif /* RTE_ETH_BOND_ALB_H_ */