Re: svn commit: r238936 - in head/sys: fs/fifofs kern sys
On Tue, Jul 31, 2012 at 7:48 AM, David Xu wrote: > Author: davidxu > Date: Tue Jul 31 05:48:35 2012 > New Revision: 238936 > URL: http://svn.freebsd.org/changeset/base/238936 > > Log: > I am comparing current pipe code with the one in 8.3-STABLE r236165, > I found 8.3 is a history BSD version using socket to implement FIFO > pipe, it uses per-file seqcount to compare with writer generation > stored in per-pipe object. The concept is after all writers are gone, > the pipe enters next generation, all old readers have not closed the > pipe should get the indication that the pipe is disconnected, result > is they should get EPIPE, SIGPIPE or get POLLHUP in poll(). > But newcomer should not know that previous writters were gone, it > should treat it as a fresh session. > I am trying to bring back FIFO pipe to history behavior. It is still > unclear that if single EOF flag can represent SBS_CANTSENDMORE and > SBS_CANTRCVMORE which socket-based version is using, but I have run > the poll regression test in tool directory, output is same as the one > on 8.3-STABLE now. > I think the output "not ok 18 FIFO state 6b: poll result 0 expected 1. > expected POLLHUP; got 0" might be bogus, because newcomer should not > know that old writers were gone. I got the same behavior on Linux. > Our implementation always return POLLIN for disconnected pipe even it > should return POLLHUP, but I think it is not wise to remove POLLIN for > compatible reason, this is our history behavior. > I'm sorry but I'm failing to understand the reason for this change. Can you point me out a test that confirm that the change is needed. The only thing I see is an increase in the memory footprint for the pipes. There was a lot of discussions on this topic on -arch mailing list http://lists.freebsd.org/pipermail/freebsd-arch/2012-January/012131.html http://lists.freebsd.org/pipermail/freebsd-arch/2012-February/012314.html Thank you -- Gianni ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238938 - head/sys/dev/wtap
Author: monthadar Date: Tue Jul 31 07:22:50 2012 New Revision: 238938 URL: http://svn.freebsd.org/changeset/base/238938 Log: Fix wtap to not panic in wtap_beacon_intrp. * Changed KASSERT to be debug printf (DWTAP_PRINTF). If state is not IEEE80211_S_RUN we return without scheduling a new callout; * When net80211 stack changes state to IEEE802_11_INIT we stop the beacon callout task; Modified: head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/wtap/if_wtap.c == --- head/sys/dev/wtap/if_wtap.c Tue Jul 31 05:51:48 2012(r238937) +++ head/sys/dev/wtap/if_wtap.c Tue Jul 31 07:22:50 2012(r238938) @@ -230,8 +230,10 @@ wtap_beacon_intrp(void *arg) struct ieee80211vap *vap = arg; struct mbuf *m; - KASSERT(vap->iv_state >= IEEE80211_S_RUN, - ("not running, state %d", vap->iv_state)); + if (vap->iv_state < IEEE80211_S_RUN) { + DWTAP_PRINTF("Skip beacon, not running, state %d", vap->iv_state); + return ; + } DWTAP_PRINTF("[%d] beacon intrp\n", avp->id); //burst mode /* * Update dynamic beacon contents. If this returns @@ -289,6 +291,8 @@ wtap_newstate(struct ieee80211vap *vap, default: goto bad; } + } else if (nstate == IEEE80211_S_INIT) { + callout_stop(&avp->av_swba); } return 0; bad: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238939 - head/sys/net80211
Author: monthadar Date: Tue Jul 31 07:31:47 2012 New Revision: 238939 URL: http://svn.freebsd.org/changeset/base/238939 Log: Fix bugs in net80211s found with wtap simulator. For description of the test scripts refer to projects/net80211_testsuite/wtap. * Test 007 showed a bug in intermediate PREP for a proxy entry. Resolved; * Test 002 showed a bug in the Addressing Mode flag for a PREQ. Resolved; Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 07:22:50 2012 (r238938) +++ head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 07:31:47 2012 (r238939) @@ -840,7 +840,7 @@ hwmp_rootmode_cb(void *arg) IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, vap->iv_bss, "%s", "send broadcast PREQ"); - preq.preq_flags = IEEE80211_MESHPREQ_FLAGS_AM; + preq.preq_flags = 0; if (ms->ms_flags & IEEE80211_MESHFLAGS_GATE) preq.preq_flags |= IEEE80211_MESHPREQ_FLAGS_GATE; if (hs->hs_rootmode == IEEE80211_HWMP_ROOTMODE_PROACTIVE) @@ -951,7 +951,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, hrtarg = IEEE80211_MESH_ROUTE_PRIV(rttarg, struct ieee80211_hwmp_route); /* Address mode: ucast */ - if((preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_AM) == 0 && + if(preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_AM && rttarg == NULL && !IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0))) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_HWMP, @@ -1029,6 +1029,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, hs->hs_seq = HWMP_SEQ_MAX(hs->hs_seq, PREQ_TSEQ(0)) + 1; prep.prep_flags = 0; + prep.prep_hopcount = 0; + IEEE80211_ADDR_COPY(prep.prep_targetaddr, vap->iv_myaddr); if (rttarg != NULL && /* if NULL it means we are the target */ rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, @@ -1038,13 +1040,13 @@ hwmp_recv_preq(struct ieee80211vap *vap, rttarg->rt_dest); /* update proxy seqno to HWMP seqno */ rttarg->rt_ext_seq = hs->hs_seq; + prep.prep_hopcount = rttarg->rt_nhops; + IEEE80211_ADDR_COPY(prep.prep_targetaddr, rttarg->rt_mesh_gate); } /* * Build and send a PREP frame. */ - prep.prep_hopcount = 0; prep.prep_ttl = ms->ms_ttl; - IEEE80211_ADDR_COPY(prep.prep_targetaddr, vap->iv_myaddr); prep.prep_targetseq = hs->hs_seq; prep.prep_lifetime = preq->preq_lifetime; prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238940 - head/sys/net80211
Author: monthadar Date: Tue Jul 31 07:36:27 2012 New Revision: 238940 URL: http://svn.freebsd.org/changeset/base/238940 Log: Fix a PREQ comparison error in 11s HWMP. * Earlier we compared two not equal metrics, one was what we recevied in the 'new PREQ' while the other was what we already have saved which was 'old PREQ' + link metric for the last hop; * Fixed by adding 'new PREQ' + link metric for the last hop in a temporary variable; Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 07:31:47 2012 (r238939) +++ head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 07:36:27 2012 (r238940) @@ -912,6 +912,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_hwmp_state *hs = vap->iv_hwmp; struct ieee80211_meshprep_ie prep; ieee80211_hwmp_seq preqid; /* last seen preqid for orig */ + uint32_t metric = 0; if (ni == vap->iv_bss || ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) @@ -985,13 +986,13 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* Data creation and update of forwarding information * according to Table 11C-8 for originator mesh STA. */ + metric = preq->preq_metric + ms->ms_pmetric->mpm_metric(ni); if (HWMP_SEQ_GT(preq->preq_origseq, hrorig->hr_seq) || (HWMP_SEQ_EQ(preq->preq_origseq, hrorig->hr_seq) && - preq->preq_metric < rtorig->rt_metric)) { + metric < rtorig->rt_metric)) { hrorig->hr_seq = preq->preq_origseq; IEEE80211_ADDR_COPY(rtorig->rt_nexthop, wh->i_addr2); - rtorig->rt_metric = preq->preq_metric + - ms->ms_pmetric->mpm_metric(ni); + rtorig->rt_metric = metric; rtorig->rt_nhops = preq->preq_hopcount + 1; ieee80211_mesh_rt_update(rtorig, preq->preq_lifetime); /* path to orig is valid now */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238941 - head/sys/netinet
Author: luigi Date: Tue Jul 31 08:04:49 2012 New Revision: 238941 URL: http://svn.freebsd.org/changeset/base/238941 Log: nobody uses this file except the userspace ipfw code, but the cast of a pointer to an integer needs a cast to prevent a warning for size mismatch. MFC after:1 week Modified: head/sys/netinet/in_cksum.c Modified: head/sys/netinet/in_cksum.c == --- head/sys/netinet/in_cksum.c Tue Jul 31 07:36:27 2012(r238940) +++ head/sys/netinet/in_cksum.c Tue Jul 31 08:04:49 2012(r238941) @@ -88,7 +88,7 @@ in_cksum(struct mbuf *m, int len) /* * Force to even boundary. */ - if ((1 & (int) w) && (mlen > 0)) { + if ((1 & (uintptr_t) w) && (mlen > 0)) { REDUCE; sum <<= 8; s_util.c[0] = *(u_char *)w; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238942 - head/sys/net80211
Author: monthadar Date: Tue Jul 31 08:05:40 2012 New Revision: 238942 URL: http://svn.freebsd.org/changeset/base/238942 Log: Fixed some debug output in hwmp_recv_prep. Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 08:04:49 2012 (r238941) +++ head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 08:05:40 2012 (r238942) @@ -1289,7 +1289,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "discard PREP from %6D, new metric %u > %u", prep->prep_targetaddr, ":", - prep->prep_metric, rt->rt_metric); + metric, rt->rt_metric); return; } } @@ -1299,7 +1299,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? "prefer" : "update", prep->prep_targetaddr, ":", - rt->rt_nhops, prep->prep_hopcount, + rt->rt_nhops, prep->prep_hopcount + 1, rt->rt_metric, metric); hr->hr_seq = prep->prep_targetseq; @@ -1371,7 +1371,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, rtext->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? "prefer" : "update", prep->prep_target_ext_addr, ":", - rtext->rt_nhops, prep->prep_hopcount, + rtext->rt_nhops, prep->prep_hopcount + 1, rtext->rt_metric, metric); rtext->rt_flags = IEEE80211_MESHRT_FLAGS_PROXY | ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238942 - head/sys/net80211
.. these are all approved-by: me. :-) Adrian On 31 July 2012 01:05, Monthadar Al Jaberi wrote: > Author: monthadar > Date: Tue Jul 31 08:05:40 2012 > New Revision: 238942 > URL: http://svn.freebsd.org/changeset/base/238942 > > Log: > Fixed some debug output in hwmp_recv_prep. > > Modified: > head/sys/net80211/ieee80211_hwmp.c > > Modified: head/sys/net80211/ieee80211_hwmp.c > == > --- head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 08:04:49 2012 > (r238941) > +++ head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 08:05:40 2012 > (r238942) > @@ -1289,7 +1289,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, > IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, > "discard PREP from %6D, new metric %u > %u", > prep->prep_targetaddr, ":", > - prep->prep_metric, rt->rt_metric); > + metric, rt->rt_metric); > return; > } > } > @@ -1299,7 +1299,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, > rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? > "prefer" : "update", > prep->prep_targetaddr, ":", > - rt->rt_nhops, prep->prep_hopcount, > + rt->rt_nhops, prep->prep_hopcount + 1, > rt->rt_metric, metric); > > hr->hr_seq = prep->prep_targetseq; > @@ -1371,7 +1371,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, > rtext->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? > "prefer" : "update", > prep->prep_target_ext_addr, ":", > - rtext->rt_nhops, prep->prep_hopcount, > + rtext->rt_nhops, prep->prep_hopcount + 1, > rtext->rt_metric, metric); > > rtext->rt_flags = IEEE80211_MESHRT_FLAGS_PROXY | ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238936 - in head/sys: fs/fifofs kern sys
On 2012/7/31 15:22, Giovanni Trematerra wrote: On Tue, Jul 31, 2012 at 7:48 AM, David Xu wrote: Author: davidxu Date: Tue Jul 31 05:48:35 2012 New Revision: 238936 URL: http://svn.freebsd.org/changeset/base/238936 Log: I am comparing current pipe code with the one in 8.3-STABLE r236165, I found 8.3 is a history BSD version using socket to implement FIFO pipe, it uses per-file seqcount to compare with writer generation stored in per-pipe object. The concept is after all writers are gone, the pipe enters next generation, all old readers have not closed the pipe should get the indication that the pipe is disconnected, result is they should get EPIPE, SIGPIPE or get POLLHUP in poll(). But newcomer should not know that previous writters were gone, it should treat it as a fresh session. I am trying to bring back FIFO pipe to history behavior. It is still unclear that if single EOF flag can represent SBS_CANTSENDMORE and SBS_CANTRCVMORE which socket-based version is using, but I have run the poll regression test in tool directory, output is same as the one on 8.3-STABLE now. I think the output "not ok 18 FIFO state 6b: poll result 0 expected 1. expected POLLHUP; got 0" might be bogus, because newcomer should not know that old writers were gone. I got the same behavior on Linux. Our implementation always return POLLIN for disconnected pipe even it should return POLLHUP, but I think it is not wise to remove POLLIN for compatible reason, this is our history behavior. I'm sorry but I'm failing to understand the reason for this change. Can you point me out a test that confirm that the change is needed. The only thing I see is an increase in the memory footprint for the pipes. There was a lot of discussions on this topic on -arch mailing list http://lists.freebsd.org/pipermail/freebsd-arch/2012-January/012131.html http://lists.freebsd.org/pipermail/freebsd-arch/2012-February/012314.html Thank you -- Gianni The old code broke some history semantic of FIFO pipe, you can try the test tool /usr/src/tools/regression/poll/pipepoll, try it before and after my commit, also compare the result with 8.3-STABLE, without this commit, both sub-tests 6c and 6d failed. I think old code did not mimic original code correctly, in 8.3-STABLE code, seqcount is stored in each file, writer generation detection is based on each copy of seqcount, but your code stored single copy of seqcount in fifoinfo object which is store as vnode data, and made the writer generation flag global by setting PIPE_SAMEWGEN in pipe object and used this flag to determine if it should return POLLHUP/POLLIN or not, this is wrong, for example: when there is no writer but have old readers, new incoming reader will executes: line 174 and 175: fip->fi_seqcount = fip->fi_wgen - fip->fi_writers; FIFO_WPDWGEN(fip, fpipe); this causes fi_seqcount to be equal to fi_wgen because fi_writer is zero, and FIFO_WPDWGEN() turns on flag PIPE_SAMEWGEN. When PIPE_SAMEWGEN is on, pipe_poll() ignores EOF, this breaks old readers, it causes old reader to get nothing while it should get POLLHUP from poll(). The new incoming reader should get nothing, so I think sub-tests 6b is wrong. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238943 - head/sys/dev/acpica
Author: mav Date: Tue Jul 31 10:58:50 2012 New Revision: 238943 URL: http://svn.freebsd.org/changeset/base/238943 Log: Add several performance optimizations to acpi_cpu_idle(). For C1 and C2 states use cpu_ticks() to measure sleep time instead of much slower ACPI timer. We can't do it for C3, as TSC may stop there. But it is less important there as wake up latency is high any way. For C1 and C2 states do not check/clear bus mastering activity status, as it is important only for C3. As side effect it can make CPU enter C2 instead of C3 if last BM activity was two sleeps back (unlike one before), but that may be even good because of collecting more statistics. Premature BM wakeup from C3, entered because of overestimation, can easily be worse then entering C2 from both performance and power consumption points of view. Together on dual Xeon E5645 system on sequential 512 bytes read test this change makes cpu_idle_acpi() as fast as simplest cpu_idle_hlt() and only few percents slower then cpu_idle_mwait(), while deeper states are still actively used during idle periods. To help with diagnostics, add C-state type into dev.cpu.X.cx_supported. Sponsored by: iXsystems, Inc. Modified: head/sys/dev/acpica/acpi_cpu.c Modified: head/sys/dev/acpica/acpi_cpu.c == --- head/sys/dev/acpica/acpi_cpu.c Tue Jul 31 08:05:40 2012 (r238942) +++ head/sys/dev/acpica/acpi_cpu.c Tue Jul 31 10:58:50 2012 (r238943) @@ -876,7 +876,8 @@ acpi_cpu_cx_list(struct acpi_cpu_softc * sbuf_new(&sb, sc->cpu_cx_supported, sizeof(sc->cpu_cx_supported), SBUF_FIXEDLEN); for (i = 0; i < sc->cpu_cx_count; i++) - sbuf_printf(&sb, "C%d/%d ", i + 1, sc->cpu_cx_states[i].trans_lat); + sbuf_printf(&sb, "C%d/%d/%d ", i + 1, sc->cpu_cx_states[i].type, + sc->cpu_cx_states[i].trans_lat); sbuf_trim(&sb); sbuf_finish(&sb); } @@ -921,6 +922,7 @@ acpi_cpu_idle() { struct acpi_cpu_softc *sc; struct acpi_cx *cx_next; +uint64_t cputicks; uint32_t start_time, end_time; intbm_active, cx_next_idx, i; @@ -960,11 +962,12 @@ acpi_cpu_idle() * driver polling for new devices keeps this bit set all the * time if USB is loaded. */ -if ((cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0) { +if ((cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0 && + cx_next_idx > sc->cpu_non_c3) { AcpiReadBitRegister(ACPI_BITREG_BUS_MASTER_STATUS, &bm_active); if (bm_active != 0) { AcpiWriteBitRegister(ACPI_BITREG_BUS_MASTER_STATUS, 1); - cx_next_idx = min(cx_next_idx, sc->cpu_non_c3); + cx_next_idx = sc->cpu_non_c3; } } @@ -980,11 +983,10 @@ acpi_cpu_idle() * we are called inside critical section, delaying context switch. */ if (cx_next->type == ACPI_STATE_C1) { - AcpiHwRead(&start_time, &AcpiGbl_FADT.XPmTimerBlock); + cputicks = cpu_ticks(); acpi_cpu_c1(); - AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); -end_time = PM_USEC(acpi_TimerDelta(end_time, start_time)); -if (curthread->td_critnest == 0) + end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); + if (curthread->td_critnest == 0) end_time = min(end_time, 50 / hz); sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + end_time) / 4; return; @@ -1008,7 +1010,13 @@ acpi_cpu_idle() * get the time very close to the CPU start/stop clock logic, this * is the only reliable time source. */ -AcpiHwRead(&start_time, &AcpiGbl_FADT.XPmTimerBlock); +if (cx_next->type == ACPI_STATE_C3) { + AcpiHwRead(&start_time, &AcpiGbl_FADT.XPmTimerBlock); + cputicks = 0; +} else { + start_time = 0; + cputicks = cpu_ticks(); +} CPU_GET_REG(cx_next->p_lvlx, 1); /* @@ -1018,7 +1026,11 @@ acpi_cpu_idle() * margin that we are certain to have a correct value. */ AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); -AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); +if (cx_next->type == ACPI_STATE_C3) { + AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); + end_time = acpi_TimerDelta(end_time, start_time); +} else + end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); /* Enable bus master arbitration and disable bus master wakeup. */ if (cx_next->type == ACPI_STATE_C3 && @@ -1028,8 +1040,6 @@ acpi_cpu_idle() } ACPI_ENABLE_IRQS(); -/* Find the actual time asleep in microseconds. */ -end_time = acpi_TimerDelta(end_time, start_time); sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + PM_USEC(end_time)) / 4; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send
svn commit: r238945 - in head/sys: net netinet netinet6
Author: glebius Date: Tue Jul 31 11:31:12 2012 New Revision: 238945 URL: http://svn.freebsd.org/changeset/base/238945 Log: Some style(9) and whitespace changes. Together with:Andrey Zonov Modified: head/sys/net/if_llatbl.c head/sys/net/if_llatbl.h head/sys/netinet/if_ether.c head/sys/netinet/in.c head/sys/netinet6/in6.c Modified: head/sys/net/if_llatbl.c == --- head/sys/net/if_llatbl.cTue Jul 31 11:16:19 2012(r238944) +++ head/sys/net/if_llatbl.cTue Jul 31 11:31:12 2012(r238945) @@ -118,8 +118,8 @@ llentry_free(struct llentry *lle) pkts_dropped++; } - KASSERT(lle->la_numheld == 0, - ("%s: la_numheld %d > 0, pkts_droped %zd", __func__, + KASSERT(lle->la_numheld == 0, + ("%s: la_numheld %d > 0, pkts_droped %zd", __func__, lle->la_numheld, pkts_dropped)); lle->la_flags &= ~LLE_VALID; @@ -144,7 +144,7 @@ llentry_update(struct llentry **llep, st la = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst); IF_AFDATA_RUNLOCK(ifp); - if ((la == NULL) && + if ((la == NULL) && (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0) { IF_AFDATA_WLOCK(ifp); la = lla_lookup(lt, @@ -182,7 +182,7 @@ lltable_free(struct lltable *llt) SLIST_REMOVE(&V_lltables, llt, lltable, llt_link); LLTABLE_WUNLOCK(); - for (i=0; i < LLTBL_HASHTBL_SIZE; i++) { + for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { int canceled; @@ -227,7 +227,7 @@ lltable_drain(int af) void lltable_prefix_free(int af, struct sockaddr *prefix, struct sockaddr *mask, - u_int flags) +u_int flags) { struct lltable *llt; @@ -297,7 +297,7 @@ lla_rt_output(struct rt_msghdr *rtm, str if (rtm->rtm_flags & RTF_ANNOUNCE) { flags |= LLE_PUB; #ifdef INET - if (dst->sa_family == AF_INET && + if (dst->sa_family == AF_INET && ((struct sockaddr_inarp *)dst)->sin_other != 0) { struct rtentry *rt; ((struct sockaddr_inarp *)dst)->sin_other = 0; @@ -378,7 +378,7 @@ lla_rt_output(struct rt_msghdr *rtm, str #ifdef INET /* gratuitous ARP */ if ((laflags & LLE_PUB) && dst->sa_family == AF_INET) { - arprequest(ifp, + arprequest(ifp, &((struct sockaddr_in *)dst)->sin_addr, &((struct sockaddr_in *)dst)->sin_addr, ((laflags & LLE_PROXY) ? Modified: head/sys/net/if_llatbl.h == --- head/sys/net/if_llatbl.hTue Jul 31 11:16:19 2012(r238944) +++ head/sys/net/if_llatbl.hTue Jul 31 11:31:12 2012(r238945) @@ -61,17 +61,17 @@ struct llentry { struct llentries *lle_head; void(*lle_free)(struct lltable *, struct llentry *); struct mbuf *la_hold; - int la_numheld; /* # of packets currently held */ + int la_numheld; /* # of packets currently held */ time_t la_expire; - uint16_t la_flags; + uint16_t la_flags; uint16_t la_asked; uint16_t la_preempt; uint16_t ln_byhint; int16_t ln_state; /* IPv6 has ND6_LLINFO_NOSTATE == -2 */ - uint16_t ln_router; + uint16_t ln_router; time_t ln_ntick; int lle_refcnt; - + union { uint64_tmac_aligned; uint16_tmac16[3]; @@ -106,6 +106,7 @@ struct llentry { ("negative refcnt %d", (lle)->lle_refcnt)); \ (lle)->lle_refcnt++;\ } while (0) + #defineLLE_REMREF(lle) do {\ LLE_WLOCK_ASSERT(lle); \ KASSERT((lle)->lle_refcnt > 1, \ @@ -158,7 +159,7 @@ struct lltable { struct llentry *(*llt_lookup)(struct lltable *, u_int flags, const struct sockaddr *l3addr); int (*llt_dump)(struct lltable *, -struct sysctl_req *); + struct sysctl_req *)
Re: svn commit: r238943 - head/sys/dev/acpica
on 31/07/2012 13:58 Alexander Motin said the following: > To help with diagnostics, add C-state type into dev.cpu.X.cx_supported I think that this really should have been a separate commit. Besides it is a POLA violation for those who may parse output of this sysctl for whatever reason. Additionally, it would seem to be better to have sub-tree per state per CPU where all the important/interesting characteristics of the state are exposed. So this part of this commit seems like a half-measure. This all has been recently discussed on acpi@ :-) -- Andriy Gapon ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238936 - in head/sys: fs/fifofs kern sys
On Tue, 31 Jul 2012, David Xu wrote: On 2012/7/31 15:22, Giovanni Trematerra wrote: On Tue, Jul 31, 2012 at 7:48 AM, David Xu wrote: Log: I am comparing current pipe code with the one in 8.3-STABLE r236165, I found 8.3 is a history BSD version using socket to implement FIFO pipe, it uses per-file seqcount to compare with writer generation stored in per-pipe object. The concept is after all writers are gone, the pipe enters next generation, all old readers have not closed the pipe should get the indication that the pipe is disconnected, result is they should get EPIPE, SIGPIPE or get POLLHUP in poll(). But newcomer should not know that previous writters were gone, it should treat it as a fresh session. Good commit message. Almost worth quoting in 3 followups :-). I wrote most of the code and forgotten some details, and the above made them clear. I am trying to bring back FIFO pipe to history behavior. It is still unclear that if single EOF flag can represent SBS_CANTSENDMORE and SBS_CANTRCVMORE which socket-based version is using, but I have run the poll regression test in tool directory, output is same as the one on 8.3-STABLE now. Not very historic. Only FreeBSD-8 (maybe 9?) did that. I think the output "not ok 18 FIFO state 6b: poll result 0 expected 1. expected POLLHUP; got 0" might be bogus, because newcomer should not know that old writers were gone. I got the same behavior on Linux. 6b is intentionally different from Linux. I forget if it is to reduce races with readers or just to simply the implementation and understanding it. New readers simply joing old readers with a hangup set for all if they manage to open the fifo (necessarily using O_NONBLOCK) after the hangup but before the old readers go away. Since this seems to increase races, I may remember it backwards Our implementation always return POLLIN for disconnected pipe even it should return POLLHUP, but I think it is not wise to remove POLLIN for compatible reason, this is our history behavior. This is historical back to FreeBSD-3 (earlier versions didn't have poll()). I think it is just a bug. POLLHUP was unimplemented for most file types before FreeBSD-8, and setting POLLIN works around this for most callers. I tried to get it fixed for at least fifos when I fixed POLLHUP for some file types. No one uses fifos, so they are safer to fix than sockets :-). I'm sorry but I'm failing to understand the reason for this change. Can you point me out a test that confirm that the change is needed. The only thing I see is an increase in the memory footprint for the pipes. There was a lot of discussions on this topic on -arch mailing list Many poll regression tests fail. http://lists.freebsd.org/pipermail/freebsd-arch/2012-January/012131.html http://lists.freebsd.org/pipermail/freebsd-arch/2012-February/012314.html There are also a lot of old PRs about this for poll() (not for your new fifo implementation). I think the PRs are mentioned in these threads. The old code broke some history semantic of FIFO pipe, you can try the test tool /usr/src/tools/regression/poll/pipepoll, try it before and after my commit, also compare the result with 8.3-STABLE, without this commit, both sub-tests 6c and 6d failed. I think old code did not mimic original code correctly, in 8.3-STABLE code, seqcount is stored in each file, writer generation detection is based on each copy of seqcount, but your code stored single copy of seqcount in fifoinfo object which is store as vnode data, and made the writer generation flag global by setting PIPE_SAMEWGEN in pipe object and used this flag to determine if it should return POLLHUP/POLLIN or not, this is wrong, for example: when there is no writer but have old readers, new incoming reader will executes: line 174 and 175: fip->fi_seqcount = fip->fi_wgen - fip->fi_writers; FIFO_WPDWGEN(fip, fpipe); this causes fi_seqcount to be equal to fi_wgen because fi_writer is zero, and FIFO_WPDWGEN() turns on flag PIPE_SAMEWGEN. When PIPE_SAMEWGEN is on, pipe_poll() ignores EOF, this breaks old readers, it causes old reader to get nothing while it should get POLLHUP from poll(). The new incoming reader should get nothing, so I think sub-tests 6b is wrong. Luckily I have forgotten the details for fifos and never understood them all for nameless pipes, so you get to fix it :-). Bruce ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238933 - head/sys/dev/puc
On Tuesday, July 31, 2012 1:23:23 am Max Khon wrote: > Author: fjoe > Date: Tue Jul 31 05:23:23 2012 > New Revision: 238933 > URL: http://svn.freebsd.org/changeset/base/238933 > > Log: > - Change back "d_ofs" to int8_t to not pessimize padding and size of > "struct puc_cfg". > - Use "puc_config_moxa" for Moxa boards that need d_ofs greater than 0x7f > > Prodded by: marcel@, gavin@ > MFC after: 3 days Thanks! -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238765 - head/sys/dev/e1000
On 7/28/12 2:09 AM, Adrian Chadd wrote: Hi, Can you please revert this commit for now? * it has some netmap stuff in it that isn't related to the commit; * it's causing panics due to lock recursion; I can confirm panics with the latest HEAD running under ESX. _mtx_lock_sleep: recursed on non-recursive mutex em0 @ /usr/src/sys/dev/e1000/if_lem.c:881 Tracing pid 12 tid 100030 td 0xfe0002960480 kdb_enter() at kdb_enter+0x3b panic() at panic+0x1d1 _mtx_lock_sleep() at _mtx_lock_sleep+0x35f _mtx_lock_flags() at _mtx_lock_flags+0x111 lem_start() at lem_start+0x34 if_transmit() at if_transmit+0xd6 ether_output_frame() at ether_output_frame+0x45 ether_output() at ether_output+0x548 arpintr() at arpintr+0x10c1 netisr_dispatch_src() at netisr_dispatch_src+0x152 ether_demux() at ether_demux+0x18d ether_nh_input() at ether_nh_input+0x290 netisr_dispatch_src() at netisr_dispatch_src+0x152 lem_intr() at lem_intr+0x3ba intr_event_execute_handlers() at intr_event_execute_handlers+0x6a ithread_loop() at ithread_loop+0xab fork_exit() at fork_exit+0x135 fork_trampoline() at fork_trampoline+0xe --- trap 0, rip = 0, rsp = 0xff8000301cb0, rbp = 0 --- * it likely has other issues you haven't yet found. :) Adrian On 25 July 2012 04:28, Luigi Rizzo wrote: Author: luigi Date: Wed Jul 25 11:28:15 2012 New Revision: 238765 URL: http://svn.freebsd.org/changeset/base/238765 Log: Use legacy interrupts as a default. This gives up to 10% speedup when used in qemu (and this driver is for non-PCIe cards, so probably its largest use is in virtualized environments). Approved by: Jack Vogel MFC after:3 days Modified: head/sys/dev/e1000/if_lem.c Modified: head/sys/dev/e1000/if_lem.c == --- head/sys/dev/e1000/if_lem.c Wed Jul 25 10:55:14 2012(r238764) +++ head/sys/dev/e1000/if_lem.c Wed Jul 25 11:28:15 2012(r238765) @@ -239,6 +239,7 @@ static void lem_enable_wakeup(device static int lem_enable_phy_wakeup(struct adapter *); static voidlem_led_func(void *, int); +#define EM_LEGACY_IRQ /* slightly faster, at least in qemu */ #ifdef EM_LEGACY_IRQ static voidlem_intr(void *); #else /* FAST IRQ */ @@ -1549,6 +1550,13 @@ lem_xmit(struct adapter *adapter, struct u32 txd_upper, txd_lower, txd_used, txd_saved; int error, nsegs, i, j, first, last = 0; +extern int netmap_drop; + if (netmap_drop == 95) { +dropme: + m_freem(*m_headp); + *m_headp = NULL; + return (ENOBUFS); + } m_head = *m_headp; txd_upper = txd_lower = txd_used = txd_saved = 0; @@ -1688,6 +1696,9 @@ lem_xmit(struct adapter *adapter, struct } } + if (netmap_drop == 96) + goto dropme; + adapter->next_avail_tx_desc = i; if (adapter->pcix_82544) @@ -1715,6 +1726,16 @@ lem_xmit(struct adapter *adapter, struct */ ctxd->lower.data |= htole32(E1000_TXD_CMD_EOP | E1000_TXD_CMD_RS); + +if (netmap_drop == 97) { + static int count=0; + if (count++ & 63 != 0) +ctxd->lower.data &= +~htole32(E1000_TXD_CMD_RS); + else + D("preserve RS"); + +} /* * Keep track in the first buffer which * descriptor will be written back @@ -1733,6 +1754,12 @@ lem_xmit(struct adapter *adapter, struct adapter->link_duplex == HALF_DUPLEX) lem_82547_move_tail(adapter); else { +extern int netmap_repeat; + if (netmap_repeat) { + int x; + for (x = 0; x < netmap_repeat; x++) + E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), i); + } E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), i); if (adapter->hw.mac.type == e1000_82547) lem_82547_update_fifo_head(adapter, @@ -2986,6 +3013,13 @@ lem_txeof(struct adapter *adapter) return; } #endif /* DEV_NETMAP */ +{ + static int drops = 0; + if (netmap_copy && drops++ < netmap_copy) + return; + drops = 0; +} + if (adapter->num_tx_desc_avail == adapter->num_tx_desc) return; ___ svn-src-...@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org" -- Andrey Zonov ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238765 - head/sys/dev/e1000
On Tue, Jul 31, 2012 at 8:13 AM, Andrey Zonov wrote: > On 7/28/12 2:09 AM, Adrian Chadd wrote: >> >> Hi, >> >> Can you please revert this commit for now? >> >> * it has some netmap stuff in it that isn't related to the commit; >> * it's causing panics due to lock recursion; > > > I can confirm panics with the latest HEAD running under ESX. > > _mtx_lock_sleep: recursed on non-recursive mutex em0 @ > /usr/src/sys/dev/e1000/if_lem.c:881 > > Tracing pid 12 tid 100030 td 0xfe0002960480 > kdb_enter() at kdb_enter+0x3b > panic() at panic+0x1d1 > _mtx_lock_sleep() at _mtx_lock_sleep+0x35f > _mtx_lock_flags() at _mtx_lock_flags+0x111 > lem_start() at lem_start+0x34 > if_transmit() at if_transmit+0xd6 > ether_output_frame() at ether_output_frame+0x45 > ether_output() at ether_output+0x548 > arpintr() at arpintr+0x10c1 > netisr_dispatch_src() at netisr_dispatch_src+0x152 > ether_demux() at ether_demux+0x18d > ether_nh_input() at ether_nh_input+0x290 > netisr_dispatch_src() at netisr_dispatch_src+0x152 > lem_intr() at lem_intr+0x3ba > intr_event_execute_handlers() at intr_event_execute_handlers+0x6a > ithread_loop() at ithread_loop+0xab > fork_exit() at fork_exit+0x135 > fork_trampoline() at fork_trampoline+0xe > --- trap 0, rip = 0, rsp = 0xff8000301cb0, rbp = 0 --- http://lists.freebsd.org/pipermail/freebsd-current/2012-July/035593.html Cheers, -Garrett ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238943 - head/sys/dev/acpica
On Tue, 2012-07-31 at 03:58 -0700, Alexander Motin wrote: > To help with diagnostics, add C-state type into > dev.cpu.X.cx_supported. Pretty sure that this breaks /etc/rc.d/power_profile Andiry and I went back and forth on this specific thing quite a bit. If you note my commit/revert at svn r238004 and r238009 where I did a similar thing and then had to yank it out. there's a lot of discussion around this point on the acpi mailing lists. http://lists.freebsd.org/pipermail/freebsd-acpi/2012-July/007645.html Sean ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238765 - head/sys/dev/e1000
On Tuesday, July 31, 2012 11:16:07 am Garrett Cooper wrote: > On Tue, Jul 31, 2012 at 8:13 AM, Andrey Zonov wrote: > > On 7/28/12 2:09 AM, Adrian Chadd wrote: > >> > >> Hi, > >> > >> Can you please revert this commit for now? > >> > >> * it has some netmap stuff in it that isn't related to the commit; > >> * it's causing panics due to lock recursion; > > > > > > I can confirm panics with the latest HEAD running under ESX. > > > > _mtx_lock_sleep: recursed on non-recursive mutex em0 @ > > /usr/src/sys/dev/e1000/if_lem.c:881 > > > > Tracing pid 12 tid 100030 td 0xfe0002960480 > > kdb_enter() at kdb_enter+0x3b > > panic() at panic+0x1d1 > > _mtx_lock_sleep() at _mtx_lock_sleep+0x35f > > _mtx_lock_flags() at _mtx_lock_flags+0x111 > > lem_start() at lem_start+0x34 > > if_transmit() at if_transmit+0xd6 > > ether_output_frame() at ether_output_frame+0x45 > > ether_output() at ether_output+0x548 > > arpintr() at arpintr+0x10c1 > > netisr_dispatch_src() at netisr_dispatch_src+0x152 > > ether_demux() at ether_demux+0x18d > > ether_nh_input() at ether_nh_input+0x290 > > netisr_dispatch_src() at netisr_dispatch_src+0x152 > > lem_intr() at lem_intr+0x3ba > > intr_event_execute_handlers() at intr_event_execute_handlers+0x6a > > ithread_loop() at ithread_loop+0xab > > fork_exit() at fork_exit+0x135 > > fork_trampoline() at fork_trampoline+0xe > > --- trap 0, rip = 0, rsp = 0xff8000301cb0, rbp = 0 --- > > http://lists.freebsd.org/pipermail/freebsd-current/2012-July/035593.html I'd prefer you not add the 'locked' variable, but instead have the normal code path just return before the 'out' label. -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238765 - head/sys/dev/e1000
Yes, I agree John, that was ugly, I'm already taking care of it with my changes, I'll send you a copy to check out. Jack On Tue, Jul 31, 2012 at 9:12 AM, John Baldwin wrote: > On Tuesday, July 31, 2012 11:16:07 am Garrett Cooper wrote: > > On Tue, Jul 31, 2012 at 8:13 AM, Andrey Zonov wrote: > > > On 7/28/12 2:09 AM, Adrian Chadd wrote: > > >> > > >> Hi, > > >> > > >> Can you please revert this commit for now? > > >> > > >> * it has some netmap stuff in it that isn't related to the commit; > > >> * it's causing panics due to lock recursion; > > > > > > > > > I can confirm panics with the latest HEAD running under ESX. > > > > > > _mtx_lock_sleep: recursed on non-recursive mutex em0 @ > > > /usr/src/sys/dev/e1000/if_lem.c:881 > > > > > > Tracing pid 12 tid 100030 td 0xfe0002960480 > > > kdb_enter() at kdb_enter+0x3b > > > panic() at panic+0x1d1 > > > _mtx_lock_sleep() at _mtx_lock_sleep+0x35f > > > _mtx_lock_flags() at _mtx_lock_flags+0x111 > > > lem_start() at lem_start+0x34 > > > if_transmit() at if_transmit+0xd6 > > > ether_output_frame() at ether_output_frame+0x45 > > > ether_output() at ether_output+0x548 > > > arpintr() at arpintr+0x10c1 > > > netisr_dispatch_src() at netisr_dispatch_src+0x152 > > > ether_demux() at ether_demux+0x18d > > > ether_nh_input() at ether_nh_input+0x290 > > > netisr_dispatch_src() at netisr_dispatch_src+0x152 > > > lem_intr() at lem_intr+0x3ba > > > intr_event_execute_handlers() at intr_event_execute_handlers+0x6a > > > ithread_loop() at ithread_loop+0xab > > > fork_exit() at fork_exit+0x135 > > > fork_trampoline() at fork_trampoline+0xe > > > --- trap 0, rip = 0, rsp = 0xff8000301cb0, rbp = 0 --- > > > > > http://lists.freebsd.org/pipermail/freebsd-current/2012-July/035593.html > > I'd prefer you not add the 'locked' variable, but instead have the normal > code > path just return before the 'out' label. > > -- > John Baldwin > ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238765 - head/sys/dev/e1000
On Tue, Jul 31, 2012 at 9:20 AM, Jack Vogel wrote: > Yes, I agree John, that was ugly, I'm already taking care of it with my > changes, > I'll send you a copy to check out. Like so: --- //depot/user/gcooper/atf-head/src/sys/dev/e1000/if_lem.c 2012-07-25 17:11:00.0 +++ /scratch/p4/user/gcooper/atf-head/src/sys/dev/e1000/if_lem.c 2012-07-25 17:11:00.0 @@ -1320,9 +1320,10 @@ lem_local_timer, adapter); goto out; } + EM_CORE_UNLOCK(adapter); + lem_rxeof(adapter, -1, NULL); EM_TX_LOCK(adapter); - lem_rxeof(adapter, -1, NULL); lem_txeof(adapter); if (ifp->if_drv_flags & IFF_DRV_RUNNING && !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) @@ -1330,8 +1331,8 @@ EM_TX_UNLOCK(adapter); out: - EM_CORE_UNLOCK(adapter); - return; + if (mtx_owned(&adapter->core_mtx)) + EM_CORE_UNLOCK(adapter); } #else /* EM_FAST_IRQ, then fast interrupt routines only */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238947 - head/sys/dev/ath
Author: adrian Date: Tue Jul 31 16:41:09 2012 New Revision: 238947 URL: http://svn.freebsd.org/changeset/base/238947 Log: Push the rate control and descriptor chaining into the descriptor "set" functions, for both legacy and 802.11n. This will simplify supporting the EDMA chipsets as these two descriptor setup functions can just be overridden in their entirety, hiding all of the subtle differences in setting things up. It's not a permanent solution, as eventually the AR5416 HAL should grow similar versions of the 11n descriptor functions and then those can be used. TODO: * Push the "clr11naggr" call into the legacy setds, just to ensure that retried frames don't end up with the aggregate bits set inappropriately; * Remove the "setlasttxdesc" call from the 11n TX path and push it into setds_11n. * Ensure that setds_11n will work correctly for non-aggregate frames; * .. and then when it does, just unconditionally call "setds_11n" for 11n NICs and "setds" for non-11n NICs. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c == --- head/sys/dev/ath/if_ath_tx.cTue Jul 31 13:11:20 2012 (r238946) +++ head/sys/dev/ath/if_ath_tx.cTue Jul 31 16:41:09 2012 (r238947) @@ -394,6 +394,50 @@ ath_tx_chaindesclist_subframe(struct ath } /* + * Set the rate control fields in the given descriptor based on + * the bf_state fields and node state. + * + * The bfs fields should already be set with the relevant rate + * control information, including whether MRR is to be enabled. + * + * Since the FreeBSD HAL currently sets up the first TX rate + * in ath_hal_setuptxdesc(), this will setup the MRR + * conditionally for the pre-11n chips, and call ath_buf_set_rate + * unconditionally for 11n chips. These require the 11n rate + * scenario to be set if MCS rates are enabled, so it's easier + * to just always call it. The caller can then only set rates 2, 3 + * and 4 if multi-rate retry is needed. + */ +static void +ath_tx_set_ratectrl(struct ath_softc *sc, struct ieee80211_node *ni, +struct ath_buf *bf) +{ + struct ath_rc_series *rc = bf->bf_state.bfs_rc; + + /* If mrr is disabled, blank tries 1, 2, 3 */ + if (! bf->bf_state.bfs_ismrr) + rc[1].tries = rc[2].tries = rc[3].tries = 0; + + /* +* Always call - that way a retried descriptor will +* have the MRR fields overwritten. +* +* XXX TODO: see if this is really needed - setting up +* the first descriptor should set the MRR fields to 0 +* for us anyway. +*/ + if (ath_tx_is_11n(sc)) { + ath_buf_set_rate(sc, ni, bf); + } else { + ath_hal_setupxtxdesc(sc->sc_ah, bf->bf_desc + , rc[1].ratecode, rc[1].tries + , rc[2].ratecode, rc[2].tries + , rc[3].ratecode, rc[3].tries + ); + } +} + +/* * Setup segments+descriptors for an 11n aggregate. * bf_first is the first buffer in the aggregate. * The descriptor list must already been linked together using @@ -471,6 +515,11 @@ ath_tx_setds_11n(struct ath_softc *sc, s */ bf_first->bf_last = bf_prev; + /* +* setup first desc with rate and aggr info +*/ + ath_tx_set_ratectrl(sc, bf_first->bf_node, bf_first); + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: end\n", __func__); } @@ -1039,7 +1088,9 @@ ath_tx_setds(struct ath_softc *sc, struc bf->bf_lastds = ds; bf->bf_last = bf; - /* XXX TODO: Setup descriptor chain */ + /* Set rate control and descriptor chain for this frame */ + ath_tx_set_ratectrl(sc, bf->bf_node, bf); + ath_tx_chaindesclist(sc, bf); } /* @@ -1088,50 +1139,6 @@ ath_tx_do_ratelookup(struct ath_softc *s } /* - * Set the rate control fields in the given descriptor based on - * the bf_state fields and node state. - * - * The bfs fields should already be set with the relevant rate - * control information, including whether MRR is to be enabled. - * - * Since the FreeBSD HAL currently sets up the first TX rate - * in ath_hal_setuptxdesc(), this will setup the MRR - * conditionally for the pre-11n chips, and call ath_buf_set_rate - * unconditionally for 11n chips. These require the 11n rate - * scenario to be set if MCS rates are enabled, so it's easier - * to just always call it. The caller can then only set rates 2, 3 - * and 4 if multi-rate retry is needed. - */ -static void -ath_tx_set_ratectrl(struct ath_softc *sc, struct ieee80211_node *ni, -struct ath_buf *bf) -{ - struct ath_rc_series *rc = bf->bf_state.bfs_rc; - - /* If mrr is disabled, blank tries 1, 2, 3 */ - if (! bf->bf_state.bfs_ismrr) - rc[1].tries = rc[2].tries = rc[3].tries = 0; - - /* -* Always call - that wa
svn commit: r238948 - head/usr.bin/find
Author: jilles Date: Tue Jul 31 16:55:41 2012 New Revision: 238948 URL: http://svn.freebsd.org/changeset/base/238948 Log: find: Remove unnecessary and inconsistent initialization. Submitted by: jhb Modified: head/usr.bin/find/main.c Modified: head/usr.bin/find/main.c == --- head/usr.bin/find/main.cTue Jul 31 16:41:09 2012(r238947) +++ head/usr.bin/find/main.cTue Jul 31 16:55:41 2012(r238948) @@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$"); time_t now;/* time find was run */ int dotfd; /* starting directory */ int ftsoptions;/* options for the ftsopen(3) call */ -int ignore_readdir_race = 0; /* ignore readdir race */ +int ignore_readdir_race; /* ignore readdir race */ int isdeprecated; /* using deprecated syntax */ int isdepth; /* do directories on post-order visit */ int isoutput; /* user specified output operator */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238943 - head/sys/dev/acpica
On 31.07.2012 19:12, Sean Bruno wrote: On Tue, 2012-07-31 at 03:58 -0700, Alexander Motin wrote: To help with diagnostics, add C-state type into dev.cpu.X.cx_supported. Pretty sure that this breaks /etc/rc.d/power_profile No, it doesn't. I've checked it beforehand. At least in my case variable was correctly set to C3. Andiry and I went back and forth on this specific thing quite a bit. If you note my commit/revert at svn r238004 and r238009 where I did a similar thing and then had to yank it out. there's a lot of discussion around this point on the acpi mailing lists. http://lists.freebsd.org/pipermail/freebsd-acpi/2012-July/007645.html I knew about that change and its revert. But it was much more invasive, substituting C-state index with C-state type, that I also consider incorrect. My change is much more simple. Yes, it may affect some POLA, but that is all. I wanted to do this for several years, and I believe that in this case benefits overweight negative side. But if someone tell I should back it out, I will. -- Alexander Motin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238949 - head/sys/dev/ath
Author: adrian Date: Tue Jul 31 17:08:29 2012 New Revision: 238949 URL: http://svn.freebsd.org/changeset/base/238949 Log: Shuffle the call to ath_hal_setuplasttxdesc() to _after_ the rate control code is called and remove it from ath_buf_set_rate(). For the legacy (non-11n API) TX routines, ath_hal_filltxdesc() takes care of setting up the intermediary and final descriptors right, complete with copying the rate control info into the final descriptor so the rate modules can grab it. The 11n version doesn't do this - ath_hal_chaintxdesc() doesn't copy the rate control bits over, nor does it clear isaggr/moreaggr/ pad delimiters. So the call to setuplasttxdesc() is needed here. So: * legacy NICs - never call the 11n rate control stuff, so filltxdesc copies the rate control info right; * 11n NICs transmitting legacy or 11n non-aggregate frames - ath_hal_set11nratescenario() is called to setup rate control and then ath_hal_filltxdesc() chains them together - so the rate control info is right; * 11n aggregate frames - set11nratescenario() is called, then ath_hal_chaintxdesc() is called to chain a list of aggregate and subframes together. This requires a call to ath_hal_setuplasttxdesc() to complete things. Tested: * AR9280 in station mode TODO: * I really should make sure that the descriptor contents get blanked out correctly or garbage left over from aggregate frames may show up in non-aggregate frames, leading to badness. Modified: head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath_tx.c == --- head/sys/dev/ath/if_ath_tx.cTue Jul 31 16:55:41 2012 (r238948) +++ head/sys/dev/ath/if_ath_tx.cTue Jul 31 17:08:29 2012 (r238949) @@ -496,13 +496,6 @@ ath_tx_setds_11n(struct ath_softc *sc, s bf_first->bf_state.bfs_ctsduration); /* -* Setup the last descriptor in the list. -* bf_prev points to the last; bf is NULL here. -*/ - ath_hal_setuplasttxdesc(sc->sc_ah, bf_prev->bf_desc, - bf_first->bf_desc); - - /* * Set the first descriptor bf_lastds field to point to * the last descriptor in the last subframe, that's where * the status update will occur. @@ -520,6 +513,13 @@ ath_tx_setds_11n(struct ath_softc *sc, s */ ath_tx_set_ratectrl(sc, bf_first->bf_node, bf_first); + /* +* Setup the last descriptor in the list. +* bf_prev points to the last; bf is NULL here. +*/ + ath_hal_setuplasttxdesc(sc->sc_ah, bf_prev->bf_desc, + bf_first->bf_desc); + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: end\n", __func__); } Modified: head/sys/dev/ath/if_ath_tx_ht.c == --- head/sys/dev/ath/if_ath_tx_ht.c Tue Jul 31 16:55:41 2012 (r238948) +++ head/sys/dev/ath/if_ath_tx_ht.c Tue Jul 31 17:08:29 2012 (r238949) @@ -560,14 +560,12 @@ ath_rateseries_print(struct ath_softc *s * This isn't useful for sending beacon frames, which has different needs * wrt what's passed into the rate scenario function. */ - void ath_buf_set_rate(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf) { HAL_11N_RATE_SERIES series[4]; struct ath_desc *ds = bf->bf_desc; - struct ath_desc *lastds = NULL; struct ath_hal *ah = sc->sc_ah; int is_pspoll = (bf->bf_state.bfs_atype == HAL_PKT_TYPE_PSPOLL); int ctsrate = bf->bf_state.bfs_ctsrate; @@ -578,13 +576,6 @@ ath_buf_set_rate(struct ath_softc *sc, s ath_rateseries_setup(sc, ni, bf, series); - /* Enforce AR5416 aggregate limit - can't do RTS w/ an agg frame > 8k */ - - /* Enforce RTS and CTS are mutually exclusive */ - - /* Get a pointer to the last tx descriptor in the list */ - lastds = bf->bf_lastds; - #if 0 printf("pktlen: %d; flags 0x%x\n", pktlen, flags); ath_rateseries_print(sc, series); @@ -602,21 +593,6 @@ ath_buf_set_rate(struct ath_softc *sc, s 4, /* number of series */ flags); - /* Setup the last descriptor in the chain */ - /* -* XXX Why is this done here, and not in the upper layer? -* The rate control code stores a copy of the RC info in -* the last descriptor as well as the first, then uses -* the shadow copy in the last descriptor to see what the RC -* decisions were. I'm not sure why; perhaps earlier hardware -* overwrote the first descriptor contents. -* -* In the 802.11n case, it also clears the moreaggr/delim -* fields. Again, this should be done by the caller of -* ath_buf_set_rate(). -*/ - ath_hal_setuplasttxdesc(ah, lastds, d
svn commit: r238950 - head/cddl/contrib/opensolaris/cmd/zpool
Author: mm Date: Tue Jul 31 17:28:28 2012 New Revision: 238950 URL: http://svn.freebsd.org/changeset/base/238950 Log: Fix reporting of root pool upgrade notice. MFC after:2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c == --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cTue Jul 31 17:08:29 2012(r238949) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cTue Jul 31 17:28:28 2012(r238950) @@ -4409,6 +4409,7 @@ typedef struct upgrade_cbdata { char**cb_argv; } upgrade_cbdata_t; +#ifdef __FreeBSD__ static int is_root_pool(zpool_handle_t *zhp) { @@ -4434,6 +4435,14 @@ is_root_pool(zpool_handle_t *zhp) return (poolname != NULL && strcmp(poolname, zpool_get_name(zhp)) == 0); } +static void +root_pool_upgrade_check(zpool_handle_t *zhp, char *poolname, int size) { + + if (poolname[0] == '\0' && is_root_pool(zhp)) + (void) strlcpy(poolname, zpool_get_name(zhp), size); +} +#endif /* FreeBSD */ + static int upgrade_version(zpool_handle_t *zhp, uint64_t version) { @@ -4524,12 +4533,8 @@ upgrade_cb(zpool_handle_t *zhp, void *ar if (ret != 0) return (ret); #ifdef __FreeBSD__ - if (cbp->cb_poolname[0] == '\0' && - is_root_pool(zhp)) { - (void) strlcpy(cbp->cb_poolname, - zpool_get_name(zhp), - sizeof(cbp->cb_poolname)); - } + root_pool_upgrade_check(zhp, cbp->cb_poolname, + sizeof(cbp->cb_poolname)); #endif /* ___FreeBSD__ */ printnl = B_TRUE; @@ -4682,17 +4687,12 @@ upgrade_one(zpool_handle_t *zhp, void *d if (cur_version != cbp->cb_version) { printnl = B_TRUE; ret = upgrade_version(zhp, cbp->cb_version); - if (ret != 0) { + if (ret != 0) + return (ret); #ifdef __FreeBSD__ - if (cbp->cb_poolname[0] == '\0' && - is_root_pool(zhp)) { - (void) strlcpy(cbp->cb_poolname, - zpool_get_name(zhp), - sizeof(cbp->cb_poolname)); - } + root_pool_upgrade_check(zhp, cbp->cb_poolname, + sizeof(cbp->cb_poolname)); #endif /* ___FreeBSD__ */ - return (ret); - } } if (cbp->cb_version >= SPA_VERSION_FEATURES) { @@ -4703,15 +4703,15 @@ upgrade_one(zpool_handle_t *zhp, void *d if (count != 0) { printnl = B_TRUE; +#ifdef __FreeBSD__ + root_pool_upgrade_check(zhp, cbp->cb_poolname, + sizeof(cbp->cb_poolname)); +#endif /* __FreeBSD __*/ } else if (cur_version == SPA_VERSION) { (void) printf(gettext("Pool '%s' already has all " "supported features enabled.\n"), zpool_get_name(zhp)); } - if (cbp->cb_poolname[0] == '\0' && is_root_pool(zhp)) { - (void) strlcpy(cbp->cb_poolname, zpool_get_name(zhp), - sizeof(cbp->cb_poolname)); - } } if (printnl) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238951 - head/cddl/contrib/opensolaris/cmd/zpool
Author: mm Date: Tue Jul 31 17:32:28 2012 New Revision: 238951 URL: http://svn.freebsd.org/changeset/base/238951 Log: Fix wrong indent according to style(9) MFC after:2 weeks > Description of fields to fill in above: 76 columns --| > PR:If a GNATS PR is affected by the change. > Submitted by: If someone else sent in the change. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > Security: Vulnerability reference (one per line) or description. > Empty fields above will be automatically removed. Mzpool_main.c Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c == --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cTue Jul 31 17:28:28 2012(r238950) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cTue Jul 31 17:32:28 2012(r238951) @@ -4704,8 +4704,8 @@ upgrade_one(zpool_handle_t *zhp, void *d if (count != 0) { printnl = B_TRUE; #ifdef __FreeBSD__ - root_pool_upgrade_check(zhp, cbp->cb_poolname, - sizeof(cbp->cb_poolname)); + root_pool_upgrade_check(zhp, cbp->cb_poolname, + sizeof(cbp->cb_poolname)); #endif /* __FreeBSD __*/ } else if (cur_version == SPA_VERSION) { (void) printf(gettext("Pool '%s' already has all " ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238765 - head/sys/dev/e1000
No, like so: --- if_lem.c2012-07-31 18:32:50.0 -0700 +++ if_lem.jfv.c2012-07-31 18:31:25.0 -0700 @@ -1,6 +1,6 @@ /** - Copyright (c) 2001-2011, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -85,7 +85,7 @@ /* * Legacy Em Driver version: */ -char lem_driver_version[] = "1.0.4"; +char lem_driver_version[] = "1.0.5"; /* * PCI Device ID Table @@ -239,16 +239,12 @@ static intlem_enable_phy_wakeup(struct adapter *); static voidlem_led_func(void *, int); -#define EM_LEGACY_IRQ/* slightly faster, at least in qemu */ -#ifdef EM_LEGACY_IRQ static voidlem_intr(void *); -#else /* FAST IRQ */ static intlem_irq_fast(void *); static voidlem_handle_rxtx(void *context, int pending); static voidlem_handle_link(void *context, int pending); static voidlem_add_rx_process_limit(struct adapter *, const char *, const char *, int *, int); -#endif /* ~EM_LEGACY_IRQ */ #ifdef DEVICE_POLLING static poll_handler_t lem_poll; @@ -305,11 +301,13 @@ TUNABLE_INT("hw.em.smart_pwr_down", &lem_smart_pwr_down); TUNABLE_INT("hw.em.sbp", &lem_debug_sbp); -#ifndef EM_LEGACY_IRQ +/* Interrupt style - default to fast */ +static int lem_use_legacy_irq = 0; +TUNABLE_INT("hw.em.use_legacy_irq", &lem_use_legacy_irq); + /* How many packets rxeof tries to clean at a time */ static int lem_rx_process_limit = 100; TUNABLE_INT("hw.em.rx_process_limit", &lem_rx_process_limit); -#endif /* Flow control setting - default to FULL */ static int lem_fc_setting = e1000_fc_full; @@ -451,12 +449,10 @@ lem_tx_abs_int_delay_dflt); } -#ifndef EM_LEGACY_IRQ /* Sysctls for limiting the amount of work done in the taskqueue */ lem_add_rx_process_limit(adapter, "rx_processing_limit", "max number of rx packets to process", &adapter->rx_process_limit, lem_rx_process_limit); -#endif /* Sysctl for setting the interface flow control */ lem_set_flow_cntrl(adapter, "flow_control", @@ -1198,22 +1194,6 @@ callout_reset(&adapter->timer, hz, lem_local_timer, adapter); e1000_clear_hw_cntrs_base_generic(&adapter->hw); -/* MSI/X configuration for 82574 */ -if (adapter->hw.mac.type == e1000_82574) { -int tmp; -tmp = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); -tmp |= E1000_CTRL_EXT_PBA_CLR; -E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, tmp); -/* -** Set the IVAR - interrupt vector routing. -** Each nibble represents a vector, high bit -** is enable, other 3 bits are the MSIX table -** entry, we map RXQ0 to 0, TXQ0 to 1, and -** Link (other) to 2, hence the magic number. -*/ -E1000_WRITE_REG(&adapter->hw, E1000_IVAR, 0x800A0908); -} - #ifdef DEVICE_POLLING /* * Only enable interrupts if we are not polling, make sure @@ -1282,7 +1262,6 @@ } #endif /* DEVICE_POLLING */ -#ifdef EM_LEGACY_IRQ /* * * Legacy Interrupt Service routine @@ -1296,7 +1275,8 @@ u32reg_icr; -if (ifp->if_capenable & IFCAP_POLLING) +if ((ifp->if_capenable & IFCAP_POLLING) || +((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)) return; EM_CORE_LOCK(adapter); @@ -1304,11 +1284,10 @@ if (reg_icr & E1000_ICR_RXO) adapter->rx_overruns++; -if ((reg_icr == 0x) || (reg_icr == 0)) -goto out; - -if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) -goto out; +if ((reg_icr == 0x) || (reg_icr == 0)) { +EM_CORE_UNLOCK(adapter); +return; +} if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { callout_stop(&adapter->timer); @@ -1318,23 +1297,22 @@ lem_tx_purge(adapter); callout_reset(&adapter->timer, hz, lem_local_timer, adapter); -goto out; +EM_CORE_UNLOCK(adapter); +return; } -EM_TX_LOCK(adapter); +EM_CORE_UNLOCK(adapter); lem_rxeof(adapter, -1, NULL); + +EM_TX_LOCK(adapter); lem_txeof(adapter); if (ifp->if_drv_flags & IFF_DRV_RUNNING && !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) lem_start_locked(ifp); EM_TX_UNLOCK(adapter); - -out: -EM_CORE_UNLOCK(adapter); return; } -#else /* EM_FAST_IRQ, then fast interrupt routines only */ static void lem_handle_link(void *context, int pending) @@ -1418,7 +1396,6 @@ adapter->rx_overruns++; return FILTER_HANDLED; } -#endif /* ~EM_LEGACY_IRQ */ /**
Re: svn commit: r238765 - head/sys/dev/e1000
On Tuesday, July 31, 2012 12:29:32 pm Garrett Cooper wrote: > On Tue, Jul 31, 2012 at 9:20 AM, Jack Vogel wrote: > > Yes, I agree John, that was ugly, I'm already taking care of it with my > > changes, > > I'll send you a copy to check out. > > Like so: > > --- //depot/user/gcooper/atf-head/src/sys/dev/e1000/if_lem.c > 2012-07-25 17:11:00.0 > +++ /scratch/p4/user/gcooper/atf-head/src/sys/dev/e1000/if_lem.c > 2012-07-25 17:11:00.0 > @@ -1320,9 +1320,10 @@ > lem_local_timer, adapter); > goto out; > } > + EM_CORE_UNLOCK(adapter); > > + lem_rxeof(adapter, -1, NULL); > EM_TX_LOCK(adapter); > - lem_rxeof(adapter, -1, NULL); > lem_txeof(adapter); > if (ifp->if_drv_flags & IFF_DRV_RUNNING && > !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) > @@ -1330,8 +1331,8 @@ > EM_TX_UNLOCK(adapter); > > out: > - EM_CORE_UNLOCK(adapter); > - return; > + if (mtx_owned(&adapter->core_mtx)) > + EM_CORE_UNLOCK(adapter); > } No, mtx_owned() is equally bad (I'd rather people be intentional about what locks they hold when, mtx_owned() allows people to be lazy IMO). Just do this: EM_TX_UNLOCK(adapter); return; out: EM_CORE_UNLOCK(adapter); } -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238943 - head/sys/dev/acpica
On Tue, 2012-07-31 at 09:12 -0700, Sean Bruno wrote: > On Tue, 2012-07-31 at 03:58 -0700, Alexander Motin wrote: > > To help with diagnostics, add C-state type into > > dev.cpu.X.cx_supported. > > Pretty sure that this breaks /etc/rc.d/power_profile > > Andiry and I went back and forth on this specific thing quite a bit. If > you note my commit/revert at svn r238004 and r238009 where I did a > similar thing and then had to yank it out. > > there's a lot of discussion around this point on the acpi mailing lists. > http://lists.freebsd.org/pipermail/freebsd-acpi/2012-July/007645.html > > Sean > Upon further review and discussion, I remove my objection to this commit. It does *not* break power_profile in my test cases. sean ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238765 - head/sys/dev/e1000
On Tuesday, July 31, 2012 1:46:59 pm Jack Vogel wrote: > No, like so: This looks good to me. The 82574 is supported by em(4) and not lem(4) it seems, hence removing that? -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238765 - head/sys/dev/e1000
Right, that code got left in lem when i split it off from em by mistake, just cleaning that up. Will commit this then. Jack On Tue, Jul 31, 2012 at 11:09 AM, John Baldwin wrote: > On Tuesday, July 31, 2012 1:46:59 pm Jack Vogel wrote: > > No, like so: > > This looks good to me. The 82574 is supported by em(4) and not lem(4) it > seems, hence removing that? > > -- > John Baldwin > ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238952 - head/sys/kern
Author: jhb Date: Tue Jul 31 18:25:00 2012 New Revision: 238952 URL: http://svn.freebsd.org/changeset/base/238952 Log: Reorder the managament of advisory locks on open files so that the advisory lock is obtained before the write count is increased during open() and the lock is released after the write count is decreased during close(). The first change closes a race where an open() that will block with O_SHLOCK or O_EXLOCK can increase the write count while it waits. If the process holding the current lock on the file then tries to call exec() on the file it has locked, it can fail with ETXTBUSY even though the advisory lock is preventing other threads from succesfully completeing a writable open(). The second change closes a race where a read-only open() with O_SHLOCK or O_EXLOCK may return successfully while the write count is non-zero due to another descriptor that had the advisory lock and was blocking the open() still being in the process of closing. If the process that completed the open() then attempts to call exec() on the file it locked, it can fail with ETXTBUSY even though the other process that held a write lock has closed the file and released the lock. Reviewed by: kib MFC after:1 month Modified: head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_syscalls.c == --- head/sys/kern/vfs_syscalls.cTue Jul 31 17:32:28 2012 (r238951) +++ head/sys/kern/vfs_syscalls.cTue Jul 31 18:25:00 2012 (r238952) @@ -1093,8 +1093,7 @@ kern_openat(struct thread *td, int fd, c struct file *fp; struct vnode *vp; int cmode; - int type, indx = -1, error; - struct flock lf; + int indx = -1, error; struct nameidata nd; int vfslocked; cap_rights_t rights_needed = CAP_LOOKUP; @@ -1180,26 +1179,11 @@ kern_openat(struct thread *td, int fd, c if (fp->f_ops == &badfileops) { KASSERT(vp->v_type != VFIFO, ("Unexpected fifo.")); fp->f_seqcount = 1; - finit(fp, flags & FMASK, DTYPE_VNODE, vp, &vnops); + finit(fp, (flags & FMASK) | (fp->f_flag & FHASLOCK), DTYPE_VNODE, + vp, &vnops); } VOP_UNLOCK(vp, 0); - if (fp->f_type == DTYPE_VNODE && (flags & (O_EXLOCK | O_SHLOCK)) != 0) { - lf.l_whence = SEEK_SET; - lf.l_start = 0; - lf.l_len = 0; - if (flags & O_EXLOCK) - lf.l_type = F_WRLCK; - else - lf.l_type = F_RDLCK; - type = F_FLOCK; - if ((flags & FNONBLOCK) == 0) - type |= F_WAIT; - if ((error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, - type)) != 0) - goto bad; - atomic_set_int(&fp->f_flag, FHASLOCK); - } if (flags & O_TRUNC) { error = fo_truncate(fp, 0, td->td_ucred, td); if (error) @@ -4483,9 +4467,8 @@ sys_fhopen(td, uap) struct mount *mp; struct vnode *vp; struct fhandle fhp; - struct flock lf; struct file *fp; - int fmode, error, type; + int fmode, error; int vfslocked; int indx; @@ -4542,24 +4525,9 @@ sys_fhopen(td, uap) #endif fp->f_vnode = vp; fp->f_seqcount = 1; - finit(fp, fmode & FMASK, DTYPE_VNODE, vp, &vnops); + finit(fp, (fmode & FMASK) | (fp->f_flag & FHASLOCK), DTYPE_VNODE, vp, + &vnops); VOP_UNLOCK(vp, 0); - if (fmode & (O_EXLOCK | O_SHLOCK)) { - lf.l_whence = SEEK_SET; - lf.l_start = 0; - lf.l_len = 0; - if (fmode & O_EXLOCK) - lf.l_type = F_WRLCK; - else - lf.l_type = F_RDLCK; - type = F_FLOCK; - if ((fmode & FNONBLOCK) == 0) - type |= F_WAIT; - if ((error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, - type)) != 0) - goto bad; - atomic_set_int(&fp->f_flag, FHASLOCK); - } if (fmode & O_TRUNC) { error = fo_truncate(fp, 0, td->td_ucred, td); if (error) Modified: head/sys/kern/vfs_vnops.c == --- head/sys/kern/vfs_vnops.c Tue Jul 31 17:32:28 2012(r238951) +++ head/sys/kern/vfs_vnops.c Tue Jul 31 18:25:00 2012(r238952) @@ -229,8 +229,10 @@ int vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred, struct thread *td, struct file *fp) { + struct mount *mp; accmode_t accmode; - int error; + struct flock lf; + int error, have_flock, lock_flags, type;
svn commit: r238953 - head/sys/dev/e1000
Author: jfv Date: Tue Jul 31 18:44:10 2012 New Revision: 238953 URL: http://svn.freebsd.org/changeset/base/238953 Log: Clean up some unused leftover code from em Make IRQ style a tuneable Fix lock handling in the interrupt handler MFC after:3 days Modified: head/sys/dev/e1000/if_lem.c Modified: head/sys/dev/e1000/if_lem.c == --- head/sys/dev/e1000/if_lem.c Tue Jul 31 18:25:00 2012(r238952) +++ head/sys/dev/e1000/if_lem.c Tue Jul 31 18:44:10 2012(r238953) @@ -1,6 +1,6 @@ /** - Copyright (c) 2001-2011, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -85,7 +85,7 @@ /* * Legacy Em Driver version: */ -char lem_driver_version[] = "1.0.4"; +char lem_driver_version[] = "1.0.5"; /* * PCI Device ID Table @@ -239,16 +239,12 @@ static void lem_enable_wakeup(device static int lem_enable_phy_wakeup(struct adapter *); static voidlem_led_func(void *, int); -#define EM_LEGACY_IRQ /* slightly faster, at least in qemu */ -#ifdef EM_LEGACY_IRQ static voidlem_intr(void *); -#else /* FAST IRQ */ static int lem_irq_fast(void *); static voidlem_handle_rxtx(void *context, int pending); static voidlem_handle_link(void *context, int pending); static voidlem_add_rx_process_limit(struct adapter *, const char *, const char *, int *, int); -#endif /* ~EM_LEGACY_IRQ */ #ifdef DEVICE_POLLING static poll_handler_t lem_poll; @@ -305,11 +301,13 @@ TUNABLE_INT("hw.em.txd", &lem_txd); TUNABLE_INT("hw.em.smart_pwr_down", &lem_smart_pwr_down); TUNABLE_INT("hw.em.sbp", &lem_debug_sbp); -#ifndef EM_LEGACY_IRQ +/* Interrupt style - default to fast */ +static int lem_use_legacy_irq = 0; +TUNABLE_INT("hw.em.use_legacy_irq", &lem_use_legacy_irq); + /* How many packets rxeof tries to clean at a time */ static int lem_rx_process_limit = 100; TUNABLE_INT("hw.em.rx_process_limit", &lem_rx_process_limit); -#endif /* Flow control setting - default to FULL */ static int lem_fc_setting = e1000_fc_full; @@ -451,12 +449,10 @@ lem_attach(device_t dev) lem_tx_abs_int_delay_dflt); } -#ifndef EM_LEGACY_IRQ /* Sysctls for limiting the amount of work done in the taskqueue */ lem_add_rx_process_limit(adapter, "rx_processing_limit", "max number of rx packets to process", &adapter->rx_process_limit, lem_rx_process_limit); -#endif /* Sysctl for setting the interface flow control */ lem_set_flow_cntrl(adapter, "flow_control", @@ -1198,22 +1194,6 @@ lem_init_locked(struct adapter *adapter) callout_reset(&adapter->timer, hz, lem_local_timer, adapter); e1000_clear_hw_cntrs_base_generic(&adapter->hw); - /* MSI/X configuration for 82574 */ - if (adapter->hw.mac.type == e1000_82574) { - int tmp; - tmp = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); - tmp |= E1000_CTRL_EXT_PBA_CLR; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, tmp); - /* - ** Set the IVAR - interrupt vector routing. - ** Each nibble represents a vector, high bit - ** is enable, other 3 bits are the MSIX table - ** entry, we map RXQ0 to 0, TXQ0 to 1, and - ** Link (other) to 2, hence the magic number. - */ - E1000_WRITE_REG(&adapter->hw, E1000_IVAR, 0x800A0908); - } - #ifdef DEVICE_POLLING /* * Only enable interrupts if we are not polling, make sure @@ -1282,7 +1262,6 @@ lem_poll(struct ifnet *ifp, enum poll_cm } #endif /* DEVICE_POLLING */ -#ifdef EM_LEGACY_IRQ /* * * Legacy Interrupt Service routine @@ -1296,7 +1275,8 @@ lem_intr(void *arg) u32 reg_icr; - if (ifp->if_capenable & IFCAP_POLLING) + if ((ifp->if_capenable & IFCAP_POLLING) || + ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)) return; EM_CORE_LOCK(adapter); @@ -1304,11 +1284,10 @@ lem_intr(void *arg) if (reg_icr & E1000_ICR_RXO) adapter->rx_overruns++; - if ((reg_icr == 0x) || (reg_icr == 0)) - goto out; - - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - goto out; + if ((reg_icr == 0x) || (reg_icr == 0)) { + EM_CORE_UNLOCK(adapter); + return; + } if (reg_icr
svn commit: r238954 - head/sys/dev/pccbb
Author: adrian Date: Tue Jul 31 18:47:17 2012 New Revision: 238954 URL: http://svn.freebsd.org/changeset/base/238954 Log: Restore the PCI bridge configuration upon resume. This allows my TI1510 cardbus/PCI bridge to work after a suspend/resume, without having to unload/reload the cbb driver. I've also tested this on stable/9. I'll MFC it shortly. PR: kern/170058 Reviewed by: jhb MFC after:1 day Modified: head/sys/dev/pccbb/pccbb_pci.c Modified: head/sys/dev/pccbb/pccbb_pci.c == --- head/sys/dev/pccbb/pccbb_pci.c Tue Jul 31 18:44:10 2012 (r238953) +++ head/sys/dev/pccbb/pccbb_pci.c Tue Jul 31 18:47:17 2012 (r238954) @@ -465,6 +465,11 @@ cbb_chipinit(struct cbb_softc *sc) if (pci_read_config(sc->dev, PCIR_LATTIMER, 1) < 0x20) pci_write_config(sc->dev, PCIR_LATTIMER, 0x20, 1); + /* Restore bus configuration */ + pci_write_config(sc->dev, PCIR_PRIBUS_2, sc->pribus, 1); + pci_write_config(sc->dev, PCIR_SECBUS_2, sc->secbus, 1); + pci_write_config(sc->dev, PCIR_SUBBUS_2, sc->subbus, 1); + /* Enable memory access */ PCI_MASK_CONFIG(sc->dev, PCIR_COMMAND, | PCIM_CMD_MEMEN ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238952 - head/sys/kern
On Tuesday, July 31, 2012 2:25:01 pm John Baldwin wrote: > Author: jhb > Date: Tue Jul 31 18:25:00 2012 > New Revision: 238952 > URL: http://svn.freebsd.org/changeset/base/238952 > > Log: > Reorder the managament of advisory locks on open files so that the advisory > lock is obtained before the write count is increased during open() and the > lock is released after the write count is decreased during close(). > > The first change closes a race where an open() that will block with O_SHLOCK > or O_EXLOCK can increase the write count while it waits. If the process > holding the current lock on the file then tries to call exec() on the file > it has locked, it can fail with ETXTBUSY even though the advisory lock is > preventing other threads from succesfully completeing a writable open(). > > The second change closes a race where a read-only open() with O_SHLOCK or > O_EXLOCK may return successfully while the write count is non-zero due to > another descriptor that had the advisory lock and was blocking the open() > still being in the process of closing. If the process that completed the > open() then attempts to call exec() on the file it locked, it can fail with > ETXTBUSY even though the other process that held a write lock has closed > the file and released the lock. > > Reviewed by:kib > MFC after: 1 month Oops, should have included: Tested by: pho I have a regression test (of sorts) for this. If you run it on an unpatched system it should start emitting errors within a few seconds. #include #include #include #include #include #include #include #include #include static void usage(void) { fprintf(stderr, "Usage: flock_close_race [args]\n"); exit(1); } static void child(const char *binary) { int fd; /* Exit as soon as our parent exits. */ while (getppid() != 1) { fd = open(binary, O_RDWR | O_EXLOCK); if (fd < 0) { /* * This may get ETXTBSY since exit() will * close its open fd's (thus releasing the * lock), before it releases the vmspace (and * mapping of the binary). */ if (errno == ETXTBSY) continue; err(1, "can't open %s", binary); } close(fd); } exit(0); } static void exec_child(char **av) { int fd; fd = open(av[0], O_RDONLY | O_SHLOCK); execv(av[0], av); err(127, "execv"); } int main(int ac, char **av) { struct stat sb; pid_t pid; if (ac < 2) usage(); if (stat(av[1], &sb) != 0) err(1, "stat(%s)", av[1]); if (!S_ISREG(sb.st_mode)) errx(1, "%s not an executable", av[1]); pid = fork(); if (pid < 0) err(1, "fork"); if (pid == 0) child(av[1]); for (;;) { pid = fork(); if (pid < 0) err(1, "fork"); if (pid == 0) exec_child(av + 1); wait(NULL); } return (0); } -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238955 - head/sys/arm/at91
Author: imp Date: Tue Jul 31 19:14:22 2012 New Revision: 238955 URL: http://svn.freebsd.org/changeset/base/238955 Log: Allow chip selects other than 0. The SAM9260EK board has its dataflash on CS1. Modified: head/sys/arm/at91/at91_spi.c Modified: head/sys/arm/at91/at91_spi.c == --- head/sys/arm/at91/at91_spi.cTue Jul 31 18:47:17 2012 (r238954) +++ head/sys/arm/at91/at91_spi.cTue Jul 31 19:14:22 2012 (r238955) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -144,6 +145,7 @@ at91_spi_attach(device_t dev) * memory and APB bandwidth. * Also, currently we lack a way for lettting both the board and the * slave devices take their maximum supported SPI clocks into account. +* Also, we hard-wire SPI mode to 3. */ csr = SPI_CSR_CPOL | (4 << 16) | (0xff << 8); WR4(sc, SPI_CSR0, csr); @@ -285,7 +287,10 @@ at91_spi_transfer(device_t dev, device_t */ WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS | PDC_PTCR_RXTDIS); -#ifdef SPI_CHIPSEL_SUPPORT + /* +* PSCDEC = 0 has a range of 0..3 for chip select. We +* don't support PSCDEC = 1 which has a range of 0..15. +*/ if (cmd->cs < 0 || cmd->cs > 3) { device_printf(dev, "Invalid chip select %d requested by %s\n", cmd->cs, @@ -293,18 +298,23 @@ at91_spi_transfer(device_t dev, device_t err = EINVAL; goto out; } + #ifdef SPI_CHIP_SELECT_HIGH_SUPPORT + /* +* The AT91RM9200 couldn't do CS high for CS 0. Other chips can, but we +* don't support that yet, or other spi modes. +*/ if (at91_is_rm92() && cmd->cs == 0 && (cmd->flags & SPI_CHIP_SELECT_HIGH) != 0) { device_printf(dev, - "Invalid chip select high requested by %s\n", + "Invalid chip select high requested by %s for cs 0.\n", device_get_nameunit(child)); err = EINVAL; goto out; } #endif - WR4(sc, SPI_MR, (RD4(sc, SPI_MR) & ~0x000f) | CS_TO_MR(cmd->cs)); -#endif + err = (RD4(sc, SPI_MR) & ~0x000f) | CS_TO_MR(cmd->cs); + WR4(sc, SPI_MR, err); /* * Set up the TX side of the transfer. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238956 - head/sys/arm/conf
Author: imp Date: Tue Jul 31 19:39:21 2012 New Revision: 238956 URL: http://svn.freebsd.org/changeset/base/238956 Log: Note about where we can boot this. Modified: head/sys/arm/conf/ATMEL Modified: head/sys/arm/conf/ATMEL == --- head/sys/arm/conf/ATMEL Tue Jul 31 19:14:22 2012(r238955) +++ head/sys/arm/conf/ATMEL Tue Jul 31 19:39:21 2012(r238956) @@ -8,7 +8,8 @@ ident ATMEL include "../at91/std.atmel" -# Arbitrary values for testing purposes. +# Typical values for most SoCs and board configurations. Will not work for +# at91sam9g45 or on some boards with non u-boot boot loaders. optionsSTARTUP_PAGETABLE_ADDR=0x2080 makeoptionsKERNPHYSADDR=0x2000 makeoptionsKERNVIRTADDR=0xc000 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238957 - head/sys/arm/conf
Author: imp Date: Tue Jul 31 19:41:12 2012 New Revision: 238957 URL: http://svn.freebsd.org/changeset/base/238957 Log: Prefer ate over macb. macb doesn't work anymore, and ate has more errata workarounds in it. Modified: head/sys/arm/conf/HL201 head/sys/arm/conf/QILA9G20 head/sys/arm/conf/SAM9G20EK head/sys/arm/conf/SN9G45 Modified: head/sys/arm/conf/HL201 == --- head/sys/arm/conf/HL201 Tue Jul 31 19:39:21 2012(r238956) +++ head/sys/arm/conf/HL201 Tue Jul 31 19:41:12 2012(r238957) @@ -70,7 +70,7 @@ devicerandom device loop device ether device uart -device macb +device ate device mii #devicelxtphy Modified: head/sys/arm/conf/QILA9G20 == --- head/sys/arm/conf/QILA9G20 Tue Jul 31 19:39:21 2012(r238956) +++ head/sys/arm/conf/QILA9G20 Tue Jul 31 19:41:12 2012(r238957) @@ -86,7 +86,6 @@ deviceuart# Serial Ports # Ethernet device ate # Ethernet Driver -#devicemacb# Alternate Ethernet driver device mii option AT91_ATE_USE_RMII Modified: head/sys/arm/conf/SAM9G20EK == --- head/sys/arm/conf/SAM9G20EK Tue Jul 31 19:39:21 2012(r238956) +++ head/sys/arm/conf/SAM9G20EK Tue Jul 31 19:41:12 2012(r238957) @@ -85,7 +85,6 @@ deviceuart# Serial Ports # Ethernet device ate # Ethernet Driver -#devicemacb# Alternate Ethernet driver device mii option AT91_ATE_USE_RMII Modified: head/sys/arm/conf/SN9G45 == --- head/sys/arm/conf/SN9G45Tue Jul 31 19:39:21 2012(r238956) +++ head/sys/arm/conf/SN9G45Tue Jul 31 19:41:12 2012(r238957) @@ -85,7 +85,6 @@ deviceuart# Serial Ports # Ethernet device ate # Ethernet Driver -#devicemacb# Alternate Ethernet driver device mii option AT91_ATE_USE_RMII ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238960 - head/sys/netinet6
Author: bz Date: Tue Jul 31 23:34:06 2012 New Revision: 238960 URL: http://svn.freebsd.org/changeset/base/238960 Log: In case of IPsec he have to do delayed checksum calculations before adding any extension header, or rather before calling into IPsec processing as we may send the packet and not return to IPv6 output processing here. PR: kern/170116 MFC After:3 days Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c == --- head/sys/netinet6/ip6_output.c Tue Jul 31 22:25:29 2012 (r238959) +++ head/sys/netinet6/ip6_output.c Tue Jul 31 23:34:06 2012 (r238960) @@ -306,6 +306,20 @@ ip6_output(struct mbuf *m0, struct ip6_p goto freehdrs; case -1:/* Do IPSec */ needipsec = 1; + /* +* Do delayed checksums now, as we may send before returning. +*/ + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { + plen = m->m_pkthdr.len - sizeof(*ip6); + in6_delayed_cksum(m, plen, sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; + } +#ifdef SCTP + if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { + sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; + } +#endif case 0: /* No IPSec */ default: break; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238961 - in head/sys/dev/ath: . ath_rate/sample
Author: adrian Date: Tue Jul 31 23:54:15 2012 New Revision: 238961 URL: http://svn.freebsd.org/changeset/base/238961 Log: Allow 802.11n hardware to support multi-rate retry when RTS/CTS is enabled. The legacy (pre-802.11n) hardware doesn't support this - although the AR5212 era hardware supports MRR, it doesn't have all the bits needed to support MRR + RTS/CTS. The AR5416 and later support a packet duration and RTS/CTS flags per rate scenario, so we should support it. Tested: * AR9280, STA PR: kern/170302 Modified: head/sys/dev/ath/ath_rate/sample/sample.c head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/ath_rate/sample/sample.c == --- head/sys/dev/ath/ath_rate/sample/sample.c Tue Jul 31 23:34:06 2012 (r238960) +++ head/sys/dev/ath/ath_rate/sample/sample.c Tue Jul 31 23:54:15 2012 (r238961) @@ -502,8 +502,10 @@ ath_rate_findrate(struct ath_softc *sc, goto done; } - /* XXX TODO: this doesn't know about 11gn vs 11g protection; teach it */ - mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT); + mrr = sc->sc_mrretry; + /* XXX check HT protmode too */ + if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot) + mrr = 0; best_rix = pick_best_rate(an, rt, size_bin, !mrr); if (best_rix >= 0) { @@ -910,7 +912,11 @@ ath_rate_tx_complete(struct ath_softc *s short_tries, long_tries); return; } - mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT); + mrr = sc->sc_mrretry; + /* XXX check HT protmode too */ + if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot) + mrr = 0; + if (!mrr || ts->ts_finaltsi == 0) { if (!IS_RATE_DEFINED(sn, final_rix)) { badrate(ifp, 0, ts->ts_rate, long_tries, status); Modified: head/sys/dev/ath/if_ath.c == --- head/sys/dev/ath/if_ath.c Tue Jul 31 23:34:06 2012(r238960) +++ head/sys/dev/ath/if_ath.c Tue Jul 31 23:54:15 2012(r238961) @@ -705,6 +705,12 @@ ath_attach(u_int16_t devid, struct ath_s (void) ath_hal_settxchainmask(sc->sc_ah, tx_chainmask); } + /* +* Disable MRR with protected frames by default. +* Only 802.11n series NICs can handle this. +*/ + sc->sc_mrrprot = 0; /* XXX should be a capability */ + #ifdef ATH_ENABLE_11N /* * Query HT capabilities @@ -714,6 +720,9 @@ ath_attach(u_int16_t devid, struct ath_s int rxs, txs; device_printf(sc->sc_dev, "[HT] enabling HT modes\n"); + + sc->sc_mrrprot = 1; /* XXX should be a capability */ + ic->ic_htcaps = IEEE80211_HTC_HT/* HT operation */ | IEEE80211_HTC_AMPDU /* A-MPDU tx/rx */ | IEEE80211_HTC_AMSDU /* A-MSDU tx/rx */ Modified: head/sys/dev/ath/if_ath_tx.c == --- head/sys/dev/ath/if_ath_tx.cTue Jul 31 23:34:06 2012 (r238960) +++ head/sys/dev/ath/if_ath_tx.cTue Jul 31 23:54:15 2012 (r238961) @@ -1051,11 +1051,12 @@ ath_tx_set_rtscts(struct ath_softc *sc, /* * Must disable multi-rate retry when using RTS/CTS. -* XXX TODO: only for pre-11n NICs. */ - bf->bf_state.bfs_ismrr = 0; - bf->bf_state.bfs_try0 = - bf->bf_state.bfs_rc[0].tries = ATH_TXMGTTRY;/* XXX ew */ + if (!sc->sc_mrrprot) { + bf->bf_state.bfs_ismrr = 0; + bf->bf_state.bfs_try0 = + bf->bf_state.bfs_rc[0].tries = ATH_TXMGTTRY; /* XXX ew */ + } } /* Modified: head/sys/dev/ath/if_athvar.h == --- head/sys/dev/ath/if_athvar.hTue Jul 31 23:34:06 2012 (r238960) +++ head/sys/dev/ath/if_athvar.hTue Jul 31 23:54:15 2012 (r238961) @@ -463,6 +463,7 @@ struct ath_softc { void(*sc_setdefantenna)(struct ath_softc *, u_int); unsigned intsc_invalid : 1,/* disable hardware accesses */ sc_mrretry : 1,/* multi-rate retry support */ + sc_mrrprot : 1,/* MRR + protection support */ sc_softled : 1,/* enable LED gpio status */ sc_hardled : 1,/* enable MAC LED status */ sc_splitmic : 1,/* split TKIP MIC keys */ ___ svn-src-
svn commit: r238962 - head/sys/dev/ath/ath_rate/sample
Author: adrian Date: Wed Aug 1 00:18:02 2012 New Revision: 238962 URL: http://svn.freebsd.org/changeset/base/238962 Log: Fix a case of "mis-located braces". PR: kern/170302 Modified: head/sys/dev/ath/ath_rate/sample/sample.c Modified: head/sys/dev/ath/ath_rate/sample/sample.c == --- head/sys/dev/ath/ath_rate/sample/sample.c Tue Jul 31 23:54:15 2012 (r238961) +++ head/sys/dev/ath/ath_rate/sample/sample.c Wed Aug 1 00:18:02 2012 (r238962) @@ -504,7 +504,7 @@ ath_rate_findrate(struct ath_softc *sc, mrr = sc->sc_mrretry; /* XXX check HT protmode too */ - if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot) + if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT && !sc->sc_mrrprot)) mrr = 0; best_rix = pick_best_rate(an, rt, size_bin, !mrr); @@ -914,7 +914,7 @@ ath_rate_tx_complete(struct ath_softc *s } mrr = sc->sc_mrretry; /* XXX check HT protmode too */ - if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot) + if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT && !sc->sc_mrrprot)) mrr = 0; if (!mrr || ts->ts_finaltsi == 0) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238963 - head/lib/libc/gen
Author: delphij Date: Wed Aug 1 00:21:55 2012 New Revision: 238963 URL: http://svn.freebsd.org/changeset/base/238963 Log: Use calloc(). Modified: head/lib/libc/gen/fts.c Modified: head/lib/libc/gen/fts.c == --- head/lib/libc/gen/fts.c Wed Aug 1 00:18:02 2012(r238962) +++ head/lib/libc/gen/fts.c Wed Aug 1 00:21:55 2012(r238963) @@ -134,9 +134,8 @@ fts_open(argv, options, compar) } /* Allocate/initialize the stream. */ - if ((priv = malloc(sizeof(*priv))) == NULL) + if ((priv = calloc(1, sizeof(*priv))) == NULL) return (NULL); - memset(priv, 0, sizeof(*priv)); sp = &priv->ftsp_fts; sp->fts_compar = compar; sp->fts_options = options; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r238962 - head/sys/dev/ath/ath_rate/sample
On Tue, Jul 31, 2012 at 8:18 PM, Adrian Chadd wrote: > --- head/sys/dev/ath/ath_rate/sample/sample.c Tue Jul 31 23:54:15 2012 > (r238961) > +++ head/sys/dev/ath/ath_rate/sample/sample.c Wed Aug 1 00:18:02 2012 > (r238962) > @@ -504,7 +504,7 @@ ath_rate_findrate(struct ath_softc *sc, > > mrr = sc->sc_mrretry; > /* XXX check HT protmode too */ > - if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot) > + if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT && !sc->sc_mrrprot)) > mrr = 0; > > best_rix = pick_best_rate(an, rt, size_bin, !mrr); Logical '&&' evaluates left-to-right already, so I do not see that the current parentheses are needed? -Ben ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238964 - head/sbin/md5
Author: delphij Date: Wed Aug 1 00:36:12 2012 New Revision: 238964 URL: http://svn.freebsd.org/changeset/base/238964 Log: Teach md5(1) about sha512. MFC after:1 month Modified: head/sbin/md5/Makefile head/sbin/md5/md5.1 head/sbin/md5/md5.c Modified: head/sbin/md5/Makefile == --- head/sbin/md5/Makefile Wed Aug 1 00:21:55 2012(r238963) +++ head/sbin/md5/Makefile Wed Aug 1 00:36:12 2012(r238964) @@ -5,11 +5,13 @@ PROG= md5 LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ ${BINDIR}/md5 ${BINDIR}/sha1 \ - ${BINDIR}/md5 ${BINDIR}/sha256 + ${BINDIR}/md5 ${BINDIR}/sha256 \ + ${BINDIR}/md5 ${BINDIR}/sha512 MLINKS=md5.1 rmd160.1 \ md5.1 sha1.1 \ - md5.1 sha256.1 + md5.1 sha256.1 \ + md5.1 sha512.1 WFORMAT?= 1 Modified: head/sbin/md5/md5.1 == --- head/sbin/md5/md5.1 Wed Aug 1 00:21:55 2012(r238963) +++ head/sbin/md5/md5.1 Wed Aug 1 00:36:12 2012(r238964) @@ -1,9 +1,9 @@ .\" $FreeBSD$ -.Dd September 7, 2008 +.Dd July 31, 2012 .Dt MD5 1 .Os .Sh NAME -.Nm md5 , sha1 , sha256 , rmd160 +.Nm md5 , sha1 , sha256 , sha512, rmd160 .Nd calculate a message-digest fingerprint (checksum) for a file .Sh SYNOPSIS .Nm md5 @@ -21,6 +21,11 @@ .Op Fl c Ar string .Op Fl s Ar string .Op Ar +.Nm sha512 +.Op Fl pqrtx +.Op Fl c Ar string +.Op Fl s Ar string +.Op Ar .Nm rmd160 .Op Fl pqrtx .Op Fl c Ar string @@ -28,7 +33,7 @@ .Op Ar .Sh DESCRIPTION The -.Nm md5 , sha1 , sha256 +.Nm md5 , sha1 , sha256 , sha512 and .Nm rmd160 utilities take as input a message of arbitrary length and produce as @@ -41,7 +46,7 @@ It is conjectured that it is computation produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. The -.Tn MD5 , SHA-1 , SHA-256 +.Tn MD5 , SHA-1 , SHA-256 , SHA-512 and .Tn RIPEMD-160 algorithms are intended for digital signature applications, where a @@ -104,7 +109,7 @@ Run a built-in test script. .El .Sh EXIT STATUS The -.Nm md5 , sha1 , sha256 +.Nm md5 , sha1 , sha256 , sha512 and .Nm rmd160 utilities exit 0 on success, @@ -115,7 +120,8 @@ and 2 if at least one file does not have .Xr md5 3 , .Xr ripemd 3 , .Xr sha 3 , -.Xr sha256 3 +.Xr sha256 3 , +.Xr sha512 3 .Rs .%A R. Rivest .%T The MD5 Message-Digest Algorithm Modified: head/sbin/md5/md5.c == --- head/sbin/md5/md5.c Wed Aug 1 00:21:55 2012(r238963) +++ head/sbin/md5/md5.c Wed Aug 1 00:36:12 2012(r238964) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ typedef char *(DIGEST_End)(void *, char extern const char *MD5TestOutput[MDTESTCOUNT]; extern const char *SHA1_TestOutput[MDTESTCOUNT]; extern const char *SHA256_TestOutput[MDTESTCOUNT]; +extern const char *SHA512_TestOutput[MDTESTCOUNT]; extern const char *RIPEMD160_TestOutput[MDTESTCOUNT]; typedef struct Algorithm_t { @@ -78,12 +80,14 @@ typedef union { MD5_CTX md5; SHA1_CTX sha1; SHA256_CTX sha256; + SHA512_CTX sha512; RIPEMD160_CTX ripemd160; } DIGEST_CTX; /* max(MD5_DIGEST_LENGTH, SHA_DIGEST_LENGTH, - SHA256_DIGEST_LENGTH, RIPEMD160_DIGEST_LENGTH)*2+1 */ -#define HEX_DIGEST_LENGTH 65 + SHA256_DIGEST_LENGTH, SHA512_DIGEST_LENGTH, + RIPEMD160_DIGEST_LENGTH)*2+1 */ +#define HEX_DIGEST_LENGTH 129 /* algorithm function table */ @@ -97,6 +101,9 @@ struct Algorithm_t Algorithm[] = { { "sha256", "SHA256", &SHA256_TestOutput, (DIGEST_Init*)&SHA256_Init, (DIGEST_Update*)&SHA256_Update, (DIGEST_End*)&SHA256_End, &SHA256_Data, &SHA256_File }, + { "sha512", "SHA512", &SHA512_TestOutput, (DIGEST_Init*)&SHA512_Init, + (DIGEST_Update*)&SHA512_Update, (DIGEST_End*)&SHA512_End, + &SHA512_Data, &SHA512_File }, { "rmd160", "RMD160", &RIPEMD160_TestOutput, (DIGEST_Init*)&RIPEMD160_Init, (DIGEST_Update*)&RIPEMD160_Update, (DIGEST_End*)&RIPEMD160_End, &RIPEMD160_Data, &RIPEMD160_File } @@ -320,6 +327,17 @@ const char *SHA256_TestOutput[MDTESTCOUN "e6eae09f10ad4122a0e2a4075761d185a272ebd9f5aa489e998ff2f09cbfdd9f" }; +const char *SHA512_TestOutput[MDTESTCOUNT] = { + "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", + "1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75", + "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a964b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f", +
svn commit: r238965 - head/sys/dev/spibus
Author: imp Date: Wed Aug 1 01:18:36 2012 New Revision: 238965 URL: http://svn.freebsd.org/changeset/base/238965 Log: Add the chip select glue. Modified: head/sys/dev/spibus/spi.h head/sys/dev/spibus/spibus.c Modified: head/sys/dev/spibus/spi.h == --- head/sys/dev/spibus/spi.h Wed Aug 1 00:36:12 2012(r238964) +++ head/sys/dev/spibus/spi.h Wed Aug 1 01:18:36 2012(r238965) @@ -1,6 +1,7 @@ /* $FreeBSD$ */ struct spi_command { + int cs; void*tx_cmd; uint32_t tx_cmd_sz; void*rx_cmd; @@ -10,3 +11,5 @@ struct spi_command { void*rx_data; uint32_t rx_data_sz; }; + +#defineSPI_CHIP_SELECT_HIGH0x1 /* Chip select high (else low) */ Modified: head/sys/dev/spibus/spibus.c == --- head/sys/dev/spibus/spibus.cWed Aug 1 00:36:12 2012 (r238964) +++ head/sys/dev/spibus/spibus.cWed Aug 1 01:18:36 2012 (r238965) @@ -158,6 +158,9 @@ spibus_hinted_child(device_t bus, const static int spibus_transfer_impl(device_t dev, device_t child, struct spi_command *cmd) { + /* Maybe set flags too? spi mode? */ + spibus_get_cs(dev, &cmd->cs); + return (SPIBUS_TRANSFER(device_get_parent(dev), child, cmd)); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"