From d64777741686106171c3d0c66cc9b2150a2b09e1 Mon Sep 17 00:00:00 2001 From: Jason Wright Date: Tue, 13 Jun 2000 05:05:00 +0000 Subject: use the source length to calculate the output length instead of relying on the length in the descriptors (which is sometimes 0!). --- sys/dev/pci/hifn7751.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index ff725ebad0d..6880990fe43 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751.c,v 1.40 2000/06/13 02:22:50 jason Exp $ */ +/* $OpenBSD: hifn7751.c,v 1.41 2000/06/13 05:04:59 jason Exp $ */ /* * Invertex AEON / Hi/fn 7751 driver @@ -1361,6 +1361,7 @@ hifn_callback(sc, cmd, macbuf) struct cryptop *crp = (struct cryptop *)cmd->private_data; struct cryptodesc *crd; struct mbuf *m; + int totlen; if ((crp->crp_flags & CRYPTO_F_IMBUF) && (cmd->src_m != cmd->dst_m)) { m_freem(cmd->src_m); @@ -1368,16 +1369,15 @@ hifn_callback(sc, cmd, macbuf) } if ((m = cmd->dst_m) != NULL) { - int totlen = cmd->src_l, len; - + totlen = cmd->src_l; + hifnstats.hst_obytes += totlen; while (m) { - len = dma->dstr[dma->dstk].l & HIFN_D_LENGTH; - if (len > totlen) - len = totlen; + if (totlen < m->m_len) { + m->m_len = totlen; + totlen = 0; + } else - totlen -= len; - m->m_len = len; - hifnstats.hst_obytes += m->m_len; + totlen -= m->m_len; m = m->m_next; if (++dma->dstk == HIFN_D_DST_RSIZE) dma->dstk = 0; -- cgit v1.2.3