Deleted Added
full compact
sfxge_tx.c (279094) sfxge_tx.c (279141)
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

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

38 *
39 * So, event queue plus label mapping to Tx queue index is:
40 * if event queue index is 0, TxQ-index = TxQ-label * [0..SFXGE_TXQ_NTYPES)
41 * else TxQ-index = SFXGE_TXQ_NTYPES + EvQ-index - 1
42 * See sfxge_get_txq_by_label() sfxge_ev.c
43 */
44
45#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

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

38 *
39 * So, event queue plus label mapping to Tx queue index is:
40 * if event queue index is 0, TxQ-index = TxQ-label * [0..SFXGE_TXQ_NTYPES)
41 * else TxQ-index = SFXGE_TXQ_NTYPES + EvQ-index - 1
42 * See sfxge_get_txq_by_label() sfxge_ev.c
43 */
44
45#include <sys/cdefs.h>
46__FBSDID("$FreeBSD: head/sys/dev/sfxge/sfxge_tx.c 279094 2015-02-21 06:24:48Z arybchik $");
46__FBSDID("$FreeBSD: head/sys/dev/sfxge/sfxge_tx.c 279141 2015-02-22 07:08:57Z arybchik $");
47
48#include <sys/types.h>
49#include <sys/mbuf.h>
50#include <sys/smp.h>
51#include <sys/socket.h>
52#include <sys/sysctl.h>
53#include <sys/syslog.h>
54

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

500
501/*
502 * Put a packet on the deferred packet list.
503 *
504 * If we are called with the txq lock held, we put the packet on the "get
505 * list", otherwise we atomically push it on the "put list". The swizzle
506 * function takes care of ordering.
507 *
47
48#include <sys/types.h>
49#include <sys/mbuf.h>
50#include <sys/smp.h>
51#include <sys/socket.h>
52#include <sys/sysctl.h>
53#include <sys/syslog.h>
54

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

500
501/*
502 * Put a packet on the deferred packet list.
503 *
504 * If we are called with the txq lock held, we put the packet on the "get
505 * list", otherwise we atomically push it on the "put list". The swizzle
506 * function takes care of ordering.
507 *
508 * The length of the put list is bounded by SFXGE_TX_MAX_DEFFERED. We
508 * The length of the put list is bounded by SFXGE_TX_MAX_DEFERRED. We
509 * overload the csum_data field in the mbuf to keep track of this length
510 * because there is no cheap alternative to avoid races.
511 */
512static int
513sfxge_tx_qdpl_put(struct sfxge_txq *txq, struct mbuf *mbuf, int locked)
514{
515 struct sfxge_tx_dpl *stdp;
516

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

564 } while (atomic_cmpset_ptr(putp, old, new) == 0);
565 }
566
567 return (0);
568}
569
570/*
571 * Called from if_transmit - will try to grab the txq lock and enqueue to the
509 * overload the csum_data field in the mbuf to keep track of this length
510 * because there is no cheap alternative to avoid races.
511 */
512static int
513sfxge_tx_qdpl_put(struct sfxge_txq *txq, struct mbuf *mbuf, int locked)
514{
515 struct sfxge_tx_dpl *stdp;
516

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

564 } while (atomic_cmpset_ptr(putp, old, new) == 0);
565 }
566
567 return (0);
568}
569
570/*
571 * Called from if_transmit - will try to grab the txq lock and enqueue to the
572 * put list if it succeeds, otherwise will push onto the defer list.
572 * put list if it succeeds, otherwise try to push onto the defer list if space.
573 */
574int
575sfxge_tx_packet_add(struct sfxge_txq *txq, struct mbuf *m)
576{
577 int locked;
578 int rc;
579
580 if (!SFXGE_LINK_UP(txq->sc)) {

--- 1058 unchanged lines hidden ---
573 */
574int
575sfxge_tx_packet_add(struct sfxge_txq *txq, struct mbuf *m)
576{
577 int locked;
578 int rc;
579
580 if (!SFXGE_LINK_UP(txq->sc)) {

--- 1058 unchanged lines hidden ---