From owner-freebsd-current@FreeBSD.ORG Mon Aug 5 20:16:24 2013 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0B48EBA8; Mon, 5 Aug 2013 20:16:24 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-la0-x231.google.com (mail-la0-x231.google.com [IPv6:2a00:1450:4010:c03::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D13162589; Mon, 5 Aug 2013 20:16:22 +0000 (UTC) Received: by mail-la0-f49.google.com with SMTP id ev20so2399907lab.36 for ; Mon, 05 Aug 2013 13:16:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=lSm+JfLcdP0pOg5ejSKOsqZcLRzLlSGySgP/NNuIpuE=; b=LT7tsatXzIytu83j92dOevJul3W8LoCbrxwomiOTfHyiifc9Fcye/gUp7SnLXNlvRm HasXXXzQtc3RuBdBn/q80iAC/s2HExE93MaaRJ9DjGeN2Km3Oq8d4siF9rXrorM+Y7AG wXPFyPcLHUuPFl48uXsg3+s5hZ1CBjlCsATKAd0HIVFor6S3y1dBNQPofQhM0kVbCf3W RRfkt3ld2yQOFEyAJBPsWrTmA18MroqimkEY/V+jZzYaxcf0fY6+LzKp7vaUW0Els0l1 UO1JJrgFDRD0XdLJ0vATQKwRtbVUV3/oOJdabeTSlWiYuwXaP0u3sWVTvj8Ce1hHB5CO fIgQ== MIME-Version: 1.0 X-Received: by 10.152.27.227 with SMTP id w3mr8381624lag.84.1375733780601; Mon, 05 Aug 2013 13:16:20 -0700 (PDT) Sender: rizzo.unipi@gmail.com Received: by 10.114.200.165 with HTTP; Mon, 5 Aug 2013 13:16:20 -0700 (PDT) In-Reply-To: References: <20130805082307.GA35162@onelab2.iet.unipi.it> <2034715395.855.1375714772487.JavaMail.root@daemoninthecloset.org> <51FFDD1E.1000206@FreeBSD.org> Date: Mon, 5 Aug 2013 22:16:20 +0200 X-Google-Sender-Auth: LS8qWBypBbsSgv83bL3eP3IuKrY Message-ID: Subject: Re: [net] protecting interfaces from races between control and data ? From: Luigi Rizzo To: Adrian Chadd Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: FreeBSD current mailing list , Bryan Venteicher , Navdeep Parhar , net@freebsd.org, Giuseppe Lettieri , Jack Vogel X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Aug 2013 20:16:24 -0000 On Mon, Aug 5, 2013 at 8:19 PM, Adrian Chadd wrote: > No, brian said two things: > > * the flag, protected by the core lock > * per-queue flags > i see no mentions on per-queue flags on his email. This is the relevant part ------------ What I've done in my drivers is: * Lock the core mutex * Clear IFF_DRV_RUNNING * Lock/unlock each queue's lock The various Rx/Tx queue functions check for IFF_DRV_RUNNING after (re)acquiring their queue lock. See at vtnet_stop_rendezvous() at [1] for an example. [1] http://svnweb.freebsd.org/base/user/bryanv/vtnetmq/sys/dev/virtio/network/if_vtnet.c?revision=252451&view=markup ----------------- > > > > -adrian > -- -----------------------------------------+------------------------------- Prof. Luigi RIZZO, rizzo@iet.unipi.it . Dip. di Ing. dell'Informazione http://www.iet.unipi.it/~luigi/ . Universita` di Pisa TEL +39-050-2211611 . via Diotisalvi 2 Mobile +39-338-6809875 . 56122 PISA (Italy) -----------------------------------------+-------------------------------