Patch for iscsid testing

2010-05-04 Thread Stefan Johansson
Hello Tech!

Is it possible to get a patch/src and test the upcoming iscsid initiator?
The presentation from AsiaBSDcon was really interesting.

/Steve



Re: tree(7) man page diff

2010-05-04 Thread Tim van der Molen
On Tue, 04 May 2010 00:20:47 +0200, Nicholas Marriott wrote:
> SPLAY_REMOVE appears to returns the pointer it is given or NULL if the
> item isn't found. I don't see what errors it could return NULL for, so I
> think it would be better to say "NULL is returned if no item with that
> key is found". Or at least if you can spot any errors I can't, "to
> indicate an error or that the key is not found".

How about "If the element does not exist in the tree, NULL is returned"?
Below is an updated version of the original diff.

> RB_REMOVE returns the pointer it is given whether or not the item is in
> the tree (even for an empty tree). This seems unexpected, so it might be
> a bug...

I think you're right. If I'm not mistaken, RB_REMOVE will have to
explicitly check whether the element exists in the tree. The second diff
below uses RB_FIND to do that. I'm not sure what consequences this has
for performance. Actually, I'm not sure it's an elegant fix in the first
place.

The second diff also removes an unnecessary variable.

Index: tree.3
===
RCS file: /cvs/src/share/man/man3/tree.3,v
retrieving revision 1.20
diff -u tree.3
--- tree.3  28 Jan 2009 12:22:48 -  1.20
+++ tree.3  4 May 2010 19:10:37 -
@@ -257,14 +257,24 @@
 .Fn SPLAY_INSERT
 macro inserts the new element
 .Fa elm
-into the tree.
+into the tree pointed to by
+.Fa head .
+Upon success,
+.Va NULL
+is returned.
+If a matching element already exists in the tree, the insertion is
+aborted, and a pointer to the existing element is returned.
 .Pp
 The
 .Fn SPLAY_REMOVE
 macro removes the element
 .Fa elm
-from the tree pointed by
+from the tree pointed to by
 .Fa head .
+Upon success, a pointer to the removed element is returned.
+If the element does not exist in the tree,
+.Va NULL
+is returned.
 .Pp
 The
 .Fn SPLAY_FIND
@@ -392,7 +402,8 @@
 .Fn RB_INSERT
 macro inserts the new element
 .Fa elm
-into the tree.
+into the tree pointed to by
+.Fa head .
 Upon success,
 .Va NULL
 is returned.
@@ -403,8 +414,12 @@
 .Fn RB_REMOVE
 macro removes the element
 .Fa elm
-from the tree pointed by
+from the tree pointed to by
 .Fa head .
+Upon success, a pointer to the removed element is returned.
+If the element does not exist in the tree,
+.Va NULL
+is returned.
 .Pp
 The
 .Fn RB_FIND
@@ -543,22 +558,5 @@
free(var);
 }
 .Ed
-.Pp
-Both
-.Fn RB_INSERT
-and
-.Fn SPLAY_INSERT
-return
-.Va NULL
-if the element was inserted in the tree successfully, otherwise they
-return a pointer to the element with the colliding key.
-.Pp
-Accordingly,
-.Fn RB_REMOVE
-and
-.Fn SPLAY_REMOVE
-return the pointer to the removed element, otherwise they return
-.Va NULL
-to indicate an error.
 .Sh AUTHORS
 The author of the tree macros is Niels Provos.

