iwn_serializer.patch

josepht, 01/25/2011 01:23 PM

Download (6.22 KB)

View differences:

sys/dev/netif/iwn/if_iwn.c
3417 3417
	case SIOCSIFFLAGS:
3418 3418
		if (ifp->if_flags & IFF_UP) {
3419 3419
			if (!(ifp->if_flags & IFF_RUNNING)) {
3420
				iwn_init_locked(sc);
3420
				iwn_init(sc);
3421 3421
				if (IWN_READ(sc, IWN_GP_CNTRL) & IWN_GP_CNTRL_RFKILL)
3422 3422
					startall = 1;
3423 3423
				else
......
3425 3425
			}
3426 3426
		} else {
3427 3427
			if (ifp->if_flags & IFF_RUNNING)
3428
				iwn_stop_locked(sc);
3428
				iwn_stop(sc);
3429 3429
		}
3430 3430
		if (startall)
3431 3431
			ieee80211_start_all(ic);
......
6180 6180
	struct ifnet *ifp = sc->sc_ifp;
6181 6181
	struct ieee80211com *ic = ifp->if_l2com;
6182 6182

  
6183
	wlan_serialize_enter();
6183 6184
	iwn_init_locked(sc);
6185
	wlan_serialize_exit();
6184 6186

  
6185 6187
	if (ifp->if_flags & IFF_RUNNING)
6186 6188
		ieee80211_start_all(ic);
......
6202 6204
static void
6203 6205
iwn_stop(struct iwn_softc *sc)
6204 6206
{
6207
	wlan_serialize_enter();
6205 6208
	iwn_stop_locked(sc);
6209
	wlan_serialize_exit();
6206 6210
}
6207 6211

  
6208 6212
/*
......
6328 6332
	wlan_serialize_enter();
6329 6333
	ifp = sc->sc_ifp;
6330 6334
	ic = ifp->if_l2com;
6331
	iwn_stop(sc);
6332
	iwn_init(sc);
6335
	iwn_stop_locked(sc);
6336
	iwn_init_locked(sc);
6333 6337
	ieee80211_notify_radio(ic, 1);
6334 6338
	wlan_serialize_exit();
6335 6339
}
......
6347 6351
	ic = ifp->if_l2com;
6348 6352
	vap = TAILQ_FIRST(&ic->ic_vaps);
6349 6353
	if (vap != NULL) {
6350
		iwn_init(sc);
6354
		iwn_init_locked(sc);
6351 6355
		ieee80211_init(vap);
6352 6356
	}
6353 6357
	wlan_serialize_exit();
......
6365 6369
	ifp = sc->sc_ifp;
6366 6370
	ic = ifp->if_l2com;
6367 6371
	vap = TAILQ_FIRST(&ic->ic_vaps);
6368
	iwn_stop(sc);
6372
	iwn_stop_locked(sc);
6369 6373
	if (vap != NULL)
6370 6374
		ieee80211_stop(vap);
6371 6375

  
......
6416 6420
	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
6417 6421

  
6418 6422
	wlan_serialize_enter();
6419
	iwn_stop(sc);
6423
	iwn_stop_locked(sc);
6420 6424
	if (vap != NULL)
6421 6425
		ieee80211_stop(vap);
6422 6426
	wlan_serialize_exit();
......
6440 6444
	pci_write_config(dev, 0x41, 0, 1);
6441 6445

  
6442 6446
	if (ifp->if_flags & IFF_UP) {
6443
		iwn_init(sc);
6447
		iwn_init_locked(sc);
6444 6448
		if (vap != NULL)
6445 6449
			ieee80211_init(vap);
6446 6450
		if (ifp->if_flags & IFF_RUNNING)
sys/kern/uipc_mbuf.c
255 255
struct objcache *mbuf_cache, *mbufphdr_cache;
256 256
struct objcache *mclmeta_cache;
257 257
struct objcache *mbufcluster_cache, *mbufphdrcluster_cache;
258
struct objcache *mbufjcluster_cache;
258 259

  
259 260
int	nmbclusters;
260 261
int	nmbufs;
......
471 472
}
472 473

  
473 474
static void
474
linkcluster(struct mbuf *m, struct mbcluster *cl)
475
linkjcluster(struct mbuf *m, struct mbcluster *cl, uint size)
475 476
{
476 477
	/*
477 478
	 * Add the cluster to the mbuf.  The caller will detect that the
......
481 482
	m->m_ext.ext_buf = cl->mcl_data;
482 483
	m->m_ext.ext_ref = m_mclref;
483 484
	m->m_ext.ext_free = m_mclfree;
484
	m->m_ext.ext_size = MCLBYTES;
485
	m->m_ext.ext_size = size;
485 486
	atomic_add_int(&cl->mcl_refs, 1);
486 487

  
487 488
	m->m_data = m->m_ext.ext_buf;
488 489
	m->m_flags |= M_EXT | M_EXT_CLUSTER;
489 490
}
490 491

  
492
static void
493
linkcluster(struct mbuf *m, struct mbcluster *cl)
494
{
495
	linkjcluster(m, cl, MCLBYTES);
496
}
497

  
491 498
static boolean_t
492 499
mbufphdrcluster_ctor(void *obj, void *private, int ocflags)
493 500
{
......
522 529
	return (TRUE);
523 530
}
524 531

  
532
static boolean_t
533
mbufjcluster_ctor(void *obj, void *private, int ocflags)
534
{
535
	struct mbuf *m = obj;
536
	struct mbcluster *cl;
537

  
538
	mbuf_ctor(obj, private, ocflags);
539
	cl = objcache_get(mclmeta_cache, ocflags);
540
	if (cl == NULL) {
541
		++mbstat[mycpu->gd_cpuid].m_drops;
542
		return (FALSE);
543
	}
544
	m->m_flags |= M_CLCACHE;
545
	linkjcluster(m, cl, MJUMPAGESIZE);
546
	return (TRUE);
547
}
548

  
525 549
/*
526 550
 * Used for both the cluster and cluster PHDR caches.
527 551
 *
......
560 584
	 */
