Add ATI Radeon HD 7850 and 7850 HD Audio to pcidevs

2013-01-13 Thread Thomas Pfaff
Add ATI Radeon HD 7850 and 7850 HD Audio to pcidevs.

Verified with the Windows driver information (I was
unable to find these ids anywhere else).

Index: pcidevs
===
RCS file: /cvs/src/sys/dev/pci/pcidevs,v
retrieving revision 1.1664
diff -u -p -r1.1664 pcidevs
--- pcidevs 2 Jan 2013 05:45:41 -   1.1664
+++ pcidevs 13 Jan 2013 10:09:07 -
@@ -1263,6 +1263,7 @@ product ATI RADEON_X700_PCIE_S0x5e6d  Ra
 product ATI RADEON_X700_SE 0x5e4f  Radeon X700 SE
 product ATI RADEON_X700_SE_S   0x5e6f  Radeon X700 SE Sec
 product ATI RADEON_HD6670  0x6758  Radeon HD 6670
+product ATI RADEON_HD7850  0x6819  Radeon HD 7850
 product ATI RADEON_HD5800  0x6899  Radeon HD 5800
 product ATI RADEON_HD5700  0x68b8  Radeon HD 5700
 product ATI RADEON_HD5670  0x68d8  Radeon HD 5670
@@ -1512,6 +1513,7 @@ product ATI RADEON_HD5600_HDA 0xaa60  Rad
 product ATI RADEON_HD5470_HDA  0xaa68  Radeon HD 5470 Audio
 product ATI RADEON_HD6670_HDA  0xaa90  Radeon HD 6670 Audio
 product ATI RADEON_HD6400_HDA  0xaa98  Radeon HD 6400 Audio
+product ATI RADEON_HD7850_HDA  0xaab0  Radeon HD 7850 HD Audio
 product ATI RS100_AGP  0xcab0  RS100 AGP
 product ATI RS200_AGP  0xcab2  RS200 AGP
 product ATI RS250_AGP  0xcab3  RS250 AGP



Re: PATCH: Print threads in top(1) output

2013-01-13 Thread Philip Guenther
On Mon, 7 Jan 2013, Vadim Zhukov wrote:
 Small nit that allows (immediately) differentiate processes and 
 threads output of top(1). Adds another dependency on machine.h, 
 though. :( Tested on both smart and dumb terminals. Any comments/okays?

Adding an extern declaration to a .c file?  Blech.  Adding an argument 
(...and fixing the incorrect function header comment...) is the Right 
Thing, IMO.

ok?

Philip Guenther

Index: display.c
===
RCS file: /cvs/src/usr.bin/top/display.c,v
retrieving revision 1.43
diff -u -p -r1.43 display.c
--- display.c   5 Jun 2012 18:52:53 -   1.43
+++ display.c   13 Jan 2013 10:52:06 -
@@ -262,12 +262,12 @@ i_timeofday(time_t * tod)
 }
 
 /*
- *  *_procstates(total, brkdn, names) - print the process summary line
+ *  *_procstates(total, brkdn, threads) - print the process/thread summary line
  *
  *  Assumptions:  cursor is at the beginning of the line on entry
  */
 void
