Deleted Added
full compact
hifn7751.c (109596) hifn7751.c (109623)
1/* $FreeBSD: head/sys/dev/hifn/hifn7751.c 109596 2003-01-20 21:11:56Z sam $ */
1/* $FreeBSD: head/sys/dev/hifn/hifn7751.c 109623 2003-01-21 08:56:16Z alfred $ */
2/* $OpenBSD: hifn7751.c,v 1.120 2002/05/17 00:33:34 deraadt Exp $ */
3
4/*
5 * Invertex AEON / Hifn 7751 driver
6 * Copyright (c) 1999 Invertex Inc. All rights reserved.
7 * Copyright (c) 1999 Theo de Raadt
8 * Copyright (c) 2000-2001 Network Security Technologies, Inc.
9 * http://www.netsec.net

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

1664 * we return ERESTART so the operation is requeued
1665 * at the crypto later, but only if there are
1666 * ops already posted to the hardware; otherwise we
1667 * have no guarantee that we'll be re-entered.
1668 */
1669 totlen = cmd->src_mapsize;
1670 if (cmd->src_m->m_flags & M_PKTHDR) {
1671 len = MHLEN;
2/* $OpenBSD: hifn7751.c,v 1.120 2002/05/17 00:33:34 deraadt Exp $ */
3
4/*
5 * Invertex AEON / Hifn 7751 driver
6 * Copyright (c) 1999 Invertex Inc. All rights reserved.
7 * Copyright (c) 1999 Theo de Raadt
8 * Copyright (c) 2000-2001 Network Security Technologies, Inc.
9 * http://www.netsec.net

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

1664 * we return ERESTART so the operation is requeued
1665 * at the crypto later, but only if there are
1666 * ops already posted to the hardware; otherwise we
1667 * have no guarantee that we'll be re-entered.
1668 */
1669 totlen = cmd->src_mapsize;
1670 if (cmd->src_m->m_flags & M_PKTHDR) {
1671 len = MHLEN;
1672 MGETHDR(m0, M_DONTWAIT, MT_DATA);
1673 if (m0 && !m_dup_pkthdr(m0, cmd->src_m, M_DONTWAIT)) {
1672 MGETHDR(m0, M_NOWAIT, MT_DATA);
1673 if (m0 && !m_dup_pkthdr(m0, cmd->src_m, M_NOWAIT)) {
1674 m_free(m0);
1675 m0 = NULL;
1676 }
1677 } else {
1678 len = MLEN;
1674 m_free(m0);
1675 m0 = NULL;
1676 }
1677 } else {
1678 len = MLEN;
1679 MGET(m0, M_DONTWAIT, MT_DATA);
1679 MGET(m0, M_NOWAIT, MT_DATA);
1680 }
1681 if (m0 == NULL) {
1682 hifnstats.hst_nomem_mbuf++;
1683 err = dma->cmdu ? ERESTART : ENOMEM;
1684 goto err_srcmap;
1685 }
1686 if (totlen >= MINCLSIZE) {
1680 }
1681 if (m0 == NULL) {
1682 hifnstats.hst_nomem_mbuf++;
1683 err = dma->cmdu ? ERESTART : ENOMEM;
1684 goto err_srcmap;
1685 }
1686 if (totlen >= MINCLSIZE) {
1687 MCLGET(m0, M_DONTWAIT);
1687 MCLGET(m0, M_NOWAIT);
1688 if ((m0->m_flags & M_EXT) == 0) {
1689 hifnstats.hst_nomem_mcl++;
1690 err = dma->cmdu ? ERESTART : ENOMEM;
1691 m_freem(m0);
1692 goto err_srcmap;
1693 }
1694 len = MCLBYTES;
1695 }
1696 totlen -= len;
1697 m0->m_pkthdr.len = m0->m_len = len;
1698 mlast = m0;
1699
1700 while (totlen > 0) {
1688 if ((m0->m_flags & M_EXT) == 0) {
1689 hifnstats.hst_nomem_mcl++;
1690 err = dma->cmdu ? ERESTART : ENOMEM;
1691 m_freem(m0);
1692 goto err_srcmap;
1693 }
1694 len = MCLBYTES;
1695 }
1696 totlen -= len;
1697 m0->m_pkthdr.len = m0->m_len = len;
1698 mlast = m0;
1699
1700 while (totlen > 0) {
1701 MGET(m, M_DONTWAIT, MT_DATA);
1701 MGET(m, M_NOWAIT, MT_DATA);
1702 if (m == NULL) {
1703 hifnstats.hst_nomem_mbuf++;
1704 err = dma->cmdu ? ERESTART : ENOMEM;
1705 m_freem(m0);
1706 goto err_srcmap;
1707 }
1708 len = MLEN;
1709 if (totlen >= MINCLSIZE) {
1702 if (m == NULL) {
1703 hifnstats.hst_nomem_mbuf++;
1704 err = dma->cmdu ? ERESTART : ENOMEM;
1705 m_freem(m0);
1706 goto err_srcmap;
1707 }
1708 len = MLEN;
1709 if (totlen >= MINCLSIZE) {
1710 MCLGET(m, M_DONTWAIT);
1710 MCLGET(m, M_NOWAIT);
1711 if ((m->m_flags & M_EXT) == 0) {
1712 hifnstats.hst_nomem_mcl++;
1713 err = dma->cmdu ? ERESTART : ENOMEM;
1714 mlast->m_next = m;
1715 m_freem(m0);
1716 goto err_srcmap;
1717 }
1718 len = MCLBYTES;

--- 922 unchanged lines hidden ---
1711 if ((m->m_flags & M_EXT) == 0) {
1712 hifnstats.hst_nomem_mcl++;
1713 err = dma->cmdu ? ERESTART : ENOMEM;
1714 mlast->m_next = m;
1715 m_freem(m0);
1716 goto err_srcmap;
1717 }
1718 len = MCLBYTES;

--- 922 unchanged lines hidden ---