Index: tree.h
===
RCS file: /cvs/src/sys/sys/tree.h,v
retrieving revision 1.12
diff -p -u tree.h
--- tree.h  2 Mar 2009 09:42:55 -   1.12
+++ tree.h  4 May 2010 19:20:30 -
@@ -521,7 +521,8 @@ attr struct type *  
\
 name##_RB_REMOVE(struct name *head, struct type *elm)  \
 {  \
struct type *child, *parent, *old = elm;\
-   int color;  \
+   if (name##_RB_FIND(head, elm) == NULL)  \
+   return (NULL);  \
if (RB_LEFT(elm, field) == NULL)\
child = RB_RIGHT(elm, field);   \
else if (RB_RIGHT(elm, field) == NULL)  \
@@ -533,7 +534,6 @@ name##_RB_REMOVE(struct name *head, struct type *elm)   
elm = left; \
child = RB_RIGHT(elm, field);   \
parent = RB_PARENT(elm, field); \
-   color = RB_COLOR(elm, field);   \
if (child)  \
RB_PARENT(child, field) = parent;   \
if (parent) {   \
@@ -567,7 +567,6 @@ name##_RB_REMOVE(struct name *head, struct type *elm)   
goto color; \
}   \
parent = RB_PARENT(elm, field); \
-   color = RB_COLOR(elm, field);   \
if (child)  \
RB_PARENT(child, field) = parent;   \
if (parent) {  

Re: Add support to AR5424

2010-05-04 Thread Luis Henriques
Hi,

Here's another patch with a couple of changes since the last one.  Not
sure how this will make any difference to the cards that were not working
with previous versions, but hopefully there will be some changes.

Please let me know if this works for you.

Alexander: sorry for the delay on sending you the debug output, but I've
been very busy on vacations! :-)

--
Luis

Index: dev/ic/ar5212.c
===
RCS file: /home/miguel/openbsd-cvsroot//src/sys/dev/ic/ar5212.c,v
retrieving revision 1.51
diff -u -p -r1.51 ar5212.c
--- dev/ic/ar5212.c 2 Jun 2009 12:39:02 -   1.51
+++ dev/ic/ar5212.c 3 May 2010 16:23:22 -
@@ -30,6 +30,7 @@ HAL_BOOL   ar5k_ar5212_nic_wakeup(struct 
 u_int16_t   ar5k_ar5212_radio_revision(struct ath_hal *, HAL_CHIP);
 voidar5k_ar5212_fill(struct ath_hal *);
 HAL_BOOLar5k_ar5212_txpower(struct ath_hal *, HAL_CHANNEL *, u_int);
+voidar5k_ar5212_hw_set_sleep_clock(struct ath_hal *, HAL_BOOL);
 
 /*
  * Initial register setting for the AR5212
@@ -234,9 +235,17 @@ ar5k_ar5212_attach(u_int16_t device, voi
hal->ah_phy_spending = AR5K_AR5212_PHY_SPENDING_AR5424;
hal->ah_radio_5ghz_revision = hal->ah_radio_2ghz_revision =
AR5K_SREV_VER_AR5413;
-   } else if (srev == AR5K_SREV_VER_AR2425) {
+   } else if (hal->ah_mac_version == (AR5K_SREV_VER_AR2425 >> 4) ||
+   hal->ah_mac_version == (AR5K_SREV_VER_AR2417 >> 4) ||
+   hal->ah_phy_revision == (AR5K_SREV_PHY_2425)) {
hal->ah_radio = AR5K_AR2425;
-   hal->ah_phy_spending = AR5K_AR5212_PHY_SPENDING_AR5112;
+   hal->ah_single_chip = AH_TRUE;
+   hal->ah_radio_5ghz_revision= AR5K_SREV_RAD_2425;
+   } else if ((hal->ah_mac_version == (AR5K_SREV_VER_AR2424 >> 4)) ||
+   (hal->ah_phy_revision == AR5K_SREV_PHY_5413)) {
+   hal->ah_radio = AR5K_AR5413;
+   hal->ah_single_chip = AH_TRUE;
+   hal->ah_radio_5ghz_revision = AR5K_SREV_RAD_5413;
} else if (hal->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112) {
hal->ah_radio = AR5K_AR5111;
hal->ah_phy_spending = AR5K_AR5212_PHY_SPENDING_AR5111;
@@ -262,6 +271,12 @@ ar5k_ar5212_attach(u_int16_t device, voi
}
hal->ah_phy = AR5K_AR5212_PHY(0);
 
+   /* Enable pci core retry fix on Hainan (5213A) and later chips */
+   if (srev >= AR5K_SREV_VER_AR5213A) {
+   AR5K_REG_ENABLE_BITS(AR5K_AR5212_PCICFG,
+   AR5K_AR5212_PCICFG_RETRY_FIX);
+   }
+
if (hal->ah_pci_express == AH_TRUE) {
/* PCI-Express based devices need some extra initialization */
ar5k_write_ini(hal, ar5212_pcie, nitems(ar5212_pcie), 0);
@@ -312,7 +327,7 @@ ar5k_ar5212_nic_reset(struct ath_hal *ha
 HAL_BOOL
 ar5k_ar5212_nic_wakeup(struct ath_hal *hal, u_int16_t flags)
 {
-   u_int32_t turbo, mode, clock;
+   u_int32_t turbo, mode, clock, bus_flags;
 
turbo = 0;
mode = 0;
@@ -335,7 +350,10 @@ ar5k_ar5212_nic_wakeup(struct ath_hal *h
clock |= AR5K_AR5212_PHY_PLL_44MHZ;
} else if (flags & IEEE80211_CHAN_5GHZ) {
mode |= AR5K_AR5212_PHY_MODE_FREQ_5GHZ;
-   clock |= AR5K_AR5212_PHY_PLL_40MHZ;
+   if (hal->ah_radio == AR5K_AR5413)
+   clock |= AR5K_AR5212_PHY_PLL_40MHZ_5413;
+   else
+   clock |= AR5K_AR5212_PHY_PLL_40MHZ;
} else {
AR5K_PRINT("invalid radio frequency mode\n");
return (AH_FALSE);
@@ -361,23 +379,30 @@ ar5k_ar5212_nic_wakeup(struct ath_hal *h
 * Reset and wakeup the device
 */
 
-   /* ...reset chipset and PCI device (if not PCI-E) */
-   if (hal->ah_pci_express == AH_FALSE &&
-   ar5k_ar5212_nic_reset(hal, AR5K_AR5212_RC_CHIP) == AH_FALSE) {
-   AR5K_PRINT("failed to reset the AR5212 + PCI chipset\n");
+   /* Wakeup the device */
+   if (ar5k_ar5212_set_power(hal,
+   HAL_PM_AWAKE, AH_TRUE, 0) == AH_FALSE) {
+   AR5K_PRINT("failed to wakeup the AR5212 chipset\n");
return (AH_FALSE);
}
 
-   /* ...wakeup */
+   /* ...reset chipset and PCI device */
+   bus_flags = (hal->ah_pci_express != AH_FALSE) ? 0 : AR5K_AR5212_RC_PCI;
+   if (ar5k_ar5212_nic_reset(hal, bus_flags) == AH_FALSE) {
+   AR5K_PRINT("failed to reset the AR5212 chipset\n");
+   return (AH_FALSE);
+   }
+
+   /* ...wakeup again */
if (ar5k_ar5212_set_power(hal,
HAL_PM_AWAKE, AH_TRUE, 0) == AH_FALSE) {
-   AR5K_PRINT("failed to resume the AR5212 (again)\n");
+   AR5K_PRINT("failed to wakeup (again) the AR5212 chipset\n");
return (AH_FALSE);
}
 
/* ...fi

Re: Clarify usage of "set +o emacs-usemeta"

2010-05-04 Thread Giovanni Bechis

On 05/03/10 21:02, Christian Weisgerber wrote:

I don't like it.  Characters with the eighth bit set and letters
with diacritics ("accented characters") aren't the same thing.


Maybe we can write something about it on Faq7.
 Cheers
  Giovanni