561 585
	for (i = 0; i < ncpus; i++) {
562 586
		atomic_set_long_nonlocked(&mbstat[i].m_msize, MSIZE);
587
		/* XXX: fix to depend on cluster size. JAT */
563 588
		atomic_set_long_nonlocked(&mbstat[i].m_mclbytes, MCLBYTES);
564 589
		atomic_set_long_nonlocked(&mbstat[i].m_minclsize, MINCLSIZE);
565 590
		atomic_set_long_nonlocked(&mbstat[i].m_mlen, MLEN);
......
602 627
	    objcache_malloc_alloc, objcache_malloc_free, &mbuf_malloc_args);
603 628
	mb_limit += limit;
604 629

  
630
	limit = nmbclusters;
631
	mbufjcluster_cache = objcache_create("mbuf + jcluster", &limit, 0,
632
	    mbufjcluster_ctor, mbufcluster_dtor, NULL,
633
	    objcache_malloc_alloc, objcache_malloc_free, &mbuf_malloc_args);
634
	mb_limit += limit;
635

  
605 636
	/*
606 637
	 * Adjust backing kmalloc pools' limit
607 638
	 *
......
611 642
	cl_limit += cl_limit / 8;
612 643
	kmalloc_raise_limit(mclmeta_malloc_args.mtype,
613 644
			    mclmeta_malloc_args.objsize * cl_limit);
645
	/* XXX: should be largest m_bufcluster size. JAT */
614 646
	kmalloc_raise_limit(M_MBUFCL, MCLBYTES * cl_limit);
615 647

  
616 648
	mb_limit += mb_limit / 8;
......
775 807
	return (m);
776 808
}
777 809

  
810
struct mbuf *
811
m_getjcl(int how, short type, int flags, size_t size)
812
{
813
	struct mbuf *m = NULL;
814
#if 0
815
	int ocflags = MBTOM(how);
816
	int ntries = 0;
817
#endif /* if 0 */
818

  
819
	return (m);
820
}
821

  
778 822
/*
779 823
 * Returns an mbuf with an attached cluster.
780 824
 * Because many network drivers use this kind of buffers a lot, it is
......
1402 1446
	/*
1403 1447
	 * Optimize the mbuf allocation but do not get too carried away.
1404 1448
	 */
1449
	/* XXX: fix to depend on cluster size. JAT */
1405 1450
	if (m->m_next || m->m_len > MLEN)
1406 1451
		gsize = MCLBYTES;
1407 1452
	else
sys/sys/mbuf.h
497 497
struct	mbuf	*m_get(int, int);
498 498
struct	mbuf	*m_getc(int len, int how, int type);
499 499
struct	mbuf	*m_getcl(int how, short type, int flags);
500
struct	mbuf	*m_getjcl(int how, short type, int flags, uint size);
500 501
struct	mbuf	*m_getclr(int, int);
501 502
struct	mbuf	*m_gethdr(int, int);
502 503
struct	mbuf	*m_getm(struct mbuf *, int, int, int);