From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from m13-4.163.com (m13-4.163.com [220.181.13.4]) by dpdk.org (Postfix) with ESMTP id 174BBC402 for ; Fri, 23 Oct 2015 06:40:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:From:Subject:MIME-Version:Message-ID; bh=ukzeI dNx5hwi12Ibo38m2CptzhLmrfdlzE5CV641m5I=; b=k1JpyMsIElvwRBb1NAYou P7pdKOx5T6bZrWW+ZoQA6g0n5ZDf75Ev6N7D9j+g1Ua3hDA+2nGjGnyQr1vyy+BN +L1+EEqzWM0y+kT2TFnJ/MuccHcCk1/0kJ4+otUQRZa66/xb1ZIzzz5DjdQqaHoH CI3I4nBGUGd2w9zP92TujA= Received: from mablexidana$163.com ( [182.92.253.20] ) by ajax-webmail-wmsvr4 (Coremail) ; Fri, 23 Oct 2015 12:40:07 +0800 (CST) X-Originating-IP: [182.92.253.20] Date: Fri, 23 Oct 2015 12:40:07 +0800 (CST) From: mablexidana To: "Bruce Richardson" , dev@dpdk.org X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 20150911(74783.7961) Copyright (c) 2002-2015 www.mailtech.cn 163com In-Reply-To: <313921ca.4b27.1508d543038.Coremail.mablexidana@163.com> References: <5e5d9466.100a4.15089d2018f.Coremail.mablexidana@163.com> <20151021110749.GD16140@bricha3-MOBL3> <313921ca.4b27.1508d543038.Coremail.mablexidana@163.com> X-CM-CTRLDATA: dn3Lx2Zvb3Rlcl9odG09MjkwMDg6NTY= MIME-Version: 1.0 Message-ID: <51540495.a2d9.15092ff2946.Coremail.mablexidana@163.com> X-CM-TRANSID: BMGowADX3gIouilWWhOPAA--.24131W X-CM-SenderInfo: xpdezvp0lgt0rd6rljoofrz/1tbiMRKcsFUL3JdtuAACsN X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== Content-Type: text/plain; charset=GBK Content-Transfer-Encoding: base64 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] fix lpm bugs 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: Fri, 23 Oct 2015 04:40:14 -0000 aGk6CkZpeGVzOiAzOTYyODRmMzQ1YTEgKCJhZGQgYXBwL3Rlc3QvdGVzdF9scG0uYyB0ZXN0IGxw bSwgYWRkIDMgbmV3IGNhc2VzIDEpLGFkZC0+bG9va3VwIDIpLGFkZC0+ZGVsZXRlLT5sb29rdXAg MyksYWRkLT5kZWxldGUtPmFkZC0+bG9va3VwIikKW1BBVENIXSBhZGQgYXBwL3Rlc3QvdGVzdF9s cG0uYyB0ZXN0IGxwbSwgYWRkIDMgbmV3IGNhc2VzCgoKdGVzdCBwcm9jZWR1cmU6CiAxKSxhZGQt Pmxvb2t1cCAKIDIpLGFkZC0+ZGVsZXRlLT5sb29rdXAgCiAzKSxhZGQtPmRlbGV0ZS0+YWRkLT5s b29rdXAKCgpUaGlzIGlzIHRoZSB0ZXN0IHByb2dyYW0gdG8gdGVzdCBscG0gYnVncy4gCgoKCgpU aGFua3MKCgpSZWdhcmRzCgoKeXVleGluCi0tLQogYXBwL3Rlc3QvdGVzdF9scG0uYyB8IDQ4MCAr KysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrCiAxIGZp bGUgY2hhbmdlZCwgNDgwIGluc2VydGlvbnMoKykKCgpkaWZmIC0tZ2l0IGEvYXBwL3Rlc3QvdGVz dF9scG0uYyBiL2FwcC90ZXN0L3Rlc3RfbHBtLmMKaW5kZXggOGI0ZGVkOS4uZDJmOGE1MiAxMDA2 NDQKLS0tIGEvYXBwL3Rlc3QvdGVzdF9scG0uYworKysgYi9hcHAvdGVzdC90ZXN0X2xwbS5jCkBA IC0zNSw4ICszNSwxMS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SByb3V0ZSB0ZXN0IHRhYmxlKi8KK2ludAorcm91dGVfdGFibGVfYXJyYXJ5X2FkZCh1aW50MzJf dCBkaXAsIHVpbnQ4X3QgZGVwdGgsIHVpbnQzMl90IG5leHRfaG9wKQoreworICAgIHVpbnQzMl90 IGkgPSAwOworICAgIHVpbnQzMl90IGRpcF9tYXNrZWQgPSBkaXAgJiBkZXB0aF90b19tYXNrKGRl cHRoKTsKKworICAgIGZvcihpID0gMDsgaSA8IExQTV9BRERfUk9VVEVfTUFYOyBpKyspIHsKKyAg ICAgICAgaWYocm91dGVfdGFibGVfYXJyYXJ5W2ldLmZsYWdzID09IDEKKyAgICAgICAgICAgICAg ICAmJiByb3V0ZV90YWJsZV9hcnJhcnlbaV0uZGlwID09IGRpcAorICAgICAgICAgICAgICAgICYm IHJvdXRlX3RhYmxlX2FycmFyeVtpXS5kZXB0aCA9PSBkZXB0aCkgeworCisgICAgICAgICAgICBy b3V0ZV90YWJsZV9hcnJhcnlbaV0uZGlwID0gZGlwX21hc2tlZDsKKyAgICAgICAgICAgIHJvdXRl X3RhYmxlX2FycmFyeVtpXS5kZXB0aCA9IGRlcHRoOworICAgICAgICAgICAgcm91dGVfdGFibGVf YXJyYXJ5W2ldLm5leHRfaG9wID0gbmV4dF9ob3A7CisKKyAgICAgICAgICAgIHJldHVybiAwOyAg IC8vZXhzaXQsIHVwZGF0ZQorICAgICAgICB9CisgICAgfQorCisgICAgZm9yKGkgPSAwOyBpIDwg TFBNX0FERF9ST1VURV9NQVg7IGkrKykgeworICAgICAgICBpZihyb3V0ZV90YWJsZV9hcnJhcnlb aV0uZmxhZ3MgPT0gMCkgeyAgLy9hZGQgdGhlIHJvdXRlCisgICAgICAgICAgICByb3V0ZV90YWJs ZV9hcnJhcnlbaV0uZmxhZ3MgPSAxOworICAgICAgICAgICAgcm91dGVfdGFibGVfYXJyYXJ5W2ld LmRpcCA9IGRpcF9tYXNrZWQ7CisgICAgICAgICAgICByb3V0ZV90YWJsZV9hcnJhcnlbaV0uZGVw dGggPSBkZXB0aDsKKyAgICAgICAgICAgIHJvdXRlX3RhYmxlX2FycmFyeVtpXS5uZXh0X2hvcCA9 IG5leHRfaG9wOworCisgICAgICAgICAgICByZXR1cm4gMDsgICAvL2FkZCBvbmUgYnkgb25lLCBz dWNjZXNzCisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gLTE7ICAvL2FkZCBmYWlsZWQK K30KKworI2lmIFJURV9WRVJTSU9OID49IFJURV9WRVJTSU9OX05VTSgyLCAxLCAwLCAwKQoraW50 IHJvdXRlX3RhYmxlX2xwbV9sb29rdXAoc3RydWN0IHJ0ZV9scG0gKmxwbSwgdWludDMyX3QgZGlw LCB1aW50OF90ICpuZXh0X2hvcCkKKyNlbHNlCitpbnQgcm91dGVfdGFibGVfbHBtX2xvb2t1cChz dHJ1Y3QgcnRlX2xwbSAqbHBtLCB1aW50MzJfdCBkaXAsIHVpbnQxNl90ICpuZXh0X2hvcCkKKyNl bmRpZgoreworICAgIGludCBpLCBqOworICAgIGludCBzdGFydCwgZW5kOworICAgIHVpbnQzMl90 IG1hc2s7CisKKyAgICBmb3IoaSA9IFJURV9MUE1fVjNfTUFYX0RFUFRIIC0gMTsgaSA+PSAwIDsg aS0tKSB7CisjaWYgUlRFX1ZFUlNJT04gPj0gUlRFX1ZFUlNJT05fTlVNKDIsIDEsIDAsIDApCisg ICAgICAgIHN0YXJ0ID0gbHBtLT5ydWxlX2luZm9baV0uZmlyc3RfcnVsZTsgICAvL2ZpbmQgZnJv bSBtYXggZGVwdGggcnVsZQorICAgICAgICBlbmQgPSBzdGFydCArIGxwbS0+cnVsZV9pbmZvW2ld LnVzZWRfcnVsZXM7CisjZWxzZQorICAgICAgICBzdGFydCA9IGkgKiBscG0tPm1heF9ydWxlc19w ZXJfZGVwdGg7CisgICAgICAgIGVuZCA9IHN0YXJ0ICsgbHBtLT51c2VkX3J1bGVzX2F0X2RlcHRo W2ldOworI2VuZGlmCisgICAgICAgIGZvcihqID0gc3RhcnQ7IGogPCBlbmQ7IGorKykgeworICAg ICAgICAgICAgbWFzayA9IGRlcHRoX3RvX21hc2soaSArIDEpOworCisgICAgICAgICAgICBpZigo ZGlwICYgbWFzaykgPT0gbHBtLT5ydWxlc190Ymxbal0uaXApIHsKKyAgICAgICAgICAgICAgICAq bmV4dF9ob3AgPSBscG0tPnJ1bGVzX3RibFtqXS5uZXh0X2hvcDsKKyAgICAgICAgICAgICAgICBy ZXR1cm4gMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHJldHVybiAt MTsKK30KKworLypzaG93IGxwbSdzIHJvdXRlIGVudHJpZXMqLwordm9pZCBscG1fcm91dGVfc2hv dyhzdHJ1Y3QgcnRlX2xwbSAqbHBtKQoreworICAgIHVpbnQzMl90IGkgPSAwLCBqID0gMDsKKyAg ICB1aW50MzJfdCBzdGFydCA9IDAsIGVuZCA9IDAsIGNvdW50ID0gMDsKKworICAgIHByaW50Zigi WyVzOiVkXXNob3cgcnVsZSBpbiBscG0gdHJlZS4uLlxuIixfX2Z1bmNfXyxfX0xJTkVfXyk7CisK KyAgICBmb3IoaSA9IDA7IGkgPCBSVEVfTFBNX1YzX01BWF9ERVBUSDsgaSsrKXsKKyNpZiBSVEVf VkVSU0lPTiA+PSBSVEVfVkVSU0lPTl9OVU0oMiwgMSwgMCwgMCkKKyAgICAgICAgc3RhcnQgPSBs cG0tPnJ1bGVfaW5mb1tpXS5maXJzdF9ydWxlOworICAgICAgICBlbmQgPSBzdGFydCArIGxwbS0+ cnVsZV9pbmZvW2ldLnVzZWRfcnVsZXM7CisjZWxzZQorICAgICAgICBzdGFydCA9IGkgKiBscG0t Pm1heF9ydWxlc19wZXJfZGVwdGg7CisgICAgICAgIGVuZCA9IHN0YXJ0ICsgbHBtLT51c2VkX3J1 bGVzX2F0X2RlcHRoW2ldOworI2VuZGlmCisgICAgICAgIGZvcihqID0gc3RhcnQ7IGogPCBlbmQ7 IGorKykgeworICAgICAgICAgICAgcHJpbnRmKCJcdHJ1bGUgaWQgOiAldSwgaXAgOiAiUFJJTlRf SVBfRk9STUFUIi8ldSwgbmV4dF9ob3AgOiAldSwgXHRcdCBscG0gYXJyYXJ5KCV1IC0gJXUgLSAl dSlcbiIsCisgICAgICAgICAgICAgICAgICAgICAgICArK2NvdW50LCBQUklOVF9ISVAobHBtLT5y dWxlc190Ymxbal0uaXApLCBpICsgMSwgbHBtLT5ydWxlc190Ymxbal0ubmV4dF9ob3AsIGksIHN0 YXJ0LCBlbmQpOworICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuOworfQorCisvKnNob3cg bHBtJ3Mgcm91dGUgZW50cmllcyBvbiBob3AxIGFuZCBob3AyKi8KK3ZvaWQKK2xwbV9yb3V0ZV9z aG93X3YyKHN0cnVjdCBydGVfbHBtICpscG0sIHVpbnQzMl90IGhvcDEsIHVpbnQzMl90IGhvcDIp Cit7CisgICAgdWludDMyX3QgaSA9IDAsIGogPSAwOworICAgIHVpbnQzMl90IHN0YXJ0ID0gMCwg ZW5kID0gMCwgY291bnQgPSAwOworCisgICAgcHJpbnRmKCJbJXM6JWRdc2hvdyBydWxlIGluIGxw bSB0cmVlLi4uXG4iLF9fZnVuY19fLF9fTElORV9fKTsKKworICAgIGZvcihpID0gMDsgaSA8IFJU RV9MUE1fVjNfTUFYX0RFUFRIOyBpKyspeworI2lmIFJURV9WRVJTSU9OID49IFJURV9WRVJTSU9O X05VTSgyLCAxLCAwLCAwKQorICAgICAgICBzdGFydCA9IGxwbS0+cnVsZV9pbmZvW2ldLmZpcnN0 X3J1bGU7CisgICAgICAgIGVuZCA9IHN0YXJ0ICsgbHBtLT5ydWxlX2luZm9baV0udXNlZF9ydWxl czsKKyNlbHNlCisgICAgICAgIHN0YXJ0ID0gaSAqIGxwbS0+bWF4X3J1bGVzX3Blcl9kZXB0aDsK KyAgICAgICAgZW5kID0gc3RhcnQgKyBscG0tPnVzZWRfcnVsZXNfYXRfZGVwdGhbaV07CisjZW5k aWYKKyAgICAgICAgZm9yKGogPSBzdGFydDsgaiA8IGVuZDsgaisrKSB7CisgICAgICAgICAgICBp ZihscG0tPnJ1bGVzX3RibFtqXS5uZXh0X2hvcCA9PSBob3AxIHx8IGxwbS0+cnVsZXNfdGJsW2pd Lm5leHRfaG9wID09IGhvcDIpIHsKKyAgICAgICAgICAgICAgICBwcmludGYoIlx0cnVsZSBpZCA6 ICV1LCBpcCA6ICJQUklOVF9JUF9GT1JNQVQiLyV1LCBuZXh0X2hvcCA6ICV1LCBcdFx0IGxwbSBh cnJhcnkoJXUgLSAldSAtICV1KVxuIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICsrY291bnQs IFBSSU5UX0hJUChscG0tPnJ1bGVzX3RibFtqXS5pcCksIGkgKyAxLCBscG0tPnJ1bGVzX3RibFtq XS5uZXh0X2hvcCwgaSwgc3RhcnQsIGVuZCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAg ICB9CisKKyAgICByZXR1cm47Cit9CisKK2ludAorbHBtX3JhbmRvbV9hZGRfbmV4dGhvcChzdHJ1 Y3QgcnRlX2xwbSAqbHBtX3RyZWUsIGludCBjb3VudCwgaW50IG5leHRfaG9wKQoreworICAgIGlu dDMyX3QgaTsKKyAgICBpbnQzMl90IHN0YXR1cyA9IDA7CisgICAgdWludDMyX3QgYWRkX2RpcCA9 IDA7CisgICAgdWludDhfdCBhZGRfZGVwdGggPSAwOworICAgIHVpbnQ4X3QgbmV4dF9ob3BfYWRk ID0gMDsKK3VpbnQzMl90IGRpcF9tYXNrZWQgPSAwOworICAgIHVpbnQ2NF90IHNlZWQgPSAwOwor ICAgIGludCBuaCA9IG5leHRfaG9wLTE7CisKKyAgICBzZWVkID0gZ2V0Q3VycmVudFRpbWUoKTsK K3J0ZV9zcmFuZChzZWVkKTsKKworZm9yIChpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKK25leHRf aG9wX2FkZCA9IG5oKys7CisKK2FkZF9kaXAgPSAweDEwMjAwMDAwICsgKHJ0ZV9yYW5kKCkgPj4g NDgpOworICAgICAgICBhZGRfZGVwdGggPSBydGVfcmFuZCgpICUgMzIgKyAxOworZGlwX21hc2tl ZCA9IGFkZF9kaXAgJiBkZXB0aF90b19tYXNrKGFkZF9kZXB0aCk7CisKK2lmKGRpcF9tYXNrZWQg PT0gMCkgeworaS0tOworY29udGludWU7Cit9CisKKyAgICAgICAgc3RhdHVzID0gcnRlX2xwbV9h ZGQobHBtX3RyZWUsIGRpcF9tYXNrZWQsIGFkZF9kZXB0aCwgbmV4dF9ob3BfYWRkKTsKKyAgICAg ICAgaWYoc3RhdHVzICE9IDApIHsKKyAgICAgICAgICAgIHByaW50ZigibHBtIGFkZCByb3V0ZXMg ZmFpbGVkLCByZXQgOiAlZC4uLlxuIiwgc3RhdHVzKTsKKyAgICAgICAgICAgIGNvbnRpbnVlOwor fQorCisgICAgICAgIHJvdXRlX3RhYmxlX2FycmFyeV9hZGQoZGlwX21hc2tlZCwgYWRkX2RlcHRo LCBuZXh0X2hvcF9hZGQpOworICAgIH0KKworICAgIHJldHVybiAwOworfQorCisvKmZvciByYW5k b20gcm91dGUgYWRkLCBmb3Igcm91dGUgdGFibGUgJiBscG0gc3RydWN0Ki8KK2ludCBscG1fcmFu ZG9tX2FkZChzdHJ1Y3QgcnRlX2xwbSAqbHBtX3RyZWUsIGludCBjb3VudCkKK3sKKyAgICBpbnQz Ml90IGk7CisgICAgaW50MzJfdCBzdGF0dXMgPSAwOworICAgIHVpbnQzMl90IGFkZF9kaXAgPSAw OworICAgIHVpbnQ4X3QgYWRkX2RlcHRoID0gMDsKKyAgICB1aW50OF90IG5leHRfaG9wX2FkZCA9 IDA7Cit1aW50MzJfdCBkaXBfbWFza2VkID0gMDsKKyAgICB1aW50NjRfdCBzZWVkID0gMDsKKwor ICAgIHNlZWQgPSBnZXRDdXJyZW50VGltZSgpOworcnRlX3NyYW5kKHNlZWQpOworICAgIHByaW50 Zigic2VlZCA9ICVsZFxuIiwgc2VlZCk7CisKK2ZvciAoaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7 CituZXh0X2hvcF9hZGQgPSBpICUgMjU2OworCithZGRfZGlwID0gMHgxMDIwMDAwMCArIChydGVf cmFuZCgpID4+IDQ4KTsKKyAgICAgICAgYWRkX2RlcHRoID0gcnRlX3JhbmQoKSAlIDMyICsgMTsK K2RpcF9tYXNrZWQgPSBhZGRfZGlwICYgZGVwdGhfdG9fbWFzayhhZGRfZGVwdGgpOworCitpZihk aXBfbWFza2VkID09IDApIHsKK2ktLTsKK2NvbnRpbnVlOworfQorCisgICAgICAgIHN0YXR1cyA9 IHJ0ZV9scG1fYWRkKGxwbV90cmVlLCBkaXBfbWFza2VkLCBhZGRfZGVwdGgsIG5leHRfaG9wX2Fk ZCk7CisgICAgICAgIGlmKHN0YXR1cyAhPSAwKSB7CisgICAgICAgICAgICBwcmludGYoImxwbSBh ZGQgcm91dGVzIGZhaWxlZCwgcmV0IDogJWQuLi5cbiIsIHN0YXR1cyk7CisgICAgICAgICAgICBj b250aW51ZTsKK30KKworICAgICAgICByb3V0ZV90YWJsZV9hcnJhcnlfYWRkKGRpcF9tYXNrZWQs IGFkZF9kZXB0aCwgbmV4dF9ob3BfYWRkKTsKKyAgICB9CisKKyAgICByZXR1cm4gMDsKK30KKwor Lypmb3IgcmFuZG9tIGxvb2t1cCB0aGUgcm91dGUqLworaW50IGxwbV9yYW5kb21fbG9va3VwKHN0 cnVjdCBydGVfbHBtICpscG1fdHJlZSwgdWludDMyX3QgcXVlcnlfY291bnQpCit7CisgICAgdWlu dDMyX3QgaSA9IDA7CisjaWYgUlRFX1ZFUlNJT04gPj0gUlRFX1ZFUlNJT05fTlVNKDIsIDEsIDAs IDApCisgICAgdWludDhfdCBsb29rdXBfbmV4dF9ob3BfMCA9IDA7CisgICAgdWludDhfdCBsb29r dXBfbmV4dF9ob3BfMSA9IDA7CisjZWxzZQorICAgIHVpbnQxNl90IGxvb2t1cF9uZXh0X2hvcF8w ID0gMDsK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K30KKworICAgIHJldHVybiAwOworfQorCisKKy8qYWRk IC0+IGxvb2t1cCovCitpbnQKK3Rlc3RfcmFuZG9tX2xwbV9jYXNlXzEoc3RydWN0IHJ0ZV9scG0g KmxwbSkKK3sKKyAgICBpbnQgcmV0ID0gMDsKKworICAgIHJldCA9IGxwbV9yYW5kb21fYWRkKGxw bSwgTFBNX0FERF9ST1VURV9NQVgpOworICAgIGlmKHJldCA8IDApIHsKKyAgICAgICAgcmV0dXJu IHJldDsKKyAgICB9CisKKyAgICByZXQgPSBscG1fcmFuZG9tX2xvb2t1cChscG0sIExQTV9URVNU X0xPT0tVUF9DT1VOVCk7CisgICAgaWYocmV0IDwgMCkgeworICAgICAgICByZXR1cm4gcmV0Owor ICAgIH0KKworICAgIHJldHVybiAwOworfQorCisvKmFkZCAtPiBkZWwgLT4gbG9va3VwKi8KK2lu dAordGVzdF9yYW5kb21fbHBtX2Nhc2VfMihzdHJ1Y3QgcnRlX2xwbSAqbHBtKQoreworICAgIGlu dCBpID0gMCwgcmV0ID0gMDsKKworICAgIGZvcihpID0gMDsgaSA8ICBMUE1fQUREX1JPVVRFX01B WDsgaSsrKSB7CisgICAgICAgIGxwbV9yYW5kb21fZGVsZXRlKGxwbSwgaSk7CisKKyAgICAgICAg cmV0ID0gbHBtX3JhbmRvbV9sb29rdXAobHBtLCBMUE1fVEVTVF9MT09LVVBfQ09VTlQpOworICAg ICAgICBpZihyZXQgPCAwKSB7CisgICAgICAgICAgICByZXR1cm4gLTE7CisgICAgICAgIH0KKyAg ICB9CisKKyAgICByZXR1cm4gMDsKK30KKworLypmb3IgbiB0aW1lczogZGVsIC0+YWRkIC0+IGxv b2t1cCovCitpbnQKK3Rlc3RfcmFuZG9tX2xwbV9jYXNlXzMoc3RydWN0IHJ0ZV9scG0gKmxwbSkK K3sKKyAgICBpbnQgcmV0ID0gMDsKKyAgICBpbnQgaSA9IDA7CisgICAgaW50IGhvcHMgPSAwOwor ICAgIGludCBhZGQgPSAxOworICAgIHJldCA9IGxwbV9yYW5kb21fYWRkKGxwbSwgTFBNX0FERF9S T1VURV9NQVgpOworICAgIGlmKHJldCA8IDApIHsKKyAgICAgICAgcmV0dXJuIHJldDsKKyAgICB9 CisgICAgaG9wcyA9IDIwMDsKKyAgICBmb3IoaSA9IDA7IGkgPCAgTFBNX0FERF9ST1VURV9NQVg7 IGkrKykgeworICAgICAgICB1c2xlZXAoMTAwMCk7CisgICAgICAgIGxwbV9yYW5kb21fZGVsZXRl KGxwbSwgaSk7CisgICAgICAgIGxwbV9yYW5kb21fYWRkX25leHRob3AobHBtLGFkZCxob3BzKTsK KyAgICAgICAgaG9wcyA9IGhvcHMgKyBhZGQ7CisgICAgICAgIHJldCA9IGxwbV9yYW5kb21fbG9v a3VwKGxwbSwgTFBNX1RFU1RfTE9PS1VQX0NPVU5UKTsKKyAgICAgICAgICAgIGlmKHJldCA8IDAp IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gLTE7CisgICAgICAgICAgICB9CisgICAgfQorCisg ICAgcmV0dXJuIDA7Cit9CisKKy8qCisgKiBUZXN0IGZvciByYW5kb20gcm91dGluZyBhZGQsIGRl bCBhbmQgbG9va3VwCisgKi8KK2ludDMyX3QKK3Rlc3RfcmFuZG9tKHZvaWQpIHsKKyAgICBpbnQg cmV0ID0gUEFTUzsKKy8vICAgIGludCBjYXNlX3Byb2Nlc3MsaTsKKyAgICBzdHJ1Y3QgcnRlX2xw bSAqbHBtID0gTlVMTDsKKyAgICBscG0gPSBydGVfbHBtX2NyZWF0ZShfX2Z1bmNfXywgU09DS0VU X0lEX0FOWSwgTFBNX0FERF9ST1VURV9NQVggICogQVJHLCAwKTsKK1RFU1RfTFBNX0FTU0VSVChs cG0gIT0gTlVMTCk7CisKKyAgICByb3V0ZV90YWJsZV9hcnJhcnlfY3JlYXRlKCk7CisKKworICAg IHJldCA9IHRlc3RfcmFuZG9tX2xwbV9jYXNlXzEobHBtKTsKKyAgICBpZihyZXQgIT0gMCkgewor ICAgICAgICBscG1fcm91dGVfc2hvdyhscG0pOworICAgICAgICBwcmludGYoInRlc3RfcmFuZG9t X2xwbV9jYXNlXzEsIGZhaWxlZC4uLlxuIik7CisgICAgICAgIHJldCA9IC0xOworICAgICAgICBn b3RvIE9VVDsKKyAgICB9CisgICAgcHJpbnRmKCJ0ZXN0X3JhbmRvbV9scG1fY2FzZV8xLCBvay4u LlxuIik7CisKKworICAgIHJldCA9IHRlc3RfcmFuZG9tX2xwbV9jYXNlXzIobHBtKTsKKyAgICBp ZihyZXQgIT0gMCkgeworICAgICAgICBscG1fcm91dGVfc2hvdyhscG0pOworICAgICAgICBwcmlu dGYoInRlc3RfcmFuZG9tX2xwbV9jYXNlXzIsIGZhaWxlZC4uLlxuIik7CisgICAgICAgIHJldCA9 IC0xOworICAgICAgICBnb3RvIE9VVDsKKyAgICB9CisgICAgcHJpbnRmKCJ0ZXN0X3JhbmRvbV9s cG1fY2FzZV8yLCBvay4uLlxuIik7CisKKyAgICByZXQgPSB0ZXN0X3JhbmRvbV9scG1fY2FzZV8z KGxwbSk7CisgICAgaWYocmV0ICE9IDApIHsKKyAgICAgICAgbHBtX3JvdXRlX3Nob3cobHBtKTsK KyAgICAgICAgcHJpbnRmKCJ0ZXN0X3JhbmRvbV9scG1fY2FzZV8zLCBmYWlsZWQuLi5cbiIpOwor ICAgICAgICByZXQgPSAtMTsKKyAgICAgICAgZ290byBPVVQ7CisgICAgfQorICAgIHByaW50Zigi dGVzdF9yYW5kb21fbHBtX2Nhc2VfMywgb2suLi5cbiIpOworCitPVVQ6CisgICAgcnRlX2xwbV9m cmVlKGxwbSkgOworICAgIHJldHVybiByZXQ7Cit9CisKKwogLyoKICAqIExvb2t1cCBwZXJmb3Jt YW5jZSB0ZXN0CiAgKi8KLS0KMS44LjUuMiAoQXBwbGUgR2l0LTQ4KQoKCgoKCgoK >From wenzhuol@shecgisg004.sh.intel.com Fri Oct 23 07:05:41 2015 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 817C6C34C for ; Fri, 23 Oct 2015 07:05:41 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 22 Oct 2015 22:05:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,185,1444719600"; d="scan'208";a="833590588" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 22 Oct 2015 22:05:39 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t9N55cmu012334; Fri, 23 Oct 2015 13:05:38 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t9N55Y8B023623; Fri, 23 Oct 2015 13:05:36 +0800 Received: (from wenzhuol@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t9N55YTV023619; Fri, 23 Oct 2015 13:05:34 +0800 From: Wenzhuo Lu To: dev@dpdk.org Date: Fri, 23 Oct 2015 13:05:32 +0800 Message-Id: <1445576732-23589-1-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1444445798-23929-1-git-send-email-wenzhuo.lu@intel.com> References: <1444445798-23929-1-git-send-email-wenzhuo.lu@intel.com> Subject: [dpdk-dev] [PATCH v3] ixgbe: Drop flow control frames from VFs 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: Fri, 23 Oct 2015 05:05:41 -0000 This patch will drop flow control frames from being transmitted from VSIs. With this patch in place a malicious VF cannot send flow control or PFC packets out on the wire. V2: Reword the comments. V3: Move the check of set_ethertype_anti_spoofing to the top of the function, to avoid occupying an ethertype_filter entity without using it. Signed-off-by: Wenzhuo Lu --- drivers/net/ixgbe/ixgbe_pf.c | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index fd1c4ca..1627030 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -55,6 +55,7 @@ #define IXGBE_MAX_VFTA (128) #define IXGBE_VF_MSG_SIZE_DEFAULT 1 #define IXGBE_VF_GET_QUEUE_MSG_SIZE 5 +#define IXGBE_ETHERTYPE_FLOW_CTRL 0x8808 static inline uint16_t dev_num_vf(struct rte_eth_dev *eth_dev) @@ -166,6 +167,50 @@ void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev) *vfinfo = NULL; } +static void +ixgbe_add_tx_flow_control_drop_filter(struct rte_eth_dev *eth_dev) +{ + struct ixgbe_hw *hw = + IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + struct ixgbe_filter_info *filter_info = + IXGBE_DEV_PRIVATE_TO_FILTER_INFO(eth_dev->data->dev_private); + uint16_t vf_num; + int i; + + if (!hw->mac.ops.set_ethertype_anti_spoofing) { + RTE_LOG(INFO, PMD, "ether type anti-spoofing is not" + " supported.\n"); + return; + } + + /* occupy an entity of ether type filter */ + for (i = 0; i < IXGBE_MAX_ETQF_FILTERS; i++) { + if (!(filter_info->ethertype_mask & (1 << i))) { + filter_info->ethertype_mask |= 1 << i; + filter_info->ethertype_filters[i] = + IXGBE_ETHERTYPE_FLOW_CTRL; + break; + } + } + if (i == IXGBE_MAX_ETQF_FILTERS) { + RTE_LOG(ERR, PMD, "Cannot find an unused ether type filter" + " entity for flow control.\n"); + return; + } + + IXGBE_WRITE_REG(hw, IXGBE_ETQF(i), + (IXGBE_ETQF_FILTER_EN | + IXGBE_ETQF_TX_ANTISPOOF | + IXGBE_ETHERTYPE_FLOW_CTRL)); + + vf_num = dev_num_vf(eth_dev); + for (i = 0; i < vf_num; i++) { + hw->mac.ops.set_ethertype_anti_spoofing(hw, true, i); + } + + return; +} + int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev) { uint32_t vtctl, fcrth; @@ -262,6 +307,8 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev) IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), fcrth); } + ixgbe_add_tx_flow_control_drop_filter(eth_dev); + return 0; } -- 1.9.3