From patchwork Mon Feb 10 22:29:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 319080 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 6EE752C00B0 for ; Tue, 11 Feb 2014 09:30:25 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752311AbaBJWaV (ORCPT ); Mon, 10 Feb 2014 17:30:21 -0500 Received: from mail-pd0-f175.google.com ([209.85.192.175]:39419 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752362AbaBJWaQ (ORCPT ); Mon, 10 Feb 2014 17:30:16 -0500 Received: by mail-pd0-f175.google.com with SMTP id w10so6643568pde.6 for ; Mon, 10 Feb 2014 14:30:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=bZCDQ4rPJYti59Au7qUDX4RK6wYsxCtBIDWHU8mMPJU=; b=rcylrC88GQD4awmewHrS04WQ6kneWKbdLxGPhT5A5mYAurh2qPZM0ruiBEboP4mv1r UQBQVj+MQlDv80T3OK+F2UnHPhhrtCLWAx++y2w8Ik6E+xQvht5K/NjFIwr99RGOlu3C 9NT8t8VYBlkBj6cx/hiRs6w7BTN31s+ec/v9E3QDkn9sSmWYQG2TZMDlt9hgy/yPtZy4 I6i3yXyNT7lU0fC8MCidnJ8TXCYjzo2JHJPWb1Ka+AEsOcKaHPewQn1DAp0iD/uuoeFb Gp0gwzrqXLlQb2r9nfxh1muPnEks2nbzND179geCJRKFFVUsRZW3k+UPPJ8GxqMlhT2b 6v6w== X-Received: by 10.68.138.165 with SMTP id qr5mr40748688pbb.123.1392071415240; Mon, 10 Feb 2014 14:30:15 -0800 (PST) Received: from mcgrof@gmail.com (c-24-7-61-223.hsd1.ca.comcast.net. [24.7.61.223]) by mx.google.com with ESMTPSA id c7sm46023850pbt.0.2014.02.10.14.30.11 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 10 Feb 2014 14:30:13 -0800 (PST) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Mon, 10 Feb 2014 14:30:10 -0800 From: "Luis R. Rodriguez" To: netdev@vger.kernel.org Cc: xen-devel@lists.xenproject.org, "Luis R. Rodriguez" , Paul Durrant , Ian Campbell , Wei Liu Subject: [RFC 2/2] xen-netback: disable multicast and use a random hw MAC address Date: Mon, 10 Feb 2014 14:29:51 -0800 Message-Id: <1392071391-13215-3-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1392071391-13215-1-git-send-email-mcgrof@do-not-panic.com> References: <1392071391-13215-1-git-send-email-mcgrof@do-not-panic.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: "Luis R. Rodriguez" Although the xen-netback interfaces do not participate in the link as a typical Ethernet device interfaces for them are still required under the current archtitecture. IPv6 addresses do not need to be created or assigned on the xen-netback interfaces however, even if the frontend devices do need them, so clear the multicast flag to ensure the net core does not initiate IPv6 Stateless Address Autoconfiguration. Clearing the multicast flag is required given that the net_device is using the ether_setup() helper. There's also no good reason why the special MAC address of FE:FF:FF:FF:FF:FF is being used other than to avoid issues with STP, since using this can create an issue if a user decides to enable multicast on the backend interfaces simply use a random MAC address with the xen OUI prefix as is done with the frontend through xen udev scripts. Cc: Paul Durrant Cc: Ian Campbell Cc: Wei Liu Cc: xen-devel@lists.xenproject.org Cc: netdev@vger.kernel.org Signed-off-by: Luis R. Rodriguez --- drivers/net/xen-netback/interface.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index b9de31e..479fbd1 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c @@ -42,6 +42,8 @@ #define XENVIF_QUEUE_LENGTH 32 #define XENVIF_NAPI_WEIGHT 64 +static const u8 xen_oui[3] = { 0x00, 0x16, 0x3e }; + int xenvif_schedulable(struct xenvif *vif) { return netif_running(vif->dev) && netif_carrier_ok(vif->dev); @@ -347,15 +349,9 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, for (i = 0; i < MAX_PENDING_REQS; i++) vif->mmap_pages[i] = NULL; - /* - * Initialise a dummy MAC address. We choose the numerically - * largest non-broadcast address to prevent the address getting - * stolen by an Ethernet bridge for STP purposes. - * (FE:FF:FF:FF:FF:FF) - */ - memset(dev->dev_addr, 0xFF, ETH_ALEN); - dev->dev_addr[0] &= ~0x01; - + eth_hw_addr_random(dev); + memcpy(dev->dev_addr, xen_oui, 3); + dev->flags &= ~IFF_MULTICAST; netif_napi_add(dev, &vif->napi, xenvif_poll, XENVIF_NAPI_WEIGHT); netif_carrier_off(dev);