[shortcut-fe] Change code style to match Linux kernel
1. Move ANSI types to Linux types.
2. Change all global variables to static defined variables.
3. Removed macro SFE_HOOK_ABOVE_BRIDGE since it is always true
in current code.
4. move extern declarations to header files.
5. Rework some comments to make them meaningful.
6. Some code style changes, such as space/newline/alignment/brackets.
Change-Id: I131071a3522e79662f092b20259d07e5458f0f73
Signed-off-by: Xiaoping Fan <xfan@codeaurora.org>
diff --git a/shortcut-fe/Kconfig b/shortcut-fe/Kconfig
index 5860576..487f1e0 100644
--- a/shortcut-fe/Kconfig
+++ b/shortcut-fe/Kconfig
@@ -1,7 +1,3 @@
-# Copyright (c) 2013 Qualcomm Atheros, Inc.
-#
-# All Rights Reserved.
-# Qualcomm Atheros Confidential and Proprietary.
#
# Shortcut forwarding engine
#
diff --git a/shortcut-fe/Makefile b/shortcut-fe/Makefile
index 1aad4e5..3b1ceaa 100644
--- a/shortcut-fe/Makefile
+++ b/shortcut-fe/Makefile
@@ -1,16 +1,4 @@
#
-# Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
-# Permission to use, copy, modify, and/or distribute this software for
-# any purpose with or without fee is hereby granted, provided that the
-# above copyright notice and this permission notice appear in all copies.
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
# Makefile for Shortcut FE.
#
diff --git a/shortcut-fe/sfe.h b/shortcut-fe/sfe.h
index f744866..6027534 100644
--- a/shortcut-fe/sfe.h
+++ b/shortcut-fe/sfe.h
@@ -2,7 +2,7 @@
* sfe.h
* Shortcut forwarding engine.
*
- * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -16,18 +16,6 @@
*/
/*
- * Select whether we "hook" in below or above the Ethernet bridge layer.
- *
- * XXX - note that hooking below the bridge (set this value to 0) will
- * not currently work completely cleanly within Linux. In order to make
- * this work properly we need to resync stats to Linux. Arguably if we
- * want to do this we also need to validate that the source MAC address
- * of any packets is actually correct too. Right now we're relying on
- * the bridge layer to do this sort of thing for us.
- */
-#define SFE_HOOK_ABOVE_BRIDGE 1
-
-/*
* Debug output verbosity level.
*/
#define DEBUG_LEVEL 2
diff --git a/shortcut-fe/sfe_cm.c b/shortcut-fe/sfe_cm.c
index 63482d9..ef8547c 100644
--- a/shortcut-fe/sfe_cm.c
+++ b/shortcut-fe/sfe_cm.c
@@ -93,26 +93,13 @@
/*
* Callback notifiers.
*/
- struct notifier_block dev_notifier;
- /* Device notifier */
- struct notifier_block inet_notifier;
- /* IPv4 notifier */
- struct notifier_block inet6_notifier;
- /* IPv6 notifier */
- uint32_t exceptions[SFE_CM_EXCEPTION_MAX];
+ struct notifier_block dev_notifier; /* Device notifier */
+ struct notifier_block inet_notifier; /* IPv4 notifier */
+ struct notifier_block inet6_notifier; /* IPv6 notifier */
+ u32 exceptions[SFE_CM_EXCEPTION_MAX];
};
-struct sfe_cm __sc;
-
-/*
- * Expose the hook for the receive processing.
- */
-extern int (*athrs_fast_nat_recv)(struct sk_buff *skb);
-
-/*
- * Expose what should be a static flag in the TCP connection tracker.
- */
-extern int nf_ct_tcp_no_window_check;
+static struct sfe_cm __sc;
/*
* sfe_cm_incr_exceptions()
@@ -150,7 +137,6 @@
* We're only interested in IPv4 and IPv6 packets.
*/
if (likely(htons(ETH_P_IP) == skb->protocol)) {
-#if (SFE_HOOK_ABOVE_BRIDGE)
struct in_device *in_dev;
/*
@@ -170,13 +156,11 @@
DEBUG_TRACE("no IP address for device: %s\n", dev->name);
return 0;
}
-#endif
return sfe_ipv4_recv(dev, skb);
}
if (likely(htons(ETH_P_IPV6) == skb->protocol)) {
-#if (SFE_HOOK_ABOVE_BRIDGE)
struct inet6_dev *in_dev;
/*
@@ -196,7 +180,6 @@
DEBUG_TRACE("no IPv6 address for device: %s\n", dev->name);
return 0;
}
-#endif
return sfe_ipv6_recv(dev, skb);
}
@@ -215,7 +198,7 @@
* structure, obtain the hardware address. This means this function also
* works if the neighbours are routers too.
*/
-static bool sfe_cm_find_dev_and_mac_addr(sfe_ip_addr_t *addr, struct net_device **dev, uint8_t *mac_addr, int is_v4)
+static bool sfe_cm_find_dev_and_mac_addr(sfe_ip_addr_t *addr, struct net_device **dev, u8 *mac_addr, int is_v4)
{
struct neighbour *neigh;
struct rtable *rt;
@@ -413,7 +396,7 @@
*/
orig_tuple = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple;
reply_tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple;
- sic.protocol = (int32_t)orig_tuple.dst.protonum;
+ sic.protocol = (s32)orig_tuple.dst.protonum;
sic.flags = 0;
@@ -421,7 +404,7 @@
* Get addressing information, non-NAT first
*/
if (likely(is_v4)) {
- uint32_t dscp;
+ u32 dscp;
sic.src_ip.ip = (__be32)orig_tuple.src.u3.ip;
sic.dest_ip.ip = (__be32)orig_tuple.dst.u3.ip;
@@ -441,11 +424,12 @@
dscp = ipv4_get_dsfield(ip_hdr(skb)) >> XT_DSCP_SHIFT;
if (dscp) {
- sic.src_dscp = sic.dest_dscp = dscp;
+ sic.dest_dscp = dscp;
+ sic.src_dscp = sic.dest_dscp;
sic.flags |= SFE_CREATE_FLAG_REMARK_DSCP;
}
} else {
- uint32_t dscp;
+ u32 dscp;
sic.src_ip.ip6[0] = *((struct sfe_ipv6_addr *)&orig_tuple.src.u3.in6);
sic.dest_ip.ip6[0] = *((struct sfe_ipv6_addr *)&orig_tuple.dst.u3.in6);
@@ -466,7 +450,8 @@
dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT;
if (dscp) {
- sic.src_dscp = sic.dest_dscp = dscp;
+ sic.dest_dscp = dscp;
+ sic.src_dscp = sic.dest_dscp;
sic.flags |= SFE_CREATE_FLAG_REMARK_DSCP;
}
}
@@ -485,6 +470,7 @@
sic.dest_td_max_window = ct->proto.tcp.seen[1].td_maxwin;
sic.dest_td_end = ct->proto.tcp.seen[1].td_end;
sic.dest_td_max_end = ct->proto.tcp.seen[1].td_maxend;
+
if (nf_ct_tcp_no_window_check
|| (ct->proto.tcp.seen[0].flags & IP_CT_TCP_FLAG_BE_LIBERAL)
|| (ct->proto.tcp.seen[1].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) {
@@ -540,7 +526,7 @@
*/
if (unlikely(skb->sp)) {
if (sic.protocol == IPPROTO_TCP &&
- !(sic.flags & SFE_CREATE_FLAG_NO_SEQ_CHECK)) {
+ !(sic.flags & SFE_CREATE_FLAG_NO_SEQ_CHECK)) {
return NF_ACCEPT;
}
@@ -556,7 +542,8 @@
* Get QoS information
*/
if (skb->priority) {
- sic.src_priority = sic.dest_priority = skb->priority;
+ sic.dest_priority = skb->priority;
+ sic.src_priority = sic.dest_priority;
sic.flags |= SFE_CREATE_FLAG_REMARK_PRIORITY;
}
@@ -588,33 +575,6 @@
goto done1;
}
-#if (!SFE_HOOK_ABOVE_BRIDGE)
- /*
- * Now our devices may actually be a bridge interface. If that's
- * the case then we need to hunt down the underlying interface.
- */
- if (src_dev->priv_flags & IFF_EBRIDGE) {
- src_br_dev = br_port_dev_get(src_dev, sic.src_mac);
- if (!src_br_dev) {
- sfe_cm_incr_exceptions(SFE_CM_EXCEPTION_NO_BRIDGE);
- DEBUG_TRACE("no port found on bridge\n");
- goto done2;
- }
-
- src_dev = src_br_dev;
- }
-
- if (dest_dev->priv_flags & IFF_EBRIDGE) {
- dest_br_dev = br_port_dev_get(dest_dev, sic.dest_mac_xlate);
- if (!dest_br_dev) {
- sfe_cm_incr_exceptions(SFE_CM_EXCEPTION_NO_BRIDGE);
- DEBUG_TRACE("no port found on bridge\n");
- goto done3;
- }
-
- dest_dev = dest_br_dev;
- }
-#else
/*
* Our devices may actually be part of a bridge interface. If that's
* the case then find the bridge interface instead.
@@ -640,7 +600,6 @@
dest_dev = dest_br_dev;
}
-#endif
sic.src_dev = src_dev;
sic.dest_dev = dest_dev;
@@ -693,7 +652,6 @@
return sfe_cm_post_routing(skb, false);
}
-
#ifdef CONFIG_NF_CONNTRACK_EVENTS
/*
* sfe_cm_conntrack_event()
@@ -701,7 +659,7 @@
*/
#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
static int sfe_cm_conntrack_event(struct notifier_block *this,
- unsigned long events, void *ptr)
+ unsigned long events, void *ptr)
#else
static int sfe_cm_conntrack_event(unsigned int events, struct nf_ct_event *item)
#endif
@@ -738,7 +696,7 @@
}
orig_tuple = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple;
- sid.protocol = (int32_t)orig_tuple.dst.protonum;
+ sid.protocol = (s32)orig_tuple.dst.protonum;
/*
* Extract information from the conntrack connection. We're only interested
@@ -822,7 +780,7 @@
memset(&tuple, 0, sizeof(tuple));
tuple.src.u.all = (__be16)sis->src_port;
tuple.dst.dir = IP_CT_DIR_ORIGINAL;
- tuple.dst.protonum = (uint8_t)sis->protocol;
+ tuple.dst.protonum = (u8)sis->protocol;
tuple.dst.u.all = (__be16)sis->dest_port;
if (sis->is_v6) {
@@ -882,19 +840,19 @@
if (ct->proto.tcp.seen[0].td_maxwin < sis->src_td_max_window) {
ct->proto.tcp.seen[0].td_maxwin = sis->src_td_max_window;
}
- if ((int32_t)(ct->proto.tcp.seen[0].td_end - sis->src_td_end) < 0) {
+ if ((s32)(ct->proto.tcp.seen[0].td_end - sis->src_td_end) < 0) {
ct->proto.tcp.seen[0].td_end = sis->src_td_end;
}
- if ((int32_t)(ct->proto.tcp.seen[0].td_maxend - sis->src_td_max_end) < 0) {
+ if ((s32)(ct->proto.tcp.seen[0].td_maxend - sis->src_td_max_end) < 0) {
ct->proto.tcp.seen[0].td_maxend = sis->src_td_max_end;
}
if (ct->proto.tcp.seen[1].td_maxwin < sis->dest_td_max_window) {
ct->proto.tcp.seen[1].td_maxwin = sis->dest_td_max_window;
}
- if ((int32_t)(ct->proto.tcp.seen[1].td_end - sis->dest_td_end) < 0) {
+ if ((s32)(ct->proto.tcp.seen[1].td_end - sis->dest_td_end) < 0) {
ct->proto.tcp.seen[1].td_end = sis->dest_td_end;
}
- if ((int32_t)(ct->proto.tcp.seen[1].td_maxend - sis->dest_td_max_end) < 0) {
+ if ((s32)(ct->proto.tcp.seen[1].td_maxend - sis->dest_td_max_end) < 0) {
ct->proto.tcp.seen[1].td_maxend = sis->dest_td_max_end;
}
spin_unlock_bh(&ct->lock);
@@ -1036,7 +994,7 @@
/*
* Hook the receive path in the network stack.
*/
- BUG_ON(athrs_fast_nat_recv != NULL);
+ BUG_ON(athrs_fast_nat_recv);
RCU_INIT_POINTER(athrs_fast_nat_recv, sfe_cm_recv);
/*
@@ -1048,9 +1006,8 @@
#ifdef CONFIG_NF_CONNTRACK_EVENTS
exit4:
-#endif
nf_unregister_hooks(sfe_cm_ops_post_routing, ARRAY_SIZE(sfe_cm_ops_post_routing));
-
+#endif
exit3:
unregister_inet6addr_notifier(&sc->inet6_notifier);
unregister_inetaddr_notifier(&sc->inet_notifier);
@@ -1109,7 +1066,6 @@
module_init(sfe_cm_init)
module_exit(sfe_cm_exit)
-MODULE_AUTHOR("Qualcomm Atheros Inc.");
MODULE_DESCRIPTION("Shortcut Forwarding Engine - Connection Manager");
MODULE_LICENSE("Dual BSD/GPL");
diff --git a/shortcut-fe/sfe_cm.h b/shortcut-fe/sfe_cm.h
index 12f2ffa..23cbde8 100644
--- a/shortcut-fe/sfe_cm.h
+++ b/shortcut-fe/sfe_cm.h
@@ -2,7 +2,7 @@
* sfe_cm.h
* Shortcut forwarding engine.
*
- * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -18,11 +18,11 @@
/*
* connection flags.
*/
-#define SFE_CREATE_FLAG_NO_SEQ_CHECK (1<<0)
+#define SFE_CREATE_FLAG_NO_SEQ_CHECK BIT(0)
/* Indicates that we should not check sequence numbers */
-#define SFE_CREATE_FLAG_REMARK_PRIORITY (1<<1)
+#define SFE_CREATE_FLAG_REMARK_PRIORITY BIT(1)
/* Indicates that we should remark priority of skb */
-#define SFE_CREATE_FLAG_REMARK_DSCP (1<<2)
+#define SFE_CREATE_FLAG_REMARK_DSCP BIT(2)
/* Indicates that we should remark DSCP of packet */
/*
@@ -44,9 +44,9 @@
int protocol;
struct net_device *src_dev;
struct net_device *dest_dev;
- uint32_t flags;
- uint32_t src_mtu;
- uint32_t dest_mtu;
+ u32 flags;
+ u32 src_mtu;
+ u32 dest_mtu;
sfe_ip_addr_t src_ip;
sfe_ip_addr_t src_ip_xlate;
sfe_ip_addr_t dest_ip;
@@ -55,27 +55,27 @@
__be16 src_port_xlate;
__be16 dest_port;
__be16 dest_port_xlate;
- uint8_t src_mac[ETH_ALEN];
- uint8_t src_mac_xlate[ETH_ALEN];
- uint8_t dest_mac[ETH_ALEN];
- uint8_t dest_mac_xlate[ETH_ALEN];
- uint8_t src_td_window_scale;
- uint32_t src_td_max_window;
- uint32_t src_td_end;
- uint32_t src_td_max_end;
- uint8_t dest_td_window_scale;
- uint32_t dest_td_max_window;
- uint32_t dest_td_end;
- uint32_t dest_td_max_end;
- uint32_t mark;
+ u8 src_mac[ETH_ALEN];
+ u8 src_mac_xlate[ETH_ALEN];
+ u8 dest_mac[ETH_ALEN];
+ u8 dest_mac_xlate[ETH_ALEN];
+ u8 src_td_window_scale;
+ u32 src_td_max_window;
+ u32 src_td_end;
+ u32 src_td_max_end;
+ u8 dest_td_window_scale;
+ u32 dest_td_max_window;
+ u32 dest_td_end;
+ u32 dest_td_max_end;
+ u32 mark;
#ifdef CONFIG_XFRM
- uint32_t original_accel;
- uint32_t reply_accel;
+ u32 original_accel;
+ u32 reply_accel;
#endif
- uint32_t src_priority;
- uint32_t dest_priority;
- uint32_t src_dscp;
- uint32_t dest_dscp;
+ u32 src_priority;
+ u32 dest_priority;
+ u32 src_dscp;
+ u32 dest_dscp;
};
/*
@@ -114,22 +114,22 @@
sfe_ip_addr_t dest_ip_xlate; /* NATed destination address */
__be16 dest_port; /* Non-NAT destination port */
__be16 dest_port_xlate; /* NATed destination port */
- uint32_t src_td_max_window;
- uint32_t src_td_end;
- uint32_t src_td_max_end;
- uint64_t src_packet_count;
- uint64_t src_byte_count;
- uint32_t src_new_packet_count;
- uint32_t src_new_byte_count;
- uint32_t dest_td_max_window;
- uint32_t dest_td_end;
- uint32_t dest_td_max_end;
- uint64_t dest_packet_count;
- uint64_t dest_byte_count;
- uint32_t dest_new_packet_count;
- uint32_t dest_new_byte_count;
- uint32_t reason; /* reason for stats sync message, i.e. destroy, flush, period sync */
- uint64_t delta_jiffies; /* Time to be added to the current timeout to keep the connection alive */
+ u32 src_td_max_window;
+ u32 src_td_end;
+ u32 src_td_max_end;
+ u64 src_packet_count;
+ u64 src_byte_count;
+ u32 src_new_packet_count;
+ u32 src_new_byte_count;
+ u32 dest_td_max_window;
+ u32 dest_td_end;
+ u32 dest_td_max_end;
+ u64 dest_packet_count;
+ u64 dest_byte_count;
+ u32 dest_new_packet_count;
+ u32 dest_new_byte_count;
+ u32 reason; /* reason for stats sync message, i.e. destroy, flush, period sync */
+ u64 delta_jiffies; /* Time to be added to the current timeout to keep the connection alive */
};
/*
@@ -141,36 +141,51 @@
sfe_ip_addr_t dest_ip;
__be16 src_port;
__be16 dest_port;
- uint32_t mark;
+ u32 mark;
};
/*
- * Type used for a sync rule callback.
+ * Expose the hook for the receive processing.
+ */
+extern int (*athrs_fast_nat_recv)(struct sk_buff *skb);
+
+/*
+ * Expose what should be a static flag in the TCP connection tracker.
+ */
+extern int nf_ct_tcp_no_window_check;
+
+/*
+ * This callback will be called in a timer
+ * at 100 times per second to sync stats back to
+ * Linux connection track.
+ *
+ * A RCU lock is taken to prevent this callback
+ * from unregistering.
*/
typedef void (*sfe_sync_rule_callback_t)(struct sfe_connection_sync *);
/*
* IPv4 APIs used by connection manager
*/
-extern int sfe_ipv4_recv(struct net_device *dev, struct sk_buff *skb);
-extern int sfe_ipv4_create_rule(struct sfe_connection_create *sic);
-extern void sfe_ipv4_destroy_rule(struct sfe_connection_destroy *sid);
-extern void sfe_ipv4_destroy_all_rules_for_dev(struct net_device *dev);
-extern void sfe_ipv4_register_sync_rule_callback(sfe_sync_rule_callback_t callback);
-extern void sfe_ipv4_update_rule(struct sfe_connection_create *sic);
-extern void sfe_ipv4_mark_rule(struct sfe_connection_mark *mark);
+int sfe_ipv4_recv(struct net_device *dev, struct sk_buff *skb);
+int sfe_ipv4_create_rule(struct sfe_connection_create *sic);
+void sfe_ipv4_destroy_rule(struct sfe_connection_destroy *sid);
+void sfe_ipv4_destroy_all_rules_for_dev(struct net_device *dev);
+void sfe_ipv4_register_sync_rule_callback(sfe_sync_rule_callback_t callback);
+void sfe_ipv4_update_rule(struct sfe_connection_create *sic);
+void sfe_ipv4_mark_rule(struct sfe_connection_mark *mark);
#ifdef SFE_SUPPORT_IPV6
/*
* IPv6 APIs used by connection manager
*/
-extern int sfe_ipv6_recv(struct net_device *dev, struct sk_buff *skb);
-extern int sfe_ipv6_create_rule(struct sfe_connection_create *sic);
-extern void sfe_ipv6_destroy_rule(struct sfe_connection_destroy *sid);
-extern void sfe_ipv6_destroy_all_rules_for_dev(struct net_device *dev);
-extern void sfe_ipv6_register_sync_rule_callback(sfe_sync_rule_callback_t callback);
-extern void sfe_ipv6_update_rule(struct sfe_connection_create *sic);
-extern void sfe_ipv6_mark_rule(struct sfe_connection_mark *mark);
+int sfe_ipv6_recv(struct net_device *dev, struct sk_buff *skb);
+int sfe_ipv6_create_rule(struct sfe_connection_create *sic);
+void sfe_ipv6_destroy_rule(struct sfe_connection_destroy *sid);
+void sfe_ipv6_destroy_all_rules_for_dev(struct net_device *dev);
+void sfe_ipv6_register_sync_rule_callback(sfe_sync_rule_callback_t callback);
+void sfe_ipv6_update_rule(struct sfe_connection_create *sic);
+void sfe_ipv6_mark_rule(struct sfe_connection_mark *mark);
#else
static inline int sfe_ipv6_recv(struct net_device *dev, struct sk_buff *skb)
{
@@ -179,7 +194,7 @@
static inline int sfe_ipv6_create_rule(struct sfe_connection_create *sic)
{
- return -1;
+ return 0;
}
static inline void sfe_ipv6_destroy_rule(struct sfe_connection_destroy *sid)
@@ -229,7 +244,7 @@
*
* return: 1, equal; 0, no equal
*/
-#define sfe_ipv4_addr_equal(a, b) ((uint32_t)(a) == (uint32_t)(b))
+#define sfe_ipv4_addr_equal(a, b) ((u32)(a) == (u32)(b))
/*
* sfe_addr_equal()
diff --git a/shortcut-fe/sfe_ipv4.c b/shortcut-fe/sfe_ipv4.c
index d930a78..75b80a1 100644
--- a/shortcut-fe/sfe_ipv4.c
+++ b/shortcut-fe/sfe_ipv4.c
@@ -147,10 +147,10 @@
* IPv4 TCP connection match additional data.
*/
struct sfe_ipv4_tcp_connection_match {
- uint8_t win_scale; /* Window scale */
- uint32_t max_win; /* Maximum window size seen */
- uint32_t end; /* Sequence number of the next byte to send (seq + segment length) */
- uint32_t max_end; /* Sequence number of the last byte to ack */
+ u8 win_scale; /* Window scale */
+ u32 max_win; /* Maximum window size seen */
+ u32 end; /* Sequence number of the next byte to send (seq + segment length) */
+ u32 max_end; /* Sequence number of the last byte to ack */
};
/*
@@ -179,24 +179,19 @@
* References to other objects.
*/
struct sfe_ipv4_connection_match *next;
- /* Next connection match entry in a list */
struct sfe_ipv4_connection_match *prev;
- /* Previous connection match entry in a list */
struct sfe_ipv4_connection *connection;
- /* Pointer to our connection */
struct sfe_ipv4_connection_match *counter_match;
- /* Pointer to the connection match in the "counter" direction to this one */
+ /* Matches the flow in the opposite direction as the one in *connection */
struct sfe_ipv4_connection_match *active_next;
- /* Pointer to the next connection in the active list */
struct sfe_ipv4_connection_match *active_prev;
- /* Pointer to the previous connection in the active list */
bool active; /* Flag to indicate if we're on the active list */
/*
* Characteristics that identify flows that match this rule.
*/
struct net_device *match_dev; /* Network device */
- uint8_t match_protocol; /* Protocol */
+ u8 match_protocol; /* Protocol */
__be32 match_src_ip; /* Source IP address */
__be32 match_dest_ip; /* Destination IP address */
__be16 match_src_port; /* Source port/connection ident */
@@ -205,12 +200,12 @@
/*
* Control the operations of the match.
*/
- uint32_t flags; /* Bit flags */
+ u32 flags; /* Bit flags */
#ifdef CONFIG_NF_FLOW_COOKIE
- uint32_t flow_cookie; /* used flow cookie, for debug */
+ u32 flow_cookie; /* used flow cookie, for debug */
#endif
#ifdef CONFIG_XFRM
- uint32_t flow_accel; /* The flow accelerated or not */
+ u32 flow_accel; /* The flow accelerated or not */
#endif
/*
@@ -219,31 +214,35 @@
union { /* Protocol-specific state */
struct sfe_ipv4_tcp_connection_match tcp;
} protocol_state;
- uint32_t rx_packet_count; /* Number of packets RX'd */
- uint32_t rx_byte_count; /* Number of bytes RX'd */
+ /*
+ * Stats recorded in a sync period. These stats will be added to
+ * rx_packet_count64/rx_byte_count64 after a sync period.
+ */
+ u32 rx_packet_count;
+ u32 rx_byte_count;
/*
* Packet translation information.
*/
__be32 xlate_src_ip; /* Address after source translation */
__be16 xlate_src_port; /* Port/connection ident after source translation */
- uint16_t xlate_src_csum_adjustment;
+ u16 xlate_src_csum_adjustment;
/* Transport layer checksum adjustment after source translation */
- uint16_t xlate_src_partial_csum_adjustment;
+ u16 xlate_src_partial_csum_adjustment;
/* Transport layer pseudo header checksum adjustment after source translation */
__be32 xlate_dest_ip; /* Address after destination translation */
__be16 xlate_dest_port; /* Port/connection ident after destination translation */
- uint16_t xlate_dest_csum_adjustment;
+ u16 xlate_dest_csum_adjustment;
/* Transport layer checksum adjustment after destination translation */
- uint16_t xlate_dest_partial_csum_adjustment;
+ u16 xlate_dest_partial_csum_adjustment;
/* Transport layer pseudo header checksum adjustment after destination translation */
/*
* QoS information
*/
- uint32_t priority;
- uint32_t dscp;
+ u32 priority;
+ u32 dscp;
/*
* Packet transmit information.
@@ -251,16 +250,16 @@
struct net_device *xmit_dev; /* Network device on which to transmit */
unsigned short int xmit_dev_mtu;
/* Interface MTU */
- uint16_t xmit_dest_mac[ETH_ALEN / 2];
+ u16 xmit_dest_mac[ETH_ALEN / 2];
/* Destination MAC address to use when forwarding */
- uint16_t xmit_src_mac[ETH_ALEN / 2];
+ u16 xmit_src_mac[ETH_ALEN / 2];
/* Source MAC address to use when forwarding */
/*
* Summary stats.
*/
- uint64_t rx_packet_count64; /* Number of packets RX'd */
- uint64_t rx_byte_count64; /* Number of bytes RX'd */
+ u64 rx_packet_count64;
+ u64 rx_byte_count64;
};
/*
@@ -272,14 +271,14 @@
struct sfe_ipv4_connection *prev;
/* Pointer to the previous entry in a hash chain */
int protocol; /* IP protocol number */
- __be32 src_ip; /* Source IP address */
- __be32 src_ip_xlate; /* NAT-translated source IP address */
- __be32 dest_ip; /* Destination IP address */
- __be32 dest_ip_xlate; /* NAT-translated destination IP address */
- __be16 src_port; /* Source port */
- __be16 src_port_xlate; /* NAT-translated source port */
- __be16 dest_port; /* Destination port */
- __be16 dest_port_xlate; /* NAT-translated destination port */
+ __be32 src_ip; /* Src IP addr pre-translation */
+ __be32 src_ip_xlate; /* Src IP addr post-translation */
+ __be32 dest_ip; /* Dest IP addr pre-translation */
+ __be32 dest_ip_xlate; /* Dest IP addr post-translation */
+ __be16 src_port; /* Src port pre-translation */
+ __be16 src_port_xlate; /* Src port post-translation */
+ __be16 dest_port; /* Dest port pre-translation */
+ __be16 dest_port_xlate; /* Dest port post-translation */
struct sfe_ipv4_connection_match *original_match;
/* Original direction matching structure */
struct net_device *original_dev;
@@ -287,13 +286,13 @@
struct sfe_ipv4_connection_match *reply_match;
/* Reply direction matching structure */
struct net_device *reply_dev; /* Reply direction source device */
- uint64_t last_sync_jiffies; /* Jiffies count for the last sync */
+ u64 last_sync_jiffies; /* Jiffies count for the last sync */
struct sfe_ipv4_connection *all_connections_next;
/* Pointer to the next entry in the list of all connections */
struct sfe_ipv4_connection *all_connections_prev;
/* Pointer to the previous entry in the list of all connections */
- uint32_t mark; /* mark for outgoing packet */
- uint32_t debug_read_seq; /* sequence number for debug dump */
+ u32 mark; /* mark for outgoing packet */
+ u32 debug_read_seq; /* sequence number for debug dump */
};
/*
@@ -423,52 +422,53 @@
#endif
/*
- * Statistics.
+ * Stats recorded in a sync period. These stats will be added to
+ * connection_xxx64 after a sync period.
*/
- uint32_t connection_create_requests;
+ u32 connection_create_requests;
/* Number of IPv4 connection create requests */
- uint32_t connection_create_collisions;
+ u32 connection_create_collisions;
/* Number of IPv4 connection create requests that collided with existing hash table entries */
- uint32_t connection_destroy_requests;
+ u32 connection_destroy_requests;
/* Number of IPv4 connection destroy requests */
- uint32_t connection_destroy_misses;
+ u32 connection_destroy_misses;
/* Number of IPv4 connection destroy requests that missed our hash table */
- uint32_t connection_match_hash_hits;
+ u32 connection_match_hash_hits;
/* Number of IPv4 connection match hash hits */
- uint32_t connection_match_hash_reorders;
+ u32 connection_match_hash_reorders;
/* Number of IPv4 connection match hash reorders */
- uint32_t connection_flushes; /* Number of IPv4 connection flushes */
- uint32_t packets_forwarded; /* Number of IPv4 packets forwarded */
- uint32_t packets_not_forwarded; /* Number of IPv4 packets not forwarded */
- uint32_t exception_events[SFE_IPV4_EXCEPTION_EVENT_LAST];
+ u32 connection_flushes; /* Number of IPv4 connection flushes */
+ u32 packets_forwarded; /* Number of IPv4 packets forwarded */
+ u32 packets_not_forwarded; /* Number of IPv4 packets not forwarded */
+ u32 exception_events[SFE_IPV4_EXCEPTION_EVENT_LAST];
/*
- * Summary tatistics.
+ * Summary statistics.
*/
- uint64_t connection_create_requests64;
+ u64 connection_create_requests64;
/* Number of IPv4 connection create requests */
- uint64_t connection_create_collisions64;
+ u64 connection_create_collisions64;
/* Number of IPv4 connection create requests that collided with existing hash table entries */
- uint64_t connection_destroy_requests64;
+ u64 connection_destroy_requests64;
/* Number of IPv4 connection destroy requests */
- uint64_t connection_destroy_misses64;
+ u64 connection_destroy_misses64;
/* Number of IPv4 connection destroy requests that missed our hash table */
- uint64_t connection_match_hash_hits64;
+ u64 connection_match_hash_hits64;
/* Number of IPv4 connection match hash hits */
- uint64_t connection_match_hash_reorders64;
+ u64 connection_match_hash_reorders64;
/* Number of IPv4 connection match hash reorders */
- uint64_t connection_flushes64; /* Number of IPv4 connection flushes */
- uint64_t packets_forwarded64; /* Number of IPv4 packets forwarded */
- uint64_t packets_not_forwarded64;
+ u64 connection_flushes64; /* Number of IPv4 connection flushes */
+ u64 packets_forwarded64; /* Number of IPv4 packets forwarded */
+ u64 packets_not_forwarded64;
/* Number of IPv4 packets not forwarded */
- uint64_t exception_events64[SFE_IPV4_EXCEPTION_EVENT_LAST];
+ u64 exception_events64[SFE_IPV4_EXCEPTION_EVENT_LAST];
/*
* Control state.
*/
struct kobject *sys_sfe_ipv4; /* sysfs linkage */
int debug_dev; /* Major number of the debug char device */
- uint32_t debug_read_seq; /* sequence number for debug dump */
+ u32 debug_read_seq; /* sequence number for debug dump */
};
/*
@@ -499,7 +499,7 @@
typedef bool (*sfe_ipv4_debug_xml_write_method_t)(struct sfe_ipv4 *si, char *buffer, char *msg, size_t *length,
int *total_read, struct sfe_ipv4_debug_xml_write_state *ws);
-struct sfe_ipv4 __si;
+static struct sfe_ipv4 __si;
/*
* sfe_ipv4_gen_ip_csum()
@@ -507,10 +507,10 @@
*
* Note that this function assumes that we have only 20 bytes of IP header.
*/
-static inline uint16_t sfe_ipv4_gen_ip_csum(struct sfe_ipv4_ip_hdr *iph)
+static inline u16 sfe_ipv4_gen_ip_csum(struct sfe_ipv4_ip_hdr *iph)
{
- uint32_t sum;
- uint16_t *i = (uint16_t *)iph;
+ u32 sum;
+ u16 *i = (u16 *)iph;
iph->check = 0;
@@ -525,19 +525,19 @@
sum = (sum & 0xffff) + (sum >> 16);
sum = (sum & 0xffff) + (sum >> 16);
- return (uint16_t)sum ^ 0xffff;
+ return (u16)sum ^ 0xffff;
}
/*
* sfe_ipv4_get_connection_match_hash()
* Generate the hash used in connection match lookups.
*/
-static inline unsigned int sfe_ipv4_get_connection_match_hash(struct net_device *dev, uint8_t protocol,
+static inline unsigned int sfe_ipv4_get_connection_match_hash(struct net_device *dev, u8 protocol,
__be32 src_ip, __be16 src_port,
__be32 dest_ip, __be16 dest_port)
{
size_t dev_addr = (size_t)dev;
- uint32_t hash = ((uint32_t)dev_addr) ^ ntohl(src_ip ^ dest_ip) ^ protocol ^ ntohs(src_port ^ dest_port);
+ u32 hash = ((u32)dev_addr) ^ ntohl(src_ip ^ dest_ip) ^ protocol ^ ntohs(src_port ^ dest_port);
return ((hash >> SFE_IPV4_CONNECTION_HASH_SHIFT) ^ hash) & SFE_IPV4_CONNECTION_HASH_MASK;
}
@@ -548,11 +548,7 @@
* On entry we must be holding the lock that protects the hash table.
*/
static struct sfe_ipv4_connection_match *
-sfe_ipv4_find_sfe_ipv4_connection_match(struct sfe_ipv4 *si, struct net_device *dev, uint8_t protocol,
- __be32 src_ip, __be16 src_port,
- __be32 dest_ip, __be16 dest_port) __attribute__((always_inline));
-static struct sfe_ipv4_connection_match *
-sfe_ipv4_find_sfe_ipv4_connection_match(struct sfe_ipv4 *si, struct net_device *dev, uint8_t protocol,
+sfe_ipv4_find_sfe_ipv4_connection_match(struct sfe_ipv4 *si, struct net_device *dev, u8 protocol,
__be32 src_ip, __be16 src_port,
__be32 dest_ip, __be16 dest_port)
{
@@ -564,29 +560,29 @@
cm = si->conn_match_hash[conn_match_idx];
/*
- * If we don't have anything in this chain then bale.
+ * If we don't have anything in this chain then bail.
*/
if (unlikely(!cm)) {
- return cm;
+ return NULL;
}
/*
* Hopefully the first entry is the one we want.
*/
- if (likely(cm->match_src_port == src_port)
- && likely(cm->match_dest_port == dest_port)
- && likely(cm->match_src_ip == src_ip)
- && likely(cm->match_dest_ip == dest_ip)
- && likely(cm->match_protocol == protocol)
- && likely(cm->match_dev == dev)) {
+ if ((cm->match_src_port == src_port)
+ && (cm->match_dest_port == dest_port)
+ && (cm->match_src_ip == src_ip)
+ && (cm->match_dest_ip == dest_ip)
+ && (cm->match_protocol == protocol)
+ && (cm->match_dev == dev)) {
si->connection_match_hash_hits++;
return cm;
}
/*
- * We may or may not have a matching entry but if we do then we want to
- * move that entry to the top of the hash chain when we get to it. We
- * presume that this will be reused again very quickly.
+ * Unfortunately we didn't find it at head, so we search it in chain and
+ * move matching entry to the top of the hash chain. We presume that this
+ * will be reused again very quickly.
*/
head = cm;
do {
@@ -602,7 +598,7 @@
* Not found then we're done.
*/
if (unlikely(!cm)) {
- return cm;
+ return NULL;
}
/*
@@ -649,13 +645,13 @@
* Precompute an incremental checksum adjustment so we can
* edit packets in this stream very quickly. The algorithm is from RFC1624.
*/
- uint16_t src_ip_hi = cm->match_src_ip >> 16;
- uint16_t src_ip_lo = cm->match_src_ip & 0xffff;
- uint32_t xlate_src_ip = ~cm->xlate_src_ip;
- uint16_t xlate_src_ip_hi = xlate_src_ip >> 16;
- uint16_t xlate_src_ip_lo = xlate_src_ip & 0xffff;
- uint16_t xlate_src_port = ~cm->xlate_src_port;
- uint32_t adj;
+ u16 src_ip_hi = cm->match_src_ip >> 16;
+ u16 src_ip_lo = cm->match_src_ip & 0xffff;
+ u32 xlate_src_ip = ~cm->xlate_src_ip;
+ u16 xlate_src_ip_hi = xlate_src_ip >> 16;
+ u16 xlate_src_ip_lo = xlate_src_ip & 0xffff;
+ u16 xlate_src_port = ~cm->xlate_src_port;
+ u32 adj;
/*
* When we compute this fold it down to a 16-bit offset
@@ -668,7 +664,7 @@
+ xlate_src_ip_hi + xlate_src_ip_lo + xlate_src_port;
adj = (adj & 0xffff) + (adj >> 16);
adj = (adj & 0xffff) + (adj >> 16);
- cm->xlate_src_csum_adjustment = (uint16_t)adj;
+ cm->xlate_src_csum_adjustment = (u16)adj;
}
@@ -677,13 +673,13 @@
* Precompute an incremental checksum adjustment so we can
* edit packets in this stream very quickly. The algorithm is from RFC1624.
*/
- uint16_t dest_ip_hi = cm->match_dest_ip >> 16;
- uint16_t dest_ip_lo = cm->match_dest_ip & 0xffff;
- uint32_t xlate_dest_ip = ~cm->xlate_dest_ip;
- uint16_t xlate_dest_ip_hi = xlate_dest_ip >> 16;
- uint16_t xlate_dest_ip_lo = xlate_dest_ip & 0xffff;
- uint16_t xlate_dest_port = ~cm->xlate_dest_port;
- uint32_t adj;
+ u16 dest_ip_hi = cm->match_dest_ip >> 16;
+ u16 dest_ip_lo = cm->match_dest_ip & 0xffff;
+ u32 xlate_dest_ip = ~cm->xlate_dest_ip;
+ u16 xlate_dest_ip_hi = xlate_dest_ip >> 16;
+ u16 xlate_dest_ip_lo = xlate_dest_ip & 0xffff;
+ u16 xlate_dest_port = ~cm->xlate_dest_port;
+ u32 adj;
/*
* When we compute this fold it down to a 16-bit offset
@@ -696,29 +692,29 @@
+ xlate_dest_ip_hi + xlate_dest_ip_lo + xlate_dest_port;
adj = (adj & 0xffff) + (adj >> 16);
adj = (adj & 0xffff) + (adj >> 16);
- cm->xlate_dest_csum_adjustment = (uint16_t)adj;
+ cm->xlate_dest_csum_adjustment = (u16)adj;
}
if (cm->flags & SFE_IPV4_CONNECTION_MATCH_FLAG_XLATE_SRC) {
- uint32_t adj = ~cm->match_src_ip + cm->xlate_src_ip;
+ u32 adj = ~cm->match_src_ip + cm->xlate_src_ip;
if (adj < cm->xlate_src_ip) {
adj++;
}
adj = (adj & 0xffff) + (adj >> 16);
adj = (adj & 0xffff) + (adj >> 16);
- cm->xlate_src_partial_csum_adjustment = (uint16_t)adj;
+ cm->xlate_src_partial_csum_adjustment = (u16)adj;
}
if (cm->flags & SFE_IPV4_CONNECTION_MATCH_FLAG_XLATE_DEST) {
- uint32_t adj = ~cm->match_dest_ip + cm->xlate_dest_ip;
+ u32 adj = ~cm->match_dest_ip + cm->xlate_dest_ip;
if (adj < cm->xlate_dest_ip) {
adj++;
}
adj = (adj & 0xffff) + (adj >> 16);
adj = (adj & 0xffff) + (adj >> 16);
- cm->xlate_dest_partial_csum_adjustment = (uint16_t)adj;
+ cm->xlate_dest_partial_csum_adjustment = (u16)adj;
}
}
@@ -762,7 +758,8 @@
*
* On entry we must be holding the lock that protects the hash table.
*/
-static inline void sfe_ipv4_insert_sfe_ipv4_connection_match(struct sfe_ipv4 *si, struct sfe_ipv4_connection_match *cm)
+static inline void sfe_ipv4_insert_sfe_ipv4_connection_match(struct sfe_ipv4 *si,
+ struct sfe_ipv4_connection_match *cm)
{
struct sfe_ipv4_connection_match **hash_head;
struct sfe_ipv4_connection_match *prev_head;
@@ -770,6 +767,7 @@
= sfe_ipv4_get_connection_match_hash(cm->match_dev, cm->match_protocol,
cm->match_src_ip, cm->match_src_port,
cm->match_dest_ip, cm->match_dest_port);
+
hash_head = &si->conn_match_hash[conn_match_idx];
prev_head = *hash_head;
cm->prev = NULL;
@@ -888,10 +886,10 @@
* sfe_ipv4_get_connection_hash()
* Generate the hash used in connection lookups.
*/
-static inline unsigned int sfe_ipv4_get_connection_hash(uint8_t protocol, __be32 src_ip, __be16 src_port,
+static inline unsigned int sfe_ipv4_get_connection_hash(u8 protocol, __be32 src_ip, __be16 src_port,
__be32 dest_ip, __be16 dest_port)
{
- uint32_t hash = ntohl(src_ip ^ dest_ip) ^ protocol ^ ntohs(src_port ^ dest_port);
+ u32 hash = ntohl(src_ip ^ dest_ip) ^ protocol ^ ntohs(src_port ^ dest_port);
return ((hash >> SFE_IPV4_CONNECTION_HASH_SHIFT) ^ hash) & SFE_IPV4_CONNECTION_HASH_MASK;
}
@@ -901,7 +899,7 @@
*
* On entry we must be holding the lock that protects the hash table.
*/
-static inline struct sfe_ipv4_connection *sfe_ipv4_find_sfe_ipv4_connection(struct sfe_ipv4 *si, uint32_t protocol,
+static inline struct sfe_ipv4_connection *sfe_ipv4_find_sfe_ipv4_connection(struct sfe_ipv4 *si, u32 protocol,
__be32 src_ip, __be16 src_port,
__be32 dest_ip, __be16 dest_port)
{
@@ -913,24 +911,22 @@
* If we don't have anything in this chain then bale.
*/
if (unlikely(!c)) {
- return c;
+ return NULL;
}
/*
* Hopefully the first entry is the one we want.
*/
- if (likely(c->src_port == src_port)
- && likely(c->dest_port == dest_port)
- && likely(c->src_ip == src_ip)
- && likely(c->dest_ip == dest_ip)
- && likely(c->protocol == protocol)) {
+ if ((c->src_port == src_port)
+ && (c->dest_port == dest_port)
+ && (c->src_ip == src_ip)
+ && (c->dest_ip == dest_ip)
+ && (c->protocol == protocol)) {
return c;
}
/*
- * We may or may not have a matching entry but if we do then we want to
- * move that entry to the top of the hash chain when we get to it. We
- * presume that this will be reused again very quickly.
+ * Unfortunately we didn't find it at head, so we search it in chain.
*/
do {
c = c->next;
@@ -963,13 +959,16 @@
mark->src_ip.ip, mark->src_port,
mark->dest_ip.ip, mark->dest_port);
if (c) {
- DEBUG_TRACE("Matching connection found for mark, "
- "setting from %08x to %08x\n",
- c->mark, mark->mark);
WARN_ON((0 != c->mark) && (0 == mark->mark));
c->mark = mark->mark;
}
spin_unlock_bh(&si->lock);
+
+ if (c) {
+ DEBUG_TRACE("Matching connection found for mark, "
+ "setting from %08x to %08x\n",
+ c->mark, mark->mark);
+ }
}
/*
@@ -1077,7 +1076,7 @@
*/
static void sfe_ipv4_gen_sync_sfe_ipv4_connection(struct sfe_ipv4 *si, struct sfe_ipv4_connection *c,
struct sfe_connection_sync *sis, sfe_sync_reason_t reason,
- uint64_t now_jiffies)
+ u64 now_jiffies)
{
struct sfe_ipv4_connection_match *original_cm;
struct sfe_ipv4_connection_match *reply_cm;
@@ -1139,10 +1138,12 @@
* from within a BH and so we're fine, but we're also called when connections are
* torn down.
*/
-static void sfe_ipv4_flush_sfe_ipv4_connection(struct sfe_ipv4 *si, struct sfe_ipv4_connection *c, sfe_sync_reason_t reason)
+static void sfe_ipv4_flush_sfe_ipv4_connection(struct sfe_ipv4 *si,
+ struct sfe_ipv4_connection *c,
+ sfe_sync_reason_t reason)
{
struct sfe_connection_sync sis;
- uint64_t now_jiffies;
+ u64 now_jiffies;
sfe_sync_rule_callback_t sync_rule_callback;
rcu_read_lock();
@@ -1186,7 +1187,7 @@
__be16 src_port;
__be16 dest_port;
struct sfe_ipv4_connection_match *cm;
- uint8_t ttl;
+ u8 ttl;
struct net_device *xmit_dev;
/*
@@ -1317,7 +1318,7 @@
* Do we have to perform translations of the source address/port?
*/
if (unlikely(cm->flags & SFE_IPV4_CONNECTION_MATCH_FLAG_XLATE_SRC)) {
- uint16_t udp_csum;
+ u16 udp_csum;
iph->saddr = cm->xlate_src_ip;
udph->source = cm->xlate_src_port;
@@ -1328,7 +1329,7 @@
*/
udp_csum = udph->check;
if (likely(udp_csum)) {
- uint32_t sum;
+ u32 sum;
if (unlikely(skb->ip_summed == CHECKSUM_PARTIAL)) {
sum = udp_csum + cm->xlate_src_partial_csum_adjustment;
@@ -1337,7 +1338,7 @@
}
sum = (sum & 0xffff) + (sum >> 16);
- udph->check = (uint16_t)sum;
+ udph->check = (u16)sum;
}
}
@@ -1345,7 +1346,7 @@
* Do we have to perform translations of the destination address/port?
*/
if (unlikely(cm->flags & SFE_IPV4_CONNECTION_MATCH_FLAG_XLATE_DEST)) {
- uint16_t udp_csum;
+ u16 udp_csum;
iph->daddr = cm->xlate_dest_ip;
udph->dest = cm->xlate_dest_port;
@@ -1356,7 +1357,7 @@
*/
udp_csum = udph->check;
if (likely(udp_csum)) {
- uint32_t sum;
+ u32 sum;
if (unlikely(skb->ip_summed == CHECKSUM_PARTIAL)) {
sum = udp_csum + cm->xlate_dest_partial_csum_adjustment;
@@ -1365,7 +1366,7 @@
}
sum = (sum & 0xffff) + (sum >> 16);
- udph->check = (uint16_t)sum;
+ udph->check = (u16)sum;
}
}
@@ -1461,16 +1462,14 @@
* sfe_ipv4_process_tcp_option_sack()
* Parse TCP SACK option and update ack according
*/
-static bool sfe_ipv4_process_tcp_option_sack(const struct sfe_ipv4_tcp_hdr *th, const uint32_t data_offs,
- uint32_t *ack) __attribute__((always_inline));
-static bool sfe_ipv4_process_tcp_option_sack(const struct sfe_ipv4_tcp_hdr *th, const uint32_t data_offs,
- uint32_t *ack)
+static bool sfe_ipv4_process_tcp_option_sack(const struct sfe_ipv4_tcp_hdr *th, const u32 data_offs,
+ u32 *ack)
{
- uint32_t length = sizeof(struct sfe_ipv4_tcp_hdr);
- uint8_t *ptr = (uint8_t *)th + length;
+ u32 length = sizeof(struct sfe_ipv4_tcp_hdr);
+ u8 *ptr = (u8 *)th + length;
/*
- * If option is TIMESTAMP discard it.
+ * Ignore processing if TCP packet has only TIMESTAMP option.
*/
if (likely(data_offs == length + TCPOLEN_TIMESTAMP + 1 + 1)
&& likely(ptr[0] == TCPOPT_NOP)
@@ -1484,10 +1483,10 @@
* TCP options. Parse SACK option.
*/
while (length < data_offs) {
- uint8_t size;
- uint8_t kind;
+ u8 size;
+ u8 kind;
- ptr = (uint8_t *)th + length;
+ ptr = (u8 *)th + length;
kind = *ptr;
/*
@@ -1500,8 +1499,8 @@
}
if (kind == TCPOPT_SACK) {
- uint32_t sack = 0;
- uint8_t re = 1 + 1;
+ u32 sack = 0;
+ u8 re = 1 + 1;
size = *(ptr + 1);
if ((size < (1 + 1 + TCPOLEN_SACK_PERBLOCK))
@@ -1512,8 +1511,8 @@
re += 4;
while (re < size) {
- uint32_t sack_re;
- uint8_t *sptr = ptr + re;
+ u32 sack_re;
+ u8 *sptr = ptr + re;
sack_re = (sptr[0] << 24) | (sptr[1] << 16) | (sptr[2] << 8) | sptr[3];
if (sack_re > sack) {
sack = sack_re;
@@ -1553,8 +1552,8 @@
__be16 dest_port;
struct sfe_ipv4_connection_match *cm;
struct sfe_ipv4_connection_match *counter_cm;
- uint8_t ttl;
- uint32_t flags;
+ u8 ttl;
+ u32 flags;
struct net_device *xmit_dev;
/*
@@ -1702,20 +1701,20 @@
* Are we doing sequence number checking?
*/
if (likely(!(cm->flags & SFE_IPV4_CONNECTION_MATCH_FLAG_NO_SEQ_CHECK))) {
- uint32_t seq;
- uint32_t ack;
- uint32_t sack;
- uint32_t data_offs;
- uint32_t end;
- uint32_t left_edge;
- uint32_t scaled_win;
- uint32_t max_end;
+ u32 seq;
+ u32 ack;
+ u32 sack;
+ u32 data_offs;
+ u32 end;
+ u32 left_edge;
+ u32 scaled_win;
+ u32 max_end;
/*
* Is our sequence fully past the right hand edge of the window?
*/
seq = ntohl(tcph->seq);
- if (unlikely((int32_t)(seq - (cm->protocol_state.tcp.max_end + 1)) > 0)) {
+ if (unlikely((s32)(seq - (cm->protocol_state.tcp.max_end + 1)) > 0)) {
struct sfe_ipv4_connection *c = cm->connection;
sfe_ipv4_remove_sfe_ipv4_connection(si, c);
si->exception_events[SFE_IPV4_EXCEPTION_EVENT_TCP_SEQ_EXCEEDS_RIGHT_EDGE]++;
@@ -1783,7 +1782,7 @@
/*
* Is our sequence fully before the left hand edge of the window?
*/
- if (unlikely((int32_t)(end - (cm->protocol_state.tcp.end
+ if (unlikely((s32)(end - (cm->protocol_state.tcp.end
- counter_cm->protocol_state.tcp.max_win - 1)) < 0)) {
struct sfe_ipv4_connection *c = cm->connection;
sfe_ipv4_remove_sfe_ipv4_connection(si, c);
@@ -1800,7 +1799,7 @@
/*
* Are we acking data that is to the right of what has been sent?
*/
- if (unlikely((int32_t)(sack - (counter_cm->protocol_state.tcp.end + 1)) > 0)) {
+ if (unlikely((s32)(sack - (counter_cm->protocol_state.tcp.end + 1)) > 0)) {
struct sfe_ipv4_connection *c = cm->connection;
sfe_ipv4_remove_sfe_ipv4_connection(si, c);
si->exception_events[SFE_IPV4_EXCEPTION_EVENT_TCP_ACK_EXCEEDS_RIGHT_EDGE]++;
@@ -1820,7 +1819,7 @@
- cm->protocol_state.tcp.max_win
- SFE_IPV4_TCP_MAX_ACK_WINDOW
- 1;
- if (unlikely((int32_t)(sack - left_edge) < 0)) {
+ if (unlikely((s32)(sack - left_edge) < 0)) {
struct sfe_ipv4_connection *c = cm->connection;
sfe_ipv4_remove_sfe_ipv4_connection(si, c);
si->exception_events[SFE_IPV4_EXCEPTION_EVENT_TCP_ACK_BEFORE_LEFT_EDGE]++;
@@ -1845,12 +1844,12 @@
/*
* If our sequence and/or ack numbers have advanced then record the new state.
*/
- if (likely((int32_t)(end - cm->protocol_state.tcp.end) >= 0)) {
+ if (likely((s32)(end - cm->protocol_state.tcp.end) >= 0)) {
cm->protocol_state.tcp.end = end;
}
max_end = sack + scaled_win;
- if (likely((int32_t)(max_end - counter_cm->protocol_state.tcp.max_end) >= 0)) {
+ if (likely((s32)(max_end - counter_cm->protocol_state.tcp.max_end) >= 0)) {
counter_cm->protocol_state.tcp.max_end = max_end;
}
}
@@ -1875,8 +1874,8 @@
* Do we have to perform translations of the source address/port?
*/
if (unlikely(cm->flags & SFE_IPV4_CONNECTION_MATCH_FLAG_XLATE_SRC)) {
- uint16_t tcp_csum;
- uint32_t sum;
+ u16 tcp_csum;
+ u32 sum;
iph->saddr = cm->xlate_src_ip;
tcph->source = cm->xlate_src_port;
@@ -1893,15 +1892,15 @@
}
sum = (sum & 0xffff) + (sum >> 16);
- tcph->check = (uint16_t)sum;
+ tcph->check = (u16)sum;
}
/*
* Do we have to perform translations of the destination address/port?
*/
if (unlikely(cm->flags & SFE_IPV4_CONNECTION_MATCH_FLAG_XLATE_DEST)) {
- uint16_t tcp_csum;
- uint32_t sum;
+ u16 tcp_csum;
+ u32 sum;
iph->daddr = cm->xlate_dest_ip;
tcph->dest = cm->xlate_dest_port;
@@ -1918,7 +1917,7 @@
}
sum = (sum & 0xffff) + (sum >> 16);
- tcph->check = (uint16_t)sum;
+ tcph->check = (u16)sum;
}
/*
@@ -2026,7 +2025,7 @@
struct sfe_ipv4_ip_hdr *icmp_iph;
unsigned int icmp_ihl_words;
unsigned int icmp_ihl;
- uint32_t *icmp_trans_h;
+ u32 *icmp_trans_h;
struct sfe_ipv4_udp_hdr *icmp_udph;
struct sfe_ipv4_tcp_hdr *icmp_tcph;
__be32 src_ip;
@@ -2035,10 +2034,10 @@
__be16 dest_port;
struct sfe_ipv4_connection_match *cm;
struct sfe_ipv4_connection *c;
- uint32_t pull_len = sizeof(struct icmphdr) + ihl;
+ u32 pull_len = sizeof(struct icmphdr) + ihl;
/*
- * Is our packet too short to contain a valid UDP header?
+ * Is our packet too short to contain a valid ICMP header?
*/
len -= ihl;
if (!pskb_may_pull(skb, pull_len)) {
@@ -2112,7 +2111,7 @@
}
len -= icmp_ihl;
- icmp_trans_h = ((uint32_t *)icmp_iph) + icmp_ihl_words;
+ icmp_trans_h = ((u32 *)icmp_iph) + icmp_ihl_words;
/*
* Handle the embedded transport layer header.
@@ -2222,7 +2221,7 @@
bool flush_on_find;
bool ip_options;
struct sfe_ipv4_ip_hdr *iph;
- uint32_t protocol;
+ u32 protocol;
/*
* Check that we have space for an IP header here.
@@ -2358,10 +2357,10 @@
if (orig_tcp->max_win < sic->src_td_max_window) {
orig_tcp->max_win = sic->src_td_max_window;
}
- if ((int32_t)(orig_tcp->end - sic->src_td_end) < 0) {
+ if ((s32)(orig_tcp->end - sic->src_td_end) < 0) {
orig_tcp->end = sic->src_td_end;
}
- if ((int32_t)(orig_tcp->max_end - sic->src_td_max_end) < 0) {
+ if ((s32)(orig_tcp->max_end - sic->src_td_max_end) < 0) {
orig_tcp->max_end = sic->src_td_max_end;
}
@@ -2369,10 +2368,10 @@
if (repl_tcp->max_win < sic->dest_td_max_window) {
repl_tcp->max_win = sic->dest_td_max_window;
}
- if ((int32_t)(repl_tcp->end - sic->dest_td_end) < 0) {
+ if ((s32)(repl_tcp->end - sic->dest_td_end) < 0) {
repl_tcp->end = sic->dest_td_end;
}
- if ((int32_t)(repl_tcp->max_end - sic->dest_td_max_end) < 0) {
+ if ((s32)(repl_tcp->max_end - sic->dest_td_max_end) < 0) {
repl_tcp->max_end = sic->dest_td_max_end;
}
@@ -2811,7 +2810,7 @@
static void sfe_ipv4_periodic_sync(unsigned long arg)
{
struct sfe_ipv4 *si = (struct sfe_ipv4 *)arg;
- uint64_t now_jiffies;
+ u64 now_jiffies;
int quota;
sfe_sync_rule_callback_t sync_rule_callback;
@@ -2967,17 +2966,17 @@
__be32 src_ip_xlate;
__be16 src_port;
__be16 src_port_xlate;
- uint64_t src_rx_packets;
- uint64_t src_rx_bytes;
+ u64 src_rx_packets;
+ u64 src_rx_bytes;
struct net_device *dest_dev;
__be32 dest_ip;
__be32 dest_ip_xlate;
__be16 dest_port;
__be16 dest_port_xlate;
- uint64_t dest_rx_packets;
- uint64_t dest_rx_bytes;
- uint64_t last_sync_jiffies;
- uint32_t mark, src_priority, dest_priority, src_dscp, dest_dscp;
+ u64 dest_rx_packets;
+ u64 dest_rx_bytes;
+ u64 last_sync_jiffies;
+ u32 mark, src_priority, dest_priority, src_dscp, dest_dscp;
#ifdef CONFIG_NF_FLOW_COOKIE
int src_flow_cookie, dst_flow_cookie;
#endif
@@ -3126,7 +3125,7 @@
static bool sfe_ipv4_debug_dev_read_exceptions_exception(struct sfe_ipv4 *si, char *buffer, char *msg, size_t *length,
int *total_read, struct sfe_ipv4_debug_xml_write_state *ws)
{
- uint64_t ct;
+ u64 ct;
spin_lock_bh(&si->lock);
ct = si->exception_events64[ws->iter_exception];
@@ -3186,15 +3185,15 @@
{
int bytes_read;
unsigned int num_connections;
- uint64_t packets_forwarded;
- uint64_t packets_not_forwarded;
- uint64_t connection_create_requests;
- uint64_t connection_create_collisions;
- uint64_t connection_destroy_requests;
- uint64_t connection_destroy_misses;
- uint64_t connection_flushes;
- uint64_t connection_match_hash_hits;
- uint64_t connection_match_hash_reorders;
+ u64 packets_forwarded;
+ u64 packets_not_forwarded;
+ u64 connection_create_requests;
+ u64 connection_create_collisions;
+ u64 connection_destroy_requests;
+ u64 connection_destroy_misses;
+ u64 connection_flushes;
+ u64 connection_match_hash_hits;
+ u64 connection_match_hash_reorders;
spin_lock_bh(&si->lock);
sfe_ipv4_update_summary_stats(si);
@@ -3264,7 +3263,7 @@
* Array of write functions that write various XML elements that correspond to
* our XML output state machine.
*/
-sfe_ipv4_debug_xml_write_method_t sfe_ipv4_debug_xml_write_methods[SFE_IPV4_DEBUG_XML_STATE_DONE] = {
+static sfe_ipv4_debug_xml_write_method_t sfe_ipv4_debug_xml_write_methods[SFE_IPV4_DEBUG_XML_STATE_DONE] = {
sfe_ipv4_debug_dev_read_start,
sfe_ipv4_debug_dev_read_connections_start,
sfe_ipv4_debug_dev_read_connections_connection,
@@ -3553,7 +3552,6 @@
EXPORT_SYMBOL(sfe_unregister_flow_cookie_cb);
#endif
-MODULE_AUTHOR("Qualcomm Atheros Inc.");
MODULE_DESCRIPTION("Shortcut Forwarding Engine - IPv4 edition");
MODULE_LICENSE("Dual BSD/GPL");
diff --git a/shortcut-fe/sfe_ipv6.c b/shortcut-fe/sfe_ipv6.c
index c07250b..191945e 100644
--- a/shortcut-fe/sfe_ipv6.c
+++ b/shortcut-fe/sfe_ipv6.c
@@ -177,10 +177,10 @@
* IPv6 TCP connection match additional data.
*/
struct sfe_ipv6_tcp_connection_match {
- uint8_t win_scale; /* Window scale */
- uint32_t max_win; /* Maximum window size seen */
- uint32_t end; /* Sequence number of the next byte to send (seq + segment length) */
- uint32_t max_end; /* Sequence number of the last byte to ack */
+ u8 win_scale; /* Window scale */
+ u32 max_win; /* Maximum window size seen */
+ u32 end; /* Sequence number of the next byte to send (seq + segment length) */
+ u32 max_end; /* Sequence number of the last byte to ack */
};
/*
@@ -209,24 +209,19 @@
* References to other objects.
*/
struct sfe_ipv6_connection_match *next;
- /* Next connection match entry in a list */
struct sfe_ipv6_connection_match *prev;
- /* Previous connection match entry in a list */
struct sfe_ipv6_connection *connection;
- /* Pointer to our connection */
struct sfe_ipv6_connection_match *counter_match;
- /* Pointer to the connection match in the "counter" direction to this one */
+ /* Matches the flow in the opposite direction as the one in connection */
struct sfe_ipv6_connection_match *active_next;
- /* Pointer to the next connection in the active list */
struct sfe_ipv6_connection_match *active_prev;
- /* Pointer to the previous connection in the active list */
bool active; /* Flag to indicate if we're on the active list */
/*
* Characteristics that identify flows that match this rule.
*/
struct net_device *match_dev; /* Network device */
- uint8_t match_protocol; /* Protocol */
+ u8 match_protocol; /* Protocol */
struct sfe_ipv6_addr match_src_ip[1]; /* Source IP address */
struct sfe_ipv6_addr match_dest_ip[1]; /* Destination IP address */
__be16 match_src_port; /* Source port/connection ident */
@@ -235,12 +230,12 @@
/*
* Control the operations of the match.
*/
- uint32_t flags; /* Bit flags */
+ u32 flags; /* Bit flags */
#ifdef CONFIG_NF_FLOW_COOKIE
- uint32_t flow_cookie; /* used flow cookie, for debug */
+ u32 flow_cookie; /* used flow cookie, for debug */
#endif
#ifdef CONFIG_XFRM
- uint32_t flow_accel; /* The flow accelerated or not */
+ u32 flow_accel; /* The flow accelerated or not */
#endif
/*
@@ -249,26 +244,30 @@
union { /* Protocol-specific state */
struct sfe_ipv6_tcp_connection_match tcp;
} protocol_state;
- uint32_t rx_packet_count; /* Number of packets RX'd */
- uint32_t rx_byte_count; /* Number of bytes RX'd */
+ /*
+ * Stats recorded in a sync period. These stats will be added to
+ * rx_packet_count64/rx_byte_count64 after a sync period.
+ */
+ u32 rx_packet_count;
+ u32 rx_byte_count;
/*
* Packet translation information.
*/
struct sfe_ipv6_addr xlate_src_ip[1]; /* Address after source translation */
__be16 xlate_src_port; /* Port/connection ident after source translation */
- uint16_t xlate_src_csum_adjustment;
+ u16 xlate_src_csum_adjustment;
/* Transport layer checksum adjustment after source translation */
struct sfe_ipv6_addr xlate_dest_ip[1]; /* Address after destination translation */
__be16 xlate_dest_port; /* Port/connection ident after destination translation */
- uint16_t xlate_dest_csum_adjustment;
+ u16 xlate_dest_csum_adjustment;
/* Transport layer checksum adjustment after destination translation */
/*
* QoS information
*/
- uint32_t priority;
- uint32_t dscp;
+ u32 priority;
+ u32 dscp;
/*
* Packet transmit information.
@@ -276,16 +275,16 @@
struct net_device *xmit_dev; /* Network device on which to transmit */
unsigned short int xmit_dev_mtu;
/* Interface MTU */
- uint16_t xmit_dest_mac[ETH_ALEN / 2];
+ u16 xmit_dest_mac[ETH_ALEN / 2];
/* Destination MAC address to use when forwarding */
- uint16_t xmit_src_mac[ETH_ALEN / 2];
+ u16 xmit_src_mac[ETH_ALEN / 2];
/* Source MAC address to use when forwarding */
/*
* Summary stats.
*/
- uint64_t rx_packet_count64; /* Number of packets RX'd */
- uint64_t rx_byte_count64; /* Number of bytes RX'd */
+ u64 rx_packet_count64;
+ u64 rx_byte_count64;
};
/*
@@ -297,14 +296,14 @@
struct sfe_ipv6_connection *prev;
/* Pointer to the previous entry in a hash chain */
int protocol; /* IP protocol number */
- struct sfe_ipv6_addr src_ip[1]; /* Source IP address */
- struct sfe_ipv6_addr src_ip_xlate[1]; /* NAT-translated source IP address */
- struct sfe_ipv6_addr dest_ip[1]; /* Destination IP address */
- struct sfe_ipv6_addr dest_ip_xlate[1]; /* NAT-translated destination IP address */
- __be16 src_port; /* Source port */
- __be16 src_port_xlate; /* NAT-translated source port */
- __be16 dest_port; /* Destination port */
- __be16 dest_port_xlate; /* NAT-translated destination port */
+ struct sfe_ipv6_addr src_ip[1]; /* Src IP addr pre-translation */
+ struct sfe_ipv6_addr src_ip_xlate[1]; /* Src IP addr post-translation */
+ struct sfe_ipv6_addr dest_ip[1]; /* Dest IP addr pre-translation */
+ struct sfe_ipv6_addr dest_ip_xlate[1]; /* Dest IP addr post-translation */
+ __be16 src_port; /* Src port pre-translation */
+ __be16 src_port_xlate; /* Src port post-translation */
+ __be16 dest_port; /* Dest port pre-translation */
+ __be16 dest_port_xlate; /* Dest port post-translation */
struct sfe_ipv6_connection_match *original_match;
/* Original direction matching structure */
struct net_device *original_dev;
@@ -312,13 +311,13 @@
struct sfe_ipv6_connection_match *reply_match;
/* Reply direction matching structure */
struct net_device *reply_dev; /* Reply direction source device */
- uint64_t last_sync_jiffies; /* Jiffies count for the last sync */
+ u64 last_sync_jiffies; /* Jiffies count for the last sync */
struct sfe_ipv6_connection *all_connections_next;
/* Pointer to the next entry in the list of all connections */
struct sfe_ipv6_connection *all_connections_prev;
/* Pointer to the previous entry in the list of all connections */
- uint32_t mark; /* mark for outgoing packet */
- uint32_t debug_read_seq; /* sequence number for debug dump */
+ u32 mark; /* mark for outgoing packet */
+ u32 debug_read_seq; /* sequence number for debug dump */
};
/*
@@ -450,52 +449,53 @@
#endif
/*
- * Statistics.
+ * Stats recorded in a sync period. These stats will be added to
+ * connection_xxx64 after a sync period.
*/
- uint32_t connection_create_requests;
+ u32 connection_create_requests;
/* Number of IPv6 connection create requests */
- uint32_t connection_create_collisions;
+ u32 connection_create_collisions;
/* Number of IPv6 connection create requests that collided with existing hash table entries */
- uint32_t connection_destroy_requests;
+ u32 connection_destroy_requests;
/* Number of IPv6 connection destroy requests */
- uint32_t connection_destroy_misses;
+ u32 connection_destroy_misses;
/* Number of IPv6 connection destroy requests that missed our hash table */
- uint32_t connection_match_hash_hits;
+ u32 connection_match_hash_hits;
/* Number of IPv6 connection match hash hits */
- uint32_t connection_match_hash_reorders;
+ u32 connection_match_hash_reorders;
/* Number of IPv6 connection match hash reorders */
- uint32_t connection_flushes; /* Number of IPv6 connection flushes */
- uint32_t packets_forwarded; /* Number of IPv6 packets forwarded */
- uint32_t packets_not_forwarded; /* Number of IPv6 packets not forwarded */
- uint32_t exception_events[SFE_IPV6_EXCEPTION_EVENT_LAST];
+ u32 connection_flushes; /* Number of IPv6 connection flushes */
+ u32 packets_forwarded; /* Number of IPv6 packets forwarded */
+ u32 packets_not_forwarded; /* Number of IPv6 packets not forwarded */
+ u32 exception_events[SFE_IPV6_EXCEPTION_EVENT_LAST];
/*
- * Summary tatistics.
+ * Summary statistics.
*/
- uint64_t connection_create_requests64;
+ u64 connection_create_requests64;
/* Number of IPv6 connection create requests */
- uint64_t connection_create_collisions64;
+ u64 connection_create_collisions64;
/* Number of IPv6 connection create requests that collided with existing hash table entries */
- uint64_t connection_destroy_requests64;
+ u64 connection_destroy_requests64;
/* Number of IPv6 connection destroy requests */
- uint64_t connection_destroy_misses64;
+ u64 connection_destroy_misses64;
/* Number of IPv6 connection destroy requests that missed our hash table */
- uint64_t connection_match_hash_hits64;
+ u64 connection_match_hash_hits64;
/* Number of IPv6 connection match hash hits */
- uint64_t connection_match_hash_reorders64;
+ u64 connection_match_hash_reorders64;
/* Number of IPv6 connection match hash reorders */
- uint64_t connection_flushes64; /* Number of IPv6 connection flushes */
- uint64_t packets_forwarded64; /* Number of IPv6 packets forwarded */
- uint64_t packets_not_forwarded64;
+ u64 connection_flushes64; /* Number of IPv6 connection flushes */
+ u64 packets_forwarded64; /* Number of IPv6 packets forwarded */
+ u64 packets_not_forwarded64;
/* Number of IPv6 packets not forwarded */
- uint64_t exception_events64[SFE_IPV6_EXCEPTION_EVENT_LAST];
+ u64 exception_events64[SFE_IPV6_EXCEPTION_EVENT_LAST];
/*
* Control state.
*/
struct kobject *sys_sfe_ipv6; /* sysfs linkage */
int debug_dev; /* Major number of the debug char device */
- uint32_t debug_read_seq; /* sequence number for debug dump */
+ u32 debug_read_seq; /* sequence number for debug dump */
};
/*
@@ -526,7 +526,7 @@
typedef bool (*sfe_ipv6_debug_xml_write_method_t)(struct sfe_ipv6 *si, char *buffer, char *msg, size_t *length,
int *total_read, struct sfe_ipv6_debug_xml_write_state *ws);
-struct sfe_ipv6 __si6;
+static struct sfe_ipv6 __si6;
/*
* sfe_ipv6_get_debug_dev()
@@ -543,7 +543,7 @@
* sfe_ipv6_is_ext_hdr()
* check if we recognize ipv6 extension header
*/
-static inline bool sfe_ipv6_is_ext_hdr(uint8_t hdr)
+static inline bool sfe_ipv6_is_ext_hdr(u8 hdr)
{
return (hdr == SFE_IPV6_EXT_HDR_HOP) ||
(hdr == SFE_IPV6_EXT_HDR_ROUTING) ||
@@ -557,7 +557,7 @@
* sfe_ipv6_change_dsfield()
* change dscp field in IPv6 packet
*/
-static inline void sfe_ipv6_change_dsfield(struct sfe_ipv6_ip_hdr *iph, uint8_t dscp)
+static inline void sfe_ipv6_change_dsfield(struct sfe_ipv6_ip_hdr *iph, u8 dscp)
{
__be16 *p = (__be16 *)iph;
@@ -568,17 +568,17 @@
* sfe_ipv6_get_connection_match_hash()
* Generate the hash used in connection match lookups.
*/
-static inline unsigned int sfe_ipv6_get_connection_match_hash(struct net_device *dev, uint8_t protocol,
+static inline unsigned int sfe_ipv6_get_connection_match_hash(struct net_device *dev, u8 protocol,
struct sfe_ipv6_addr *src_ip, __be16 src_port,
struct sfe_ipv6_addr *dest_ip, __be16 dest_port)
{
- uint32_t idx, hash = 0;
+ u32 idx, hash = 0;
size_t dev_addr = (size_t)dev;
for (idx = 0; idx < 4; idx++) {
hash ^= src_ip->addr[idx] ^ dest_ip->addr[idx];
}
- hash = ((uint32_t)dev_addr) ^ hash ^ protocol ^ ntohs(src_port ^ dest_port);
+ hash = ((u32)dev_addr) ^ hash ^ protocol ^ ntohs(src_port ^ dest_port);
return ((hash >> SFE_IPV6_CONNECTION_HASH_SHIFT) ^ hash) & SFE_IPV6_CONNECTION_HASH_MASK;
}
@@ -589,11 +589,7 @@
* On entry we must be holding the lock that protects the hash table.
*/
static struct sfe_ipv6_connection_match *
-sfe_ipv6_find_connection_match(struct sfe_ipv6 *si, struct net_device *dev, uint8_t protocol,
- struct sfe_ipv6_addr *src_ip, __be16 src_port,
- struct sfe_ipv6_addr *dest_ip, __be16 dest_port) __attribute__((always_inline));
-static struct sfe_ipv6_connection_match *
-sfe_ipv6_find_connection_match(struct sfe_ipv6 *si, struct net_device *dev, uint8_t protocol,
+sfe_ipv6_find_connection_match(struct sfe_ipv6 *si, struct net_device *dev, u8 protocol,
struct sfe_ipv6_addr *src_ip, __be16 src_port,
struct sfe_ipv6_addr *dest_ip, __be16 dest_port)
{
@@ -605,29 +601,29 @@
cm = si->conn_match_hash[conn_match_idx];
/*
- * If we don't have anything in this chain then bale.
+ * If we don't have anything in this chain then bail.
*/
if (unlikely(!cm)) {
- return cm;
+ return NULL;
}
/*
* Hopefully the first entry is the one we want.
*/
- if (likely(cm->match_src_port == src_port)
- && likely(cm->match_dest_port == dest_port)
- && likely(sfe_ipv6_addr_equal(cm->match_src_ip, src_ip))
- && likely(sfe_ipv6_addr_equal(cm->match_dest_ip, dest_ip))
- && likely(cm->match_protocol == protocol)
- && likely(cm->match_dev == dev)) {
+ if ((cm->match_src_port == src_port)
+ && (cm->match_dest_port == dest_port)
+ && (sfe_ipv6_addr_equal(cm->match_src_ip, src_ip))
+ && (sfe_ipv6_addr_equal(cm->match_dest_ip, dest_ip))
+ && (cm->match_protocol == protocol)
+ && (cm->match_dev == dev)) {
si->connection_match_hash_hits++;
return cm;
}
/*
- * We may or may not have a matching entry but if we do then we want to
- * move that entry to the top of the hash chain when we get to it. We
- * presume that this will be reused again very quickly.
+ * Unfortunately we didn't find it at head, so we search it in chain and
+ * move matching entry to the top of the hash chain. We presume that this
+ * will be reused again very quickly.
*/
head = cm;
do {
@@ -643,7 +639,7 @@
* Not found then we're done.
*/
if (unlikely(!cm)) {
- return cm;
+ return NULL;
}
/*
@@ -680,9 +676,9 @@
*/
static void sfe_ipv6_connection_match_compute_translations(struct sfe_ipv6_connection_match *cm)
{
- uint32_t diff[9];
- uint32_t *idx_32;
- uint16_t *idx_16;
+ u32 diff[9];
+ u32 *idx_32;
+ u16 *idx_16;
/*
* Before we insert the entry look to see if this is tagged as doing address
@@ -690,8 +686,8 @@
* to the transport checksum.
*/
if (cm->flags & SFE_IPV6_CONNECTION_MATCH_FLAG_XLATE_SRC) {
- uint32_t adj = 0;
- uint32_t carry = 0;
+ u32 adj = 0;
+ u32 carry = 0;
/*
* Precompute an incremental checksum adjustment so we can
@@ -703,10 +699,10 @@
*(idx_32++) = cm->match_src_ip->addr[2];
*(idx_32++) = cm->match_src_ip->addr[3];
- idx_16 = (uint16_t *)idx_32;
+ idx_16 = (u16 *)idx_32;
*(idx_16++) = cm->match_src_port;
*(idx_16++) = ~cm->xlate_src_port;
- idx_32 = (uint32_t *)idx_16;
+ idx_32 = (u32 *)idx_16;
*(idx_32++) = ~cm->xlate_src_ip->addr[0];
*(idx_32++) = ~cm->xlate_src_ip->addr[1];
@@ -721,7 +717,7 @@
* wrap-around!
*/
for (idx_32 = diff; idx_32 < diff + 9; idx_32++) {
- uint32_t w = *idx_32;
+ u32 w = *idx_32;
adj += carry;
adj += w;
carry = (w > adj);
@@ -729,12 +725,12 @@
adj += carry;
adj = (adj & 0xffff) + (adj >> 16);
adj = (adj & 0xffff) + (adj >> 16);
- cm->xlate_src_csum_adjustment = (uint16_t)adj;
+ cm->xlate_src_csum_adjustment = (u16)adj;
}
if (cm->flags & SFE_IPV6_CONNECTION_MATCH_FLAG_XLATE_DEST) {
- uint32_t adj = 0;
- uint32_t carry = 0;
+ u32 adj = 0;
+ u32 carry = 0;
/*
* Precompute an incremental checksum adjustment so we can
@@ -746,10 +742,10 @@
*(idx_32++) = cm->match_dest_ip->addr[2];
*(idx_32++) = cm->match_dest_ip->addr[3];
- idx_16 = (uint16_t *)idx_32;
+ idx_16 = (u16 *)idx_32;
*(idx_16++) = cm->match_dest_port;
*(idx_16++) = ~cm->xlate_dest_port;
- idx_32 = (uint32_t *)idx_16;
+ idx_32 = (u32 *)idx_16;
*(idx_32++) = ~cm->xlate_dest_ip->addr[0];
*(idx_32++) = ~cm->xlate_dest_ip->addr[1];
@@ -764,7 +760,7 @@
* wrap-around!
*/
for (idx_32 = diff; idx_32 < diff + 9; idx_32++) {
- uint32_t w = *idx_32;
+ u32 w = *idx_32;
adj += carry;
adj += w;
carry = (w > adj);
@@ -772,7 +768,7 @@
adj += carry;
adj = (adj & 0xffff) + (adj >> 16);
adj = (adj & 0xffff) + (adj >> 16);
- cm->xlate_dest_csum_adjustment = (uint16_t)adj;
+ cm->xlate_dest_csum_adjustment = (u16)adj;
}
}
@@ -815,7 +811,8 @@
*
* On entry we must be holding the lock that protects the hash table.
*/
-static inline void sfe_ipv6_insert_connection_match(struct sfe_ipv6 *si, struct sfe_ipv6_connection_match *cm)
+static inline void sfe_ipv6_insert_connection_match(struct sfe_ipv6 *si,
+ struct sfe_ipv6_connection_match *cm)
{
struct sfe_ipv6_connection_match **hash_head;
struct sfe_ipv6_connection_match *prev_head;
@@ -823,6 +820,7 @@
= sfe_ipv6_get_connection_match_hash(cm->match_dev, cm->match_protocol,
cm->match_src_ip, cm->match_src_port,
cm->match_dest_ip, cm->match_dest_port);
+
hash_head = &si->conn_match_hash[conn_match_idx];
prev_head = *hash_head;
cm->prev = NULL;
@@ -943,10 +941,10 @@
* sfe_ipv6_get_connection_hash()
* Generate the hash used in connection lookups.
*/
-static inline unsigned int sfe_ipv6_get_connection_hash(uint8_t protocol, struct sfe_ipv6_addr *src_ip, __be16 src_port,
+static inline unsigned int sfe_ipv6_get_connection_hash(u8 protocol, struct sfe_ipv6_addr *src_ip, __be16 src_port,
struct sfe_ipv6_addr *dest_ip, __be16 dest_port)
{
- uint32_t idx, hash = 0;
+ u32 idx, hash = 0;
for (idx = 0; idx < 4; idx++) {
hash ^= src_ip->addr[idx] ^ dest_ip->addr[idx];
@@ -961,7 +959,7 @@
*
* On entry we must be holding the lock that protects the hash table.
*/
-static inline struct sfe_ipv6_connection *sfe_ipv6_find_connection(struct sfe_ipv6 *si, uint32_t protocol,
+static inline struct sfe_ipv6_connection *sfe_ipv6_find_connection(struct sfe_ipv6 *si, u32 protocol,
struct sfe_ipv6_addr *src_ip, __be16 src_port,
struct sfe_ipv6_addr *dest_ip, __be16 dest_port)
{
@@ -973,24 +971,22 @@
* If we don't have anything in this chain then bale.
*/
if (unlikely(!c)) {
- return c;
+ return NULL;
}
/*
* Hopefully the first entry is the one we want.
*/
- if (likely(c->src_port == src_port)
- && likely(c->dest_port == dest_port)
- && likely(sfe_ipv6_addr_equal(c->src_ip, src_ip))
- && likely(sfe_ipv6_addr_equal(c->dest_ip, dest_ip))
- && likely(c->protocol == protocol)) {
+ if ((c->src_port == src_port)
+ && (c->dest_port == dest_port)
+ && (sfe_ipv6_addr_equal(c->src_ip, src_ip))
+ && (sfe_ipv6_addr_equal(c->dest_ip, dest_ip))
+ && (c->protocol == protocol)) {
return c;
}
/*
- * We may or may not have a matching entry but if we do then we want to
- * move that entry to the top of the hash chain when we get to it. We
- * presume that this will be reused again very quickly.
+ * Unfortunately we didn't find it at head, so we search it in chain.
*/
do {
c = c->next;
@@ -1023,13 +1019,16 @@
mark->src_ip.ip6, mark->src_port,
mark->dest_ip.ip6, mark->dest_port);
if (c) {
- DEBUG_TRACE("Matching connection found for mark, "
- "setting from %08x to %08x\n",
- c->mark, mark->mark);
WARN_ON((0 != c->mark) && (0 == mark->mark));
c->mark = mark->mark;
}
spin_unlock_bh(&si->lock);
+
+ if (c) {
+ DEBUG_TRACE("Matching connection found for mark, "
+ "setting from %08x to %08x\n",
+ c->mark, mark->mark);
+ }
}
/*
@@ -1137,7 +1136,7 @@
*/
static void sfe_ipv6_gen_sync_connection(struct sfe_ipv6 *si, struct sfe_ipv6_connection *c,
struct sfe_connection_sync *sis, sfe_sync_reason_t reason,
- uint64_t now_jiffies)
+ u64 now_jiffies)
{
struct sfe_ipv6_connection_match *original_cm;
struct sfe_ipv6_connection_match *reply_cm;
@@ -1198,10 +1197,12 @@
* from within a BH and so we're fine, but we're also called when connections are
* torn down.
*/
-static void sfe_ipv6_flush_connection(struct sfe_ipv6 *si, struct sfe_ipv6_connection *c, sfe_sync_reason_t reason)
+static void sfe_ipv6_flush_connection(struct sfe_ipv6 *si,
+ struct sfe_ipv6_connection *c,
+ sfe_sync_reason_t reason)
{
struct sfe_connection_sync sis;
- uint64_t now_jiffies;
+ u64 now_jiffies;
sfe_sync_rule_callback_t sync_rule_callback;
rcu_read_lock();
@@ -1374,7 +1375,7 @@
* Do we have to perform translations of the source address/port?
*/
if (unlikely(cm->flags & SFE_IPV6_CONNECTION_MATCH_FLAG_XLATE_SRC)) {
- uint16_t udp_csum;
+ u16 udp_csum;
iph->saddr = cm->xlate_src_ip[0];
udph->source = cm->xlate_src_port;
@@ -1385,9 +1386,9 @@
*/
udp_csum = udph->check;
if (likely(udp_csum)) {
- uint32_t sum = udp_csum + cm->xlate_src_csum_adjustment;
+ u32 sum = udp_csum + cm->xlate_src_csum_adjustment;
sum = (sum & 0xffff) + (sum >> 16);
- udph->check = (uint16_t)sum;
+ udph->check = (u16)sum;
}
}
@@ -1395,7 +1396,7 @@
* Do we have to perform translations of the destination address/port?
*/
if (unlikely(cm->flags & SFE_IPV6_CONNECTION_MATCH_FLAG_XLATE_DEST)) {
- uint16_t udp_csum;
+ u16 udp_csum;
iph->daddr = cm->xlate_dest_ip[0];
udph->dest = cm->xlate_dest_port;
@@ -1406,9 +1407,9 @@
*/
udp_csum = udph->check;
if (likely(udp_csum)) {
- uint32_t sum = udp_csum + cm->xlate_dest_csum_adjustment;
+ u32 sum = udp_csum + cm->xlate_dest_csum_adjustment;
sum = (sum & 0xffff) + (sum >> 16);
- udph->check = (uint16_t)sum;
+ udph->check = (u16)sum;
}
}
@@ -1499,16 +1500,14 @@
* sfe_ipv6_process_tcp_option_sack()
* Parse TCP SACK option and update ack according
*/
-static bool sfe_ipv6_process_tcp_option_sack(const struct sfe_ipv6_tcp_hdr *th, const uint32_t data_offs,
- uint32_t *ack) __attribute__((always_inline));
-static bool sfe_ipv6_process_tcp_option_sack(const struct sfe_ipv6_tcp_hdr *th, const uint32_t data_offs,
- uint32_t *ack)
+static bool sfe_ipv6_process_tcp_option_sack(const struct sfe_ipv6_tcp_hdr *th, const u32 data_offs,
+ u32 *ack)
{
- uint32_t length = sizeof(struct sfe_ipv6_tcp_hdr);
- uint8_t *ptr = (uint8_t *)th + length;
+ u32 length = sizeof(struct sfe_ipv6_tcp_hdr);
+ u8 *ptr = (u8 *)th + length;
/*
- * If option is TIMESTAMP discard it.
+ * Ignore processing if TCP packet has only TIMESTAMP option.
*/
if (likely(data_offs == length + TCPOLEN_TIMESTAMP + 1 + 1)
&& likely(ptr[0] == TCPOPT_NOP)
@@ -1522,10 +1521,10 @@
* TCP options. Parse SACK option.
*/
while (length < data_offs) {
- uint8_t size;
- uint8_t kind;
+ u8 size;
+ u8 kind;
- ptr = (uint8_t *)th + length;
+ ptr = (u8 *)th + length;
kind = *ptr;
/*
@@ -1538,8 +1537,8 @@
}
if (kind == TCPOPT_SACK) {
- uint32_t sack = 0;
- uint8_t re = 1 + 1;
+ u32 sack = 0;
+ u8 re = 1 + 1;
size = *(ptr + 1);
if ((size < (1 + 1 + TCPOLEN_SACK_PERBLOCK))
@@ -1550,8 +1549,8 @@
re += 4;
while (re < size) {
- uint32_t sack_re;
- uint8_t *sptr = ptr + re;
+ u32 sack_re;
+ u8 *sptr = ptr + re;
sack_re = (sptr[0] << 24) | (sptr[1] << 16) | (sptr[2] << 8) | sptr[3];
if (sack_re > sack) {
sack = sack_re;
@@ -1591,7 +1590,7 @@
__be16 dest_port;
struct sfe_ipv6_connection_match *cm;
struct sfe_ipv6_connection_match *counter_cm;
- uint32_t flags;
+ u32 flags;
struct net_device *xmit_dev;
/*
@@ -1739,20 +1738,20 @@
* Are we doing sequence number checking?
*/
if (likely(!(cm->flags & SFE_IPV6_CONNECTION_MATCH_FLAG_NO_SEQ_CHECK))) {
- uint32_t seq;
- uint32_t ack;
- uint32_t sack;
- uint32_t data_offs;
- uint32_t end;
- uint32_t left_edge;
- uint32_t scaled_win;
- uint32_t max_end;
+ u32 seq;
+ u32 ack;
+ u32 sack;
+ u32 data_offs;
+ u32 end;
+ u32 left_edge;
+ u32 scaled_win;
+ u32 max_end;
/*
* Is our sequence fully past the right hand edge of the window?
*/
seq = ntohl(tcph->seq);
- if (unlikely((int32_t)(seq - (cm->protocol_state.tcp.max_end + 1)) > 0)) {
+ if (unlikely((s32)(seq - (cm->protocol_state.tcp.max_end + 1)) > 0)) {
struct sfe_ipv6_connection *c = cm->connection;
sfe_ipv6_remove_connection(si, c);
si->exception_events[SFE_IPV6_EXCEPTION_EVENT_TCP_SEQ_EXCEEDS_RIGHT_EDGE]++;
@@ -1820,7 +1819,7 @@
/*
* Is our sequence fully before the left hand edge of the window?
*/
- if (unlikely((int32_t)(end - (cm->protocol_state.tcp.end
+ if (unlikely((s32)(end - (cm->protocol_state.tcp.end
- counter_cm->protocol_state.tcp.max_win - 1)) < 0)) {
struct sfe_ipv6_connection *c = cm->connection;
sfe_ipv6_remove_connection(si, c);
@@ -1837,7 +1836,7 @@
/*
* Are we acking data that is to the right of what has been sent?
*/
- if (unlikely((int32_t)(sack - (counter_cm->protocol_state.tcp.end + 1)) > 0)) {
+ if (unlikely((s32)(sack - (counter_cm->protocol_state.tcp.end + 1)) > 0)) {
struct sfe_ipv6_connection *c = cm->connection;
sfe_ipv6_remove_connection(si, c);
si->exception_events[SFE_IPV6_EXCEPTION_EVENT_TCP_ACK_EXCEEDS_RIGHT_EDGE]++;
@@ -1857,7 +1856,7 @@
- cm->protocol_state.tcp.max_win
- SFE_IPV6_TCP_MAX_ACK_WINDOW
- 1;
- if (unlikely((int32_t)(sack - left_edge) < 0)) {
+ if (unlikely((s32)(sack - left_edge) < 0)) {
struct sfe_ipv6_connection *c = cm->connection;
sfe_ipv6_remove_connection(si, c);
si->exception_events[SFE_IPV6_EXCEPTION_EVENT_TCP_ACK_BEFORE_LEFT_EDGE]++;
@@ -1882,12 +1881,12 @@
/*
* If our sequence and/or ack numbers have advanced then record the new state.
*/
- if (likely((int32_t)(end - cm->protocol_state.tcp.end) >= 0)) {
+ if (likely((s32)(end - cm->protocol_state.tcp.end) >= 0)) {
cm->protocol_state.tcp.end = end;
}
max_end = sack + scaled_win;
- if (likely((int32_t)(max_end - counter_cm->protocol_state.tcp.max_end) >= 0)) {
+ if (likely((s32)(max_end - counter_cm->protocol_state.tcp.max_end) >= 0)) {
counter_cm->protocol_state.tcp.max_end = max_end;
}
}
@@ -1912,8 +1911,8 @@
* Do we have to perform translations of the source address/port?
*/
if (unlikely(cm->flags & SFE_IPV6_CONNECTION_MATCH_FLAG_XLATE_SRC)) {
- uint16_t tcp_csum;
- uint32_t sum;
+ u16 tcp_csum;
+ u32 sum;
iph->saddr = cm->xlate_src_ip[0];
tcph->source = cm->xlate_src_port;
@@ -1925,15 +1924,15 @@
tcp_csum = tcph->check;
sum = tcp_csum + cm->xlate_src_csum_adjustment;
sum = (sum & 0xffff) + (sum >> 16);
- tcph->check = (uint16_t)sum;
+ tcph->check = (u16)sum;
}
/*
* Do we have to perform translations of the destination address/port?
*/
if (unlikely(cm->flags & SFE_IPV6_CONNECTION_MATCH_FLAG_XLATE_DEST)) {
- uint16_t tcp_csum;
- uint32_t sum;
+ u16 tcp_csum;
+ u32 sum;
iph->daddr = cm->xlate_dest_ip[0];
tcph->dest = cm->xlate_dest_port;
@@ -1945,7 +1944,7 @@
tcp_csum = tcph->check;
sum = tcp_csum + cm->xlate_dest_csum_adjustment;
sum = (sum & 0xffff) + (sum >> 16);
- tcph->check = (uint16_t)sum;
+ tcph->check = (u16)sum;
}
/*
@@ -2054,10 +2053,10 @@
__be16 dest_port;
struct sfe_ipv6_connection_match *cm;
struct sfe_ipv6_connection *c;
- uint8_t next_hdr;
+ u8 next_hdr;
/*
- * Is our packet too short to contain a valid UDP header?
+ * Is our packet too short to contain a valid ICMP header?
*/
len -= ihl;
if (!pskb_may_pull(skb, ihl + sizeof(struct icmp6hdr))) {
@@ -2237,7 +2236,7 @@
unsigned int ihl = sizeof(struct sfe_ipv6_ip_hdr);
bool flush_on_find = false;
struct sfe_ipv6_ip_hdr *iph;
- uint8_t next_hdr;
+ u8 next_hdr;
/*
* Check that we have space for an IP header and an uplayer header here.
@@ -2363,10 +2362,10 @@
if (orig_tcp->max_win < sic->src_td_max_window) {
orig_tcp->max_win = sic->src_td_max_window;
}
- if ((int32_t)(orig_tcp->end - sic->src_td_end) < 0) {
+ if ((s32)(orig_tcp->end - sic->src_td_end) < 0) {
orig_tcp->end = sic->src_td_end;
}
- if ((int32_t)(orig_tcp->max_end - sic->src_td_max_end) < 0) {
+ if ((s32)(orig_tcp->max_end - sic->src_td_max_end) < 0) {
orig_tcp->max_end = sic->src_td_max_end;
}
@@ -2374,10 +2373,10 @@
if (repl_tcp->max_win < sic->dest_td_max_window) {
repl_tcp->max_win = sic->dest_td_max_window;
}
- if ((int32_t)(repl_tcp->end - sic->dest_td_end) < 0) {
+ if ((s32)(repl_tcp->end - sic->dest_td_end) < 0) {
repl_tcp->end = sic->dest_td_end;
}
- if ((int32_t)(repl_tcp->max_end - sic->dest_td_max_end) < 0) {
+ if ((s32)(repl_tcp->max_end - sic->dest_td_max_end) < 0) {
repl_tcp->max_end = sic->dest_td_max_end;
}
@@ -2818,7 +2817,7 @@
static void sfe_ipv6_periodic_sync(unsigned long arg)
{
struct sfe_ipv6 *si = (struct sfe_ipv6 *)arg;
- uint64_t now_jiffies;
+ u64 now_jiffies;
int quota;
sfe_sync_rule_callback_t sync_rule_callback;
@@ -2972,17 +2971,17 @@
struct sfe_ipv6_addr src_ip_xlate;
__be16 src_port;
__be16 src_port_xlate;
- uint64_t src_rx_packets;
- uint64_t src_rx_bytes;
+ u64 src_rx_packets;
+ u64 src_rx_bytes;
struct net_device *dest_dev;
struct sfe_ipv6_addr dest_ip;
struct sfe_ipv6_addr dest_ip_xlate;
__be16 dest_port;
__be16 dest_port_xlate;
- uint64_t dest_rx_packets;
- uint64_t dest_rx_bytes;
- uint64_t last_sync_jiffies;
- uint32_t mark, src_priority, dest_priority, src_dscp, dest_dscp;
+ u64 dest_rx_packets;
+ u64 dest_rx_bytes;
+ u64 last_sync_jiffies;
+ u32 mark, src_priority, dest_priority, src_dscp, dest_dscp;
#ifdef CONFIG_NF_FLOW_COOKIE
int src_flow_cookie, dst_flow_cookie;
#endif
@@ -3131,7 +3130,7 @@
static bool sfe_ipv6_debug_dev_read_exceptions_exception(struct sfe_ipv6 *si, char *buffer, char *msg, size_t *length,
int *total_read, struct sfe_ipv6_debug_xml_write_state *ws)
{
- uint64_t ct;
+ u64 ct;
spin_lock_bh(&si->lock);
ct = si->exception_events64[ws->iter_exception];
@@ -3191,15 +3190,15 @@
{
int bytes_read;
unsigned int num_connections;
- uint64_t packets_forwarded;
- uint64_t packets_not_forwarded;
- uint64_t connection_create_requests;
- uint64_t connection_create_collisions;
- uint64_t connection_destroy_requests;
- uint64_t connection_destroy_misses;
- uint64_t connection_flushes;
- uint64_t connection_match_hash_hits;
- uint64_t connection_match_hash_reorders;
+ u64 packets_forwarded;
+ u64 packets_not_forwarded;
+ u64 connection_create_requests;
+ u64 connection_create_collisions;
+ u64 connection_destroy_requests;
+ u64 connection_destroy_misses;
+ u64 connection_flushes;
+ u64 connection_match_hash_hits;
+ u64 connection_match_hash_reorders;
spin_lock_bh(&si->lock);
sfe_ipv6_update_summary_stats(si);
@@ -3542,7 +3541,6 @@
sysfs_remove_file(si->sys_sfe_ipv6, &sfe_ipv6_debug_dev_attr.attr);
kobject_put(si->sys_sfe_ipv6);
-
}
module_init(sfe_ipv6_init)
@@ -3560,7 +3558,6 @@
EXPORT_SYMBOL(sfe_ipv6_unregister_flow_cookie_cb);
#endif
-MODULE_AUTHOR("Qualcomm Atheros Inc.");
MODULE_DESCRIPTION("Shortcut Forwarding Engine - IPv6 support");
MODULE_LICENSE("Dual BSD/GPL");