Deleted Added
full compact
nicvf_queues.c (297482) nicvf_queues.c (297721)
1/*
2 * Copyright (C) 2015 Cavium Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*
2 * Copyright (C) 2015 Cavium Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/vnic/nicvf_queues.c 297482 2016-04-01 06:28:33Z sephe $
26 * $FreeBSD: head/sys/dev/vnic/nicvf_queues.c 297721 2016-04-08 16:14:18Z zbb $
27 *
28 */
29#include <sys/cdefs.h>
27 *
28 */
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/dev/vnic/nicvf_queues.c 297482 2016-04-01 06:28:33Z sephe $");
30__FBSDID("$FreeBSD: head/sys/dev/vnic/nicvf_queues.c 297721 2016-04-08 16:14:18Z zbb $");
31
32#include "opt_inet.h"
33#include "opt_inet6.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/bitset.h>
38#include <sys/bitstring.h>

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

1899 gather->addr = data;
1900}
1901
1902/* Put an mbuf to a SQ for packet transfer. */
1903static int
1904nicvf_tx_mbuf_locked(struct snd_queue *sq, struct mbuf **mbufp)
1905{
1906 bus_dma_segment_t segs[256];
31
32#include "opt_inet.h"
33#include "opt_inet6.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/bitset.h>
38#include <sys/bitstring.h>

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

1899 gather->addr = data;
1900}
1901
1902/* Put an mbuf to a SQ for packet transfer. */
1903static int
1904nicvf_tx_mbuf_locked(struct snd_queue *sq, struct mbuf **mbufp)
1905{
1906 bus_dma_segment_t segs[256];
1907 struct nicvf *nic;
1908 struct snd_buff *snd_buff;
1909 size_t seg;
1910 int nsegs, qentry;
1911 int subdesc_cnt;
1912 int err;
1913
1914 NICVF_TX_LOCK_ASSERT(sq);
1915

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

1923 if (__predict_false(err != 0)) {
1924 /* ARM64TODO: Add mbuf defragmenting if we lack maps */
1925 m_freem(*mbufp);
1926 *mbufp = NULL;
1927 return (err);
1928 }
1929
1930 /* Set how many subdescriptors is required */
1907 struct snd_buff *snd_buff;
1908 size_t seg;
1909 int nsegs, qentry;
1910 int subdesc_cnt;
1911 int err;
1912
1913 NICVF_TX_LOCK_ASSERT(sq);
1914

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

1922 if (__predict_false(err != 0)) {
1923 /* ARM64TODO: Add mbuf defragmenting if we lack maps */
1924 m_freem(*mbufp);
1925 *mbufp = NULL;
1926 return (err);
1927 }
1928
1929 /* Set how many subdescriptors is required */
1931 nic = sq->nic;
1932 if ((*mbufp)->m_pkthdr.tso_segsz != 0 && nic->hw_tso)
1933 subdesc_cnt = MIN_SQ_DESC_PER_PKT_XMIT;
1934 else
1935 subdesc_cnt = MIN_SQ_DESC_PER_PKT_XMIT + nsegs - 1;
1936
1930 subdesc_cnt = MIN_SQ_DESC_PER_PKT_XMIT + nsegs - 1;
1937 if (subdesc_cnt > sq->free_cnt) {
1938 /* ARM64TODO: Add mbuf defragmentation if we lack descriptors */
1939 bus_dmamap_unload(sq->snd_buff_dmat, snd_buff->dmap);
1940 return (ENOBUFS);
1941 }
1942
1943 qentry = nicvf_get_sq_desc(sq, subdesc_cnt);
1944

--- 436 unchanged lines hidden ---
1931 if (subdesc_cnt > sq->free_cnt) {
1932 /* ARM64TODO: Add mbuf defragmentation if we lack descriptors */
1933 bus_dmamap_unload(sq->snd_buff_dmat, snd_buff->dmap);
1934 return (ENOBUFS);
1935 }
1936
1937 qentry = nicvf_get_sq_desc(sq, subdesc_cnt);
1938

--- 436 unchanged lines hidden ---