net/bonding: remove unnecessary cast
[dpdk.git] / drivers / net / bonding / rte_eth_bond_pmd.c
index 4ca8afb..6a6ed89 100644 (file)
@@ -160,8 +160,7 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev,
                uint16_t slave_port) {
        struct rte_eth_dev_info slave_info;
        struct rte_flow_error error;
-       struct bond_dev_private *internals = (struct bond_dev_private *)
-                       (bond_dev->data->dev_private);
+       struct bond_dev_private *internals = bond_dev->data->dev_private;
 
        const struct rte_flow_action_queue lacp_queue_conf = {
                .index = 0,
@@ -201,8 +200,7 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev,
 int
 bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) {
        struct rte_eth_dev *bond_dev = &rte_eth_devices[port_id];
-       struct bond_dev_private *internals = (struct bond_dev_private *)
-                       (bond_dev->data->dev_private);
+       struct bond_dev_private *internals = bond_dev->data->dev_private;
        struct rte_eth_dev_info bond_info;
        uint16_t idx;
 
@@ -227,9 +225,7 @@ int
 bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint16_t slave_port) {
 
        struct rte_flow_error error;
-       struct bond_dev_private *internals = (struct bond_dev_private *)
-                       (bond_dev->data->dev_private);
-
+       struct bond_dev_private *internals = bond_dev->data->dev_private;
        struct rte_flow_action_queue lacp_queue_conf = {
                .index = internals->mode4.dedicated_queues.rx_qid,
        };
@@ -591,7 +587,7 @@ mode6_debug(const char __attribute__((unused)) *info,
        struct rte_ether_hdr *eth_h, uint16_t port,
        uint32_t __attribute__((unused)) *burstnumber)
 {
-       struct ipv4_hdr *ipv4_h;
+       struct rte_ipv4_hdr *ipv4_h;
 #ifdef RTE_LIBRTE_BOND_DEBUG_ALB
        struct rte_arp_hdr *arp_h;
        char dst_ip[16];
@@ -607,8 +603,8 @@ mode6_debug(const char __attribute__((unused)) *info,
        strlcpy(buf, info, 16);
 #endif
 
-       if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) {
-               ipv4_h = (struct ipv4_hdr *)((char *)(eth_h + 1) + offset);
+       if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4)) {
+               ipv4_h = (struct rte_ipv4_hdr *)((char *)(eth_h + 1) + offset);
                ipv4_addr_to_dot(ipv4_h->src_addr, src_ip, MaxIPv4String);
 #ifdef RTE_LIBRTE_BOND_DEBUG_ALB
                ipv4_addr_to_dot(ipv4_h->dst_addr, dst_ip, MaxIPv4String);
@@ -653,7 +649,7 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
                        bond_mode_alb_arp_recv(eth_h, offset, internals);
                }
 #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1)
-               else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4))
+               else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4))
                        mode6_debug("RX IPv4:", eth_h, bufs[i]->port, &burstnumberRX);
 #endif
        }
@@ -755,13 +751,13 @@ ether_hash(struct rte_ether_hdr *eth_hdr)
 }
 
 static inline uint32_t
-ipv4_hash(struct ipv4_hdr *ipv4_hdr)
+ipv4_hash(struct rte_ipv4_hdr *ipv4_hdr)
 {
        return ipv4_hdr->src_addr ^ ipv4_hdr->dst_addr;
 }
 
 static inline uint32_t
-ipv6_hash(struct ipv6_hdr *ipv6_hdr)
+ipv6_hash(struct rte_ipv6_hdr *ipv6_hdr)
 {
        unaligned_uint32_t *word_src_addr =
                (unaligned_uint32_t *)&(ipv6_hdr->src_addr[0]);
@@ -811,13 +807,13 @@ burst_xmit_l23_hash(struct rte_mbuf **buf, uint16_t nb_pkts,
 
                vlan_offset = get_vlan_offset(eth_hdr, &proto);
 
-               if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) == proto) {
-                       struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)
+               if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4) == proto) {
+                       struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *)
                                        ((char *)(eth_hdr + 1) + vlan_offset);
                        l3hash = ipv4_hash(ipv4_hdr);
 
-               } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) {
-                       struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *)
+               } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6) == proto) {
+                       struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *)
                                        ((char *)(eth_hdr + 1) + vlan_offset);
                        l3hash = ipv6_hash(ipv6_hdr);
                }
@@ -839,8 +835,8 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts,
        size_t vlan_offset;
        int i;
 
