|
|
475e44 |
From c92ad04556a0b319acc798a8499aa42b6bd766c2 Mon Sep 17 00:00:00 2001
|
|
|
475e44 |
From: John Fastabend <john.r.fastabend@intel.com>
|
|
|
475e44 |
Date: Mon, 8 Jul 2013 12:12:08 -0700
|
|
|
475e44 |
Subject: [PATCH] lldpad: do not require active TLVs to configure attributes
|
|
|
475e44 |
|
|
|
475e44 |
No longer require TLV data structures to be initialized to read/write
|
|
|
475e44 |
configuration. This allows managing ports before link is established.
|
|
|
475e44 |
|
|
|
475e44 |
In this patch we update the command handlers to read the config file
|
|
|
475e44 |
on gets which works because sets keep the config file in sync. The set
|
|
|
475e44 |
operations are updated by removing the requirement of existing data
|
|
|
475e44 |
structures. If the data structure is not available yet the config value
|
|
|
475e44 |
is written to the configuration file only.
|
|
|
475e44 |
|
|
|
475e44 |
Because the sets may occur before ifup() any checks for valid ports
|
|
|
475e44 |
must be done in the set handler path. For 8021qaz this means verifying
|
|
|
475e44 |
the port supports DCB.
|
|
|
475e44 |
|
|
|
475e44 |
The VDP mode attribute is AFAIK the only attribute that can not
|
|
|
475e44 |
be set or queried before ifup(). This is because the mode values are
|
|
|
475e44 |
not stored in the config file. This is left for future work if the
|
|
|
475e44 |
VDP mode values need to be configured prior to ifup(). At this time
|
|
|
475e44 |
I'm not sure this would be useful.
|
|
|
475e44 |
|
|
|
475e44 |
One other change is attributes without values in the config file
|
|
|
475e44 |
will be left blank when displayed with the '-c' option. I believe this
|
|
|
475e44 |
is more in spirit with the intent of the option. One example here
|
|
|
475e44 |
given on a tap device that has not been brought online yet and has
|
|
|
475e44 |
no capabilities configuration value.
|
|
|
475e44 |
|
|
|
475e44 |
# ./lldptool -t -g ncb -i tap0 -V EVBcfg -c
|
|
|
475e44 |
fmode=bridge
|
|
|
475e44 |
capabilities=
|
|
|
475e44 |
vsis=3295
|
|
|
475e44 |
rte=15
|
|
|
475e44 |
enableTx=no
|
|
|
475e44 |
|
|
|
475e44 |
I tested many of the 8021qaz, dcbtool, VDP, and EVB commands along
|
|
|
475e44 |
with some of the other TLV types.
|
|
|
475e44 |
|
|
|
475e44 |
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
|
|
|
475e44 |
---
|
|
|
475e44 |
lldp_8021qaz.c | 12 +++++++-----
|
|
|
475e44 |
1 file changed, 7 insertions(+), 5 deletions(-)
|
|
|
475e44 |
|
|
|
475e44 |
diff --git a/lldp_8021qaz.c b/lldp_8021qaz.c
|
|
|
475e44 |
index b3da01b..fb7843c 100644
|
|
|
475e44 |
--- a/lldp_8021qaz.c
|
|
|
475e44 |
+++ b/lldp_8021qaz.c
|
|
|
475e44 |
@@ -492,6 +492,7 @@ static int get_dcbx_hw(const char *ifname, __u8 *dcbx)
|
|
|
475e44 |
if (!attr) {
|
|
|
475e44 |
LLDPAD_DBG("%s: %s: nlmsg_find_attr failed, no GDCBX support\n",
|
|
|
475e44 |
__func__, ifname);
|
|
|
475e44 |
+ err = -EOPNOTSUPP;
|
|
|
475e44 |
goto out;
|
|
|
475e44 |
}
|
|
|
475e44 |
|
|
|
475e44 |
@@ -540,8 +541,7 @@ void ieee8021qaz_ifup(char *ifname, struct lldp_agent *agent)
|
|
|
475e44 |
/* If hardware is not DCBX IEEE compliant or it is managed
|
|
|
475e44 |
* by an LLD agent most likely a firmware agent abort
|
|
|
475e44 |
*/
|
|
|
475e44 |
- if (!(dcbx & DCB_CAP_DCBX_VER_IEEE) ||
|
|
|
475e44 |
- (dcbx & DCB_CAP_DCBX_LLD_MANAGED))
|
|
|
475e44 |
+ if (dcbx & DCB_CAP_DCBX_LLD_MANAGED)
|
|
|
475e44 |
return;
|
|
|
475e44 |
|
|
|
475e44 |
/* If 802.1Qaz is already configured no need to continue */
|
|
|
475e44 |
@@ -633,8 +633,10 @@ initialized:
|
|
|
475e44 |
/* Query hardware and set maximum number of TCs with hardware values */
|
|
|
475e44 |
len = get_ieee_hw(ifname, &ets, &pfc, &data, &cnt);
|
|
|
475e44 |
if (len > 0) {
|
|
|
475e44 |
- tlvs->ets->cfgl->max_tcs = ets->ets_cap;
|
|
|
475e44 |
- tlvs->pfc->local.pfc_cap = pfc->pfc_cap;
|
|
|
475e44 |
+ if (ets)
|
|
|
475e44 |
+ tlvs->ets->cfgl->max_tcs = ets->ets_cap;
|
|
|
475e44 |
+ if (pfc)
|
|
|
475e44 |
+ tlvs->pfc->local.pfc_cap = pfc->pfc_cap;
|
|
|
475e44 |
|
|
|
475e44 |
free(ets);
|
|
|
475e44 |
free(pfc);
|
|
|
475e44 |
@@ -644,7 +646,7 @@ initialized:
|
|
|
475e44 |
/* if the dcbx field is filled in by the dcbx query then the
|
|
|
475e44 |
* kernel is supports IEEE mode, so make IEEE DCBX active by default.
|
|
|
475e44 |
*/
|
|
|
475e44 |
- if (!dcbx || (dcbx_get_legacy_version(ifname) & ~MASK_DCBX_FORCE)) {
|
|
|
475e44 |
+ if (dcbx_get_legacy_version(ifname) & ~MASK_DCBX_FORCE) {
|
|
|
475e44 |
tlvs->active = false;
|
|
|
475e44 |
} else {
|
|
|
475e44 |
tlvs->active = true;
|
|
|
475e44 |
--
|
|
|
475e44 |
1.9.3
|
|
|
475e44 |
|