Minor cleanups after yesterday's patch.

The code (bridging and dummynet) actually worked fine!
This commit is contained in:
Luigi Rizzo 2001-01-26 19:43:54 +00:00
parent 8566f92052
commit 26fb17bdd0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=71686
3 changed files with 15 additions and 27 deletions

View file

@ -348,8 +348,8 @@ SYSCTL_PROC(_net_link_ether, OID_AUTO, bridge, CTLTYPE_INT|CTLFLAG_RW,
SYSCTL_INT(_net_link_ether, OID_AUTO, bridge_ipfw, CTLFLAG_RW,
&bdg_ipfw,0,"Pass bridged pkts through firewall");
#define SY(parent, var, comment) \
int var ; \
#define SY(parent, var, comment) \
static int var ; \
SYSCTL_INT(parent, OID_AUTO, var, CTLFLAG_RW, &(var), 0, comment);
int bdg_ipfw_drops;
@ -365,23 +365,15 @@ SYSCTL_PROC(_net_link_ether, OID_AUTO, bridge_refresh, CTLTYPE_INT|CTLFLAG_WR,
#if 1 /* diagnostic vars */
static int bdg_split_pkts;
SYSCTL_INT(_net_link_ether, OID_AUTO, bdg_split_pkts,
CTLFLAG_RW, &bdg_split_pkts,0,"Packets split in bdg_forward");
SY(_net_link_ether, bdg_split_pkts, "Packets split in bdg_forward");
static int bdg_thru;
SYSCTL_INT(_net_link_ether, OID_AUTO, bdg_thru,
CTLFLAG_RW, &bdg_thru,0,"Packets through bridge");
SY(_net_link_ether, bdg_thru, "Packets through bridge");
static int bdg_copied;
SYSCTL_INT(_net_link_ether, OID_AUTO, bdg_copied,
CTLFLAG_RW, &bdg_copied,0,"Packets copied in bdg_forward");
SY(_net_link_ether, bdg_copied, "Packets copied in bdg_forward");
SY(_net_link_ether, bdg_copy, "Force copy in bdg_forward");
SY(_net_link_ether, bdg_nopredict, "Disable predicted header location");
SY(_net_link_ether, bdg_predict, "Correctly predicted header location");
SY(_net_link_ether, bdg_null_eh, "bdg_forward called with null_eh");
SY(_net_link_ether, bdg_fw_avg, "Cycle counter avg");
SY(_net_link_ether, bdg_fw_ticks, "Cycle counter item");
SY(_net_link_ether, bdg_fw_count, "Cycle counter count");
@ -652,8 +644,7 @@ bdg_forward(struct mbuf **m0, struct ether_header *const eh, struct ifnet *dst)
*/
struct ether_header save_eh = *eh ;
quad_t ticks;
DDB(ticks = rdtsc();)
DEB(quad_t ticks; ticks = rdtsc();)
bdg_thru++;
if (dst == BDG_DROP) { /* this should not happen */
@ -762,7 +753,7 @@ bdg_forward(struct mbuf **m0, struct ether_header *const eh, struct ifnet *dst)
* The firewall knows this is a bridged packet as the cookie ptr
* is NULL.
*/
i = (*ip_fw_chk_ptr)(&ip, 0, NULL, NULL, &m, &rule, NULL);
i = (*ip_fw_chk_ptr)(&ip, 0, NULL, NULL /* cookie */, &m, &rule, NULL);
if (m == NULL) { /* pkt discarded by firewall */
/*
@ -800,7 +791,7 @@ bdg_forward(struct mbuf **m0, struct ether_header *const eh, struct ifnet *dst)
/*
* check the common case of eh pointing already into the mbuf
*/
if ( bdg_nopredict == 0 && (void *)eh + ETHER_HDR_LEN == (void *)m->m_data) {
if ( (void *)eh + ETHER_HDR_LEN == (void *)m->m_data) {
m->m_data -= ETHER_HDR_LEN ;
m->m_len += ETHER_HDR_LEN ;
m->m_pkthdr.len += ETHER_HDR_LEN ;
@ -873,7 +864,7 @@ bdg_forward(struct mbuf **m0, struct ether_header *const eh, struct ifnet *dst)
/*
* check the common case of eh pointing already into the mbuf
*/
if ( bdg_nopredict == 0 && (void *)eh + ETHER_HDR_LEN == (void *)m->m_data) {
if ( (void *)eh + ETHER_HDR_LEN == (void *)m->m_data) {
m->m_data -= ETHER_HDR_LEN ;
m->m_len += ETHER_HDR_LEN ;
m->m_pkthdr.len += ETHER_HDR_LEN ;
@ -908,7 +899,7 @@ bdg_forward(struct mbuf **m0, struct ether_header *const eh, struct ifnet *dst)
if (ifp == NULL)
once = 1 ;
}
DDB(bdg_fw_ticks += (u_long)(rdtsc() - ticks) ; bdg_fw_count++ ;
DEB(bdg_fw_ticks += (u_long)(rdtsc() - ticks) ; bdg_fw_count++ ;
if (bdg_fw_count != 0) bdg_fw_avg = bdg_fw_ticks/bdg_fw_count; )
return error ;

View file

@ -442,7 +442,7 @@ transmit_event(struct dn_pipe *pipe)
/*
* same as ether_input, make eh be a pointer into the mbuf
*/
eh = (void *)pkt->dn_m->m_data ;
eh = mtod(pkt->dn_m, struct ether_header *);
m_adj(pkt->dn_m, ETHER_HDR_LEN);
/*
* bdg_forward() wants a pointer to the pseudo-mbuf-header, but
@ -627,7 +627,6 @@ ready_event_wfq(struct dn_pipe *p)
if (blh->elements > 0)
p->V = MAX64 ( p->V, blh->p[0].key );
/* move from not_eligible_heap to scheduler_heap */
neh = &(p->not_eligible_heap) ;
while (neh->elements > 0 && DN_KEY_LEQ(neh->p[0].key, p->V) ) {
struct dn_flow_queue *q = neh->p[0].object ;
heap_extract(neh, NULL);
@ -655,7 +654,6 @@ ready_event_wfq(struct dn_pipe *p)
p->V = 0 ;
p->idle_heap.elements = 0 ;
}
/*
* If we are getting clocks from dummynet (not a real interface) and
* If we are under credit, schedule the next ready event.
@ -1674,7 +1672,7 @@ delete_pipe(struct dn_pipe *p)
pipe_remove_from_heap(&wfq_ready_heap, b);
splx(s);
free(b, M_IPFW);
} else { /* this is a dummynet queue (dn_flow_set) */
} else { /* this is a WF2Q queue (dn_flow_set) */
struct dn_flow_set *a, *b;
/* locate set */

View file

@ -16,7 +16,6 @@
* $FreeBSD$
*/
#define STATEFUL 1
#define DEB(x)
#define DDB(x) x
@ -986,9 +985,9 @@ ip_fw_chk(struct ip **pip, int hlen,
proto = ip->ip_p;
src_ip = ip->ip_src;
dst_ip = ip->ip_dst;
if (0 && BRIDGED) {
offset = (NTOHS(ip->ip_off) & IP_OFFMASK);
ip_len = NTOHS(ip->ip_len);
if (0 && BRIDGED) { /* not yet... */
offset = (ntohs(ip->ip_off) & IP_OFFMASK);
ip_len = ntohs(ip->ip_len);
} else {
offset = (ip->ip_off & IP_OFFMASK);
ip_len = ip->ip_len;