-       struct udp_hdr *udp_hdr;
-       struct tcp_hdr *tcp_hdr;
+       struct rte_udp_hdr *udp_hdr;
+       struct rte_tcp_hdr *tcp_hdr;
        uint32_t hash, l3hash, l4hash;
 
        for (i = 0; i < nb_pkts; i++) {
@@ -851,8 +847,8 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts,
                l3hash = 0;
                l4hash = 0;
 
-               if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) == proto) {
-                       struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)
+               if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4) == proto) {
+                       struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *)
                                        ((char *)(eth_hdr + 1) + vlan_offset);
                        size_t ip_hdr_offset;
 
@@ -862,11 +858,11 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts,
                        if (likely(rte_ipv4_frag_pkt_is_fragmented(ipv4_hdr)
                                                                == 0)) {
                                ip_hdr_offset = (ipv4_hdr->version_ihl
-                                       & IPV4_HDR_IHL_MASK) *
-                                       IPV4_IHL_MULTIPLIER;
+                                       & RTE_IPV4_HDR_IHL_MASK) *
+                                       RTE_IPV4_IHL_MULTIPLIER;
 
                                if (ipv4_hdr->next_proto_id == IPPROTO_TCP) {
-                                       tcp_hdr = (struct tcp_hdr *)
+                                       tcp_hdr = (struct rte_tcp_hdr *)
                                                ((char *)ipv4_hdr +
                                                        ip_hdr_offset);
                                        if ((size_t)tcp_hdr + sizeof(*tcp_hdr)
@@ -874,7 +870,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts,
                                                l4hash = HASH_L4_PORTS(tcp_hdr);
                                } else if (ipv4_hdr->next_proto_id ==
                                                                IPPROTO_UDP) {
-                                       udp_hdr = (struct udp_hdr *)
+                                       udp_hdr = (struct rte_udp_hdr *)
                                                ((char *)ipv4_hdr +
                                                        ip_hdr_offset);
                                        if ((size_t)udp_hdr + sizeof(*udp_hdr)
@@ -882,16 +878,16 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts,
                                                l4hash = HASH_L4_PORTS(udp_hdr);
                                }
                        }
-               } else if  (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) {
-                       struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *)
+               } else if  (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6) == proto) {
+                       struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *)
                                        ((char *)(eth_hdr + 1) + vlan_offset);
                        l3hash = ipv6_hash(ipv6_hdr);
 
                        if (ipv6_hdr->proto == IPPROTO_TCP) {
-                               tcp_hdr = (struct tcp_hdr *)(ipv6_hdr + 1);
+                               tcp_hdr = (struct rte_tcp_hdr *)(ipv6_hdr + 1);
                                l4hash = HASH_L4_PORTS(tcp_hdr);
                        } else if (ipv6_hdr->proto == IPPROTO_UDP) {
-                               udp_hdr = (struct udp_hdr *)(ipv6_hdr + 1);
+                               udp_hdr = (struct rte_udp_hdr *)(ipv6_hdr + 1);
                                l4hash = HASH_L4_PORTS(udp_hdr);
                        }
                }
@@ -1735,8 +1731,7 @@ slave_configure_slow_queue(struct rte_eth_dev *bonded_eth_dev,
                struct rte_eth_dev *slave_eth_dev)
 {
        int errval = 0;
-       struct bond_dev_private *internals = (struct bond_dev_private *)
-               bonded_eth_dev->data->dev_private;
+       struct bond_dev_private *internals = bonded_eth_dev->data->dev_private;
        struct port *port = &bond_mode_8023ad_ports[slave_eth_dev->data->port_id];
 
        if (port->slow_pool == NULL) {
@@ -1802,8 +1797,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
        uint16_t q_id;
        struct rte_flow_error flow_error;
 
-       struct bond_dev_private *internals = (struct bond_dev_private *)
-               bonded_eth_dev->data->dev_private;
+       struct bond_dev_private *internals = bonded_eth_dev->data->dev_private;
 
        /* Stop slave */
        rte_eth_dev_stop(slave_eth_dev->data->port_id);
@@ -2421,8 +2415,8 @@ bond_ethdev_slave_link_status_change_monitor(void *cb_arg)
        if (cb_arg == NULL)
                return;
 
-       bonded_ethdev = (struct rte_eth_dev *)cb_arg;
-       internals = (struct bond_dev_private *)bonded_ethdev->data->dev_private;
+       bonded_ethdev = cb_arg;
+       internals = bonded_ethdev->data->dev_private;
 
        if (!bonded_ethdev->data->dev_started ||
                !internals->link_status_polling_enabled)