#define TCP_FLAGS_OFFSET 13
#define TCP_FLAG_MASK 0x3f
-static inline struct ovs_tcphdr *ovs_tcp_hdr(const struct sk_buff *skb)
-{
- return (struct ovs_tcphdr *)skb_transport_header(skb);
-}
-
void flow_used(struct sw_flow *flow, struct sk_buff *skb)
{
u8 tcp_flags = 0;
- if (flow->key.dl_type == htons(ETH_P_IP) && iphdr_ok(skb)) {
- struct iphdr *nh = ip_hdr(skb);
- flow->ip_tos = nh->tos;
- if (flow->key.nw_proto == IPPROTO_TCP && tcphdr_ok(skb)) {
- u8 *tcp = (u8 *)tcp_hdr(skb);
- tcp_flags = *(tcp + TCP_FLAGS_OFFSET) & TCP_FLAG_MASK;
- }
+ if (flow->key.dl_type == htons(ETH_P_IP) &&
+ flow->key.nw_proto == IPPROTO_TCP) {
+ u8 *tcp = (u8 *)tcp_hdr(skb);
+ tcp_flags = *(tcp + TCP_FLAGS_OFFSET) & TCP_FLAG_MASK;
}
spin_lock_bh(&flow->lock);
- ktime_get_ts(&flow->used);
+ flow->used = jiffies;
flow->packet_count++;
flow->byte_count += skb->len;
flow->tcp_flags |= tcp_flags;
return retval;
}
-struct sw_flow *flow_cast(const struct tbl_node *node)
-{
- return container_of(node, struct sw_flow, tbl_node);
-}
-
u32 flow_hash(const struct xflow_key *key)
{
return jhash2((u32*)key, sizeof *key / sizeof(u32), hash_seed);