From owner-freebsd-current@FreeBSD.ORG Mon Jun 30 16:36:23 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 88A30AEA for ; Mon, 30 Jun 2014 16:36:23 +0000 (UTC) Received: from mail-vc0-x232.google.com (mail-vc0-x232.google.com [IPv6:2607:f8b0:400c:c03::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 482882A42 for ; Mon, 30 Jun 2014 16:36:23 +0000 (UTC) Received: by mail-vc0-f178.google.com with SMTP id ij19so7898685vcb.9 for ; Mon, 30 Jun 2014 09:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=Z7D4bnbWsXoWaV1hWVhy8zlv3m0C8l0vOIYrDVtO0gs=; b=yFx2ipi+/MwRZBvbi6U1U7KT0TCuISR2x7hNiBcPYFYDAu2w0zbmZ5kF1/PDPxNJS2 vg2w9zZQsK0ExsHQRe+qAbgJrTnG5CFygDG8/q5SprZ0naYJrox0Tsazz1tQFOoSaKaj ErSQMrIz7+Bu7WdvGVWQ0a5bLbRQ1lIUdmcSi1XAHE6xa7o0wdW6yTbYEjmeY0B71Im4 FFjFKFSd4jQmcsOsXomP2U4KapsWjNwHmZq6CdmHmjoWcON3rOWzbGt35UJ/S/F5VxXG ARIE8Mn87oYahgLWcnZ96t4Ox6gX0ye+rS/1MNeNCSMAUXCv9OsxZU4JbUziFJbCG4zK TbMg== MIME-Version: 1.0 X-Received: by 10.58.39.42 with SMTP id m10mr38177874vek.29.1404146182421; Mon, 30 Jun 2014 09:36:22 -0700 (PDT) Received: by 10.58.161.102 with HTTP; Mon, 30 Jun 2014 09:36:22 -0700 (PDT) Date: Mon, 30 Jun 2014 18:36:22 +0200 Message-ID: Subject: Fix Emulex "oce" driver in CURRENT From: Stefano Garzarella To: freebsd-current@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: Luigi Rizzo X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jun 2014 16:36:23 -0000 Hello, I had problems during some experiments with Emulex and "oce" driver in CURRENT. I found several bugs in the "oce" driver and this patch fixes them. - oce_multiq_start(): if the link is down returns ENXIO without consuming the mbuf. A trivial fix is to remove the initial error check, since oce_multiq_transmit() which is called next handles the link down situation correctly. - oce_multiq_transmit(): there is an extra call to drbr_enqueue() causing the mbuf to be enqueued twice when the NIC's queue is full. - oce_multiq_transmit(): same problem fixed recently in ixgbe (r267187) and other drivers: if the mbuf is enqueued, the proper return value is 0 This patch has been reviewed by luigi (in cc). If someone could have a look on this and give me some feedback it would be great. Regards, Stefano Garzarella diff --git a/sys/dev/oce/oce_if.c b/sys/dev/oce/oce_if.c index 70d6393..af57491 100644 --- a/sys/dev/oce/oce_if.c +++ b/sys/dev/oce/oce_if.c @@ -563,9 +563,6 @@ oce_multiq_start(struct ifnet *ifp, struct mbuf *m) int queue_index = 0; int status = 0; - if (!sc->link_status) - return ENXIO; - if ((m->m_flags & M_FLOWID) != 0) queue_index = m->m_pkthdr.flowid % sc->nwqs; @@ -1274,7 +1271,6 @@ oce_multiq_transmit(struct ifnet *ifp, struct mbuf *m, struct oce_wq *wq) drbr_putback(ifp, br, next); wq->tx_stats.tx_stops ++; ifp->if_drv_flags |= IFF_DRV_OACTIVE; - status = drbr_enqueue(ifp, br, next); } break; } @@ -1285,7 +1281,7 @@ oce_multiq_transmit(struct ifnet *ifp, struct mbuf *m, struct oce_wq *wq) ETHER_BPF_MTAP(ifp, next); } - return status; + return 0; }