Thread (15 messages) flat view 15 messages, 3 authors, 2016-01-06

Re: [PATCH net-next 11/12] IB/mlx5: Add flow steering utilities

From: Or Gerlitz <hidden>
Date: 2016-01-06 08:03:56

On 1/5/2016 10:04 PM, Saeed Mahameed wrote:
+static bool is_valid_attr(struct ib_flow_attr *flow_attr)
+{
+	union ib_flow_spec *ib_spec = (union ib_flow_spec *)(flow_attr + 1);
+	bool has_ipv4_spec = false;
+	bool eth_type_ipv4 = true;
+	unsigned int spec_index;
+
+	/* Validate that ehtertype is correct */
typo s/ehtertype/ethertype/ -- better if you grep all comments in the 
patches and run them through speller
+	for (spec_index = 0; spec_index < flow_attr->num_of_specs; spec_index++) {
+		if (ib_spec->type == IB_FLOW_SPEC_ETH &&
+		    ib_spec->eth.mask.ether_type) {
+			eth_type_ipv4 = ib_spec->eth.mask.ether_type == 0xffff &&
sparse complains here on this

drivers/infiniband/hw/mlx5//main.c:1006:58: warning: restricted __be16 
degrades to integer

even if this isn't real bug, make the tool happy, so we'll have the 
driver keep being clean from such warns
+				ib_spec->eth.val.ether_type == htons(ETH_P_IP);
+		} else if (ib_spec->type == IB_FLOW_SPEC_IPV4) {
+			has_ipv4_spec = true;
+		}
+		ib_spec = (void *)ib_spec + ib_spec->size;
+	}
+	return !has_ipv4_spec || eth_type_ipv4;
+}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help