if.c revision ef0c0f0afcec83a3da370a0d2e5474b204f32582
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * Copyright (c) 1995 Danny Gasparovski.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * Please read the file COPYRIGHT for the
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * terms and conditions of the copyright.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#define ifs_init(ifm) ((ifm)->ifs_next = (ifm)->ifs_prev = (ifm))
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amorestatic void ifs_insque(struct mbuf *ifm, struct mbuf *ifmhead)
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore /* 14 for ethernet */
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore if_fastq.ifq_next = if_fastq.ifq_prev = &if_fastq;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore if_batchq.ifq_next = if_batchq.ifq_prev = &if_batchq;
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore/* sl_compress_init(&comp_s); */
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * if_output: Queue packet into an output queue.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * There are 2 output queue's, if_fastq and if_batchq.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * Each output queue is a doubly linked list of double linked lists
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * of mbufs, each list belonging to one "session" (socket). This
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * way, we can output packets fairly by sending one packet from each
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * session, instead of all the packets from one session, then all packets
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * from the next session, etc. Packets on the if_fastq get absolute
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * priority, but if one session hogs the link, it gets "downgraded"
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * to the batchq until it runs out of packets, then it'll return
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * to the fastq (eg. if the user does an ls -alR in a telnet session,
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * it'll temporarily get downgraded to the batchq)
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amoreif_output(PNATState pData, struct socket *so, struct mbuf *ifm)
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * First remove the mbuf from m_usedlist,
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * since we're gonna use m_next and m_prev ourselves
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * XXX Shouldn't need this, gotta change dtom() etc.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * See if there's already a batchq list for this session.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * This can include an interactive session, which should go on fastq,
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * but gets too greedy... hence it'll be downgraded from fastq to batchq.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * We mustn't put this packet back on the fastq (or we'll send it out of order)
goto diddit;
goto diddit;
++if_queued;
if (so)
if (on_fastq
#ifndef FULL_BOLT
if (link_up)
if (!if_queued)
--if_queued;
if (!if_queued)