From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by dpdk.org (Postfix) with ESMTP id 5AA13B0A5 for ; Tue, 10 Jun 2014 23:05:26 +0200 (CEST) Received: by mail-pd0-f172.google.com with SMTP id fp1so6498534pdb.17 for ; Tue, 10 Jun 2014 14:05:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-type:content-transfer-encoding; bh=mm++YYqUmYXi/9cBtqZLoWowZyAw+Y3smq0TNoUQmA4=; b=jFaWgVjrQ35pYST8QVnPAgDxg3NZNSnDftfL746QoYcUMVCY7JeIc92unrVx5XwdEu wK/xM20JGv/4/e5xrJAlXyZ7YOyQKUkIF3RoPxFLrl4EF0tGY1rASaWwlkyp0cDH6tW8 lwJVwnaMvpK8Ty/Xp6qfBA5jyKi9unAL3wQM1OlV4iebdEA/lYcsbhp868v2kMgtLDns +a6LXyiYVCZ8/wV2A7eauCwC+Lg1Gc1sRokxCULvzbLfDxZs8mRRBvnLrvo+nbRo7T8H 58AZSH58x7ryf3oVKeI7K1hX7YhTK1dGaa+75//eiFlleQetXYcMeFKUxKHJ3OVnyNYF AcLg== X-Gm-Message-State: ALoCoQkOHgJhk2N9CAFApEaYjUxySnrJwLUeXrcF2h50RGMURn7eY6wfH6eb+DP6o08eo65xH0pq X-Received: by 10.68.95.225 with SMTP id dn1mr14375985pbb.126.1402434340608; Tue, 10 Jun 2014 14:05:40 -0700 (PDT) Received: from nehalam.linuxnetplumber.net (static-50-53-83-51.bvtn.or.frontiernet.net. [50.53.83.51]) by mx.google.com with ESMTPSA id tg9sm71164043pbc.29.2014.06.10.14.05.39 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 10 Jun 2014 14:05:40 -0700 (PDT) Date: Tue, 10 Jun 2014 14:05:37 -0700 From: Stephen Hemminger To: dev@dpdk.org Message-ID: <20140610140537.14ae01d2@nehalam.linuxnetplumber.net> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH] add link state control driver flag 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: , X-List-Received-Date: Tue, 10 Jun 2014 21:05:26 -0000 Only some devices support the link state interrupt configuration option. Link state control does not work in virtual drivers (virtio, vmxnet3, igbvf, and ixgbevf). Instead of having the application try and guess whether it will work or not provide a driver flag that can be checked instead. Note: if device driver doesn't support link state control, what would happen previously is that the code would never detect link transitions. This prevents that. Signed-off-by: Stephen Hemminger --- lib/librte_eal/common/include/rte_pci.h | 2 ++ lib/librte_ether/rte_ethdev.c | 14 ++++++++++++++ lib/librte_pmd_e1000/em_ethdev.c | 2 +- lib/librte_pmd_e1000/igb_ethdev.c | 2 +- lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 2 +- 5 files changed, 19 insertions(+), 3 deletions(-) --- a/lib/librte_eal/common/include/rte_pci.h 2014-06-10 13:52:10.446532658 -0700 +++ b/lib/librte_eal/common/include/rte_pci.h 2014-06-10 13:54:18.667854409 -0700 @@ -196,6 +196,8 @@ struct rte_pci_driver { #define RTE_PCI_DRV_MULTIPLE 0x0002 /** Device needs to be unbound even if no module is provided */ #define RTE_PCI_DRV_FORCE_UNBIND 0x0004 +/** Device driver supports link state interrupt */ +#define RTE_PCI_DRV_LSC 0x0008 /**< Internal use only - Macro used by pci addr parsing functions **/ #define GET_PCIADDR_FIELD(in, fd, lim, dlm) \ --- a/lib/librte_pmd_e1000/em_ethdev.c 2014-06-10 13:52:10.446532658 -0700 +++ b/lib/librte_pmd_e1000/em_ethdev.c 2014-06-10 13:53:19.963254573 -0700 @@ -280,7 +280,7 @@ static struct eth_driver rte_em_pmd = { { .name = "rte_em_pmd", .id_table = pci_id_em_map, - .drv_flags = RTE_PCI_DRV_NEED_IGB_UIO, + .drv_flags = RTE_PCI_DRV_NEED_IGB_UIO | RTE_PCI_DRV_LSC, }, .eth_dev_init = eth_em_dev_init, .dev_private_size = sizeof(struct e1000_adapter), --- a/lib/librte_pmd_e1000/igb_ethdev.c 2014-06-10 13:52:10.446532658 -0700 +++ b/lib/librte_pmd_e1000/igb_ethdev.c 2014-06-10 13:52:57.023017751 -0700 @@ -603,7 +603,7 @@ static struct eth_driver rte_igb_pmd = { { .name = "rte_igb_pmd", .id_table = pci_id_igb_map, - .drv_flags = RTE_PCI_DRV_NEED_IGB_UIO, + .drv_flags = RTE_PCI_DRV_NEED_IGB_UIO | RTE_PCI_DRV_LSC, }, .eth_dev_init = eth_igb_dev_init, .dev_private_size = sizeof(struct e1000_adapter), --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 2014-06-10 13:52:10.446532658 -0700 +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 2014-06-10 13:53:52.307586153 -0700 @@ -999,7 +999,7 @@ static struct eth_driver rte_ixgbe_pmd = { .name = "rte_ixgbe_pmd", .id_table = pci_id_ixgbe_map, - .drv_flags = RTE_PCI_DRV_NEED_IGB_UIO, + .drv_flags = RTE_PCI_DRV_NEED_IGB_UIO | RTE_PCI_DRV_LSC, }, .eth_dev_init = eth_ixgbe_dev_init, .dev_private_size = sizeof(struct ixgbe_adapter), --- a/lib/librte_ether/rte_ethdev.c 2014-06-10 13:52:10.446532658 -0700 +++ b/lib/librte_ether/rte_ethdev.c 2014-06-10 13:52:10.426532446 -0700 @@ -636,6 +636,20 @@ rte_eth_dev_configure(uint8_t port_id, u memcpy(&dev->data->dev_conf, dev_conf, sizeof(dev->data->dev_conf)); /* + * If link state interrupt is enabled, check that the + * device supports it. + */ + if (dev_conf->intr_conf.lsc == 1) { + const struct rte_pci_driver *pci_drv = &dev->driver->pci_drv; + + if (!(pci_drv->drv_flags & RTE_PCI_DRV_LSC)) { + PMD_DEBUG_TRACE("driver %s does not support lsc\n", + pci_drv->name); + return (-EINVAL); + } + } + + /* * If jumbo frames are enabled, check that the maximum RX packet * length is supported by the configured device. */