From owner-freebsd-net@FreeBSD.ORG Wed Jan 16 01:31:39 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 66E822C4 for ; Wed, 16 Jan 2013 01:31:39 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-ea0-f176.google.com (mail-ea0-f176.google.com [209.85.215.176]) by mx1.freebsd.org (Postfix) with ESMTP id 06FF1C2C for ; Wed, 16 Jan 2013 01:31:35 +0000 (UTC) Received: by mail-ea0-f176.google.com with SMTP id a13so2971eaa.7 for ; Tue, 15 Jan 2013 17:31:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=EMHQL6hhEWH59khu31ffsyfpFiBz12fatrqN3DOuXGA=; b=gJlCIP3RR47XILte67bIqnWuyG0bqLmOsFPM0OyIJltfwHZ8e0Io0Hss3Up2yg1eUP GIUcTCOGHN5lI5wGtGRP9OR+JE2I/YafLCi4gh+2/S9xWx6SmN4U2iVPr30pisKtRO5Q PlhAl6pIGd3qFiam9pxm4P+cVsH1P+n0GscOwSvss3KC0+PX9TfIoG9DkApUsQkCXgX4 NIEn0RGU/aPYvlL7OIT7VL8vuokUHROZA7d9UmZ9L43LFbOjj4IugavEwokNU0ia9/22 p8NZrjh77sBdM85fxW7As/0ayFEO8wYAarqetjRx0Bq1N32fKrQWgmNr4H7iCpWUhuYm 9uFQ== MIME-Version: 1.0 Received: by 10.14.225.72 with SMTP id y48mr245086646eep.46.1358299404872; Tue, 15 Jan 2013 17:23:24 -0800 (PST) Sender: rizzo.unipi@gmail.com Received: by 10.14.0.2 with HTTP; Tue, 15 Jan 2013 17:23:24 -0800 (PST) Date: Tue, 15 Jan 2013 17:23:24 -0800 X-Google-Sender-Auth: 4Tl_Ya13TIFNE9Aoqdc8vGPh-QE Message-ID: Subject: two problems in dev/e1000/if_lem.c::lem_handle_rxtx() From: Luigi Rizzo To: head@freebsd.org, "freebsd-net@freebsd.org" Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: Jack Vogel X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jan 2013 01:31:39 -0000 Hi, i found a couple of problems in dev/e1000/if_lem.c::lem_handle_rxtx() , (compare with dev/e1000/if_em.c::em_handle_que() for better understanding): 1. in if_em.c::em_handle_que(), when em_rxeof() exceeds the rx_process_limit, the task is rescheduled so it can complete the work. Conversely, in if_lem.c::lem_handle_rxtx() the lem_rxeof() is only run once, and if there are more pending packets the only chance to drain them is to receive (many) more interrupts. This is a relatively serious problem, because the receiver has a hard time recovering. I'd like to commit a fix to this same as it is done in e1000. 2. in if_em.c::em_handle_que(), interrupts are reenabled unconditionally, whereas lem_handle_rxtx() only enables them if IFF_DRV_RUNNING is set. I cannot really tell what is the correct way here, so I'd like to put a comment there unless there is a good suggestion on what to do. Accesses to the intr register are race-prone anyways (disabled in fastintr, enabled in the rxtx task without holding any lock, and generally accessed under EM_CORE_LOCK in other places), and presumably enabling/disabling the interrupts around activations of the taks is just an optimization (and on a VM, it is actually a pessimization due to the huge cost of VM exits). cheers luigi