if_nlge.c (212896) | if_nlge.c (212957) |
---|---|
1/*- 2 * Copyright (c) 2003-2009 RMI Corporation 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 --- 31 unchanged lines hidden (view full) --- 40 * The XLS device supports upto 8 10/100/1000 Ethernet MACs or max 2 10G 41 * Ethernet MACs. The 1G MACs are of SGMII and 10G MACs are of XAUI 42 * interface. These ports are part of two network accelerators. 43 * The nlge driver configures and initializes non-SPI4 Ethernet ports in the 44 * XLR/XLS devices and enables data transfer on them. 45 */ 46 47#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003-2009 RMI Corporation 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 --- 31 unchanged lines hidden (view full) --- 40 * The XLS device supports upto 8 10/100/1000 Ethernet MACs or max 2 10G 41 * Ethernet MACs. The 1G MACs are of SGMII and 10G MACs are of XAUI 42 * interface. These ports are part of two network accelerators. 43 * The nlge driver configures and initializes non-SPI4 Ethernet ports in the 44 * XLR/XLS devices and enables data transfer on them. 45 */ 46 47#include <sys/cdefs.h> |
48__FBSDID("$FreeBSD: head/sys/mips/rmi/dev/nlge/if_nlge.c 212896 2010-09-20 11:53:57Z jchandra $"); | 48__FBSDID("$FreeBSD: head/sys/mips/rmi/dev/nlge/if_nlge.c 212957 2010-09-21 07:58:47Z jchandra $"); |
49 50#ifdef HAVE_KERNEL_OPTION_HEADERS 51#include "opt_device_polling.h" 52#endif 53 54#include <sys/endian.h> 55#include <sys/systm.h> 56#include <sys/sockio.h> --- 597 unchanged lines hidden (view full) --- 654 } 655 656 if (ctrl == CTRL_REG_FREE || ctrl == CTRL_JUMBO_FREE) { 657 ifp = sc->nlge_if; 658 if (!tx_error) { 659 if (is_p2p) { 660 release_tx_desc(phys_addr); 661 } else { | 49 50#ifdef HAVE_KERNEL_OPTION_HEADERS 51#include "opt_device_polling.h" 52#endif 53 54#include <sys/endian.h> 55#include <sys/systm.h> 56#include <sys/sockio.h> --- 597 unchanged lines hidden (view full) --- 654 } 655 656 if (ctrl == CTRL_REG_FREE || ctrl == CTRL_JUMBO_FREE) { 657 ifp = sc->nlge_if; 658 if (!tx_error) { 659 if (is_p2p) { 660 release_tx_desc(phys_addr); 661 } else { |
662#ifdef __mips64 | 662#ifdef __mips_n64 |
663 m = (struct mbuf *)(uintptr_t)xlr_paddr_ld(phys_addr); 664 m->m_nextpkt = NULL; 665#else 666 m = (struct mbuf *)(uintptr_t)phys_addr; 667#endif 668 m_freem(m); 669 } 670 NLGE_LOCK(sc); --- 1236 unchanged lines hidden (view full) --- 1907 for (m = mbuf_chain; m != NULL; m = m->m_next) { 1908 buf = (vm_offset_t) m->m_data; 1909 len = m->m_len; 1910 1911 while (len) { 1912 if (msg_sz == (FMN_SZ - 1)) { 1913 p2p = uma_zalloc(nl_tx_desc_zone, M_NOWAIT); 1914 if (p2p == NULL) { | 663 m = (struct mbuf *)(uintptr_t)xlr_paddr_ld(phys_addr); 664 m->m_nextpkt = NULL; 665#else 666 m = (struct mbuf *)(uintptr_t)phys_addr; 667#endif 668 m_freem(m); 669 } 670 NLGE_LOCK(sc); --- 1236 unchanged lines hidden (view full) --- 1907 for (m = mbuf_chain; m != NULL; m = m->m_next) { 1908 buf = (vm_offset_t) m->m_data; 1909 len = m->m_len; 1910 1911 while (len) { 1912 if (msg_sz == (FMN_SZ - 1)) { 1913 p2p = uma_zalloc(nl_tx_desc_zone, M_NOWAIT); 1914 if (p2p == NULL) { |
1915 return 2; | 1915 return (2); |
1916 } 1917 /* 1918 * Save the virtual address in the descriptor, 1919 * it makes freeing easy. 1920 */ 1921 p2p->frag[XLR_MAX_TX_FRAGS] = 1922 (uint64_t)(vm_offset_t)p2p; 1923 cur_p2d = &p2p->frag[0]; --- 19 unchanged lines hidden (view full) --- 1943 printf("Zero-length mbuf chain ??\n"); 1944 *n_entries = msg_sz ; 1945 return (0); 1946 } 1947 1948 /* set eop in most-recent p2d */ 1949 cur_p2d[-1] |= (1ULL << 63); 1950 | 1916 } 1917 /* 1918 * Save the virtual address in the descriptor, 1919 * it makes freeing easy. 1920 */ 1921 p2p->frag[XLR_MAX_TX_FRAGS] = 1922 (uint64_t)(vm_offset_t)p2p; 1923 cur_p2d = &p2p->frag[0]; --- 19 unchanged lines hidden (view full) --- 1943 printf("Zero-length mbuf chain ??\n"); 1944 *n_entries = msg_sz ; 1945 return (0); 1946 } 1947 1948 /* set eop in most-recent p2d */ 1949 cur_p2d[-1] |= (1ULL << 63); 1950 |
1951#ifdef __mips64 | 1951#ifdef __mips_n64 |
1952 /* 1953 * On n64, we cannot store our mbuf pointer(64 bit) in the freeback 1954 * message (40bit available), so we put the mbuf in m_nextpkt and 1955 * use the physical addr of that in freeback message. 1956 */ 1957 mbuf_chain->m_nextpkt = mbuf_chain; 1958 fbpaddr = vtophys(&mbuf_chain->m_nextpkt); 1959#else --- 468 unchanged lines hidden --- | 1952 /* 1953 * On n64, we cannot store our mbuf pointer(64 bit) in the freeback 1954 * message (40bit available), so we put the mbuf in m_nextpkt and 1955 * use the physical addr of that in freeback message. 1956 */ 1957 mbuf_chain->m_nextpkt = mbuf_chain; 1958 fbpaddr = vtophys(&mbuf_chain->m_nextpkt); 1959#else --- 468 unchanged lines hidden --- |