Unix Technical Forum

em(4) diff

This is a discussion on em(4) diff within the mailing.openbsd.tech forums, part of the OpenBSD category; --> Intel Gig em(4) users. Please try out this diff. - Run em_local_timer() once per second instead of running it ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > mailing.openbsd.tech

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-18-2008, 07:45 AM
Brad
 
Posts: n/a
Default em(4) diff

Intel Gig em(4) users. Please try out this diff.

- Run em_local_timer() once per second instead of running it once per 2 seconds.
This makes gathering of error stats more precise, and netstat(1) output look
right.
- Modify the caller of em_encap() to detect a NULL m_head and not try
to queue the mbuf if that happens.

From FreeBSD

Index: if_em.c
================================================== =================
RCS file: /cvs/src/sys/dev/pci/if_em.c,v
retrieving revision 1.44
diff -u -p -r1.44 if_em.c
--- if_em.c 1 Apr 2005 06:44:14 -0000 1.44
+++ if_em.c 8 Apr 2005 13:56:03 -0000
@@ -184,7 +184,7 @@ int em_get_buf(int i, struct em_softc *
struct mbuf *);
void em_enable_vlans(struct em_softc *);
void em_disable_vlans(struct em_softc *);
-int em_encap(struct em_softc *, struct mbuf *);
+int em_encap(struct em_softc *, struct mbuf **);
void em_smartspeed(struct em_softc *);
int em_82547_fifo_workaround(struct em_softc *, int);
void em_82547_update_fifo_head(struct em_softc *, int);
@@ -460,7 +460,13 @@ em_start_locked(struct ifnet *ifp)

if (m_head == NULL) break;

- if (em_encap(sc, m_head)) {
+ /*
+ * em_encap() can modify our pointer, and or make it NULL on
+ * failure. In that event, we can't requeue.
+ */
+ if (em_encap(sc, &m_head)) {
+ if (m_head == NULL)
+ break;
ifp->if_flags |= IFF_OACTIVE;
break;
}
@@ -733,7 +739,7 @@ em_init_locked(struct em_softc *sc)
ifp->if_flags |= IFF_RUNNING;
ifp->if_flags &= ~IFF_OACTIVE;

- timeout_add(&sc->timer_handle, 2*hz);
+ timeout_add(&sc->timer_handle, hz);
em_clear_hw_cntrs(&sc->hw);
em_enable_intr(sc);

@@ -785,7 +791,7 @@ em_intr(void *arg)
sc->hw.get_link_status = 1;
em_check_for_link(&sc->hw);
em_update_link_status(sc);
- timeout_add(&sc->timer_handle, 2*hz);
+ timeout_add(&sc->timer_handle, hz);
}

while (loop_cnt > 0) {
@@ -930,13 +936,15 @@ em_media_change(struct ifnet *ifp)
* return 0 on success, positive on failure
************************************************** ********************/
int
-em_encap(struct em_softc *sc, struct mbuf *m_head)
+em_encap(struct em_softc *sc, struct mbuf **m_headp)
{
u_int32_t txd_upper;
u_int32_t txd_lower, txd_used = 0, txd_saved = 0;
int i, j, error;
u_int64_t address;

+ struct mbuf *m_head;
+
/* For 82544 Workaround */
DESC_ARRAY desc_array;
u_int32_t array_elements;
@@ -948,7 +956,8 @@ em_encap(struct em_softc *sc, struct mbu

struct em_buffer *tx_buffer = NULL;
struct em_tx_desc *current_tx_desc = NULL;
- /*struct ifnet *ifp = &sc->interface_data.ac_if;*/
+
+ m_head = *m_headp;

/*
* Force a cleanup if number of TX descriptors
@@ -1364,7 +1373,7 @@ em_local_timer(void *arg)
}
em_smartspeed(sc);

- timeout_add(&sc->timer_handle, 2*hz);
+ timeout_add(&sc->timer_handle, hz);

EM_UNLOCK(sc);
return;

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:33 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com