-i_procstates(int total, int *brkdn)
+i_procstates(int total, int *brkdn, int threads)
 {
if (screen_length  2 || !smart_terminal) {
int i;
@@ -275,23 +275,26 @@ i_procstates(int total, int *brkdn)
 
move(1, 0);
clrtoeol();
-   /* write current number of processes and remember the value */
-   printwp(%d processes:, total);
+   /* write current number of procs and remember the value */
+   if (threads == Yes)
+   printwp(%d threads:, total);
+   else
+   printwp(%d processes:, total);
 
if (smart_terminal)
move(1, 15);
else {
/* put out enough spaces to get to column 15 */
i = digits(total);
-   while (i++  4) {
+   while (i++  (threads == Yes ? 6 : 4)) {
if (putchar(' ') == EOF)
exit(1);
}
}
 
/* format and print the process state summary */
-   summary_format(procstates_buffer, sizeof(procstates_buffer), 
brkdn,
-   procstate_names);
+   summary_format(procstates_buffer, sizeof(procstates_buffer),
+   brkdn, procstate_names);
 
addstrp(procstates_buffer);
putn();
@@ -299,7 +302,7 @@ i_procstates(int total, int *brkdn)
 }
 
 /*
- *  *_cpustates(states, names) - print the cpu state percentages
+ *  *_cpustates(states) - print the cpu state percentages
  *
  *  Assumptions:  cursor is on the PREVIOUS line
  */
Index: display.h
===
RCS file: /cvs/src/usr.bin/top/display.h,v
retrieving revision 1.11
diff -u -p -r1.11 display.h
--- display.h   22 Nov 2007 11:01:04 -  1.11
+++ display.h   13 Jan 2013 10:52:06 -
@@ -38,7 +38,7 @@ int display_resize(void);
 void i_loadave(int, double *);
 void u_loadave(int, double *);
 void i_timeofday(time_t *);
-void i_procstates(int, int *);
+void i_procstates(int, int *, int);
 void u_procstates(int, int *);
 void i_cpustates(int64_t *);
 void u_cpustates(int64_t *);
Index: top.c
===
RCS file: /cvs/src/usr.bin/top/top.c,v
retrieving revision 1.79
diff -u -p -r1.79 top.c
--- top.c   8 Jun 2012 13:41:16 -   1.79
+++ top.c   13 Jan 2013 10:52:06 -
@@ -452,8 +452,9 @@ restart:
time(curr_time);
i_timeofday(curr_time);
 
-   /* display process state breakdown */
-   i_procstates(system_info.p_total, system_info.procstates);
+   /* display process/threads state breakdown */
+   i_procstates(system_info.p_total, system_info.procstates,
+   ps.threads);
 
/* display the cpu state percentage breakdown */
i_cpustates(system_info.cpustates);



Re: PATCH: Print threads in top(1) output

2013-01-13 Thread Vadim Zhukov
13.01.2013 14:55 пользователь Philip Guenther
guent...@gmail.com
написал:

 On Mon, 7 Jan 2013, Vadim Zhukov wrote:
  Small nit that allows (immediately) differentiate processes and
  threads output of top(1). Adds another dependency on machine.h,
  though. :( Tested on both smart and dumb terminals. Any comments/okays?

 Adding an extern declaration to a .c file?  Blech.  Adding an argument
 (...and fixing the incorrect function header comment...) is the Right
 Thing, IMO.

You're right. I like your diff more.

 ok?

 Philip Guenther

 Index: display.c
 ===
 RCS file: /cvs/src/usr.bin/top/display.c,v
 retrieving revision 1.43
 diff -u -p -r1.43 display.c
 --- display.c   5 Jun 2012 18:52:53 -   1.43
 +++ display.c   13 Jan 2013 10:52:06 -
 @@ -262,12 +262,12 @@ i_timeofday(time_t * tod)
  }

  /*
 - *  *_procstates(total, brkdn, names) - print the process summary line
 + *  *_procstates(total, brkdn, threads) - print the process/thread
summary line
   *
   *  Assumptions:  cursor is at the beginning of the line on entry
   */
  void
 -i_procstates(int total, int *brkdn)
 +i_procstates(int total, int *brkdn, int threads)
  {
 if (screen_length  2 || !smart_terminal) {
 int i;
 @@ -275,23 +275,26 @@ i_procstates(int total, int *brkdn)

 move(1, 0);
 clrtoeol();
 -   /* write current number of processes and remember the
value */
 -   printwp(%d processes:, total);
 +   /* write current number of procs and remember the value */
 +   if (threads == Yes)
 +   printwp(%d threads:, total);
 +   else
 +   printwp(%d processes:, total);

 if (smart_terminal)
 move(1, 15);
 else {
 /* put out enough spaces to get to column 15 */
 i = digits(total);
 -   while (i++  4) {
 +   while (i++  (threads == Yes ? 6 : 4)) {
 if (putchar(' ') == EOF)
 exit(1);
 }
 }

 /* format and print the process state summary */
 -   summary_format(procstates_buffer,
sizeof(procstates_buffer), brkdn,
 -   procstate_names);
 +   summary_format(procstates_buffer,
sizeof(procstates_buffer),
 +   brkdn, procstate_names);

 addstrp(procstates_buffer);
 putn();
 @@ -299,7 +302,7 @@ i_procstates(int total, int *brkdn)
  }

  /*
 - *  *_cpustates(states, names) - print the cpu state percentages
 + *  *_cpustates(states) - print the cpu state percentages
   *
   *  Assumptions:  cursor is on the PREVIOUS line
   */
 Index: display.h
 ===
 RCS file: /cvs/src/usr.bin/top/display.h,v
 retrieving revision 1.11
 diff -u -p -r1.11 display.h
 --- display.h   22 Nov 2007 11:01:04 -  1.11
 +++ display.h   13 Jan 2013 10:52:06 -
 @@ -38,7 +38,7 @@ int display_resize(void);
  void i_loadave(int, double *);
  void u_loadave(int, double *);
  void i_timeofday(time_t *);
 -void i_procstates(int, int *);
 +void i_procstates(int, int *, int);
  void u_procstates(int, int *);
  void i_cpustates(int64_t *);
  void u_cpustates(int64_t *);
 Index: top.c
 ===
 RCS file: /cvs/src/usr.bin/top/top.c,v
 retrieving revision 1.79
 diff -u -p -r1.79 top.c
 --- top.c   8 Jun 2012 13:41:16 -   1.79
 +++ top.c   13 Jan 2013 10:52:06 -
 @@ -452,8 +452,9 @@ restart:
 time(curr_time);
 i_timeofday(curr_time);

 -   /* display process state breakdown */
 -   i_procstates(system_info.p_total, system_info.procstates);
 +   /* display process/threads state breakdown */
 +   i_procstates(system_info.p_total, system_info.procstates,
 +   ps.threads);

 /* display the cpu state percentage breakdown */
 i_cpustates(system_info.cpustates);



Re: Add ATI Radeon HD 7850 and 7850 HD Audio to pcidevs

2013-01-13 Thread Alexey E. Suslikov
Thomas Pfaff tpfaff at tp76.info writes:

  product ATI RADEON_HD6400_HDA0xaa98  Radeon HD 6400 Audio
 +product ATI RADEON_HD7850_HDA0xaab0  Radeon HD 7850 HD Audio

I think 7850 audio entry shouldn't say HD twice (see 6400).



Re: Add ATI Radeon HD 7850 and 7850 HD Audio to pcidevs

2013-01-13 Thread Thomas Pfaff
On Sun, 13 Jan 2013 12:18:50 + (UTC)
Alexey E. Suslikov alexey.susli...@gmail.com wrote:

 Thomas Pfaff tpfaff at tp76.info writes:
 
   product ATI RADEON_HD6400_HDA  0xaa98  Radeon HD 6400 Audio
  +product ATI RADEON_HD7850_HDA  0xaab0  Radeon HD 7850 HD Audio
 
 I think 7850 audio entry shouldn't say HD twice (see 6400).


product ATI RADEON_HD6310_HDA  0x1314  Radeon HD 6310 HD Audio

I'm not sure what's correct.



Re: [miniroot/install.sub] skip x* sets if do not expect to run X.

2013-01-13 Thread Gleydson Soares
please, disregard this diff.
it is definitely wrong.

-- gsoares



pf tcp window check

2013-01-13 Thread Alexander Bluhm
Hi

I think pf sequence number tracking is too strict by one octet.

The bug is triggered by a TCP packet with the FIN bit set and
containing data that fits exactly into the announced window.

This packet announces a window of 1024 octets as scaling factor is 3:
00:58:30.250388 10.188.50.50.45397  10.188.50.10.13330: . ack 130049 win 128 
nop,nop,timestamp 110573613 3971688291 (DF)

The other side sends 1024 octes data and FIN:
00:58:30.251669 10.188.50.10.13330  10.188.50.50.45397: FP 130049:131073(1024) 
ack 1 win 2048 nop,nop,timestamp 3971688291 110573613

The packet counts 1025 stream length to pf, 1024 data + 1 FIN.
These 1025 octets do not fit into the 1024 window so pf drops the
packet.  Our stack generates and accepts the packet as only the
data part has to fit into the socket buffer.

To fix this, pf should only use the data lenght for window comparison.

ok?

bluhm

Index: net/pf.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/pf.c,v
retrieving revision 1.817
diff -u -p -r1.817 pf.c
--- net/pf.c23 Nov 2012 18:35:25 -  1.817
+++ net/pf.c14 Jan 2013 01:40:38 -
@@ -4013,7 +4013,7 @@ pf_tcp_track_full(struct pf_pdesc *pd, s
 {
struct tcphdr   *th = pd-hdr.tcp;
u_int16_twin = ntohs(th-th_win);
-   u_int32_tack, end, seq, orig_seq;
+   u_int32_tack, end, data_end, seq, orig_seq;
u_int8_t sws, dws;
int  ackskew;
 
@@ -4076,6 +4076,7 @@ pf_tcp_track_full(struct pf_pdesc *pd, s
}
}
}
+   data_end = end;
if (th-th_flags  TH_FIN)
end++;
 
@@ -4106,6 +4107,7 @@ pf_tcp_track_full(struct pf_pdesc *pd, s
end = seq + pd-p_len;
if (th-th_flags  TH_SYN)
end++;
+   data_end = end;
if (th-th_flags  TH_FIN)
end++;
}
@@ -4152,7 +4154,7 @@ pf_tcp_track_full(struct pf_pdesc *pd, s
 
 
 #define MAXACKWINDOW (0x + 1500)   /* 1500 is an arbitrary fudge factor */
-   if (SEQ_GEQ(src-seqhi, end) 
+   if (SEQ_GEQ(src-seqhi, data_end) 
/* Last octet inside other's window space */
SEQ_GEQ(seq, src-seqlo - (dst-max_win  dws)) 
/* Retrans: not more than one window back */
@@ -4223,7 +4225,7 @@ pf_tcp_track_full(struct pf_pdesc *pd, s
} else if ((dst-state  TCPS_SYN_SENT ||
dst-state = TCPS_FIN_WAIT_2 ||
src-state = TCPS_FIN_WAIT_2) 
-   SEQ_GEQ(src-seqhi + MAXACKWINDOW, end) 
+   SEQ_GEQ(src-seqhi + MAXACKWINDOW, data_end) 
/* Within a window forward of the originating packet */
SEQ_GEQ(seq, src-seqlo - MAXACKWINDOW)) {
/* Within a window backward of the originating packet */
@@ -4313,12 +4315,13 @@ pf_tcp_track_full(struct pf_pdesc *pd, s
pd-dir == PF_IN ? in : out,
pd-dir == (*state)-direction ? fwd : rev);
addlog(pf: State failure on: %c %c %c %c | %c %c\n,
-   SEQ_GEQ(src-seqhi, end) ? ' ' : '1',
+   SEQ_GEQ(src-seqhi, data_end) ? ' ' : '1',
SEQ_GEQ(seq, src-seqlo - (dst-max_win  dws)) ?
' ': '2',
(ackskew = -MAXACKWINDOW) ? ' ' : '3',
(ackskew = (MAXACKWINDOW  sws)) ? ' ' : '4',
-   SEQ_GEQ(src-seqhi + MAXACKWINDOW, end) ?' ' :'5',
+   SEQ_GEQ(src-seqhi + MAXACKWINDOW, data_end) ?
+   ' ' :'5',
SEQ_GEQ(seq, src-seqlo - MAXACKWINDOW) ?' ' :'6');
}
REASON_SET(reason, PFRES_BADSTATE);



Re: hardware VLAN tagging for vr(4)

2013-01-13 Thread Darren Tucker
Resurrecting this, I've now fixed the problem I introduced when I merged
in your changes and have tested it.

The performance on my ALIX routing from a VLAN to another non-VLAN
interface, iperf TCP went up a little (the CPU is saturated at this
point):

baseline: RX 80.0 Mbits/sec TX 65.2 Mbits/sec
hwtagging: RX 80.4 Mbits/sec TX 73.2 Mbits/sec

ok?

Index: dev/pci/if_vr.c
===
RCS file: /cvs/src/sys/dev/pci/if_vr.c,v
retrieving revision 1.121
diff -u -p -r1.121 if_vr.c
--- dev/pci/if_vr.c 1 Dec 2012 09:55:03 -   1.121
+++ dev/pci/if_vr.c 14 Jan 2013 03:30:55 -
@@ -62,6 +62,7 @@
  */
 
 #include bpfilter.h
+#include vlan.h
 
 #include sys/param.h
 #include sys/systm.h
@@ -83,6 +84,11 @@
 #include net/if_dl.h
 #include net/if_media.h
 
+#if NVLAN  0
+#include net/if_types.h
+#include net/if_vlan_var.h
+#endif
+
 #if NBPFILTER  0
 #include net/bpf.h
 #endif
@@ -632,6 +638,12 @@ vr_attach(struct device *parent, struct 
ifp-if_capabilities |= IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 |
IFCAP_CSUM_UDPv4;
 
+#if NVLAN  0
+   /* if the hardware can do VLAN tagging, say so. */
+   if (sc-vr_quirks  VR_Q_HWTAG)
+   ifp-if_capabilities |= IFCAP_VLAN_HWTAGGING;
+#endif
+
 #ifndef SMALL_KERNEL
if (sc-vr_revid = REV_ID_VT3065_A) {
ifp-if_capabilities |= IFCAP_WOL;
@@ -874,6 +886,21 @@ vr_rxeof(struct vr_softc *sc)
cur_rx-vr_map-dm_mapsize, BUS_DMASYNC_POSTREAD);
bus_dmamap_unload(sc-sc_dmat, cur_rx-vr_map);
 
+#if NVLAN  0
+   /*
+* If there's a tagged packet, the 802.1q header will be at the
+* 4-byte boundary following the CRC.  There will be 2 bytes
+* TPID (0x8100) and 2 bytes TCI (including VLAN ID).
+* This isn't in the data sheet.
+*/
+   if (rxctl  VR_RXCTL_TAG) {
+   int offset = ((total_len + 3)  ~3) + 2;
+   m-m_pkthdr.ether_vtag = htons(*(u_int16_t *)
+   ((u_int8_t *)m-m_data + offset));
+   m-m_flags |= M_VLANTAG;
+   }
+#endif
+
/*
 * The VIA Rhine chip includes the CRC with every
 * received frame, and there's no way to turn this
@@ -1223,12 +1250,20 @@ vr_encap(struct vr_softc *sc, struct vr_
 
if (m_new != NULL) {
m_freem(m_head);
-
c-vr_mbuf = m_new;
} else
c-vr_mbuf = m_head;
txmap = c-vr_map;
for (i = 0; i  txmap-dm_nsegs; i++) {
+#if NVLAN  0
+   /* Tell chip to insert VLAN tag if needed. */
+   if (m_head-m_flags  M_VLANTAG) {
+   u_int32_t vtag = m_head-m_pkthdr.ether_vtag;
+   vtag = (vtag  VR_TXSTAT_PQSHIFT)  VR_TXSTAT_PQMASK;
+   vr_status |= vtag;
+   vr_ctl |= htole32(VR_TXCTL_INSERTTAG);
+   }
+#endif
if (i != 0)
*cp = c = c-vr_nextdesc;
f = c-vr_ptr;
@@ -1254,7 +1289,7 @@ vr_encap(struct vr_softc *sc, struct vr_
sc-vr_cdata.vr_tx_cnt++;
}
 
-   /* Set EOP on the last desciptor */
+   /* Set EOP on the last descriptor */
f-vr_ctl |= htole32(VR_TXCTL_LASTFRAG | VR_TXCTL_FINT);
 
return (0);
@@ -1395,6 +1430,11 @@ vr_init(void *xsc)
 
VR_CLRBIT(sc, VR_TXCFG, VR_TXCFG_TX_THRESH);
VR_SETBIT(sc, VR_TXCFG, VR_TXTHRESH_STORENFWD);
+
+#if NVLAN  0
+   if (ifp-if_capabilities  IFCAP_VLAN_HWTAGGING)
+   VR_SETBIT(sc, VR_TXCFG, VR_TXCFG_TXTAGEN);
+#endif
 
/* Init circular RX list. */
if (vr_list_rx_init(sc) == ENOBUFS) {
Index: dev/pci/if_vrreg.h
===
RCS file: /cvs/src/sys/dev/pci/if_vrreg.h,v
retrieving revision 1.32
diff -u -p -r1.32 if_vrreg.h
--- dev/pci/if_vrreg.h  20 Oct 2012 16:12:22 -  1.32
+++ dev/pci/if_vrreg.h  14 Jan 2013 03:30:55 -
@@ -83,6 +83,9 @@
 #define VR_MPA_CNT 0x7C
 #define VR_CRC_CNT 0x7E
 #define VR_STICKHW 0x83
+#define VR_CAMMASK 0x88 /* length 4 bytes */
+#define VR_CAMCTRL 0x92
+#define VR_CAMADDR 0x93
 
 /* Misc Registers */
 #define VR_MISC_CR10x81
@@ -342,6 +345,14 @@
 #define VR_BCR1_VLANFILT_ENB   0x80/* 6105M */
 
 /*
+ * CAM Control registers (VT6105M)
+ */
+#define VR_CAMCTRL_WREN0x01
+#define VR_CAMCTRL_VCAMSEL 0x02
+#define VR_CAMCTRL_WRITE   0x04
+#define VR_CAMCTRL_READ0x08
+
+/*
  * Rhine TX/RX list structure.
  */
 
@@ -404,6 +415,7 @@ struct vr_desc {
 #define VR_TXSTAT_ERRSUM   0x8000
 #define VR_TXSTAT_PQMASK   0x7FFF
 #define