Deleted Added
full compact
if_patm_tx.c (243857) if_patm_tx.c (254804)
1/*-
2 * Copyright (c) 2003
3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

33 * All rights reserved.
34 *
35 * Author: Hartmut Brandt <harti@freebsd.org>
36 *
37 * Driver for IDT77252 based cards like ProSum's.
38 */
39
40#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003
3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

33 * All rights reserved.
34 *
35 * Author: Hartmut Brandt <harti@freebsd.org>
36 *
37 * Driver for IDT77252 based cards like ProSum's.
38 */
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/sys/dev/patm/if_patm_tx.c 243857 2012-12-04 09:32:43Z glebius $");
41__FBSDID("$FreeBSD: head/sys/dev/patm/if_patm_tx.c 254804 2013-08-24 19:51:18Z andre $");
42
43#include "opt_inet.h"
44#include "opt_natm.h"
45
46#include <sys/types.h>
47#include <sys/param.h>
48#include <sys/systm.h>
49#include <sys/malloc.h>

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

368 m_freem(m);
369 continue;
370 }
371 break;
372 }
373 }
374
375 /* save data */
42
43#include "opt_inet.h"
44#include "opt_natm.h"
45
46#include <sys/types.h>
47#include <sys/param.h>
48#include <sys/systm.h>
49#include <sys/malloc.h>

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

368 m_freem(m);
369 continue;
370 }
371 break;
372 }
373 }
374
375 /* save data */
376 m->m_pkthdr.header = vcc;
376 m->m_pkthdr.PH_loc.ptr = vcc;
377
378 /* try to put it on the channels queue */
379 if (_IF_QFULL(&vcc->scd->q)) {
380 sc->ifp->if_oerrors++;
381 sc->stats.tx_qfull++;
382 m_freem(m);
383 continue;
384 }

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

468
469 /* limit the number of outstanding packets to the tag space */
470 while (scd->num_on_card < IDT_TSQE_TAG_SPACE) {
471 /* get the next packet */
472 _IF_DEQUEUE(&scd->q, m);
473 if (m == NULL)
474 break;
475
377
378 /* try to put it on the channels queue */
379 if (_IF_QFULL(&vcc->scd->q)) {
380 sc->ifp->if_oerrors++;
381 sc->stats.tx_qfull++;
382 m_freem(m);
383 continue;
384 }

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

468
469 /* limit the number of outstanding packets to the tag space */
470 while (scd->num_on_card < IDT_TSQE_TAG_SPACE) {
471 /* get the next packet */
472 _IF_DEQUEUE(&scd->q, m);
473 if (m == NULL)
474 break;
475
476 a.vcc = m->m_pkthdr.header;
476 a.vcc = m->m_pkthdr.PH_loc.ptr;
477
478 /* we must know the number of segments beforehand - count
479 * this may actually give a wrong number of segments for
480 * AAL_RAW where we still need to remove the cell header */
481 segs = 0;
482 for (tmp = m; tmp != NULL; tmp = tmp->m_next)
483 if (tmp->m_len != 0)
484 segs++;

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

494 /* get a DMA map */
495 if ((map = patm_txmap_get(sc)) == NULL) {
496 _IF_PREPEND(&scd->q, m);
497 sc->stats.tx_out_of_maps++;
498 break;
499 }
500
501 /* load the map */
477
478 /* we must know the number of segments beforehand - count
479 * this may actually give a wrong number of segments for
480 * AAL_RAW where we still need to remove the cell header */
481 segs = 0;
482 for (tmp = m; tmp != NULL; tmp = tmp->m_next)
483 if (tmp->m_len != 0)
484 segs++;

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

494 /* get a DMA map */
495 if ((map = patm_txmap_get(sc)) == NULL) {
496 _IF_PREPEND(&scd->q, m);
497 sc->stats.tx_out_of_maps++;
498 break;
499 }
500
501 /* load the map */
502 m->m_pkthdr.header = map;
502 m->m_pkthdr.PH_loc.ptr = map;
503 a.mbuf = m;
504
505 /* handle AAL_RAW */
506 if (a.vcc->vcc.aal == ATMIO_AAL_RAW) {
507 u_char hdr[4];
508
509 m_copydata(m, 0, 4, hdr);
510 a.hdr = (hdr[0] << 24) | (hdr[1] << 16) |

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

685 /* next tag to try */
686 NEXT_TAG(last);
687
688 m = scd->on_card[last];
689 KASSERT(m != NULL, ("%stag=%u", dump_scd(sc, scd), tag));
690 scd->on_card[last] = NULL;
691 patm_debug(sc, TX, "ok tag=%x", last);
692
503 a.mbuf = m;
504
505 /* handle AAL_RAW */
506 if (a.vcc->vcc.aal == ATMIO_AAL_RAW) {
507 u_char hdr[4];
508
509 m_copydata(m, 0, 4, hdr);
510 a.hdr = (hdr[0] << 24) | (hdr[1] << 16) |

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

685 /* next tag to try */
686 NEXT_TAG(last);
687
688 m = scd->on_card[last];
689 KASSERT(m != NULL, ("%stag=%u", dump_scd(sc, scd), tag));
690 scd->on_card[last] = NULL;
691 patm_debug(sc, TX, "ok tag=%x", last);
692
693 map = m->m_pkthdr.header;
693 map = m->m_pkthdr.PH_loc.ptr;
694 scd->space += m->m_pkthdr.csum_data;
695
696 bus_dmamap_sync(sc->tx_tag, map->map,
697 BUS_DMASYNC_POSTWRITE);
698 bus_dmamap_unload(sc->tx_tag, map->map);
699 m_freem(m);
700 SLIST_INSERT_HEAD(&sc->tx_maps_free, map, link);
701 scd->num_on_card--;

--- 575 unchanged lines hidden ---
694 scd->space += m->m_pkthdr.csum_data;
695
696 bus_dmamap_sync(sc->tx_tag, map->map,
697 BUS_DMASYNC_POSTWRITE);
698 bus_dmamap_unload(sc->tx_tag, map->map);
699 m_freem(m);
700 SLIST_INSERT_HEAD(&sc->tx_maps_free, map, link);
701 scd->num_on_card--;

--- 575 unchanged lines hidden ---