Patches cleanup
This commit is contained in:
parent
28642b3aa4
commit
e50f8e33bc
@ -1,169 +0,0 @@
|
||||
For vdp to be usable, enabletx must be set to true. The check for enabletx
|
||||
needs to be made before checking if vdp_data for this ifname already exists.
|
||||
Otherwise VDP is running even though enabletx is false.
|
||||
|
||||
Signed-off-by: Jens Osterkamp <jens@linux.vnet.ibm.com>
|
||||
---
|
||||
ecp/ecp_rx.c | 10 +++-------
|
||||
ecp/ecp_tx.c | 7 +++----
|
||||
include/lldp_vdp.h | 1 +
|
||||
lldp_vdp.c | 38 ++++++++++++++++++++++----------------
|
||||
4 files changed, 29 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/ecp/ecp_rx.c b/ecp/ecp_rx.c
|
||||
index a56cd3b..182b911 100644
|
||||
--- a/ecp/ecp_rx.c
|
||||
+++ b/ecp/ecp_rx.c
|
||||
@@ -211,9 +211,7 @@ void ecp_rx_ReceiveFrame(void *ctx, unsigned int ifindex, const u8 *buf, size_t
|
||||
LLDPAD_DBG("%s(%i)-%s: received packet with size %i\n", __func__, __LINE__,
|
||||
vd->ifname, (int) len);
|
||||
|
||||
- if (!port ||
|
||||
- port->adminStatus == disabled ||
|
||||
- port->adminStatus == enabledTxOnly)
|
||||
+ if (vd->enabletx == false)
|
||||
return;
|
||||
|
||||
if (vd->ecp.rx.framein &&
|
||||
@@ -551,15 +549,13 @@ bool ecp_set_rx_state(struct vdp_data *vd)
|
||||
}
|
||||
return false;
|
||||
case ECP_RX_INIT_RECEIVE:
|
||||
- if ((port->adminStatus == enabledRxTx) ||
|
||||
- (port->adminStatus == enabledRxOnly)) {
|
||||
+ if (vd->enabletx == true) {
|
||||
ecp_rx_change_state(vd, ECP_RX_RECEIVE_WAIT);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case ECP_RX_RECEIVE_WAIT:
|
||||
- if ((port->adminStatus == disabled) ||
|
||||
- (port->adminStatus == enabledTxOnly)) {
|
||||
+ if (vd->enabletx == false) {
|
||||
ecp_rx_change_state(vd, ECP_RX_IDLE);
|
||||
return true;
|
||||
}
|
||||
diff --git a/ecp/ecp_tx.c b/ecp/ecp_tx.c
|
||||
index c81e101..8a9d2b0 100644
|
||||
--- a/ecp/ecp_tx.c
|
||||
+++ b/ecp/ecp_tx.c
|
||||
@@ -414,15 +414,14 @@ static bool ecp_set_tx_state(struct vdp_data *vd)
|
||||
|
||||
switch (vd->ecp.tx.state) {
|
||||
case ECP_TX_INIT_TRANSMIT:
|
||||
- if (port->portEnabled && ((port->adminStatus == enabledRxTx) ||
|
||||
- (port->adminStatus == enabledTxOnly)) && vd->ecp.tx.localChange) {
|
||||
+ if (port->portEnabled && (vd->enabletx == true)
|
||||
+ && vd->ecp.tx.localChange) {
|
||||
ecp_tx_change_state(vd, ECP_TX_TRANSMIT_ECPDU);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case ECP_TX_TRANSMIT_ECPDU:
|
||||
- if ((port->adminStatus == disabled) ||
|
||||
- (port->adminStatus == enabledRxOnly)) {
|
||||
+ if (vd->enabletx == false) {
|
||||
ecp_tx_change_state(vd, ECP_TX_INIT_TRANSMIT);
|
||||
return true;
|
||||
}
|
||||
diff --git a/include/lldp_vdp.h b/include/lldp_vdp.h
|
||||
index b9fd37f..1192364 100644
|
||||
--- a/include/lldp_vdp.h
|
||||
+++ b/include/lldp_vdp.h
|
||||
@@ -112,6 +112,7 @@ struct vsi_profile {
|
||||
|
||||
struct vdp_data {
|
||||
char ifname[IFNAMSIZ];
|
||||
+ u8 enabletx;
|
||||
struct ecp ecp;
|
||||
struct unpacked_tlv *vdp;
|
||||
int role;
|
||||
diff --git a/lldp_vdp.c b/lldp_vdp.c
|
||||
index 646105a..424bcbe 100644
|
||||
--- a/lldp_vdp.c
|
||||
+++ b/lldp_vdp.c
|
||||
@@ -42,6 +42,8 @@
|
||||
#include "config.h"
|
||||
#include "lldp_tlv.h"
|
||||
#include "lldp_vdp_cmds.h"
|
||||
+#include "lldp_vdp_clif.h"
|
||||
+#include "lldp_mand_clif.h"
|
||||
|
||||
const char * const vsi_responses[] = {
|
||||
[VDP_RESPONSE_SUCCESS] = "success",
|
||||
@@ -1365,10 +1367,11 @@ out_err:
|
||||
void vdp_ifup(char *ifname)
|
||||
{
|
||||
char *string;
|
||||
+ char config_path[16];
|
||||
struct vdp_data *vd;
|
||||
struct vdp_user_data *ud;
|
||||
- struct port *port;
|
||||
struct vsi_profile *p;
|
||||
+ int enabletx = false;
|
||||
|
||||
/* VDP does not support bonded devices */
|
||||
if (is_bond(ifname))
|
||||
@@ -1376,9 +1379,25 @@ void vdp_ifup(char *ifname)
|
||||
|
||||
LLDPAD_DBG("%s(%i): starting VDP for if %s !\n", __func__, __LINE__, ifname);
|
||||
|
||||
+ snprintf(config_path, sizeof(config_path), "%s.%s",
|
||||
+ VDP_PREFIX, ARG_TLVTXENABLE);
|
||||
+
|
||||
+ if (get_config_setting(ifname, config_path, (void *)&enabletx,
|
||||
+ CONFIG_TYPE_BOOL))
|
||||
+ enabletx = false;
|
||||
+
|
||||
+ if (enabletx == false) {
|
||||
+ LLDPAD_WARN("%s(%i): port %s not enabled for VDP (%i) !\n",
|
||||
+ __func__, __LINE__, ifname, enabletx);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
vd = vdp_data(ifname);
|
||||
if (vd) {
|
||||
- LLDPAD_WARN("%s:%s vdp data already exists !\n", __func__, ifname);
|
||||
+ vd->enabletx = enabletx;
|
||||
+
|
||||
+ LLDPAD_WARN("%s:%s vdp data already exists !\n",
|
||||
+ __func__, ifname);
|
||||
goto out_start_again;
|
||||
}
|
||||
|
||||
@@ -1392,6 +1411,7 @@ void vdp_ifup(char *ifname)
|
||||
strncpy(vd->ifname, ifname, IFNAMSIZ);
|
||||
|
||||
vd->role = VDP_ROLE_STATION;
|
||||
+ vd->enabletx = enabletx;
|
||||
|
||||
if (!get_cfg(ifname, "vdp.role", (void *)&string,
|
||||
CONFIG_TYPE_STRING)) {
|
||||
@@ -1408,20 +1428,6 @@ void vdp_ifup(char *ifname)
|
||||
ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_VDP);
|
||||
LIST_INSERT_HEAD(&ud->head, vd, entry);
|
||||
|
||||
- port = port_find_by_name(ifname);
|
||||
-
|
||||
- if (!port) {
|
||||
- LLDPAD_ERR("%s(%i): could not find port for %s!\n",
|
||||
- __func__, __LINE__, ifname);
|
||||
- goto out_err;
|
||||
- }
|
||||
-
|
||||
- if (port->adminStatus != enabledRxTx) {
|
||||
- LLDPAD_WARN("%s(%i): port %s not enabled for RxTx (%i) !\n",
|
||||
- __func__, __LINE__, ifname, port->adminStatus);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
out_start_again:
|
||||
if (ecp_init(ifname)) {
|
||||
LLDPAD_ERR("%s:%s unable to init ecp !\n", __func__, ifname);
|
||||
--
|
||||
1.7.4.4
|
||||
|
||||
_______________________________________________
|
||||
lldp-devel mailing list
|
||||
lldp-devel@open-lldp.org
|
||||
https://lists.open-fcoe.org/mailman/listinfo/lldp-devel
|
Loading…
Reference in New Issue
Block a user