From patchwork Wed Apr 15 15:20:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 4313 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id B2E39C37A; Wed, 15 Apr 2015 17:20:22 +0200 (CEST) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by dpdk.org (Postfix) with ESMTP id 7FC49C36C for ; Wed, 15 Apr 2015 17:20:19 +0200 (CEST) Received: by pabtp1 with SMTP id tp1so54369467pab.2 for ; Wed, 15 Apr 2015 08:20:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ee5MGdSoyB6VyYrUnpi3NhrcDA21uuMY+pfyoJ4hN0g=; b=XLsy51oQnULNtb5MIE0HSp+gZ16UGpxKmz4ApC8F4nmKa5BE9chR9rJ/jADGoBuOaI P1mnCx8yCbofxC1FxKm2zUBT8pzB8waqaFMXETJpxwk1cYckEM0eaDRS9Gv8QQUqng6u i6LKUjIqUzS7UsixSe9lY6L0WFpnNjM83pFJZDOu9odaqIaM5x9lPIqnzzuGbIV7aRRq gSrWOi0NFmoZaTUHfslTUcBn19/bwhRi/W9YUfQuyEIv8Vr3SQRSYjmq/cz/uiFo+EII 4oVEqem1OZ9KfAwKs/oxGG/1nayDZHc13HFmnC137I98YCNVgm3cz3hF29IZsFmigi1K htGg== X-Gm-Message-State: ALoCoQntdioCOrV3EioSwt6RP2kcoAVxQ23s4mwri45C96A/kWkbvuNgeTVCw575Zqy/ZnoUFXy5 X-Received: by 10.70.46.65 with SMTP id t1mr46873963pdm.128.1429111218945; Wed, 15 Apr 2015 08:20:18 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id sm7sm4459057pac.45.2015.04.15.08.20.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Apr 2015 08:20:17 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Date: Wed, 15 Apr 2015 08:20:17 -0700 Message-Id: <1429111219-8789-4-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1429111219-8789-1-git-send-email-stephen@networkplumber.org> References: <1429111219-8789-1-git-send-email-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 3/5] virtio: don't set mac table unless negotiated X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Don't attempt to set the MAC address table unless the host allows it. Also, don't return a value from mac_table_set since all callers ignore the return value. Signed-off-by: Stephen Hemminger Acked-by: Changchun Ouyang --- lib/librte_pmd_virtio/virtio_ethdev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c index f0859d8..3cb9c6a 100644 --- a/lib/librte_pmd_virtio/virtio_ethdev.c +++ b/lib/librte_pmd_virtio/virtio_ethdev.c @@ -668,7 +668,7 @@ virtio_get_hwaddr(struct virtio_hw *hw) } } -static int +static void virtio_mac_table_set(struct virtio_hw *hw, const struct virtio_net_ctrl_mac *uc, const struct virtio_net_ctrl_mac *mc) @@ -676,6 +676,11 @@ virtio_mac_table_set(struct virtio_hw *hw, struct virtio_pmd_ctrl ctrl; int err, len[2]; + if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_MAC_ADDR)) { + PMD_DRV_LOG(INFO, "host does not support mac table\n"); + return; + } + ctrl.hdr.class = VIRTIO_NET_CTRL_MAC; ctrl.hdr.cmd = VIRTIO_NET_CTRL_MAC_TABLE_SET; @@ -688,8 +693,6 @@ virtio_mac_table_set(struct virtio_hw *hw, err = virtio_send_command(hw->cvq, &ctrl, len, 2); if (err != 0) PMD_DRV_LOG(NOTICE, "mac table set failed: %d", err); - - return err; } static void