Deleted Added
full compact
sfxge_rx.c (280522) sfxge_rx.c (280532)
1/*-
2 * Copyright (c) 2010-2011 Solarflare Communications, Inc.
3 * All rights reserved.
4 *
5 * This software was developed in part by Philip Paeps under contract for
6 * Solarflare Communications, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2010-2011 Solarflare Communications, Inc.
3 * All rights reserved.
4 *
5 * This software was developed in part by Philip Paeps under contract for
6 * Solarflare Communications, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: stable/10/sys/dev/sfxge/sfxge_rx.c 280522 2015-03-25 10:27:54Z arybchik $");
31__FBSDID("$FreeBSD: stable/10/sys/dev/sfxge/sfxge_rx.c 280532 2015-03-25 10:37:36Z arybchik $");
32
33#include <sys/types.h>
34#include <sys/mbuf.h>
35#include <sys/smp.h>
36#include <sys/socket.h>
37#include <sys/sysctl.h>
38#include <sys/limits.h>
39

--- 47 unchanged lines hidden (view full) ---

87
88/* Flags for sfxge_lro_conn::l2_id; must not collide with EVL_VLID_MASK */
89#define SFXGE_LRO_L2_ID_VLAN 0x4000
90#define SFXGE_LRO_L2_ID_IPV6 0x8000
91#define SFXGE_LRO_CONN_IS_VLAN_ENCAP(c) ((c)->l2_id & SFXGE_LRO_L2_ID_VLAN)
92#define SFXGE_LRO_CONN_IS_TCPIPV4(c) (!((c)->l2_id & SFXGE_LRO_L2_ID_IPV6))
93
94/* Compare IPv6 addresses, avoiding conditional branches */
32
33#include <sys/types.h>
34#include <sys/mbuf.h>
35#include <sys/smp.h>
36#include <sys/socket.h>
37#include <sys/sysctl.h>
38#include <sys/limits.h>
39

--- 47 unchanged lines hidden (view full) ---

87
88/* Flags for sfxge_lro_conn::l2_id; must not collide with EVL_VLID_MASK */
89#define SFXGE_LRO_L2_ID_VLAN 0x4000
90#define SFXGE_LRO_L2_ID_IPV6 0x8000
91#define SFXGE_LRO_CONN_IS_VLAN_ENCAP(c) ((c)->l2_id & SFXGE_LRO_L2_ID_VLAN)
92#define SFXGE_LRO_CONN_IS_TCPIPV4(c) (!((c)->l2_id & SFXGE_LRO_L2_ID_IPV6))
93
94/* Compare IPv6 addresses, avoiding conditional branches */
95static __inline unsigned long ipv6_addr_cmp(const struct in6_addr *left,
96 const struct in6_addr *right)
95static unsigned long ipv6_addr_cmp(const struct in6_addr *left,
96 const struct in6_addr *right)
97{
98#if LONG_BIT == 64
99 const uint64_t *left64 = (const uint64_t *)left;
100 const uint64_t *right64 = (const uint64_t *)right;
101 return (left64[0] - right64[0]) | (left64[1] - right64[1]);
102#else
103 return (left->s6_addr32[0] - right->s6_addr32[0]) |
104 (left->s6_addr32[1] - right->s6_addr32[1]) |

--- 57 unchanged lines hidden (view full) ---

162 rxq->refill_delay = min(rxq->refill_delay * 2, 10 * hz);
163 else
164 rxq->refill_delay = hz / 10;
165
166 callout_reset_curcpu(&rxq->refill_callout, rxq->refill_delay,
167 sfxge_rx_post_refill, rxq);
168}
169
97{
98#if LONG_BIT == 64
99 const uint64_t *left64 = (const uint64_t *)left;
100 const uint64_t *right64 = (const uint64_t *)right;
101 return (left64[0] - right64[0]) | (left64[1] - right64[1]);
102#else
103 return (left->s6_addr32[0] - right->s6_addr32[0]) |
104 (left->s6_addr32[1] - right->s6_addr32[1]) |

--- 57 unchanged lines hidden (view full) ---

162 rxq->refill_delay = min(rxq->refill_delay * 2, 10 * hz);
163 else
164 rxq->refill_delay = hz / 10;
165
166 callout_reset_curcpu(&rxq->refill_callout, rxq->refill_delay,
167 sfxge_rx_post_refill, rxq);
168}
169
170static inline struct mbuf *sfxge_rx_alloc_mbuf(struct sfxge_softc *sc)
170static struct mbuf *sfxge_rx_alloc_mbuf(struct sfxge_softc *sc)
171{
172 struct mb_args args;
173 struct mbuf *m;
174
175 /* Allocate mbuf structure */
176 args.flags = M_PKTHDR;
177 args.type = MT_DATA;
178 m = (struct mbuf *)uma_zalloc_arg(zone_mbuf, &args, M_NOWAIT);

--- 1056 unchanged lines hidden ---
171{
172 struct mb_args args;
173 struct mbuf *m;
174
175 /* Allocate mbuf structure */
176 args.flags = M_PKTHDR;
177 args.type = MT_DATA;
178 m = (struct mbuf *)uma_zalloc_arg(zone_mbuf, &args, M_NOWAIT);

--- 1056 unchanged lines hidden ---