From patchwork Mon Aug 22 00:12:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghu Vatsavayi X-Patchwork-Id: 661318 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 3sHZFg5f1vz9t0v for ; Mon, 22 Aug 2016 10:29:27 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=CAVIUMNETWORKS.onmicrosoft.com header.i=@CAVIUMNETWORKS.onmicrosoft.com header.b=QFnDlNRi; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753995AbcHVA3T (ORCPT ); Sun, 21 Aug 2016 20:29:19 -0400 Received: from mail-bn3nam01on0082.outbound.protection.outlook.com ([104.47.33.82]:62277 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753959AbcHVA3Q (ORCPT ); Sun, 21 Aug 2016 20:29:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=nhzLiYcOdgAbIDeSmUV92GrkvPUTt5Ruc3xyHz3m4pQ=; b=QFnDlNRiqdkvcv+R1Fze4Zqg26nEp3LCuL/1VIlGfc+0/xzgdh9HkomdJKq12s9tEONGeLm4zoJzzUnPVFlc395bgSkeRwBYFbslE8/gpO4qRZjZLOAw7FpiuTbGoeDhazNzC9I0wP/30/QhsU/k51me1ecW81jtjvnBSyF/KT0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Raghu.Vatsavayi@cavium.com; Received: from localhost.caveonetworks.com (50.233.148.156) by SN1PR07MB2144.namprd07.prod.outlook.com (10.164.47.14) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.9; Mon, 22 Aug 2016 00:13:55 +0000 From: Raghu Vatsavayi To: CC: , Raghu Vatsavayi , Derek Chickles , Satanand Burla , Felix Manlunas , Raghu Vatsavayi Subject: [PATCH net-next V3 09/18] liquidio: MSIX support for CN23XX Date: Sun, 21 Aug 2016 17:12:36 -0700 Message-ID: <1471824765-26473-10-git-send-email-rvatsavayi@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1471824765-26473-1-git-send-email-rvatsavayi@caviumnetworks.com> References: <1471824765-26473-1-git-send-email-rvatsavayi@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: SN1PR0701CA0068.namprd07.prod.outlook.com (10.163.126.36) To SN1PR07MB2144.namprd07.prod.outlook.com (10.164.47.14) X-MS-Office365-Filtering-Correlation-Id: a4b4fecc-1e24-4292-bd9d-08d3ca213491 X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2144; 2:F7EtwQfFfGnmNgZtiWslfZ0wFUi5qhiyrrMrd44J/MGUh4wH16vJIHX1G9ZGKDHcASmZdry8y3fjSFziAgJ2pLeQgYFRCxFGRqrZls/vWqcKO5F2zzwDHgv+z+xId49u2fEUwg5KsCkXntorquD/e4zHXu34l52HinnVoj7WFlZc12KEnpcZnSNCGxR8jkyq; 3:hw4jb7tUtMFT73S0c5Or4oFJRa+mzNIPuvqRVoDawpufFcHRxdPj5RtSZZP2g0zp6J4ei0LyOUrdCw/xygWN9W9PK3Gr59yEOqXSIFf3wJDQrcCiDlV6W8kCQLsRX8L3 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR07MB2144; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2144; 25:N4zRuhU4x2GtpVfspJh7WOhO228t5Q8IiX1gY62A7aK1DUKEyPogp1zKySKtCczxp8gW+shTz3OCV3AbucTX7vvct6uhFg81e7H0BfS4nKa84DxeFvD0wFhcMvobWJYIQCwZ0ILtGexd0tUzf3vSHOksJ5+RF2a+rdbdtFSVCY8SvHPj8Z+D71+khh03ZOH7sufk5pQN7BggC+8eRcR6sUc8o7HScxfYRzU4MfdMQdkQ+kjSd90rLhC60ItzGQxPLswvHA0ldF+ea1UrmxFbn1wNvLkJ3oJnBRXQvPf0N9w7hlRFYqLYxK4v1GmO1cp/x2rkEB97nndye+q3ddD0HDXgqWdN6K4L7VvRblqboViHETdxwTaS/X8BtVEVGcQIMow4BT20P1hMZhptQfICUqUgzjgbN+8Gn1eFSJOjq+1mH2sFi+yHZukD9dpneTCPLWAXN3gTBQAkbhjzwIXkqnBnH8nuUCSo93r9yQx6YKJNC1uUJVOzfyj1KWjx4JXRwwn9jlbup9UqFF9tPEZw8zlDHyJSRdObRe6FX1DE/PEuioGEczAuOSWHYpID+xPnr6QPPiphTL+TO+n0CGeIKL3N8YNRp3a/kICKfYM6pb+OHUB/4rwfcs2ccTXsXleCiFnhb+z3pKsotxLMY2dS7yqwR6rsskyuF6owI+0iuWc6tYgbsbvGZVf/uMVDplY7PrTLf4puQ+5J5E+MKaqPnW3VWAbblYs5j+arONPXiTyp99w2q58ZyA9ed+pn3ECkIwlAAZGhw4GnCO3SQ7s2bQ== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2144; 31:oiE2i39p6JpBOG6p9TY9E+OX1PiQvfIR/OHBxDVVSlpOvr7S325qp1b0oBErs4C4EHb8Rr3TJdNqZwXNH+M/aPFa0zJpdyX9fFc4yITaNeWNuwZ1aWqDBPh6rmVo8ABMwzXYF9j/yMs6gBcMr4IsbccF6n2Xodfy+YxwwrnJ+idT303VvO4LfcoZfCczu2l0MMhVreRlamDj0DWjZF+vCzfDeAIhm1/ZpkEbOgQPfKQ=; 20:2VWdz8lON7h4WHfajAF5i61+Vtpc8T7FNFXXGKWaa27VBN1N+6kzgthsfTX8ae8pXgG6AztB7IHdwZDZh2YIi8xAxJD2JsROG7wbH2rLGJaO7rNijCLp5LMDWqX6az4ogAQOeSCjw7cbkpFhvGaL7LQKWfjBLa9Dar33Mn/I5qux8MR7aW/zOgppSHepPlX+VCgN3ega0lDuemhJaI8inBCqhh6Ju6+T14vB/+pZ2HL+ltOctJjRB1wUtogHBhnobPvSNMAVgrlsCx+N4liGLszQg4Ek9pZegNgI9278x+J2YyaDv3zUdn2gpODvyrtQ9ODNKFfcgx4YKS4DqWX9XCgHTZY/zQNBJBA08DX/AWr8huOgDkq32q+3vNaW064BusyOF59Cn+jCSqBZp97tKw5uhqIuiw331jSvAgxz8ufxPhNj65I+AStmK4ooBPYp6VRSo6Jmi+1QwX9sVGefFiCBXPYfyEp6y6zSz5p08+9F0CuopPLFMV/tUGL6T5bIH85yRdSxBuAcFpPGQE56C2bYn+i4Q4g4bT9gURAAOfEjaUpnG3UnMF4sPyLEgU5lvnMoMd2z82aNx3GYUQxq/5Pt8nAyJlK2Cx8cDM6d7cU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:SN1PR07MB2144; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2144; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2144; 4:iDWvl6VKC6rk8OlVHtPhtc0CktMDaJKnqNaXsq+sSnfyW83JmQLbB/5xbknIk3fa4s3xG54YABc1l3eF22oD+HjIvbChOX/24KKS4K9ybguZ+6kJxpSjggCh8ZH9pEiI95NQHI5pDVFkUvWTrALnjFKG+j2bOo9rQ73t24PPgSWiae216cYSM5ieZPZaFDxCiSMB+1VqtMPIC7eWoO+DiY1QolTXx361TJDWRxgeGKjjGqt8+lWyitcSqv4WfSyKYMOQnbuc5R9R1GqRIhIjdkrOypE9rUsxsjdJt2MBFwOM2supQcd0bEGiK4wDUEw4ndDfDyachui8pD00Sc/1MDbBlsW1lwmkzn0QIdVetzWima17/uVm9xH0BxCmU9oXbDYP7Y4sueJ6Y1WfG4nLGw== X-Forefront-PRVS: 00429279BA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(229853001)(53416004)(105586002)(2351001)(76506005)(19580405001)(66066001)(47776003)(5003940100001)(50986999)(76176999)(8676002)(81156014)(106356001)(42186005)(101416001)(81166006)(31430400001)(33646002)(97736004)(4001430100002)(77096005)(50226002)(2950100001)(189998001)(5660300001)(92566002)(50466002)(36756003)(107886002)(110136002)(586003)(2906002)(6116002)(4326007)(3846002)(48376002)(69596002)(19580395003)(68736007)(305945005)(7846002)(7736002)(4720700001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2144; H:localhost.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB2144; 23:dP+yVwnC14gY7LP7FGxtNZL9tJjd2FrKPVPCR2fCY?= =?us-ascii?Q?4Uh/3it3NrWS/nItMJaxc+sMz9594i11qKq2nyv0uLjMAsHrUMEKcsRvNGv1?= =?us-ascii?Q?fI1Rfa17ZxalrX0WsI9y5ua49qOr28iHlpMr4R9t6loGNpSrb6O2gENkeTqo?= =?us-ascii?Q?pXv0sdcsz7bkDFtfodXKvHx+NsrPVp2+UNDfdRSEumtOrjLeVXx+SGfbhAtN?= =?us-ascii?Q?jnCe1DhSdLAP6C07oGQR1XZfYYEhZe60JJa7lc2Rqf/r/0JDTi9kGJFi6lwm?= =?us-ascii?Q?q7603TeoDzzWxaCQyNEB+Ll1o9QS9Hkjp0wsooMxqEI+tGWIaJB3SGDdLu0/?= =?us-ascii?Q?J0TUlOfGfdvKPQvu1AtCZaSqek+Nvalf5SwIVaeaMFTDkrkuvwdgwbn6fPpv?= =?us-ascii?Q?TWbZnqcHfiLxcaLksvGlEEqWu7oaymLm3cjE/fzYEK3E7QidOLYtLTzPxwmn?= =?us-ascii?Q?fdBHca+QcKSdp1wLPScT+TmcUp0OnqL4i80h/wMiPhrk7Mn75JOl2xaISv79?= =?us-ascii?Q?hDHv1CT3vtBT+3w52Ol2Iot3IsKlN+/E0KIOQvSy1QDMKYQha8YAEPi2uBYf?= =?us-ascii?Q?taBNFMefizLZIInzT/3JMxaTv4TB+5SUcgsI8Zc3oGLQo+hF1rWAhHVveuHa?= =?us-ascii?Q?8h2lKUcDFJsPEhsPNcc0CFZJ+0qLQyHB3ONZmXQcVlBOWWqLFAPyONl/cTsY?= =?us-ascii?Q?c72n15Va2t67tk3um3kwuxvWP5oqwhbeVuCBo+gFNhwBDx4pDW1hZmVeI+b9?= =?us-ascii?Q?hJj7OSjCbYIiy76vLPRUDA0YzW5LE21ndiOD/F2Iw50GWBTQZRZg5AfTuXMr?= =?us-ascii?Q?n0qw21MjdITh5204gjH+pY0p8XXtQfErm7Du5ljnDRxDb9GWJCJy+tA+D/DI?= =?us-ascii?Q?Bi/PcMDGijGUxuFKgduXLeAxL+0FQ+SsDthJ7ILXSQu/CQKG2GuUa8/qTaPo?= =?us-ascii?Q?lVXcKhsVbUnQ0mPXxSGMc8Ff35Nj0yGeYXIMYjhGVFhrlaw9kTkfulr2S7CW?= =?us-ascii?Q?w9zhjcrZp469lxL5iKtJEC4RyiWNly9kLAc4PIV9YT4/ktleHT6LY8N7TqqE?= =?us-ascii?Q?lG3oSf660+WgUWdAH8PXCszRkbLsel83QSafue7xj8voo05YOugPr4+XPj+H?= =?us-ascii?Q?xKKy6C8ZYb1cftqNms9Xsgc/BSKdnIuXsW5YkwGOvEF1GYh+AOjo55obosEp?= =?us-ascii?Q?yreSx9Q+lXE4WKoWdGWrQ4u/v7U6iQEPgRlhp4+Clo1ZCovdxDxndtZQ+ILF?= =?us-ascii?Q?jnMEt3Toe9E9sWI4DG4Wh9faQGwMz1I2BKVdrxk?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2144; 6:5s/Aw5DpX/CUWPzaGbL/KdUW5ijkrL/py6zW5Xin3TazdQW1sw4D0PW8aCZNKlrgKNhyM+6SJTkDuqZvnxX9tm3CvRtbXEdIOEGPJhjrhSgcSEw+t3/vdWWQWw3C5xsrXJ4UVebxRIZYSfJlZXhbGvuTXpSGREP/+6r9XrO8vSUKS3eghsU7SR0JWlh6fn7oHU1BB2oFQY2WnFjPIMuHbq0AYJHOsWePcWmSICh2pkhm/D1/EvrrIzD3AP474nDLcwHdWEXQqPfDjHYI5YuLOCvS64btxz2eavY9f5VOWV4=; 5:9STUkGg+e8ysR8mpyL69vL/vs8TMbPqOY74NEhWFpgqInczJdR7LY3ep4PmnlH4HA+/mZ0494NapdEKZQJVs/kHHGTyvlREdbu/lwsm2PcqdUjffpbrxWkxjgxZ/aPwl76bsSEOKQ9eUwgp6rIvb8g==; 24:LAwvfZ3qlhNKZVIdsaOe7TIJpvKv7ATpuJ2tXTtgowLGsunGy7FgdRQLKB85qXGXsb4mg1DG7rYTBT6VYjqEMZC1Hi7gBUe0v1jMyOVE6tk=; 7:X7DmlJUpW9NuLiMXrJTG2QFLT96nWG2DqR4tSMAT8eW+WoMwQiVzA3nBqNfaBXySenIcfNcT5Y54YMEYfZLvAvflbkDt5Wca9OwfgPuvpEJIyVEUM5Tr5ARlqETTtMNfvas3cSzcg1qkYO4y91zKuJ8xN67eMR7Y98MxXcCYRDlaFBYJTxaN0gvp/+TloXQjR33hWXGrSxTPSOvBBorTWtf+fecugIRA0VoA1Z2sX4U05xUmuqW8pSbVx7tH0VEr SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2016 00:13:55.0006 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2144 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch adds support msix interrupt for cn23xx device. Signed-off-by: Derek Chickles Signed-off-by: Satanand Burla Signed-off-by: Felix Manlunas Signed-off-by: Raghu Vatsavayi --- .../ethernet/cavium/liquidio/cn23xx_pf_device.c | 174 ++++++++++++-- .../net/ethernet/cavium/liquidio/cn66xx_device.c | 12 +- .../net/ethernet/cavium/liquidio/cn66xx_device.h | 4 +- drivers/net/ethernet/cavium/liquidio/lio_main.c | 255 +++++++++++++++++---- .../net/ethernet/cavium/liquidio/octeon_device.c | 39 ++++ .../net/ethernet/cavium/liquidio/octeon_device.h | 31 ++- 6 files changed, 449 insertions(+), 66 deletions(-) diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c index 1a72cc6..0603218 100644 --- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c +++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c @@ -558,10 +558,16 @@ static void cn23xx_setup_iq_regs(struct octeon_device *oct, u32 iq_no) */ pkt_in_done = readq(iq->inst_cnt_reg); - /* Clear the count by writing back what we read, but don't - * enable interrupts - */ - writeq(pkt_in_done, iq->inst_cnt_reg); + if (oct->msix_on) { + /* Set CINT_ENB to enable IQ interrupt */ + writeq((pkt_in_done | CN23XX_INTR_CINT_ENB), + iq->inst_cnt_reg); + } else { + /* Clear the count by writing back what we read, but don't + * enable interrupts + */ + writeq(pkt_in_done, iq->inst_cnt_reg); + } iq->reset_instr_cnt = 0; } @@ -570,6 +576,9 @@ static void cn23xx_setup_oq_regs(struct octeon_device *oct, u32 oq_no) { u32 reg_val; struct octeon_droq *droq = oct->droq[oq_no]; + struct octeon_cn23xx_pf *cn23xx = (struct octeon_cn23xx_pf *)oct->chip; + u64 time_threshold; + u64 cnt_threshold; oq_no += oct->sriov_info.pf_srn; @@ -586,19 +595,31 @@ static void cn23xx_setup_oq_regs(struct octeon_device *oct, u32 oq_no) droq->pkts_credit_reg = (u8 *)oct->mmio[0].hw_addr + CN23XX_SLI_OQ_PKTS_CREDIT(oq_no); - /* Enable this output queue to generate Packet Timer Interrupt - */ - reg_val = octeon_read_csr(oct, CN23XX_SLI_OQ_PKT_CONTROL(oq_no)); - reg_val |= CN23XX_PKT_OUTPUT_CTL_TENB; - octeon_write_csr(oct, CN23XX_SLI_OQ_PKT_CONTROL(oq_no), - reg_val); + if (!oct->msix_on) { + /* Enable this output queue to generate Packet Timer Interrupt + */ + reg_val = + octeon_read_csr(oct, CN23XX_SLI_OQ_PKT_CONTROL(oq_no)); + reg_val |= CN23XX_PKT_OUTPUT_CTL_TENB; + octeon_write_csr(oct, CN23XX_SLI_OQ_PKT_CONTROL(oq_no), + reg_val); - /* Enable this output queue to generate Packet Count Interrupt - */ - reg_val = octeon_read_csr(oct, CN23XX_SLI_OQ_PKT_CONTROL(oq_no)); - reg_val |= CN23XX_PKT_OUTPUT_CTL_CENB; - octeon_write_csr(oct, CN23XX_SLI_OQ_PKT_CONTROL(oq_no), - reg_val); + /* Enable this output queue to generate Packet Count Interrupt + */ + reg_val = + octeon_read_csr(oct, CN23XX_SLI_OQ_PKT_CONTROL(oq_no)); + reg_val |= CN23XX_PKT_OUTPUT_CTL_CENB; + octeon_write_csr(oct, CN23XX_SLI_OQ_PKT_CONTROL(oq_no), + reg_val); + } else { + time_threshold = cn23xx_pf_get_oq_ticks( + oct, (u32)CFG_GET_OQ_INTR_TIME(cn23xx->conf)); + cnt_threshold = (u32)CFG_GET_OQ_INTR_PKT(cn23xx->conf); + + octeon_write_csr64( + oct, CN23XX_SLI_OQ_PKT_INT_LEVELS(oq_no), + ((u64)(time_threshold << 32 | cnt_threshold))); + } } static void cn23xx_enable_io_queues(struct octeon_device *oct) @@ -744,6 +765,85 @@ static void cn23xx_disable_io_queues(struct octeon_device *oct) } } +static u64 cn23xx_pf_msix_interrupt_handler(void *dev) +{ + struct octeon_ioq_vector *ioq_vector = (struct octeon_ioq_vector *)dev; + struct octeon_device *oct = ioq_vector->oct_dev; + u64 pkts_sent; + u64 ret = 0; + struct octeon_droq *droq = oct->droq[ioq_vector->droq_index]; + + dev_dbg(&oct->pci_dev->dev, "In %s octeon_dev @ %p\n", __func__, oct); + + if (!droq) { + dev_err(&oct->pci_dev->dev, "23XX bringup FIXME: oct pfnum:%d ioq_vector->ioq_num :%d droq is NULL\n", + oct->pf_num, ioq_vector->ioq_num); + return 0; + } + + pkts_sent = readq(droq->pkts_sent_reg); + + /* If our device has interrupted, then proceed. Also check + * for all f's if interrupt was triggered on an error + * and the PCI read fails. + */ + if (!pkts_sent || (pkts_sent == 0xFFFFFFFFFFFFFFFFULL)) + return ret; + + /* Write count reg in sli_pkt_cnts to clear these int.*/ + if ((pkts_sent & CN23XX_INTR_PO_INT) || + (pkts_sent & CN23XX_INTR_PI_INT)) { + if (pkts_sent & CN23XX_INTR_PO_INT) + ret |= MSIX_PO_INT; + } + + if (pkts_sent & CN23XX_INTR_PI_INT) + /* We will clear the count when we update the read_index. */ + ret |= MSIX_PI_INT; + + /* Never need to handle msix mbox intr for pf. They arrive on the last + * msix + */ + return ret; +} + +static void cn23xx_handle_pcie_error_intr(struct octeon_device *oct, u64 intr64) +{ + dev_err(&oct->pci_dev->dev, "OCTEON[%d]: Error Intr: 0x%016llx\n", + oct->octeon_id, + CVM_CAST64(intr64)); +} + +static irqreturn_t cn23xx_interrupt_handler(void *dev) +{ + struct octeon_device *oct = (struct octeon_device *)dev; + struct octeon_cn23xx_pf *cn23xx = (struct octeon_cn23xx_pf *)oct->chip; + u64 intr64; + + dev_dbg(&oct->pci_dev->dev, "In %s octeon_dev @ %p\n", __func__, oct); + intr64 = readq(cn23xx->intr_sum_reg64); + + oct->int_status = 0; + + if (intr64 & CN23XX_INTR_ERR) + cn23xx_handle_pcie_error_intr(oct, intr64); + + if (oct->msix_on != 1) { + if (intr64 & CN23XX_INTR_PKT_DATA) + oct->int_status |= OCT_DEV_INTR_PKT_DATA; + } + + if (intr64 & (CN23XX_INTR_DMA0_FORCE)) + oct->int_status |= OCT_DEV_INTR_DMA0_FORCE; + if (intr64 & (CN23XX_INTR_DMA1_FORCE)) + oct->int_status |= OCT_DEV_INTR_DMA1_FORCE; + + /* Clear the current interrupts */ + writeq(intr64, cn23xx->intr_sum_reg64); + + return IRQ_HANDLED; +} + static void cn23xx_reinit_regs(struct octeon_device *oct) { u32 i; @@ -766,7 +866,7 @@ static void cn23xx_reinit_regs(struct octeon_device *oct) oct->fn_list.setup_device_regs(oct); - oct->fn_list.enable_interrupt(oct); + oct->fn_list.enable_interrupt(oct, OCTEON_ALL_INTR); oct->fn_list.enable_io_queues(oct); @@ -779,6 +879,37 @@ static void cn23xx_reinit_regs(struct octeon_device *oct) } } +static void cn23xx_enable_pf_interrupt(struct octeon_device *oct, u8 intr_flag) +{ + struct octeon_cn23xx_pf *cn23xx = (struct octeon_cn23xx_pf *)oct->chip; + u64 intr_val = 0; + + /* Divide the single write to multiple writes based on the flag. */ + /* Enable Interrupt */ + if (intr_flag == OCTEON_ALL_INTR) { + writeq(cn23xx->intr_mask64, cn23xx->intr_enb_reg64); + } else if (intr_flag & OCTEON_OUTPUT_INTR) { + intr_val = readq(cn23xx->intr_enb_reg64); + intr_val |= CN23XX_INTR_PKT_DATA; + writeq(intr_val, cn23xx->intr_enb_reg64); + } +} + +static void cn23xx_disable_pf_interrupt(struct octeon_device *oct, u8 intr_flag) +{ + struct octeon_cn23xx_pf *cn23xx = (struct octeon_cn23xx_pf *)oct->chip; + u64 intr_val = 0; + + /* Disable Interrupts */ + if (intr_flag == OCTEON_ALL_INTR) { + writeq(0, cn23xx->intr_enb_reg64); + } else if (intr_flag & OCTEON_OUTPUT_INTR) { + intr_val = readq(cn23xx->intr_enb_reg64); + intr_val &= ~CN23XX_INTR_PKT_DATA; + writeq(intr_val, cn23xx->intr_enb_reg64); + } +} + static void cn23xx_get_pcie_qlmport(struct octeon_device *oct) { oct->pcie_port = (octeon_read_csr(oct, CN23XX_SLI_MAC_NUMBER)) & 0xff; @@ -833,7 +964,8 @@ static void cn23xx_setup_reg_address(struct octeon_device *oct) cn23xx_get_pcie_qlmport(oct); cn23xx->intr_mask64 = CN23XX_INTR_MASK; - cn23xx->intr_mask64 |= CN23XX_INTR_PKT_TIME; + if (!oct->msix_on) + cn23xx->intr_mask64 |= CN23XX_INTR_PKT_TIME; if (oct->rev_id >= OCTEON_CN23XX_REV_1_1) cn23xx->intr_mask64 |= CN23XX_INTR_VF_MBOX; @@ -918,9 +1050,15 @@ int setup_cn23xx_octeon_pf_device(struct octeon_device *oct) oct->fn_list.setup_iq_regs = cn23xx_setup_iq_regs; oct->fn_list.setup_oq_regs = cn23xx_setup_oq_regs; + oct->fn_list.process_interrupt_regs = cn23xx_interrupt_handler; + oct->fn_list.msix_interrupt_handler = cn23xx_pf_msix_interrupt_handler; + oct->fn_list.setup_device_regs = cn23xx_setup_pf_device_regs; oct->fn_list.reinit_regs = cn23xx_reinit_regs; + oct->fn_list.enable_interrupt = cn23xx_enable_pf_interrupt; + oct->fn_list.disable_interrupt = cn23xx_disable_pf_interrupt; + oct->fn_list.enable_io_queues = cn23xx_enable_io_queues; oct->fn_list.disable_io_queues = cn23xx_disable_io_queues; diff --git a/drivers/net/ethernet/cavium/liquidio/cn66xx_device.c b/drivers/net/ethernet/cavium/liquidio/cn66xx_device.c index c03d370..60c910b 100644 --- a/drivers/net/ethernet/cavium/liquidio/cn66xx_device.c +++ b/drivers/net/ethernet/cavium/liquidio/cn66xx_device.c @@ -436,7 +436,7 @@ void lio_cn6xxx_reinit_regs(struct octeon_device *oct) oct->fn_list.setup_device_regs(oct); - oct->fn_list.enable_interrupt(oct->chip); + oct->fn_list.enable_interrupt(oct, OCTEON_ALL_INTR); oct->fn_list.enable_io_queues(oct); @@ -507,18 +507,20 @@ lio_cn6xxx_update_read_index(struct octeon_instr_queue *iq) return new_idx; } -void lio_cn6xxx_enable_interrupt(void *chip) +void lio_cn6xxx_enable_interrupt(struct octeon_device *oct, + u8 unused __attribute__((unused))) { - struct octeon_cn6xxx *cn6xxx = (struct octeon_cn6xxx *)chip; + struct octeon_cn6xxx *cn6xxx = (struct octeon_cn6xxx *)oct->chip; u64 mask = cn6xxx->intr_mask64 | CN6XXX_INTR_DMA0_FORCE; /* Enable Interrupt */ writeq(mask, cn6xxx->intr_enb_reg64); } -void lio_cn6xxx_disable_interrupt(void *chip) +void lio_cn6xxx_disable_interrupt(struct octeon_device *oct, + u8 unused __attribute__((unused))) { - struct octeon_cn6xxx *cn6xxx = (struct octeon_cn6xxx *)chip; + struct octeon_cn6xxx *cn6xxx = (struct octeon_cn6xxx *)oct->chip; /* Disable Interrupts */ writeq(0, cn6xxx->intr_enb_reg64); diff --git a/drivers/net/ethernet/cavium/liquidio/cn66xx_device.h b/drivers/net/ethernet/cavium/liquidio/cn66xx_device.h index 28c4722..e6e15ba 100644 --- a/drivers/net/ethernet/cavium/liquidio/cn66xx_device.h +++ b/drivers/net/ethernet/cavium/liquidio/cn66xx_device.h @@ -90,8 +90,8 @@ void lio_cn6xxx_bar1_idx_write(struct octeon_device *oct, u32 idx, u32 mask); u32 lio_cn6xxx_bar1_idx_read(struct octeon_device *oct, u32 idx); u32 lio_cn6xxx_update_read_index(struct octeon_instr_queue *iq); -void lio_cn6xxx_enable_interrupt(void *chip); -void lio_cn6xxx_disable_interrupt(void *chip); +void lio_cn6xxx_enable_interrupt(struct octeon_device *oct, u8 unused); +void lio_cn6xxx_disable_interrupt(struct octeon_device *oct, u8 unused); void cn6xxx_get_pcie_qlmport(struct octeon_device *oct); void lio_cn6xxx_setup_reg_address(struct octeon_device *oct, void *chip, struct octeon_reg_list *reg_list); diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index 6879799..82b5ebd 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c @@ -68,6 +68,8 @@ static int conf_type; module_param(conf_type, int, 0); MODULE_PARM_DESC(conf_type, "select octeon configuration 0 default 1 ovs"); +static int msix_enable = 1; + static int ptp_enable = 1; /* Bit mask values for lio->ifstate */ @@ -195,6 +197,19 @@ static void octeon_droq_bh(unsigned long pdev) reschedule |= octeon_droq_process_packets(oct, oct->droq[q_no], MAX_PACKET_BUDGET); lio_enable_irq(oct->droq[q_no], NULL); + + if (OCTEON_CN23XX_PF(oct) && msix_enable) { + /* set time and cnt interrupt thresholds for this DROQ + * for NAPI + */ + int adjusted_q_no = q_no + oct->sriov_info.pf_srn; + + octeon_write_csr64( + oct, CN23XX_SLI_OQ_PKT_INT_LEVELS(adjusted_q_no), + 0x5700000040ULL); + octeon_write_csr64( + oct, CN23XX_SLI_OQ_PKTS_SENT(adjusted_q_no), 0); + } } if (reschedule) @@ -347,7 +362,7 @@ static void stop_pci_io(struct octeon_device *oct) pci_disable_device(oct->pci_dev); /* Disable interrupts */ - oct->fn_list.disable_interrupt(oct->chip); + oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR); pcierror_quiesce_device(oct); @@ -910,6 +925,27 @@ static void update_txq_status(struct octeon_device *oct, int iq_num) } } +static +int liquidio_schedule_msix_droq_pkt_handler(struct octeon_droq *droq, u64 ret) +{ + struct octeon_device *oct = droq->oct_dev; + struct octeon_device_priv *oct_priv = + (struct octeon_device_priv *)oct->priv; + + if (droq->ops.poll_mode) { + droq->ops.napi_fn(droq); + } else { + if (ret & MSIX_PO_INT) { + tasklet_schedule(&oct_priv->droq_tasklet); + return 1; + } + /* this will be flushed periodically by check iq db */ + if (ret & MSIX_PI_INT) + return 0; + } + return 0; +} + /** * \brief Droq packet processor sceduler * @param oct octeon device @@ -940,19 +976,36 @@ void liquidio_schedule_droq_pkt_handlers(struct octeon_device *oct) } } +static irqreturn_t +liquidio_msix_intr_handler(int irq __attribute__((unused)), void *dev) +{ + u64 ret; + struct octeon_ioq_vector *ioq_vector = (struct octeon_ioq_vector *)dev; + struct octeon_device *oct = ioq_vector->oct_dev; + struct octeon_droq *droq = oct->droq[ioq_vector->droq_index]; + + ret = oct->fn_list.msix_interrupt_handler(ioq_vector); + + if ((ret & MSIX_PO_INT) || (ret & MSIX_PI_INT)) + liquidio_schedule_msix_droq_pkt_handler(droq, ret); + + return IRQ_HANDLED; +} + /** * \brief Interrupt handler for octeon * @param irq unused * @param dev octeon device */ static -irqreturn_t liquidio_intr_handler(int irq __attribute__((unused)), void *dev) +irqreturn_t liquidio_legacy_intr_handler(int irq __attribute__((unused)), + void *dev) { struct octeon_device *oct = (struct octeon_device *)dev; irqreturn_t ret; /* Disable our interrupts for the duration of ISR */ - oct->fn_list.disable_interrupt(oct->chip); + oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR); ret = oct->fn_list.process_interrupt_regs(oct); @@ -961,7 +1014,7 @@ irqreturn_t liquidio_intr_handler(int irq __attribute__((unused)), void *dev) /* Re-enable our interrupts */ if (!(atomic_read(&oct->status) == OCT_DEV_IN_RESET)) - oct->fn_list.enable_interrupt(oct->chip); + oct->fn_list.enable_interrupt(oct, OCTEON_ALL_INTR); return ret; } @@ -975,24 +1028,108 @@ irqreturn_t liquidio_intr_handler(int irq __attribute__((unused)), void *dev) static int octeon_setup_interrupt(struct octeon_device *oct) { int irqret, err; + struct msix_entry *msix_entries; + int i; + int num_ioq_vectors; + + if (OCTEON_CN23XX_PF(oct) && msix_enable) { + oct->num_msix_irqs = oct->sriov_info.num_pf_rings; + /* one non ioq interrupt for handling sli_mac_pf_int_sum */ + oct->num_msix_irqs += 1; + + oct->msix_entries = kcalloc( + oct->num_msix_irqs, sizeof(struct msix_entry), GFP_KERNEL); + if (!oct->msix_entries) { + /* dev_err(&oct->pci_dev->dev, + * "Memory Alloc failed...\n"); + * This is commenting due WARNING: Possible unnecessary + * out of memory' message + */ + return 1; + } + msix_entries = (struct msix_entry *)oct->msix_entries; + /*Assumption is that pf msix vectors start from pf srn to pf to + * trs and not from 0. if not change this code + */ + for (i = 0; i < oct->num_msix_irqs - 1; i++) + msix_entries[i].entry = oct->sriov_info.pf_srn + i; + msix_entries[oct->num_msix_irqs - 1].entry = + oct->sriov_info.trs; + + if (pci_enable_msix(oct->pci_dev, msix_entries, + oct->num_msix_irqs)) { + dev_err(&oct->pci_dev->dev, "unable to Allocate MSI-X interrupts\n"); + kfree(oct->msix_entries); + return 1; + } + dev_dbg(&oct->pci_dev->dev, "OCTEON: Enough MSI-X interrupts are allocated...\n"); + + num_ioq_vectors = oct->num_msix_irqs; + + /** For PF, there is one non-ioq interrupt handler */ + num_ioq_vectors -= 1; + irqret = request_irq(msix_entries[num_ioq_vectors].vector, + liquidio_legacy_intr_handler, 0, "octeon", + oct); + if (irqret) { + dev_err(&oct->pci_dev->dev, + "OCTEON: Request_irq failed for MSIX interrupt Error: %d\n", + irqret); + kfree(oct->msix_entries); + return 1; + } - err = pci_enable_msi(oct->pci_dev); - if (err) - dev_warn(&oct->pci_dev->dev, "Reverting to legacy interrupts. Error: %d\n", - err); - else - oct->flags |= LIO_FLAG_MSI_ENABLED; - - irqret = request_irq(oct->pci_dev->irq, liquidio_intr_handler, - IRQF_SHARED, "octeon", oct); - if (irqret) { - if (oct->flags & LIO_FLAG_MSI_ENABLED) - pci_disable_msi(oct->pci_dev); - dev_err(&oct->pci_dev->dev, "Request IRQ failed with code: %d\n", - irqret); - return 1; + for (i = 0; i < num_ioq_vectors; i++) { + irqret = request_irq(msix_entries[i].vector, + liquidio_msix_intr_handler, 0, + "octeon", &oct->ioq_vector[i]); + if (irqret) { + dev_err(&oct->pci_dev->dev, + "OCTEON: Request_irq failed for MSIX interrupt Error: %d\n", + irqret); + /** Freeing the non-ioq irq vector here . */ + free_irq(msix_entries[num_ioq_vectors].vector, + oct); + + while (i) { + i--; + free_irq(msix_entries[i].vector, + &oct->ioq_vector[i]); + /** clearing affinity mask. */ + irq_set_affinity_hint( + msix_entries[i].vector, NULL); + } + kfree(oct->msix_entries); + return 1; + } + oct->ioq_vector[i].vector = msix_entries[i].vector; + /* assign the cpu mask for this msix interrupt vector */ + irq_set_affinity_hint( + msix_entries[i].vector, + (&oct->ioq_vector[i].affinity_mask)); + } + oct->msix_on = 1; + dev_dbg(&oct->pci_dev->dev, "OCTEON[%d]: MSI-X enabled\n", + oct->octeon_id); + } else { + err = pci_enable_msi(oct->pci_dev); + if (err) + dev_warn(&oct->pci_dev->dev, "Reverting to legacy interrupts. Error: %d\n", + err); + else + oct->flags |= LIO_FLAG_MSI_ENABLED; + + irqret = request_irq(oct->pci_dev->irq, + liquidio_legacy_intr_handler, IRQF_SHARED, + "octeon", oct); + if (irqret) { + if (oct->flags & LIO_FLAG_MSI_ENABLED) + pci_disable_msi(oct->pci_dev); + dev_err(&oct->pci_dev->dev, "Request IRQ failed with code: %d\n", + irqret); + return 1; + } } - return 0; } @@ -1015,6 +1152,9 @@ liquidio_probe(struct pci_dev *pdev, return -ENOMEM; } + if (pdev->device == OCTEON_CN23XX_PF_VID) + oct_dev->msix_on = msix_enable; + dev_info(&pdev->dev, "Initializing device %x:%x.\n", (u32)pdev->vendor, (u32)pdev->device); @@ -1054,6 +1194,7 @@ liquidio_probe(struct pci_dev *pdev, static void octeon_destroy_resources(struct octeon_device *oct) { int i; + struct msix_entry *msix_entries; struct octeon_device_priv *oct_priv = (struct octeon_device_priv *)oct->priv; @@ -1098,15 +1239,34 @@ static void octeon_destroy_resources(struct octeon_device *oct) dev_err(&oct->pci_dev->dev, "OQ had pending packets\n"); /* Disable interrupts */ - oct->fn_list.disable_interrupt(oct->chip); + oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR); + + if (oct->msix_on) { + msix_entries = (struct msix_entry *)oct->msix_entries; + for (i = 0; i < oct->num_msix_irqs - 1; i++) { + /* clear the affinity_cpumask */ + irq_set_affinity_hint(msix_entries[i].vector, + NULL); + free_irq(msix_entries[i].vector, + &oct->ioq_vector[i]); + } + /* non-iov vector's argument is oct struct */ + free_irq(msix_entries[i].vector, oct); - /* Release the interrupt line */ - free_irq(oct->pci_dev->irq, oct); + pci_disable_msix(oct->pci_dev); + kfree(oct->msix_entries); + oct->msix_entries = NULL; + } else { + /* Release the interrupt line */ + free_irq(oct->pci_dev->irq, oct); - if (oct->flags & LIO_FLAG_MSI_ENABLED) - pci_disable_msi(oct->pci_dev); + if (oct->flags & LIO_FLAG_MSI_ENABLED) + pci_disable_msi(oct->pci_dev); + } - /* fallthrough */ + if (OCTEON_CN23XX_PF(oct)) + octeon_free_ioq_vector(oct); + /* fallthrough */ case OCT_DEV_IN_RESET: case OCT_DEV_DROQ_INIT_DONE: /*atomic_set(&oct->status, OCT_DEV_DROQ_INIT_DONE);*/ @@ -2194,7 +2354,12 @@ static int liquidio_open(struct net_device *netdev) ifstate_set(lio, LIO_IFSTATE_RUNNING); - setup_tx_poll_fn(netdev); + if (OCTEON_CN23XX_PF(oct)) { + if (!oct->msix_on) + setup_tx_poll_fn(netdev); + } else { + setup_tx_poll_fn(netdev); + } start_txq(netdev); @@ -2240,7 +2405,12 @@ static int liquidio_stop(struct net_device *netdev) /* Now it should be safe to tell Octeon that nic interface is down. */ send_rx_ctrl_cmd(lio, 0); - cleanup_tx_poll_fn(netdev); + if (OCTEON_CN23XX_PF(oct)) { + if (!oct->msix_on) + cleanup_tx_poll_fn(netdev); + } else { + cleanup_tx_poll_fn(netdev); + } if (lio->ptp_clock) { ptp_clock_unregister(lio->ptp_clock); @@ -2252,7 +2422,6 @@ static int liquidio_stop(struct net_device *netdev) return 0; } - /** * \brief Converts a mask based on net device flags * @param netdev network device @@ -3740,15 +3909,23 @@ static int octeon_device_init(struct octeon_device *octeon_dev) atomic_set(&octeon_dev->status, OCT_DEV_DROQ_INIT_DONE); - /* The input and output queue registers were setup earlier (the queues - * were not enabled). Any additional registers that need to be - * programmed should be done now. - */ - ret = octeon_dev->fn_list.setup_device_regs(octeon_dev); - if (ret) { - dev_err(&octeon_dev->pci_dev->dev, - "Failed to configure device registers\n"); - return ret; + if (OCTEON_CN23XX_PF(octeon_dev)) { + if (octeon_allocate_ioq_vector(octeon_dev)) { + dev_err(&octeon_dev->pci_dev->dev, "OCTEON: ioq vector allocation failed\n"); + return 1; + } + + } else { + /* The input and output queue registers were setup earlier (the + * queues were not enabled). Any additional registers + * that need to be programmed should be done now. + */ + ret = octeon_dev->fn_list.setup_device_regs(octeon_dev); + if (ret) { + dev_err(&octeon_dev->pci_dev->dev, + "Failed to configure device registers\n"); + return ret; + } } /* Initialize the tasklet that handles output queue packet processing.*/ @@ -3762,7 +3939,7 @@ static int octeon_device_init(struct octeon_device *octeon_dev) return 1; /* Enable Octeon device interrupts */ - octeon_dev->fn_list.enable_interrupt(octeon_dev->chip); + octeon_dev->fn_list.enable_interrupt(octeon_dev, OCTEON_ALL_INTR); /* Enable the input and output queues for this Octeon device */ octeon_dev->fn_list.enable_io_queues(octeon_dev); diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_device.c b/drivers/net/ethernet/cavium/liquidio/octeon_device.c index 120b78e..5252763 100644 --- a/drivers/net/ethernet/cavium/liquidio/octeon_device.c +++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.c @@ -746,6 +746,45 @@ struct octeon_device *octeon_allocate_device(u32 pci_id, return oct; } +int +octeon_allocate_ioq_vector(struct octeon_device *oct) +{ + int i, num_ioqs = 0; + struct octeon_ioq_vector *ioq_vector; + int cpu_num; + int size; + + if (OCTEON_CN23XX_PF(oct)) + num_ioqs = oct->sriov_info.num_pf_rings; + size = sizeof(struct octeon_ioq_vector) * num_ioqs; + + oct->ioq_vector = vmalloc(size); + if (!oct->ioq_vector) + return 1; + memset(oct->ioq_vector, 0, size); + for (i = 0; i < num_ioqs; i++) { + ioq_vector = &oct->ioq_vector[i]; + ioq_vector->oct_dev = oct; + ioq_vector->iq_index = i; + ioq_vector->droq_index = i; + + cpu_num = i % num_online_cpus(); + cpumask_set_cpu(cpu_num, &ioq_vector->affinity_mask); + + if (oct->chip_id == OCTEON_CN23XX_PF_VID) + ioq_vector->ioq_num = i + oct->sriov_info.pf_srn; + else + ioq_vector->ioq_num = i; + } + return 0; +} + +void +octeon_free_ioq_vector(struct octeon_device *oct) +{ + vfree(oct->ioq_vector); +} + /* this function is only for setting up the first queue */ int octeon_setup_instr_queues(struct octeon_device *oct) { diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_device.h b/drivers/net/ethernet/cavium/liquidio/octeon_device.h index a84ed82..8e28ff4 100644 --- a/drivers/net/ethernet/cavium/liquidio/octeon_device.h +++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.h @@ -52,6 +52,9 @@ enum octeon_pci_swap_mode { OCTEON_PCI_32BIT_LW_SWAP = 3 }; +#define OCTEON_OUTPUT_INTR (2) +#define OCTEON_ALL_INTR 0xff + /*--------------- PCI BAR1 index registers -------------*/ /* BAR1 Mask */ @@ -205,6 +208,7 @@ struct octeon_fn_list { void (*setup_oq_regs)(struct octeon_device *, u32); irqreturn_t (*process_interrupt_regs)(void *); + u64 (*msix_interrupt_handler)(void *); int (*soft_reset)(struct octeon_device *); int (*setup_device_regs)(struct octeon_device *); void (*reinit_regs)(struct octeon_device *); @@ -216,8 +220,8 @@ struct octeon_fn_list { void (*enable_oq_pkt_time_intr)(struct octeon_device *, u32); void (*disable_oq_pkt_time_intr)(struct octeon_device *, u32); - void (*enable_interrupt)(void *); - void (*disable_interrupt)(void *); + void (*enable_interrupt)(struct octeon_device *, u8); + void (*disable_interrupt)(struct octeon_device *, u8); void (*enable_io_queues)(struct octeon_device *); void (*disable_io_queues)(struct octeon_device *); @@ -278,6 +282,9 @@ struct octdev_props { struct net_device *netdev; }; +#define MSIX_PO_INT 0x1 +#define MSIX_PI_INT 0x2 + struct octeon_pf_vf_hs_word { #ifdef __LITTLE_ENDIAN_BITFIELD /** PKIND value assigned for the DPI interface */ @@ -325,6 +332,15 @@ struct octeon_sriov_info { }; +struct octeon_ioq_vector { + struct octeon_device *oct_dev; + int iq_index; + int droq_index; + int vector; + struct cpumask affinity_mask; + u32 ioq_num; +}; + /** The Octeon device. * Each Octeon device has this structure to represent all its * components. @@ -449,10 +465,19 @@ struct octeon_device { void *priv; + int num_msix_irqs; + + void *msix_entries; + struct octeon_sriov_info sriov_info; struct octeon_pf_vf_hs_word pfvf_hsword; + int msix_on; + + /** IOq information of it's corresponding MSI-X interrupt. */ + struct octeon_ioq_vector *ioq_vector; + int rx_pause; int tx_pause; @@ -720,6 +745,8 @@ void *oct_get_config_info(struct octeon_device *oct, u16 card_type); */ struct octeon_config *octeon_get_conf(struct octeon_device *oct); +void octeon_free_ioq_vector(struct octeon_device *oct); +int octeon_allocate_ioq_vector(struct octeon_device *oct); void lio_enable_irq(struct octeon_droq *droq, struct octeon_instr_queue *iq); /* LiquidIO driver pivate flags */