* [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast
@ 2018-02-26 8:10 Zhiyong Yang
2018-02-26 8:10 ` [dpdk-dev] [PATCH 1/5] flow_classify: remove void pointer cast Zhiyong Yang
` (6 more replies)
0 siblings, 7 replies; 10+ messages in thread
From: Zhiyong Yang @ 2018-02-26 8:10 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
The patch series cleanup void pointer explicit cast related to
struct rte_flow_item fields in librte_flow_classify and make
code more readable.
Zhiyong Yang (5):
flow_classify: remove void pointer cast
net/ixgbe: remove void pointer cast
net/e1000: remove void pointer cast
net/bnxt: remove void pointer cast
net/sfc: remove void pointer cast
drivers/net/bnxt/bnxt_filter.c | 44 ++++-----
drivers/net/e1000/igb_flow.c | 27 +++---
drivers/net/ixgbe/ixgbe_flow.c | 106 +++++++++------------
drivers/net/sfc/sfc_flow.c | 8 +-
lib/librte_flow_classify/rte_flow_classify.c | 4 +-
lib/librte_flow_classify/rte_flow_classify_parse.c | 24 ++---
6 files changed, 93 insertions(+), 120 deletions(-)
--
2.13.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 1/5] flow_classify: remove void pointer cast
2018-02-26 8:10 [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast Zhiyong Yang
@ 2018-02-26 8:10 ` Zhiyong Yang
2018-03-14 11:02 ` Iremonger, Bernard
2018-02-26 8:11 ` [dpdk-dev] [PATCH 2/5] net/ixgbe: " Zhiyong Yang
` (5 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Zhiyong Yang @ 2018-02-26 8:10 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, bernard.iremonger, Zhiyong Yang
Cc: bernard.iremonger@intel.com
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
lib/librte_flow_classify/rte_flow_classify.c | 4 +---
lib/librte_flow_classify/rte_flow_classify_parse.c | 24 +++++++++++-----------
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/lib/librte_flow_classify/rte_flow_classify.c b/lib/librte_flow_classify/rte_flow_classify.c
index 7edb2f15f..591d98e25 100644
--- a/lib/librte_flow_classify/rte_flow_classify.c
+++ b/lib/librte_flow_classify/rte_flow_classify.c
@@ -635,9 +635,7 @@ action_apply(struct rte_flow_classifier *cls,
}
if (count) {
ret = 0;
- ntuple_stats =
- (struct rte_flow_classify_ipv4_5tuple_stats *)
- stats->stats;
+ ntuple_stats = stats->stats;
ntuple_stats->counter1 = count;
ntuple_stats->ipv4_5tuple = rule->rules.u.ipv4_5tuple;
}
diff --git a/lib/librte_flow_classify/rte_flow_classify_parse.c b/lib/librte_flow_classify/rte_flow_classify_parse.c
index 10eaf0435..f65ceaf7c 100644
--- a/lib/librte_flow_classify/rte_flow_classify_parse.c
+++ b/lib/librte_flow_classify/rte_flow_classify_parse.c
@@ -279,7 +279,7 @@ classify_parse_ntuple_filter(const struct rte_flow_attr *attr,
}
- ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask;
+ ipv4_mask = item->mask;
/**
* Only support src & dst addresses, protocol,
* others should be masked.
@@ -301,7 +301,7 @@ classify_parse_ntuple_filter(const struct rte_flow_attr *attr,
filter->src_ip_mask = ipv4_mask->hdr.src_addr;
filter->proto_mask = ipv4_mask->hdr.next_proto_id;
- ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec;
+ ipv4_spec = item->spec;
filter->dst_ip = ipv4_spec->hdr.dst_addr;
filter->src_ip = ipv4_spec->hdr.src_addr;
filter->proto = ipv4_spec->hdr.next_proto_id;
@@ -339,7 +339,7 @@ classify_parse_ntuple_filter(const struct rte_flow_attr *attr,
}
if (item->type == RTE_FLOW_ITEM_TYPE_TCP) {
- tcp_mask = (const struct rte_flow_item_tcp *)item->mask;
+ tcp_mask = item->mask;
/**
* Only support src & dst ports, tcp flags,
@@ -373,12 +373,12 @@ classify_parse_ntuple_filter(const struct rte_flow_attr *attr,
return -EINVAL;
}
- tcp_spec = (const struct rte_flow_item_tcp *)item->spec;
+ tcp_spec = item->spec;
filter->dst_port = tcp_spec->hdr.dst_port;
filter->src_port = tcp_spec->hdr.src_port;
filter->tcp_flags = tcp_spec->hdr.tcp_flags;
} else if (item->type == RTE_FLOW_ITEM_TYPE_UDP) {
- udp_mask = (const struct rte_flow_item_udp *)item->mask;
+ udp_mask = item->mask;
/**
* Only support src & dst ports,
@@ -397,11 +397,11 @@ classify_parse_ntuple_filter(const struct rte_flow_attr *attr,
filter->dst_port_mask = udp_mask->hdr.dst_port;
filter->src_port_mask = udp_mask->hdr.src_port;
- udp_spec = (const struct rte_flow_item_udp *)item->spec;
+ udp_spec = item->spec;
filter->dst_port = udp_spec->hdr.dst_port;
filter->src_port = udp_spec->hdr.src_port;
} else {
- sctp_mask = (const struct rte_flow_item_sctp *)item->mask;
+ sctp_mask = item->mask;
/**
* Only support src & dst ports,
@@ -420,7 +420,7 @@ classify_parse_ntuple_filter(const struct rte_flow_attr *attr,
filter->dst_port_mask = sctp_mask->hdr.dst_port;
filter->src_port_mask = sctp_mask->hdr.src_port;
- sctp_spec = (const struct rte_flow_item_sctp *)item->spec;
+ sctp_spec = item->spec;
filter->dst_port = sctp_spec->hdr.dst_port;
filter->src_port = sctp_spec->hdr.src_port;
}
@@ -480,12 +480,12 @@ classify_parse_ntuple_filter(const struct rte_flow_attr *attr,
switch (act->type) {
case RTE_FLOW_ACTION_TYPE_COUNT:
action.action_mask |= 1LLU << RTE_FLOW_ACTION_TYPE_COUNT;
- count = (const struct rte_flow_action_count *)act->conf;
+ count = act->conf;
memcpy(&action.act.counter, count, sizeof(action.act.counter));
break;
case RTE_FLOW_ACTION_TYPE_MARK:
action.action_mask |= 1LLU << RTE_FLOW_ACTION_TYPE_MARK;
- mark_spec = (const struct rte_flow_action_mark *)act->conf;
+ mark_spec = act->conf;
memcpy(&action.act.mark, mark_spec, sizeof(action.act.mark));
break;
default:
@@ -502,12 +502,12 @@ classify_parse_ntuple_filter(const struct rte_flow_attr *attr,
switch (act->type) {
case RTE_FLOW_ACTION_TYPE_COUNT:
action.action_mask |= 1LLU << RTE_FLOW_ACTION_TYPE_COUNT;
- count = (const struct rte_flow_action_count *)act->conf;
+ count = act->conf;
memcpy(&action.act.counter, count, sizeof(action.act.counter));
break;
case RTE_FLOW_ACTION_TYPE_MARK:
action.action_mask |= 1LLU << RTE_FLOW_ACTION_TYPE_MARK;
- mark_spec = (const struct rte_flow_action_mark *)act->conf;
+ mark_spec = act->conf;
memcpy(&action.act.mark, mark_spec, sizeof(action.act.mark));
break;
case RTE_FLOW_ACTION_TYPE_END:
--
2.13.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 2/5] net/ixgbe: remove void pointer cast
2018-02-26 8:10 [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast Zhiyong Yang
2018-02-26 8:10 ` [dpdk-dev] [PATCH 1/5] flow_classify: remove void pointer cast Zhiyong Yang
@ 2018-02-26 8:11 ` Zhiyong Yang
2018-02-26 8:11 ` [dpdk-dev] [PATCH 3/5] net/e1000: " Zhiyong Yang
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Zhiyong Yang @ 2018-02-26 8:11 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, wenzhuo.lu, konstantin.ananyev, Zhiyong Yang
Cc: wenzhuo.lu@intel.com
Cc: konstantin.ananyev@intel.com
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
drivers/net/ixgbe/ixgbe_flow.c | 106 ++++++++++++++++++-----------------------
1 file changed, 46 insertions(+), 60 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index dcbfb38b3..abdeac28b 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -264,8 +264,8 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
}
/* Skip Ethernet */
if (item->type == RTE_FLOW_ITEM_TYPE_ETH) {
- eth_spec = (const struct rte_flow_item_eth *)item->spec;
- eth_mask = (const struct rte_flow_item_eth *)item->mask;
+ eth_spec = item->spec;
+ eth_mask = item->mask;
/*Not supported last point for range*/
if (item->last) {
rte_flow_error_set(error,
@@ -298,8 +298,8 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
}
if (item->type == RTE_FLOW_ITEM_TYPE_VLAN) {
- vlan_spec = (const struct rte_flow_item_vlan *)item->spec;
- vlan_mask = (const struct rte_flow_item_vlan *)item->mask;
+ vlan_spec = item->spec;
+ vlan_mask = item->mask;
/*Not supported last point for range*/
if (item->last) {
rte_flow_error_set(error,
@@ -346,7 +346,7 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
return -rte_errno;
}
- ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask;
+ ipv4_mask = item->mask;
/**
* Only support src & dst addresses, protocol,
* others should be masked.
@@ -368,7 +368,7 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
filter->src_ip_mask = ipv4_mask->hdr.src_addr;
filter->proto_mask = ipv4_mask->hdr.next_proto_id;
- ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec;
+ ipv4_spec = item->spec;
filter->dst_ip = ipv4_spec->hdr.dst_addr;
filter->src_ip = ipv4_spec->hdr.src_addr;
filter->proto = ipv4_spec->hdr.next_proto_id;
@@ -413,7 +413,7 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
}
if (item->type == RTE_FLOW_ITEM_TYPE_TCP) {
- tcp_mask = (const struct rte_flow_item_tcp *)item->mask;
+ tcp_mask = item->mask;
/**
* Only support src & dst ports, tcp flags,
@@ -447,12 +447,12 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
return -rte_errno;
}
- tcp_spec = (const struct rte_flow_item_tcp *)item->spec;
+ tcp_spec = item->spec;
filter->dst_port = tcp_spec->hdr.dst_port;
filter->src_port = tcp_spec->hdr.src_port;
filter->tcp_flags = tcp_spec->hdr.tcp_flags;
} else if (item->type == RTE_FLOW_ITEM_TYPE_UDP) {
- udp_mask = (const struct rte_flow_item_udp *)item->mask;
+ udp_mask = item->mask;
/**
* Only support src & dst ports,
@@ -471,11 +471,11 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
filter->dst_port_mask = udp_mask->hdr.dst_port;
filter->src_port_mask = udp_mask->hdr.src_port;
- udp_spec = (const struct rte_flow_item_udp *)item->spec;
+ udp_spec = item->spec;
filter->dst_port = udp_spec->hdr.dst_port;
filter->src_port = udp_spec->hdr.src_port;
} else if (item->type == RTE_FLOW_ITEM_TYPE_SCTP) {
- sctp_mask = (const struct rte_flow_item_sctp *)item->mask;
+ sctp_mask = item->mask;
/**
* Only support src & dst ports,
@@ -494,7 +494,7 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
filter->dst_port_mask = sctp_mask->hdr.dst_port;
filter->src_port_mask = sctp_mask->hdr.src_port;
- sctp_spec = (const struct rte_flow_item_sctp *)item->spec;
+ sctp_spec = item->spec;
filter->dst_port = sctp_spec->hdr.dst_port;
filter->src_port = sctp_spec->hdr.src_port;
} else {
@@ -699,8 +699,8 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr,
return -rte_errno;
}
- eth_spec = (const struct rte_flow_item_eth *)item->spec;
- eth_mask = (const struct rte_flow_item_eth *)item->mask;
+ eth_spec = item->spec;
+ eth_mask = item->mask;
/* Mask bits of source MAC address must be full of 0.
* Mask bits of destination MAC address must be full
@@ -1000,8 +1000,8 @@ cons_parse_syn_filter(const struct rte_flow_attr *attr,
return -rte_errno;
}
- tcp_spec = (const struct rte_flow_item_tcp *)item->spec;
- tcp_mask = (const struct rte_flow_item_tcp *)item->mask;
+ tcp_spec = item->spec;
+ tcp_mask = item->mask;
if (!(tcp_spec->hdr.tcp_flags & TCP_SYN_FLAG) ||
tcp_mask->hdr.src_port ||
tcp_mask->hdr.dst_port ||
@@ -1198,8 +1198,8 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
return -rte_errno;
}
- e_tag_spec = (const struct rte_flow_item_e_tag *)item->spec;
- e_tag_mask = (const struct rte_flow_item_e_tag *)item->mask;
+ e_tag_spec = item->spec;
+ e_tag_mask = item->mask;
/* Only care about GRP and E cid base. */
if (e_tag_mask->epcp_edei_in_ecid_b ||
@@ -1447,12 +1447,9 @@ static inline uint8_t signature_match(const struct rte_flow_item pattern[])
break;
if (item->type == RTE_FLOW_ITEM_TYPE_FUZZY) {
- spec =
- (const struct rte_flow_item_fuzzy *)item->spec;
- last =
- (const struct rte_flow_item_fuzzy *)item->last;
- mask =
- (const struct rte_flow_item_fuzzy *)item->mask;
+ spec = item->spec;
+ last = item->last;
+ mask = item->mask;
if (!spec || !mask)
return 0;
@@ -1632,7 +1629,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
if (item->spec) {
rule->b_spec = TRUE;
- eth_spec = (const struct rte_flow_item_eth *)item->spec;
+ eth_spec = item->spec;
/* Get the dst MAC. */
for (j = 0; j < ETHER_ADDR_LEN; j++) {
@@ -1645,7 +1642,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
if (item->mask) {
rule->b_mask = TRUE;
- eth_mask = (const struct rte_flow_item_eth *)item->mask;
+ eth_mask = item->mask;
/* Ether type should be masked. */
if (eth_mask->type ||
@@ -1725,8 +1722,8 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
return -rte_errno;
}
- vlan_spec = (const struct rte_flow_item_vlan *)item->spec;
- vlan_mask = (const struct rte_flow_item_vlan *)item->mask;
+ vlan_spec = item->spec;
+ vlan_mask = item->mask;
rule->ixgbe_fdir.formatted.vlan_id = vlan_spec->tci;
@@ -1772,8 +1769,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
return -rte_errno;
}
rule->b_mask = TRUE;
- ipv4_mask =
- (const struct rte_flow_item_ipv4 *)item->mask;
+ ipv4_mask = item->mask;
if (ipv4_mask->hdr.version_ihl ||
ipv4_mask->hdr.type_of_service ||
ipv4_mask->hdr.total_length ||
@@ -1793,8 +1789,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
if (item->spec) {
rule->b_spec = TRUE;
- ipv4_spec =
- (const struct rte_flow_item_ipv4 *)item->spec;
+ ipv4_spec = item->spec;
rule->ixgbe_fdir.formatted.dst_ip[0] =
ipv4_spec->hdr.dst_addr;
rule->ixgbe_fdir.formatted.src_ip[0] =
@@ -1844,8 +1839,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
}
rule->b_mask = TRUE;
- ipv6_mask =
- (const struct rte_flow_item_ipv6 *)item->mask;
+ ipv6_mask = item->mask;
if (ipv6_mask->hdr.vtc_flow ||
ipv6_mask->hdr.payload_len ||
ipv6_mask->hdr.proto ||
@@ -1885,8 +1879,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
if (item->spec) {
rule->b_spec = TRUE;
- ipv6_spec =
- (const struct rte_flow_item_ipv6 *)item->spec;
+ ipv6_spec = item->spec;
rte_memcpy(rule->ixgbe_fdir.formatted.src_ip,
ipv6_spec->hdr.src_addr, 16);
rte_memcpy(rule->ixgbe_fdir.formatted.dst_ip,
@@ -1938,7 +1931,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
return -rte_errno;
}
rule->b_mask = TRUE;
- tcp_mask = (const struct rte_flow_item_tcp *)item->mask;
+ tcp_mask = item->mask;
if (tcp_mask->hdr.sent_seq ||
tcp_mask->hdr.recv_ack ||
tcp_mask->hdr.data_off ||
@@ -1957,7 +1950,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
if (item->spec) {
rule->b_spec = TRUE;
- tcp_spec = (const struct rte_flow_item_tcp *)item->spec;
+ tcp_spec = item->spec;
rule->ixgbe_fdir.formatted.src_port =
tcp_spec->hdr.src_port;
rule->ixgbe_fdir.formatted.dst_port =
@@ -2003,7 +1996,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
return -rte_errno;
}
rule->b_mask = TRUE;
- udp_mask = (const struct rte_flow_item_udp *)item->mask;
+ udp_mask = item->mask;
if (udp_mask->hdr.dgram_len ||
udp_mask->hdr.dgram_cksum) {
memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
@@ -2017,7 +2010,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
if (item->spec) {
rule->b_spec = TRUE;
- udp_spec = (const struct rte_flow_item_udp *)item->spec;
+ udp_spec = item->spec;
rule->ixgbe_fdir.formatted.src_port =
udp_spec->hdr.src_port;
rule->ixgbe_fdir.formatted.dst_port =
@@ -2068,8 +2061,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
return -rte_errno;
}
rule->b_mask = TRUE;
- sctp_mask =
- (const struct rte_flow_item_sctp *)item->mask;
+ sctp_mask = item->mask;
if (sctp_mask->hdr.tag ||
sctp_mask->hdr.cksum) {
memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
@@ -2083,8 +2075,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
if (item->spec) {
rule->b_spec = TRUE;
- sctp_spec =
- (const struct rte_flow_item_sctp *)item->spec;
+ sctp_spec = item->spec;
rule->ixgbe_fdir.formatted.src_port =
sctp_spec->hdr.src_port;
rule->ixgbe_fdir.formatted.dst_port =
@@ -2092,8 +2083,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
}
/* others even sctp port is not supported */
} else {
- sctp_mask =
- (const struct rte_flow_item_sctp *)item->mask;
+ sctp_mask = item->mask;
if (sctp_mask &&
(sctp_mask->hdr.src_port ||
sctp_mask->hdr.dst_port ||
@@ -2136,7 +2126,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
return -rte_errno;
}
- raw_mask = (const struct rte_flow_item_raw *)item->mask;
+ raw_mask = item->mask;
/* check mask */
if (raw_mask->relative != 0x1 ||
@@ -2152,7 +2142,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
return -rte_errno;
}
- raw_spec = (const struct rte_flow_item_raw *)item->spec;
+ raw_spec = item->spec;
/* check spec */
if (raw_spec->relative != 0 ||
@@ -2425,8 +2415,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
/* Tunnel type is always meaningful. */
rule->mask.tunnel_type_mask = 1;
- vxlan_mask =
- (const struct rte_flow_item_vxlan *)item->mask;
+ vxlan_mask = item->mask;
if (vxlan_mask->flags) {
memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
rte_flow_error_set(error, EINVAL,
@@ -2452,8 +2441,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
if (item->spec) {
rule->b_spec = TRUE;
- vxlan_spec = (const struct rte_flow_item_vxlan *)
- item->spec;
+ vxlan_spec = item->spec;
rte_memcpy(((uint8_t *)
&rule->ixgbe_fdir.formatted.tni_vni + 1),
vxlan_spec->vni, RTE_DIM(vxlan_spec->vni));
@@ -2490,8 +2478,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
/* Tunnel type is always meaningful. */
rule->mask.tunnel_type_mask = 1;
- nvgre_mask =
- (const struct rte_flow_item_nvgre *)item->mask;
+ nvgre_mask = item->mask;
if (nvgre_mask->flow_id) {
memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
rte_flow_error_set(error, EINVAL,
@@ -2534,8 +2521,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
if (item->spec) {
rule->b_spec = TRUE;
- nvgre_spec =
- (const struct rte_flow_item_nvgre *)item->spec;
+ nvgre_spec = item->spec;
if (nvgre_spec->c_k_s_rsvd0_ver !=
rte_cpu_to_be_16(0x2000) &&
nvgre_mask->c_k_s_rsvd0_ver) {
@@ -2591,7 +2577,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
return -rte_errno;
}
rule->b_mask = TRUE;
- eth_mask = (const struct rte_flow_item_eth *)item->mask;
+ eth_mask = item->mask;
/* Ether type should be masked. */
if (eth_mask->type) {
@@ -2632,7 +2618,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
if (item->spec) {
rule->b_spec = TRUE;
- eth_spec = (const struct rte_flow_item_eth *)item->spec;
+ eth_spec = item->spec;
/* Get the dst MAC. */
for (j = 0; j < ETHER_ADDR_LEN; j++) {
@@ -2671,8 +2657,8 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
return -rte_errno;
}
- vlan_spec = (const struct rte_flow_item_vlan *)item->spec;
- vlan_mask = (const struct rte_flow_item_vlan *)item->mask;
+ vlan_spec = item->spec;
+ vlan_mask = item->mask;
rule->ixgbe_fdir.formatted.vlan_id = vlan_spec->tci;
--
2.13.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 3/5] net/e1000: remove void pointer cast
2018-02-26 8:10 [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast Zhiyong Yang
2018-02-26 8:10 ` [dpdk-dev] [PATCH 1/5] flow_classify: remove void pointer cast Zhiyong Yang
2018-02-26 8:11 ` [dpdk-dev] [PATCH 2/5] net/ixgbe: " Zhiyong Yang
@ 2018-02-26 8:11 ` Zhiyong Yang
2018-02-26 8:11 ` [dpdk-dev] [PATCH 4/5] net/bnxt: " Zhiyong Yang
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Zhiyong Yang @ 2018-02-26 8:11 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, wenzhuo.lu, Zhiyong Yang
Cc: wenzhuo.lu@intel.com
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
drivers/net/e1000/igb_flow.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
index a14275968..c0f5b5190 100644
--- a/drivers/net/e1000/igb_flow.c
+++ b/drivers/net/e1000/igb_flow.c
@@ -175,7 +175,7 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
return -rte_errno;
}
- ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask;
+ ipv4_mask = item->mask;
/**
* Only support src & dst addresses, protocol,
* others should be masked.
@@ -198,7 +198,7 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
filter->src_ip_mask = ipv4_mask->hdr.src_addr;
filter->proto_mask = ipv4_mask->hdr.next_proto_id;
- ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec;
+ ipv4_spec = item->spec;
filter->dst_ip = ipv4_spec->hdr.dst_addr;
filter->src_ip = ipv4_spec->hdr.src_addr;
filter->proto = ipv4_spec->hdr.next_proto_id;
@@ -228,7 +228,7 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
/* get the TCP/UDP/SCTP info */
if (item->type == RTE_FLOW_ITEM_TYPE_TCP) {
if (item->spec && item->mask) {
- tcp_mask = (const struct rte_flow_item_tcp *)item->mask;
+ tcp_mask = item->mask;
/**
* Only support src & dst ports, tcp flags,
@@ -263,14 +263,14 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
return -rte_errno;
}
- tcp_spec = (const struct rte_flow_item_tcp *)item->spec;
+ tcp_spec = item->spec;
filter->dst_port = tcp_spec->hdr.dst_port;
filter->src_port = tcp_spec->hdr.src_port;
filter->tcp_flags = tcp_spec->hdr.tcp_flags;
}
} else if (item->type == RTE_FLOW_ITEM_TYPE_UDP) {
if (item->spec && item->mask) {
- udp_mask = (const struct rte_flow_item_udp *)item->mask;
+ udp_mask = item->mask;
/**
* Only support src & dst ports,
@@ -289,14 +289,13 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
filter->dst_port_mask = udp_mask->hdr.dst_port;
filter->src_port_mask = udp_mask->hdr.src_port;
- udp_spec = (const struct rte_flow_item_udp *)item->spec;
+ udp_spec = item->spec;
filter->dst_port = udp_spec->hdr.dst_port;
filter->src_port = udp_spec->hdr.src_port;
}
} else {
if (item->spec && item->mask) {
- sctp_mask = (const struct rte_flow_item_sctp *)
- item->mask;
+ sctp_mask = item->mask;
/**
* Only support src & dst ports,
@@ -533,8 +532,8 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr,
return -rte_errno;
}
- eth_spec = (const struct rte_flow_item_eth *)item->spec;
- eth_mask = (const struct rte_flow_item_eth *)item->mask;
+ eth_spec = item->spec;
+ eth_mask = item->mask;
/* Mask bits of source MAC address must be full of 0.
* Mask bits of destination MAC address must be full
@@ -848,8 +847,8 @@ cons_parse_syn_filter(const struct rte_flow_attr *attr,
return -rte_errno;
}
- tcp_spec = (const struct rte_flow_item_tcp *)item->spec;
- tcp_mask = (const struct rte_flow_item_tcp *)item->mask;
+ tcp_spec = item->spec;
+ tcp_mask = item->mask;
if (!(tcp_spec->hdr.tcp_flags & TCP_SYN_FLAG) ||
tcp_mask->hdr.src_port ||
tcp_mask->hdr.dst_port ||
@@ -1065,8 +1064,8 @@ cons_parse_flex_filter(const struct rte_flow_attr *attr,
return -rte_errno;
}
- raw_spec = (const struct rte_flow_item_raw *)item->spec;
- raw_mask = (const struct rte_flow_item_raw *)item->mask;
+ raw_spec = item->spec;
+ raw_mask = item->mask;
if (!raw_mask->length ||
!raw_mask->relative) {
--
2.13.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 4/5] net/bnxt: remove void pointer cast
2018-02-26 8:10 [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast Zhiyong Yang
` (2 preceding siblings ...)
2018-02-26 8:11 ` [dpdk-dev] [PATCH 3/5] net/e1000: " Zhiyong Yang
@ 2018-02-26 8:11 ` Zhiyong Yang
2018-02-26 8:11 ` [dpdk-dev] [PATCH 5/5] net/sfc: " Zhiyong Yang
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Zhiyong Yang @ 2018-02-26 8:11 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, ajit.khaparde, somnath.kotur, Zhiyong Yang
Cc: ajit.khaparde@broadcom.com
Cc: somnath.kotur@broadcom.com
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
drivers/net/bnxt/bnxt_filter.c | 44 ++++++++++++++++--------------------------
1 file changed, 17 insertions(+), 27 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c
index 032e8eed0..bbaae1a07 100644
--- a/drivers/net/bnxt/bnxt_filter.c
+++ b/drivers/net/bnxt/bnxt_filter.c
@@ -354,8 +354,8 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
}
switch (item->type) {
case RTE_FLOW_ITEM_TYPE_ETH:
- eth_spec = (const struct rte_flow_item_eth *)item->spec;
- eth_mask = (const struct rte_flow_item_eth *)item->mask;
+ eth_spec = item->spec;
+ eth_mask = item->mask;
/* Source MAC address mask cannot be partially set.
* Should be All 0's or all 1's.
@@ -410,10 +410,8 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
break;
case RTE_FLOW_ITEM_TYPE_VLAN:
- vlan_spec =
- (const struct rte_flow_item_vlan *)item->spec;
- vlan_mask =
- (const struct rte_flow_item_vlan *)item->mask;
+ vlan_spec = item->spec;
+ vlan_mask = item->mask;
if (vlan_mask->tci & 0xFFFF && !vlan_mask->tpid) {
/* Only the VLAN ID can be matched. */
filter->l2_ovlan =
@@ -431,10 +429,8 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
break;
case RTE_FLOW_ITEM_TYPE_IPV4:
/* If mask is not involved, we could use EM filters. */
- ipv4_spec =
- (const struct rte_flow_item_ipv4 *)item->spec;
- ipv4_mask =
- (const struct rte_flow_item_ipv4 *)item->mask;
+ ipv4_spec = item->spec;
+ ipv4_mask = item->mask;
/* Only IP DST and SRC fields are maskable. */
if (ipv4_mask->hdr.version_ihl ||
ipv4_mask->hdr.type_of_service ||
@@ -483,10 +479,8 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
}
break;
case RTE_FLOW_ITEM_TYPE_IPV6:
- ipv6_spec =
- (const struct rte_flow_item_ipv6 *)item->spec;
- ipv6_mask =
- (const struct rte_flow_item_ipv6 *)item->mask;
+ ipv6_spec = item->spec;
+ ipv6_mask = item->mask;
/* Only IP DST and SRC fields are maskable. */
if (ipv6_mask->hdr.vtc_flow ||
@@ -527,8 +521,8 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
EM_FLOW_ALLOC_INPUT_IP_ADDR_TYPE_IPV6;
break;
case RTE_FLOW_ITEM_TYPE_TCP:
- tcp_spec = (const struct rte_flow_item_tcp *)item->spec;
- tcp_mask = (const struct rte_flow_item_tcp *)item->mask;
+ tcp_spec = item->spec;
+ tcp_mask = item->mask;
/* Check TCP mask. Only DST & SRC ports are maskable */
if (tcp_mask->hdr.sent_seq ||
@@ -564,8 +558,8 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
}
break;
case RTE_FLOW_ITEM_TYPE_UDP:
- udp_spec = (const struct rte_flow_item_udp *)item->spec;
- udp_mask = (const struct rte_flow_item_udp *)item->mask;
+ udp_spec = item->spec;
+ udp_mask = item->mask;
if (udp_mask->hdr.dgram_len ||
udp_mask->hdr.dgram_cksum) {
@@ -597,10 +591,8 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
}
break;
case RTE_FLOW_ITEM_TYPE_VXLAN:
- vxlan_spec =
- (const struct rte_flow_item_vxlan *)item->spec;
- vxlan_mask =
- (const struct rte_flow_item_vxlan *)item->mask;
+ vxlan_spec = item->spec;
+ vxlan_mask = item->mask;
/* Check if VXLAN item is used to describe protocol.
* If yes, both spec and mask should be NULL.
* If no, both spec and mask shouldn't be NULL.
@@ -646,10 +638,8 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
}
break;
case RTE_FLOW_ITEM_TYPE_NVGRE:
- nvgre_spec =
- (const struct rte_flow_item_nvgre *)item->spec;
- nvgre_mask =
- (const struct rte_flow_item_nvgre *)item->mask;
+ nvgre_spec = item->spec;
+ nvgre_mask = item->mask;
/* Check if NVGRE item is used to describe protocol.
* If yes, both spec and mask should be NULL.
* If no, both spec and mask shouldn't be NULL.
@@ -692,7 +682,7 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
}
break;
case RTE_FLOW_ITEM_TYPE_VF:
- vf_spec = (const struct rte_flow_item_vf *)item->spec;
+ vf_spec = item->spec;
vf = vf_spec->id;
if (!BNXT_PF(bp)) {
rte_flow_error_set(error, EINVAL,
--
2.13.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 5/5] net/sfc: remove void pointer cast
2018-02-26 8:10 [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast Zhiyong Yang
` (3 preceding siblings ...)
2018-02-26 8:11 ` [dpdk-dev] [PATCH 4/5] net/bnxt: " Zhiyong Yang
@ 2018-02-26 8:11 ` Zhiyong Yang
2018-02-26 11:03 ` Andrew Rybchenko
2018-02-27 13:45 ` [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast Ferruh Yigit
2018-03-06 18:57 ` Ferruh Yigit
6 siblings, 1 reply; 10+ messages in thread
From: Zhiyong Yang @ 2018-02-26 8:11 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, arybchenko, Zhiyong Yang
Cc: arybchenko@solarflare.com
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
drivers/net/sfc/sfc_flow.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c
index 93cdf8f4c..eb555c324 100644
--- a/drivers/net/sfc/sfc_flow.c
+++ b/drivers/net/sfc/sfc_flow.c
@@ -115,13 +115,13 @@ sfc_flow_parse_init(const struct rte_flow_item *item,
return -rte_errno;
}
- mask = (const uint8_t *)def_mask;
+ mask = def_mask;
} else {
- mask = (const uint8_t *)item->mask;
+ mask = item->mask;
}
- spec = (const uint8_t *)item->spec;
- last = (const uint8_t *)item->last;
+ spec = item->spec;
+ last = item->last;
if (spec == NULL)
goto exit;
--
2.13.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 5/5] net/sfc: remove void pointer cast
2018-02-26 8:11 ` [dpdk-dev] [PATCH 5/5] net/sfc: " Zhiyong Yang
@ 2018-02-26 11:03 ` Andrew Rybchenko
0 siblings, 0 replies; 10+ messages in thread
From: Andrew Rybchenko @ 2018-02-26 11:03 UTC (permalink / raw)
To: Zhiyong Yang, dev; +Cc: ferruh.yigit
On 02/26/2018 11:11 AM, Zhiyong Yang wrote:
> Cc: arybchenko@solarflare.com
> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
> drivers/net/sfc/sfc_flow.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c
> index 93cdf8f4c..eb555c324 100644
> --- a/drivers/net/sfc/sfc_flow.c
> +++ b/drivers/net/sfc/sfc_flow.c
> @@ -115,13 +115,13 @@ sfc_flow_parse_init(const struct rte_flow_item *item,
> return -rte_errno;
> }
>
> - mask = (const uint8_t *)def_mask;
> + mask = def_mask;
> } else {
> - mask = (const uint8_t *)item->mask;
> + mask = item->mask;
> }
>
> - spec = (const uint8_t *)item->spec;
> - last = (const uint8_t *)item->last;
> + spec = item->spec;
> + last = item->last;
>
> if (spec == NULL)
> goto exit;
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast
2018-02-26 8:10 [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast Zhiyong Yang
` (4 preceding siblings ...)
2018-02-26 8:11 ` [dpdk-dev] [PATCH 5/5] net/sfc: " Zhiyong Yang
@ 2018-02-27 13:45 ` Ferruh Yigit
2018-03-06 18:57 ` Ferruh Yigit
6 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2018-02-27 13:45 UTC (permalink / raw)
To: Zhiyong Yang, dev
On 2/26/2018 8:10 AM, Zhiyong Yang wrote:
> The patch series cleanup void pointer explicit cast related to
> struct rte_flow_item fields in librte_flow_classify and make
> code more readable.
>
> Zhiyong Yang (5):
> flow_classify: remove void pointer cast
> net/ixgbe: remove void pointer cast
> net/e1000: remove void pointer cast
> net/bnxt: remove void pointer cast
> net/sfc: remove void pointer cast
For series
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast
2018-02-26 8:10 [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast Zhiyong Yang
` (5 preceding siblings ...)
2018-02-27 13:45 ` [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast Ferruh Yigit
@ 2018-03-06 18:57 ` Ferruh Yigit
6 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2018-03-06 18:57 UTC (permalink / raw)
To: Zhiyong Yang, dev
On 2/26/2018 8:10 AM, Zhiyong Yang wrote:
> The patch series cleanup void pointer explicit cast related to
> struct rte_flow_item fields in librte_flow_classify and make
> code more readable.
>
> Zhiyong Yang (5):
> flow_classify: remove void pointer cast
> net/ixgbe: remove void pointer cast
> net/e1000: remove void pointer cast
> net/bnxt: remove void pointer cast
> net/sfc: remove void pointer cast
Series applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 1/5] flow_classify: remove void pointer cast
2018-02-26 8:10 ` [dpdk-dev] [PATCH 1/5] flow_classify: remove void pointer cast Zhiyong Yang
@ 2018-03-14 11:02 ` Iremonger, Bernard
0 siblings, 0 replies; 10+ messages in thread
From: Iremonger, Bernard @ 2018-03-14 11:02 UTC (permalink / raw)
To: Yang, Zhiyong, dev; +Cc: Yigit, Ferruh
> -----Original Message-----
> From: Yang, Zhiyong
> Sent: Monday, February 26, 2018 8:11 AM
> To: dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>; Yang, Zhiyong <zhiyong.yang@intel.com>
> Subject: [PATCH 1/5] flow_classify: remove void pointer cast
>
> Cc: bernard.iremonger@intel.com
> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-03-14 11:02 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-26 8:10 [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast Zhiyong Yang
2018-02-26 8:10 ` [dpdk-dev] [PATCH 1/5] flow_classify: remove void pointer cast Zhiyong Yang
2018-03-14 11:02 ` Iremonger, Bernard
2018-02-26 8:11 ` [dpdk-dev] [PATCH 2/5] net/ixgbe: " Zhiyong Yang
2018-02-26 8:11 ` [dpdk-dev] [PATCH 3/5] net/e1000: " Zhiyong Yang
2018-02-26 8:11 ` [dpdk-dev] [PATCH 4/5] net/bnxt: " Zhiyong Yang
2018-02-26 8:11 ` [dpdk-dev] [PATCH 5/5] net/sfc: " Zhiyong Yang
2018-02-26 11:03 ` Andrew Rybchenko
2018-02-27 13:45 ` [dpdk-dev] [PATCH 0/5] remove void pointer explicit cast Ferruh Yigit
2018-03-06 18:57 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).