Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.1:Update
dcbd
dcbd-0.7.35rt.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File dcbd-0.7.35rt.patch of Package dcbd
Index: dcbd-0.7.31rt/clif_cmds.c =================================================================== --- dcbd-0.7.31rt.orig/clif_cmds.c +++ dcbd-0.7.31rt/clif_cmds.c @@ -869,18 +869,18 @@ static int get_bcn_data(bcn_attribs *bcn for (i = 0; i < MAX_USER_PRIORITIES; i++) { sprintf(rbuf+BCN_UP_RP(i), "%1x", - bcn_data->bcn.bcn_up_settings[i].rp_admin); + bcn_data->bcn.up_settings[i].rp_admin); } if (cmd == CMD_GET_PEER || cmd == CMD_GET_OPER) { bitmap = 0; for (i = 0; i < MAX_USER_PRIORITIES; i++) - if (bcn_data->bcn.bcn_up_settings[i].rp_oper) + if (bcn_data->bcn.up_settings[i].rp_oper) bitmap |= (1<<i); sprintf(rbuf+BCN_UP_RP_OP, "%02x", bitmap); bitmap = 0; for (i = 0; i < MAX_USER_PRIORITIES; i++) - if (bcn_data->bcn.bcn_up_settings[i].rem_tag_oper) + if (bcn_data->bcn.up_settings[i].rem_tag_oper) bitmap |= (1<<i); sprintf(rbuf+BCN_UP_RP_RTAG_OP, "%02x", bitmap); } else { @@ -894,7 +894,7 @@ static int get_bcn_data(bcn_attribs *bcn if (cmd == CMD_GET_PEER) { bitmap = 0; for (i = 0; i < MAX_USER_PRIORITIES; i++) - if (bcn_data->bcn.bcn_up_settings[i].cp_admin) + if (bcn_data->bcn.up_settings[i].cp_admin) bitmap |= (1<<i); sprintf(rbuf+BCN_UP_CP, "%02x", bitmap); } else { @@ -941,6 +941,7 @@ static int get_bcn_data(bcn_attribs *bcn static int set_pg_config(pg_attribs *pg_data, char *port_id, char *ibuf, int ilen) { + full_dcb_attrib_ptrs dcb_data; u8 flag; dcb_result status = dcb_success; int i; @@ -1051,7 +1052,9 @@ static int set_pg_config(pg_attribs *pg_ return dcb_bad_params; } - status = dcb_check_config(pg_data); + memset((void *)&dcb_data, 0, sizeof(dcb_data)); + dcb_data.pg = pg_data; + status = dcb_check_config(&dcb_data); /* if the rule checking fails and client did not supply * user priority percentages, then compute new percentages @@ -1059,7 +1062,7 @@ static int set_pg_config(pg_attribs *pg_ */ if (status == dcb_bad_params && !uppcts_changed) { rebalance_uppcts(pg_data); - status = dcb_check_config(pg_data); + status = dcb_check_config(&dcb_data); } if (status != dcb_success) { @@ -1222,9 +1225,9 @@ static int set_bcn_config(bcn_attribs *b if (flag == CLIF_NOT_SUPPLIED) continue; if (flag & 0x07) - bcn_data->bcn.bcn_up_settings[i].rp_admin = 1; + bcn_data->bcn.up_settings[i].rp_admin = 1; else - bcn_data->bcn.bcn_up_settings[i].rp_admin = 0; + bcn_data->bcn.up_settings[i].rp_admin = 0; } off += MAX_USER_PRIORITIES; Index: dcbd-0.7.31rt/config.c =================================================================== --- dcbd-0.7.31rt.orig/config.c +++ dcbd-0.7.31rt/config.c @@ -846,12 +846,12 @@ static dcb_result _set_persistent(char * goto set_error; } if (!config_setting_set_int_elem(setting, i, - bcn->bcn.bcn_up_settings[i].cp_admin)) { + bcn->bcn.up_settings[i].cp_admin)) { goto set_error; } TRACE1("BCN TC element # : ", i) TRACE1("the value is : ", - bcn->bcn.bcn_up_settings[i].cp_admin) + bcn->bcn.up_settings[i].cp_admin) } } @@ -866,12 +866,12 @@ static dcb_result _set_persistent(char * goto set_error; } if (!config_setting_set_int_elem(setting, i, - bcn->bcn.bcn_up_settings[i].rp_admin)) { + bcn->bcn.up_settings[i].rp_admin)) { goto set_error; } TRACE1("BCN TC element # : ", i) TRACE1("the value is : ", - bcn->bcn.bcn_up_settings[i].rp_admin) + bcn->bcn.up_settings[i].rp_admin) } } @@ -1178,16 +1178,16 @@ static int get_bcn_array_config(config_s switch(int_type) { case TYPE_BCN_CP: - result->bcn_up_settings[i].cp_admin = + result->up_settings[i].cp_admin = (char)config_setting_get_int(setting_value); rval = check_bool( - result->bcn_up_settings[i].cp_admin); + result->up_settings[i].cp_admin); break; case TYPE_BCN_RP: - result->bcn_up_settings[i].rp_admin = + result->up_settings[i].rp_admin = (char)config_setting_get_int(setting_value); rval = check_bool( - result->bcn_up_settings[i].rp_admin); + result->up_settings[i].rp_admin); break; default: break; Index: dcbd-0.7.31rt/dcbd.spec =================================================================== --- dcbd-0.7.31rt.orig/dcbd.spec +++ dcbd-0.7.31rt/dcbd.spec @@ -1,6 +1,6 @@ Name: dcbd Summary: Intel(R) EEDC Connection -Version: 0.7.31rt +Version: 0.7.35rt Release: 1 Source: %{name}-%{version}.tar.gz Vendor: Intel Corporation Index: dcbd-0.7.31rt/dcb_protocol.cpp =================================================================== --- dcbd-0.7.31rt.orig/dcb_protocol.cpp +++ dcbd-0.7.31rt/dcb_protocol.cpp @@ -36,6 +36,8 @@ #include <map> #include <string> +static void send_oper_events(char *device_name); + boolean_t bLLDPPresent = TRUE; u8 gdcbx_subtype = dcbx_subtype1; @@ -145,7 +147,17 @@ boolean_t add_pg(char *device_name, pg_a void init_oper_pg(pg_attribs *Attrib) { + char sTmp[MAX_DESCRIPTION_LEN]; + memset(Attrib,0,sizeof(*Attrib)); + snprintf(sTmp, MAX_DESCRIPTION_LEN, DEF_CFG_STORE); + pg_it itpg = pg.find(sTmp); + if (itpg == pg.end()) { + return; + } + Attrib->num_tcs = itpg->second->num_tcs; + memcpy(&(Attrib->rx), &(itpg->second->rx), sizeof(Attrib->rx)); + memcpy(&(Attrib->tx), &(itpg->second->tx), sizeof(Attrib->tx)); } boolean_t add_oper_pg(char *device_name) @@ -243,9 +255,18 @@ boolean_t add_apptlv(char *device_name, CATCH_END(FALSE); } -void init_oper_apptlv(app_attribs *Store) +void init_oper_apptlv(app_attribs *Store, u32 Subtype) { + char sTmp[MAX_DESCRIPTION_LEN]; + memset(Store,0,sizeof(*Store)); + snprintf(sTmp, MAX_DESCRIPTION_LEN, "%s%hu", DEF_CFG_STORE, Subtype); + app_it itapp = apptlv.find(sTmp); + if (itapp == apptlv.end()) { + return; + } + Store->Length =itapp->second->Length; + memcpy(&(Store->AppData), &(itapp->second->AppData), sizeof(Store->Length)); } boolean_t add_oper_apptlv(char *device_name, u32 Subtype) @@ -265,7 +286,7 @@ boolean_t add_oper_apptlv(char *device_n /* Device not present: add */ app_attribs *store = (app_attribs*)malloc(sizeof(*store)); if (!store) return FALSE; - init_oper_apptlv(store); + init_oper_apptlv(store, Subtype); oper_apptlv.insert(make_pair(dn, store)); } return TRUE; @@ -403,7 +424,16 @@ boolean_t add_pfc(char *device_name, pfc void init_oper_pfc(pfc_attribs *Attrib) { + char sTmp[MAX_DESCRIPTION_LEN]; + memset(Attrib,0,sizeof(*Attrib)); + snprintf(sTmp, MAX_DESCRIPTION_LEN, DEF_CFG_STORE); + pfc_it itpfc = pfc.find(sTmp); + if (itpfc == pfc.end()) { + return; + } + Attrib->num_tcs = itpfc->second->num_tcs; + memcpy(&(Attrib->admin), &(itpfc->second->admin), sizeof(Attrib->admin)); } boolean_t add_oper_pfc(char *device_name) @@ -523,7 +553,15 @@ boolean_t add_bcn(char *device_name, bcn } void init_oper_bcn(bcn_attribs *Attrib) { + char sTmp[MAX_DESCRIPTION_LEN]; + memset(Attrib,0,sizeof(*Attrib)); + snprintf(sTmp, MAX_DESCRIPTION_LEN, DEF_CFG_STORE); + bcn_it itbcn = bcn.find(sTmp); + if (itbcn == bcn.end()) { + return; + } + memcpy(&(Attrib->bcn), &(itbcn->second->bcn), sizeof(Attrib->bcn)); } boolean_t add_oper_bcn(char *device_name) @@ -620,9 +658,17 @@ boolean_t add_llink(char *device_name, l CATCH_END(FALSE); } -void init_oper_llink(llink_attribs *Attrib) +void init_oper_llink(llink_attribs *Attrib, u32 Subtype) { + char sTmp[MAX_DESCRIPTION_LEN]; + memset(Attrib,0,sizeof(*Attrib)); + snprintf(sTmp, MAX_DESCRIPTION_LEN, "%s%hu", DEF_CFG_STORE, Subtype); + llink_it itllink = llink.find(sTmp); + if (itllink == llink.end()) { + return; + } + memcpy(&(Attrib->llink), &(itllink->second->llink), sizeof(Attrib->llink)); } boolean_t add_oper_llink(char *device_name, u32 subtype) @@ -644,7 +690,7 @@ boolean_t add_oper_llink(char *device_na if (!store) return 0; - init_oper_llink(store); + init_oper_llink(store, subtype); oper_llink.insert(make_pair(dn, store)); } return TRUE; @@ -754,7 +800,9 @@ dcb_result get_dcb_support(char *device_ boolean_t add_adapter(char *device_name) { u32 EventFlag = 0; - full_dcb_attribs attribs; + full_dcb_attrib_ptrs attr_ptr; + full_dcb_attribs attribs; + feature_support dcb_support = {0}; dcb_result sResult = dcb_success; printf("add_adapter (%s)\n", device_name); @@ -767,7 +815,10 @@ boolean_t add_adapter(char *device_name) } printf(" dcbx subtype = %d\n", gdcbx_subtype); - if ((sResult = dcb_check_config(&attribs.pg)) != dcb_success) { + memset (&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.pg = &(attribs.pg); + attr_ptr.bcn = &(attribs.bcn); + if ((sResult = dcb_check_config(&attr_ptr)) != dcb_success) { printf("Rule checker returned error %d\n", sResult); } else { /* big else */ @@ -874,6 +925,8 @@ boolean_t add_adapter(char *device_name) sResult = dcb_failed; goto add_adapter_error; } + } + for(int i = 0; i < DCB_MAX_LLKTLV ; i++) { if (!add_llink(device_name, &attribs.llink[i], i)) { log_message(MSG_ERR_RESOURCE_MEMORY, "%s", device_name); @@ -897,6 +950,11 @@ boolean_t add_adapter(char *device_name) } } + if (get_dcb_support(device_name, &dcb_support) != dcb_success) { + sResult = dcb_failed; + goto add_adapter_error; + } + /* Initialize features state machines for PG and PFC and * APPTLVs. */ @@ -913,7 +971,7 @@ boolean_t add_adapter(char *device_name) sResult = dcb_failed; goto add_adapter_error; } - if (run_feature_protocol(device_name, + if (dcb_support.bcn && run_feature_protocol(device_name, DCB_LOCAL_CHANGE_BCN) != dcb_success) { printf("run_feature_protocol error (BCN)\n"); sResult = dcb_failed; @@ -930,11 +988,13 @@ boolean_t add_adapter(char *device_name) goto add_adapter_error; } } - if (run_feature_protocol(device_name, - DCB_LOCAL_CHANGE_LLINK) != dcb_success) { - printf("run_feature_protocol error (LLINK)\n"); - sResult = dcb_failed; - goto add_adapter_error; + for (int i = 0; i < DCB_MAX_LLKTLV ; i++) { + if (run_feature_protocol(device_name, + DCB_LOCAL_CHANGE_LLINK, i) != dcb_success) { + printf("run_feature_protocol error (LLINK)\n"); + sResult = dcb_failed; + goto add_adapter_error; + } } /* apply all feature setting to the driver:linux only */ @@ -980,6 +1040,8 @@ boolean_t remove_adapter(char *device_na feature_protocol_attribs *pFP; void *itp = NULL; + send_oper_events(device_name); + /* save device name for remove port */ if (device_name == NULL) { printf("remove_adapter: null device\n"); @@ -1193,6 +1255,15 @@ boolean_t remove_adapter(char *device_na if (itp) free (itp); itp = NULL; } + } + for(int i = 0; i < DCB_MAX_LLKTLV ; i++) { + string dn1 = dn; + char sTemp[SHORT_STRING]; + /* Localization OK */ + snprintf(sTemp, SHORT_STRING, "%hu", i); + /* Append device name with subtype */ + dn1.append(sTemp); + /* Release LLINK data store */ llink_it itllink = llink.find(dn1); if (itllink != llink.end()) { @@ -1406,9 +1477,9 @@ boolean_t add_app_defaults(u32 subtype) snprintf(sTmp, MAX_DESCRIPTION_LEN, DEF_CFG_STORE); switch (subtype) { - case 0: /* FCoE subtype */ + case APP_FCOE_STYPE: /* FCoE subtype */ app_data.Length = 1; - app_data.AppData[0] = 0x08; + app_data.AppData[0] = 0x08; /* bit pattern: User Priority 3 */ break; default: break; @@ -1472,7 +1543,7 @@ boolean_t add_bcn_defaults() bcn_data.bcn.rp_ru = DEF_BCN_RATE_UNIT; bcn_data.bcn.rp_ri = DEF_BCN_INITIAL_RATE; bcn_data.bcn.rp_wrtt = DEF_BCN_RTT_AVG_WEIGHT; - bcn_data.bcn.cp_sf = BCN_CP_SAMP_INTERVAL; + bcn_data.bcn.cp_sf = DEF_BCN_CP_SAMP_INTERVAL; snprintf(sTmp, MAX_DESCRIPTION_LEN, DEF_CFG_STORE); /* Create bcn default data store for the device. */ @@ -1703,12 +1774,12 @@ void mark_llink_sent(char *device_name, dcb_result put_pg(char *device_name, pg_attribs *pg_data) { TRY_BEGIN; - u32 EventFlag = 0; - dcb_result result = dcb_success; - full_dcb_attribs attribs; - boolean_t bChange = FALSE; - string dn(device_name); - full_dcb_attrib_ptrs att_ptrs; + full_dcb_attribs attribs; + full_dcb_attrib_ptrs attr_ptr; + string dn(device_name); + u32 EventFlag = 0; + dcb_result result = dcb_success; + boolean_t bChange = FALSE; if (!pg_data) return dcb_bad_params; @@ -1723,15 +1794,15 @@ dcb_result put_pg(char *device_name, pg } /* Check the rules */ - if (dcb_check_config(pg_data) != dcb_success) { + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.pg = pg_data; + if (dcb_check_config(&attr_ptr) != dcb_success) { printf("Rule checking failed in put_pg()\n"); result = dcb_bad_params; goto Exit; } bChange = TRUE; - memset(&att_ptrs, 0, sizeof(att_ptrs)); - att_ptrs.pg = pg_data; - if (set_persistent(device_name, &att_ptrs) != + if (set_persistent(device_name, &attr_ptr) != dcb_success) { printf("Set persistent failed put_pg()\n"); result = dcb_device_not_found; @@ -1765,10 +1836,10 @@ dcb_result put_pg(char *device_name, pg } else { /* Not in DCB data store, so store in persistent storage */ if (get_persistent(device_name, &attribs) == dcb_success) { - memset(&att_ptrs, 0, sizeof(att_ptrs)); - att_ptrs.pg = pg_data; - att_ptrs.pgid = &attribs.descript; - if (set_persistent(device_name, &att_ptrs) != + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.pg = pg_data; + attr_ptr.pgid = &attribs.descript; + if (set_persistent(device_name, &attr_ptr) != dcb_success) { printf("Set persistent failed in put_pg()\n"); result = dcb_device_not_found; @@ -1908,7 +1979,7 @@ dcb_result put_pfc(char *device_name, pf full_dcb_attribs attribs; boolean_t bChange = FALSE; string dn(device_name); - full_dcb_attrib_ptrs att_ptrs; + full_dcb_attrib_ptrs attr_ptr; if (!pfc_data) return dcb_bad_params; @@ -1921,9 +1992,9 @@ dcb_result put_pfc(char *device_name, pf goto Exit; } bChange = TRUE; - memset(&att_ptrs, 0, sizeof(att_ptrs)); - att_ptrs.pfc = pfc_data; - if (set_persistent(device_name, &att_ptrs) != dcb_success) { + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.pfc = pfc_data; + if (set_persistent(device_name, &attr_ptr) != dcb_success) { printf("Set persistent failed in put_pfc()\n"); result = dcb_device_not_found; goto Exit; @@ -1954,10 +2025,10 @@ dcb_result put_pfc(char *device_name, pf } else { /* Store in persistent storage - not in DCB data store */ if (get_persistent(device_name, &attribs) == dcb_success) { - memset(&att_ptrs, 0, sizeof(att_ptrs)); - att_ptrs.pfc = pfc_data; - att_ptrs.pgid = &attribs.descript; - if (set_persistent(device_name, &att_ptrs) != + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.pfc = pfc_data; + attr_ptr.pgid = &attribs.descript; + if (set_persistent(device_name, &attr_ptr) != dcb_success) { result = dcb_device_not_found; } @@ -2023,7 +2094,7 @@ dcb_result put_bcn(char *device_name, bc full_dcb_attribs attribs; boolean_t bChange = FALSE; string dn(device_name); - full_dcb_attrib_ptrs att_ptrs; + full_dcb_attrib_ptrs attr_ptr; if (!bcn_data) return dcb_bad_params; @@ -2036,10 +2107,16 @@ dcb_result put_bcn(char *device_name, bc if (memcmp((*it).second, bcn_data, sizeof(*bcn_data)) == 0) { goto Exit; } + /* Check the rules */ + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.bcn = bcn_data; + if (dcb_check_config(&attr_ptr) != dcb_success) { + printf("Rule checking failed in put_bcn()\n"); + result = dcb_bad_params; + goto Exit; + } bChange = TRUE; - memset(&att_ptrs, 0, sizeof(att_ptrs)); - att_ptrs.bcn = bcn_data; - if (set_persistent(device_name, &att_ptrs) != dcb_success) { + if (set_persistent(device_name, &attr_ptr) != dcb_success) { printf("Set persistent failed in put_bcn()\n"); result = dcb_device_not_found; goto Exit; @@ -2067,10 +2144,10 @@ dcb_result put_bcn(char *device_name, bc } else { /* Store in persistent storage - not in DCB data store */ if (get_persistent(device_name, &attribs) == dcb_success) { - memset(&att_ptrs, 0, sizeof(att_ptrs)); - att_ptrs.bcn = bcn_data; - att_ptrs.pgid = &attribs.descript; - if (set_persistent(device_name, &att_ptrs) != + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.bcn = bcn_data; + attr_ptr.pgid = &attribs.descript; + if (set_persistent(device_name, &attr_ptr) != dcb_success) { result = dcb_device_not_found; } @@ -2275,7 +2352,7 @@ dcb_result put_app(char *device_name, u3 full_dcb_attribs attribs; boolean_t bChange = FALSE; string dn(device_name); - full_dcb_attrib_ptrs att_ptrs; + full_dcb_attrib_ptrs attr_ptr; /* append device name with subtype */ snprintf(stmp, SHORT_STRING, "%hu", subtype); /* Localization OK */ @@ -2293,10 +2370,10 @@ dcb_result put_app(char *device_name, u3 } /* Store in persistent storage */ bChange = TRUE; - memset(&att_ptrs, 0, sizeof(att_ptrs)); - att_ptrs.app = app_data; - att_ptrs.app_subtype = (u8)subtype; - if (set_persistent(device_name, &att_ptrs) != dcb_success) { + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.app = app_data; + attr_ptr.app_subtype = (u8)subtype; + if (set_persistent(device_name, &attr_ptr) != dcb_success) { printf("Set persistent failed in put_app()\n"); return dcb_device_not_found; } @@ -2327,11 +2404,11 @@ dcb_result put_app(char *device_name, u3 } else { /* Not in DCB data store, store in persistent storage */ if (get_persistent(device_name, &attribs) == dcb_success) { - memset(&att_ptrs, 0, sizeof(att_ptrs)); - att_ptrs.app = app_data; - att_ptrs.app_subtype = (u8)subtype; - att_ptrs.pgid = &attribs.descript; - if (set_persistent(device_name, &att_ptrs) != + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.app = app_data; + attr_ptr.app_subtype = (u8)subtype; + attr_ptr.pgid = &attribs.descript; + if (set_persistent(device_name, &attr_ptr) != dcb_success) { printf("Set persistent failed in put_app()\n"); result = dcb_device_not_found; @@ -2402,7 +2479,7 @@ dcb_result put_llink(char *device_name, boolean_t bChange = FALSE; string dn(device_name); char stmp[SHORT_STRING]; - full_dcb_attrib_ptrs att_ptrs; + full_dcb_attrib_ptrs attr_ptr; /* append device name with subtype */ snprintf(stmp, SHORT_STRING, "%hu", subtype); /* Localization OK */ @@ -2421,10 +2498,10 @@ dcb_result put_llink(char *device_name, goto Exit; } bChange = TRUE; - memset(&att_ptrs, 0, sizeof(att_ptrs)); - att_ptrs.llink = llink_data; - att_ptrs.llink_subtype = LLINK_FCOE_STYPE; - if (set_persistent(device_name, &att_ptrs) != dcb_success) { + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.llink = llink_data; + attr_ptr.llink_subtype = LLINK_FCOE_STYPE; + if (set_persistent(device_name, &attr_ptr) != dcb_success) { printf("Set persistent failed in put_llink()\n"); result = dcb_device_not_found; goto Exit; @@ -2455,11 +2532,11 @@ dcb_result put_llink(char *device_name, } else { /* Store in persistent storage - though not in DCB data store*/ if (get_persistent(device_name, &attribs) == dcb_success) { - memset(&att_ptrs, 0, sizeof(att_ptrs)); - att_ptrs.llink = llink_data; - att_ptrs.llink_subtype = LLINK_FCOE_STYPE; - att_ptrs.pgid = &attribs.descript; - if (set_persistent(device_name, &att_ptrs) + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.llink = llink_data; + attr_ptr.llink_subtype = LLINK_FCOE_STYPE; + attr_ptr.pgid = &attribs.descript; + if (set_persistent(device_name, &attr_ptr) != dcb_success) { result = dcb_device_not_found; } @@ -2733,7 +2810,7 @@ dcb_result put_bwg_descrpt(char *device_ dcb_result result = dcb_success; full_dcb_attribs attribs; unsigned int size; - full_dcb_attrib_ptrs att_ptrs; + full_dcb_attrib_ptrs attr_ptr; if (!name) return dcb_bad_params; size = (unsigned int)strlen(name); /* Localization OK */ @@ -2750,9 +2827,9 @@ dcb_result put_bwg_descrpt(char *device_ memcpy(((*it).second)->pgid_desc[bwgid], name, size); /* Put a null at the end incase it was truncated */ ((*it).second)->pgid_desc[bwgid][size] = '\0'; - memset(&att_ptrs, 0, sizeof(att_ptrs)); - att_ptrs.pgid = ((*it).second); - if (set_persistent(device_name, &att_ptrs) != dcb_success) { + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.pgid = ((*it).second); + if (set_persistent(device_name, &attr_ptr) != dcb_success) { return dcb_device_not_found; } } else { @@ -2768,9 +2845,9 @@ dcb_result put_bwg_descrpt(char *device_ /* Put a null at the end in case it was * truncated */ attribs.descript.pgid_desc[bwgid][size] = '\0'; - memset(&att_ptrs, 0, sizeof(att_ptrs)); - att_ptrs.pgid = &attribs.descript; - if (set_persistent(device_name, &att_ptrs) + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.pgid = &attribs.descript; + if (set_persistent(device_name, &attr_ptr) != dcb_success) { printf("Set persistent failed " "in put_bwg_descrpt()\n"); @@ -2838,9 +2915,7 @@ void CopyConfigToOper(char *device_name, return; } /* Copy Src to Oper. */ - int i; - - for (i = 0; i < MAX_USER_PRIORITIES; i++) { + for (int i = 0; i < MAX_USER_PRIORITIES; i++) { (*Oper).second->tx.up[i].pgid = (*Src).second->tx.up[i].pgid; (*Oper).second->rx.up[i].pgid = @@ -2869,7 +2944,7 @@ void CopyConfigToOper(char *device_name, } } - for (i = 0; i < MAX_BANDWIDTH_GROUPS; i++) { + for (int i = 0; i < MAX_BANDWIDTH_GROUPS; i++) { (*Oper).second->tx.pg_percent[i] = (*Src).second->tx.pg_percent[i]; (*Oper).second->rx.pg_percent[i] = @@ -3040,8 +3115,6 @@ void CopyConfigToOper(char *device_name, ******************************************************************************/ boolean_t LocalPeerCompatible(char *device_name, u32 EventFlag, u32 Subtype) { - int i; - TRY_BEGIN; string dn(device_name); if (DCB_TEST_FLAGS(EventFlag, DCB_LOCAL_CHANGE_PG, DCB_LOCAL_CHANGE_PG) @@ -3067,7 +3140,7 @@ boolean_t LocalPeerCompatible(char *devi match = TRUE; if (ppg->protocol.dcbx_st == dcbx_subtype1) { - for (i = 0; i < MAX_USER_PRIORITIES; i++) { + for (int i = 0; i < MAX_USER_PRIORITIES; i++) { if (lpg->tx.up[i].pgid != ppg->tx.up[i].pgid) match = FALSE; @@ -3078,7 +3151,7 @@ boolean_t LocalPeerCompatible(char *devi ppg->tx.up[i].percent_of_pg_cap) match = FALSE; } - for (i = 0; i < MAX_BANDWIDTH_GROUPS; i++) { + for (int i = 0; i < MAX_BANDWIDTH_GROUPS; i++) { if (lpg->tx.pg_percent[i] != ppg->tx.pg_percent[i]) match = FALSE; @@ -3209,6 +3282,7 @@ int set_configuration(char *device_name, TRY_BEGIN; string dn(device_name); dcb_result sResult; + full_dcb_attrib_ptrs attr_ptr; if (DCB_TEST_FLAGS(EventFlag, DCB_LOCAL_CHANGE_PG, DCB_LOCAL_CHANGE_PG) || @@ -3224,9 +3298,11 @@ int set_configuration(char *device_name, pgroup_attribs pg_data; if (DCB_TEST_FLAGS(EventFlag, DCB_REMOTE_CHANGE_PG, DCB_REMOTE_CHANGE_PG)) { - if ((sResult = dcb_check_config((*Oper).second)) + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.pg = ((*Oper).second); + if ((sResult = dcb_check_config(&attr_ptr)) != dcb_success) { - printf("Rule check returned error %d\n", + printf("PG rule check returned error %d\n", sResult); /* Localization OK */ return sResult; } @@ -3246,6 +3322,17 @@ int set_configuration(char *device_name, if (Oper == oper_bcn.end() || Local == bcn.end()) { return 1; } + if (DCB_TEST_FLAGS(EventFlag, DCB_REMOTE_CHANGE_BCN, + DCB_REMOTE_CHANGE_BCN)) { + memset(&attr_ptr, 0, sizeof(attr_ptr)); + attr_ptr.bcn = ((*Oper).second); + if ((sResult = dcb_check_config(&attr_ptr)) + != dcb_success) { + printf("BCN rule check returned error %d\n", + sResult); /* Localization OK */ + return sResult; + } + } return set_hw_bcn(device_name, &(*Oper).second->bcn, (*Local).second->protocol.OperMode); } else if (DCB_TEST_FLAGS(EventFlag, DCB_LOCAL_CHANGE_PFC, @@ -3275,6 +3362,51 @@ int set_configuration(char *device_name, /****************************************************************************** ** +** Method: send_oper_events +** +** Description: This routine is called by remove_adapter. +** For any feature whose OperMode is TRUE, send an +** event since the port is going away - indicating an +** OperMode change. +** +** Arguments: char *device_name +** +** Returns: dcb_success if successful, failure code otherwise. +** +******************************************************************************/ +static void send_oper_events(char *device_name) +{ + pg_attribs pg_data; + pfc_attribs pfc_data; + bcn_attribs bcn_data; + app_attribs app_data; + llink_attribs llink_data; + + if (get_pg(device_name, &pg_data) == dcb_success) + if (pg_data.protocol.OperMode) + pg_event(device_name, EVENT_OPERMODE); + + if (get_pfc(device_name, &pfc_data) == dcb_success) + if (pfc_data.protocol.OperMode) + pfc_event(device_name, EVENT_OPERMODE); + + if (get_bcn(device_name, &bcn_data) == dcb_success) + if (bcn_data.protocol.OperMode) + bcn_event(device_name, EVENT_OPERMODE); + + for (int i = 0; i < DCB_MAX_APPTLV ; i++) + if (get_app(device_name, i, &app_data) == dcb_success) + if (app_data.protocol.OperMode) + app_event(device_name, i, EVENT_OPERMODE); + + for (int i = 0; i < DCB_MAX_LLKTLV ; i++) + if (get_llink(device_name, i, &llink_data) == dcb_success) + if (llink_data.protocol.OperMode) + llink_event(device_name, i, EVENT_OPERMODE); +} + +/****************************************************************************** +** ** Method: run_feature_protocol ** ** Description: This function runs feature state machine for a local or remote @@ -4246,11 +4378,13 @@ void update_feature_syncd(char *device_n } } - /* Get the local LLINK feature protocol */ - llink_it it4 = llink.find(dn); - if (it4 != llink.end()) - if ((&((*it4).second)->protocol)->Advertise == FALSE) - (&((*it4).second)->protocol)->Syncd = TRUE; + for (int i = 0; i < DCB_MAX_LLKTLV ; i++) { + /* Get the local LLINK feature protocol */ + llink_it it4 = llink.find(dn); + if (it4 != llink.end()) + if ((&((*it4).second)->protocol)->Advertise == FALSE) + (&((*it4).second)->protocol)->Syncd = TRUE; + } CATCH_END_VOID; @@ -4490,7 +4624,7 @@ send: ** u32 EventFlag ** u32 SubType - This is valid for APPTLV event flags only. ** If >= DCB_MAX_APPTLV, then we process all Subtypes -** for APPTLV flags. +** for APPTLV flags. ** Returns: dcb_success if successful, failure code otherwise. ** *******************************************************************************/ @@ -4545,8 +4679,11 @@ dcb_result run_dcb_protocol(char *device if (DCB_TEST_FLAGS(EventFlag, DCB_LOCAL_CHANGE_LLINK, DCB_LOCAL_CHANGE_LLINK) && (result != dcb_ctrl_vers_not_compatible)) { - result = run_feature_protocol(device_name, - DCB_LOCAL_CHANGE_LLINK); + + for (i = SubTypeMin; i < SubTypeMax; i++) { + result = run_feature_protocol(device_name, + DCB_LOCAL_CHANGE_LLINK, i); + } LocalChange = TRUE; } /* Only allow local or remote change at a time. */ @@ -4580,8 +4717,10 @@ dcb_result run_dcb_protocol(char *device if (DCB_TEST_FLAGS(EventFlag, DCB_REMOTE_CHANGE_LLINK, DCB_REMOTE_CHANGE_LLINK) && (result != dcb_ctrl_vers_not_compatible)) { - result = run_feature_protocol(device_name, - DCB_REMOTE_CHANGE_LLINK); + for (i = SubTypeMin; i < SubTypeMax; i++) { + result = run_feature_protocol(device_name, + DCB_REMOTE_CHANGE_LLINK, i); + } } } Index: dcbd-0.7.31rt/dcb_rule_chk.cpp =================================================================== --- dcbd-0.7.31rt.orig/dcb_rule_chk.cpp +++ dcbd-0.7.31rt/dcb_rule_chk.cpp @@ -44,186 +44,270 @@ * return : dcb_result *****************************************************************************/ dcb_result -dcb_check_config (pg_attribs *pg) +dcb_check_config (full_dcb_attrib_ptrs *attribs) { + pg_attribs *pg; + bcn_cfg *bcn; u8 i, tx_bw, rx_bw, tx_bw_id, rx_bw_id; u8 tx_bw_sum[MAX_BW_GROUP],rx_bw_sum[MAX_BW_GROUP]; boolean_t tx_link_strict[MAX_BW_GROUP], rx_link_strict[MAX_BW_GROUP]; u8 link_strict_pgid; - memset(tx_bw_sum,0,sizeof(tx_bw_sum)); - memset(rx_bw_sum,0,sizeof(rx_bw_sum)); - memset(tx_link_strict,0,sizeof(tx_link_strict)); - memset(rx_link_strict,0,sizeof(rx_link_strict)); - - tx_bw = 0, rx_bw = 0; - /* Internally in the pg_attribs structure, a link strict PGID is - * maintained as a PGID value (0-7) with a corresponding - * strict_priority field value of 'dcb_link'. Only one link strict - * PGID is allowed. - */ - link_strict_pgid = LINK_STRICT_PGID; - /* Check rules for Tx and Rx Bandwidth Groups */ - for (i = 0; i < MAX_BW_GROUP; i++) { - tx_bw = tx_bw + pg->tx.pg_percent[i]; - - /* check for >1 link strict PGID */ - if (pg->tx.up[i].strict_priority == dcb_link) { - if (link_strict_pgid == LINK_STRICT_PGID) { - link_strict_pgid = pg->tx.up[i].pgid; - } else if (pg->tx.up[i].pgid != link_strict_pgid) { - log_message(MSG_ERR_DCB_TOO_MANY_LSP_PGIDS, - "%d", (int)pg->tx.up[i].pgid); - return dcb_bad_params; + if (attribs == NULL) { + return dcb_failed; + } + + if (attribs->pg) { + pg = attribs->pg; + memset(tx_bw_sum,0,sizeof(tx_bw_sum)); + memset(rx_bw_sum,0,sizeof(rx_bw_sum)); + memset(tx_link_strict,0,sizeof(tx_link_strict)); + memset(rx_link_strict,0,sizeof(rx_link_strict)); + + tx_bw = 0, rx_bw = 0; + /* Internally in the pg_attribs structure, a link strict PGID is + * maintained as a PGID value (0-7) with a corresponding + * strict_priority field value of 'dcb_link'. Only one link strict + * PGID is allowed. + */ + link_strict_pgid = LINK_STRICT_PGID; + /* Check rules for Tx and Rx Bandwidth Groups */ + for (i = 0; i < MAX_BW_GROUP; i++) { + tx_bw = tx_bw + pg->tx.pg_percent[i]; + + /* check for >1 link strict PGID */ + if (pg->tx.up[i].strict_priority == dcb_link) { + if (link_strict_pgid == LINK_STRICT_PGID) { + link_strict_pgid = pg->tx.up[i].pgid; + } else if (pg->tx.up[i].pgid != link_strict_pgid) { + log_message(MSG_ERR_DCB_TOO_MANY_LSP_PGIDS, + "%d", (int)pg->tx.up[i].pgid); + return dcb_bad_params; + } + /* don't include link strict group %'s */ + tx_bw = tx_bw - pg->tx.pg_percent[i]; } - /* don't include link strict group %'s */ - tx_bw = tx_bw - pg->tx.pg_percent[i]; } - } - if (tx_bw != BW_PERCENT) { - /* only valid scenario for BWT!=100 is BWT==0 and all BWGs - * link strict - */ + if (tx_bw != BW_PERCENT) { + /* only valid scenario for BWT!=100 is BWT==0 and all BWGs + * link strict + */ + for (i = 0; i < MAX_BW_GROUP; i++) { + if ((tx_bw != 0) || (pg->tx.up[i].strict_priority != + dcb_link)) { + log_message(MSG_ERR_DCB_INVALID_TX_TOTAL_BWG, + "%d", (int)tx_bw); + return dcb_bad_params; + } + } + } + + link_strict_pgid = LINK_STRICT_PGID; for (i = 0; i < MAX_BW_GROUP; i++) { - if ((tx_bw != 0) || (pg->tx.up[i].strict_priority != - dcb_link)) { - log_message(MSG_ERR_DCB_INVALID_TX_TOTAL_BWG, - "%d", (int)tx_bw); + rx_bw = rx_bw + pg->rx.pg_percent[i]; + + /* check for >1 link strict PGID */ + if (pg->rx.up[i].strict_priority == dcb_link) { + if (link_strict_pgid == LINK_STRICT_PGID) { + link_strict_pgid = pg->rx.up[i].pgid; + } else if (pg->rx.up[i].pgid != link_strict_pgid) { + log_message(MSG_ERR_DCB_TOO_MANY_LSP_PGIDS, + "%d", (int)pg->rx.up[i].pgid); + return dcb_bad_params; + } + /* don't include link strict group %'s */ + rx_bw = rx_bw - pg->rx.pg_percent[i]; + } + } + if (rx_bw != BW_PERCENT) { + /* only valid scenario for BWT!=100 is BWT==0 and all BWGs + * link strict + */ + for (i = 0; i < MAX_BW_GROUP; i++) { + if ((rx_bw != 0) || (pg->rx.up[i].strict_priority != + dcb_link)) { + log_message(MSG_ERR_DCB_INVALID_RX_TOTAL_BWG, + "%d", (int)rx_bw); + return dcb_bad_params; + } + } + } + + /* Go through each traffic class and check rules for Tx and Rx */ + for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { + + /* Since we assign strict priority to RX & TX via enumeration, + * from the data stores and from the peer. It would be + * impossible for both of them to be set. + * So that is no longer checked in this function. + */ + + /* Transmit Check */ + tx_bw = 0, tx_bw_id = 0; + tx_bw = (u8)(pg->tx.up[i].percent_of_pg_cap); + tx_bw_id = (u8)(pg->tx.up[i].pgid); + + if (tx_bw_id >= MAX_BW_GROUP) { + log_message(MSG_ERR_DCB_INVALID_TX_BWG_IDX, "%d", + (int)tx_bw_id); + return dcb_bad_params; + } + if (pg->tx.up[i].strict_priority == dcb_link) { + tx_link_strict[tx_bw_id] = TRUE; + /* Link strict should have zero bandwidth */ + if (tx_bw){ + log_message( + MSG_ERR_DCB_INVALID_TX_LSP_NZERO_BW_TC, + "%d%d", i, (int)tx_bw); + return dcb_bad_params; + } + } else if (!tx_bw) { + log_message(MSG_ERR_DCB_INVALID_TX_ZERO_BW_TC, "%d", i); + /* Non link strict should have non zero bandwidth*/ + return dcb_bad_params; + } + /* Receive Check */ + rx_bw = 0, rx_bw_id = 0; + rx_bw = (u8)(pg->rx.up[i].percent_of_pg_cap); + rx_bw_id = (u8)(pg->rx.up[i].pgid); + + if (rx_bw_id >= MAX_BW_GROUP) { + log_message(MSG_ERR_DCB_INVALID_RX_BWG_IDX, "%d", + (int)rx_bw_id); return dcb_bad_params; } + if (pg->rx.up[i].strict_priority == dcb_link) { + rx_link_strict[rx_bw_id] = TRUE; + /* Link strict class should have zero bandwidth */ + if (rx_bw){ + log_message(MSG_ERR_DCB_INVALID_RX_LSP_NZERO_BW_TC, + "%d%d", i, (int)rx_bw); + return dcb_bad_params; + } + } else if (!rx_bw) { + log_message(MSG_ERR_DCB_INVALID_RX_ZERO_BW_TC, "%d", i); + /* Non link strict class should have non-zero bw */ + return dcb_bad_params; /* DCB_RX_ERR_TC_BW_ZERO; */ + } + tx_bw_sum[tx_bw_id] = tx_bw_sum[tx_bw_id] + tx_bw; + rx_bw_sum[rx_bw_id] = rx_bw_sum[rx_bw_id] + rx_bw; + } - } - link_strict_pgid = LINK_STRICT_PGID; - for (i = 0; i < MAX_BW_GROUP; i++) { - rx_bw = rx_bw + pg->rx.pg_percent[i]; - - /* check for >1 link strict PGID */ - if (pg->rx.up[i].strict_priority == dcb_link) { - if (link_strict_pgid == LINK_STRICT_PGID) { - link_strict_pgid = pg->rx.up[i].pgid; - } else if (pg->rx.up[i].pgid != link_strict_pgid) { - log_message(MSG_ERR_DCB_TOO_MANY_LSP_PGIDS, - "%d", (int)pg->rx.up[i].pgid); + /* Transmit Check */ + for (i = 0; i < MAX_BW_GROUP; i++) { + /* sum of bandwidth percentages of all traffic classes within + * a Bandwidth Group must total 100 except for link strict + * group (zero bandwidth). + */ + if (tx_link_strict[i]) { + if (tx_bw_sum[i] && pg->tx.pg_percent[i]) { + log_message(MSG_ERR_DCB_INVALID_TX_LSP_NZERO_BWG, + "%d%d", i, (int)tx_bw_sum[i]); + /* Link strict group should have zero bw */ + return dcb_bad_params; + } + } else if (tx_bw_sum[i] != BW_PERCENT && tx_bw_sum[i] != 0) { + log_message(MSG_ERR_DCB_INVALID_TX_BWG, "%d%d", + i, (int)tx_bw_sum[i]); return dcb_bad_params; } - /* don't include link strict group %'s */ - rx_bw = rx_bw - pg->rx.pg_percent[i]; } - } - if (rx_bw != BW_PERCENT) { - /* only valid scenario for BWT!=100 is BWT==0 and all BWGs - * link strict - */ + /* Receive Check */ for (i = 0; i < MAX_BW_GROUP; i++) { - if ((rx_bw != 0) || (pg->rx.up[i].strict_priority != - dcb_link)) { - log_message(MSG_ERR_DCB_INVALID_RX_TOTAL_BWG, - "%d", (int)rx_bw); + /* sum of bandwidth percentages of all traffic classes + * within a Bandwidth Group must total 100 except for + * link strict group ( zero bandwidth). + */ + if (rx_link_strict[i]) { + if (rx_bw_sum[i] && pg->rx.pg_percent[i]) { + log_message(MSG_ERR_DCB_INVALID_RX_LSP_NZERO_BWG, + "%d%d", i, (int)rx_bw_sum[i]); + /* Link strict group should have zero bw */ + return dcb_bad_params; + } + } else if (rx_bw_sum[i] != BW_PERCENT && rx_bw_sum[i] != 0) { + log_message(MSG_ERR_DCB_INVALID_RX_BWG, "%d%d", + i, (int)rx_bw_sum[i]); return dcb_bad_params; } } } - /* Go through each traffic class and check rules for Tx and Rx */ - for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { - - /* Since we assign strict priority to RX & TX via enumeration, - * from the data stores and from the peer. It would be - * impossible for both of them to be set. - * So that is no longer checked in this function. - */ - - /* Transmit Check */ - tx_bw = 0, tx_bw_id = 0; - tx_bw = (u8)(pg->tx.up[i].percent_of_pg_cap); - tx_bw_id = (u8)(pg->tx.up[i].pgid); - - if (tx_bw_id >= MAX_BW_GROUP) { - log_message(MSG_ERR_DCB_INVALID_TX_BWG_IDX, "%d", - (int)tx_bw_id); - return dcb_bad_params; - } - if (pg->tx.up[i].strict_priority == dcb_link) { - tx_link_strict[tx_bw_id] = TRUE; - /* Link strict should have zero bandwidth */ - if (tx_bw){ - log_message( - MSG_ERR_DCB_INVALID_TX_LSP_NZERO_BW_TC, - "%d%d", i, (int)tx_bw); - return dcb_bad_params; - } - } else if (!tx_bw) { - log_message(MSG_ERR_DCB_INVALID_TX_ZERO_BW_TC, "%d", i); - /* Non link strict should have non zero bandwidth*/ + if (attribs->bcn) { + bcn = &(attribs->bcn->bcn); + // bcn->cp_sf is not used, and not checked + if ((bcn->rp_alpha < MIN_BCN_DELTA) || + (bcn->rp_alpha > MAX_BCN_DELTA)) { return dcb_bad_params; } - /* Receive Check */ - rx_bw = 0, rx_bw_id = 0; - rx_bw = (u8)(pg->rx.up[i].percent_of_pg_cap); - rx_bw_id = (u8)(pg->rx.up[i].pgid); - - if (rx_bw_id >= MAX_BW_GROUP) { - log_message(MSG_ERR_DCB_INVALID_RX_BWG_IDX, "%d", - (int)rx_bw_id); - return dcb_bad_params; - } - if (pg->rx.up[i].strict_priority == dcb_link) { - rx_link_strict[rx_bw_id] = TRUE; - /* Link strict class should have zero bandwidth */ - if (rx_bw){ - log_message(MSG_ERR_DCB_INVALID_RX_LSP_NZERO_BW_TC, - "%d%d", i, (int)rx_bw); - return dcb_bad_params; - } - } else if (!rx_bw) { - log_message(MSG_ERR_DCB_INVALID_RX_ZERO_BW_TC, "%d", i); - /* Non link strict class should have non-zero bw */ - return dcb_bad_params; /* DCB_RX_ERR_TC_BW_ZERO; */ + if ((bcn->rp_beta < MIN_BCN_DELTA) || + (bcn->rp_beta > MAX_BCN_DELTA)) { + return dcb_bad_params; } - tx_bw_sum[tx_bw_id] = tx_bw_sum[tx_bw_id] + tx_bw; - rx_bw_sum[rx_bw_id] = rx_bw_sum[rx_bw_id] + rx_bw; - - } - - /* Transmit Check */ - for (i = 0; i < MAX_BW_GROUP; i++) { - /* sum of bandwidth percentages of all traffic classes within - * a Bandwidth Group must total 100 except for link strict - * group (zero bandwidth). - */ - if (tx_link_strict[i]) { - if (tx_bw_sum[i] && pg->tx.pg_percent[i]) { - log_message(MSG_ERR_DCB_INVALID_TX_LSP_NZERO_BWG, - "%d%d", i, (int)tx_bw_sum[i]); - /* Link strict group should have zero bw */ - return dcb_bad_params; - } - } else if (tx_bw_sum[i] != BW_PERCENT && tx_bw_sum[i] != 0) { - log_message(MSG_ERR_DCB_INVALID_TX_BWG, "%d%d", - i, (int)tx_bw_sum[i]); + if ((bcn->rp_gd < MIN_BCN_DELTA) || + (bcn->rp_gd > MAX_BCN_DELTA)) { return dcb_bad_params; } - } - /* Receive Check */ - for (i = 0; i < MAX_BW_GROUP; i++) { - /* sum of bandwidth percentages of all traffic classes - * within a Bandwidth Group must total 100 except for - * link strict group ( zero bandwidth). - */ - if (rx_link_strict[i]) { - if (rx_bw_sum[i] && pg->rx.pg_percent[i]) { - log_message(MSG_ERR_DCB_INVALID_RX_LSP_NZERO_BWG, - "%d%d", i, (int)rx_bw_sum[i]); - /* Link strict group should have zero bw */ - return dcb_bad_params; - } - } else if (rx_bw_sum[i] != BW_PERCENT && rx_bw_sum[i] != 0) { - log_message(MSG_ERR_DCB_INVALID_RX_BWG, "%d%d", - i, (int)rx_bw_sum[i]); + if ((bcn->rp_gi < MIN_BCN_DELTA) || + (bcn->rp_gi > MAX_BCN_DELTA)) { + return dcb_bad_params; + } + if ((bcn->rp_tmax < MIN_BCN_BKOFF_TMR_RNG) || + (bcn->rp_tmax > MAX_BCN_BKOFF_TMR_RNG)) { + return dcb_bad_params; + } + if ((bcn->rp_c < MIN_BCN_LINK_CAPACITY) || + (bcn->rp_c > MAX_BCN_LINK_CAPACITY)) { + return dcb_bad_params; + } + if ((bcn->rp_ri < MIN_BCN_INITIAL_RATE) || + (bcn->rp_ri > MAX_BCN_INITIAL_RATE)) { + return dcb_bad_params; + } + if ((bcn->rp_td < MIN_BCN_DRIFT_TIMER) || + (bcn->rp_td > MAX_BCN_DRIFT_TIMER)) { + return dcb_bad_params; + } + if ((bcn->rp_rmin < MIN_BCN_RESTRT_RATE) || + (bcn->rp_rmin > MAX_BCN_RESTRT_RATE)) { + return dcb_bad_params; + } + if ((bcn->rp_w < MIN_BCN_DERVD_WEIGHT) || + (bcn->rp_w > MAX_BCN_DERVD_WEIGHT)) { + return dcb_bad_params; + } + if ((bcn->rp_rd < MIN_BCN_DRIFT_INC) || + (bcn->rp_rd > MAX_BCN_DRIFT_INC)) { return dcb_bad_params; } + if ((bcn->rp_ru < MIN_BCN_RATE_UNIT) || + (bcn->rp_ru > MAX_BCN_RATE_UNIT)) { + return dcb_bad_params; + } + if (bcn->rp_wrtt > MAX_BCN_RTT_AVG_WEIGHT) { + return dcb_bad_params; + } + for (i=0; i < MAX_TRAFFIC_CLASSES; i++) { + if ((bcn->up_settings[i].cp_admin < 0) || + (bcn->up_settings[i].cp_admin > 1)) { + return dcb_bad_params; + } + if ((bcn->up_settings[i].rp_admin < 0) || + (bcn->up_settings[i].rp_admin > 1)) { + return dcb_bad_params; + } + if ((bcn->up_settings[i].rp_oper < 0) || + (bcn->up_settings[i].rp_oper > 1)) { + return dcb_bad_params; + } + if ((bcn->up_settings[i].rem_tag_oper < 0) || + (bcn->up_settings[i].rem_tag_oper > 1)) { + return dcb_bad_params; + } + } } + return dcb_success; } Index: dcbd-0.7.31rt/dcbtool.c =================================================================== --- dcbd-0.7.31rt.orig/dcbtool.c +++ dcbd-0.7.31rt/dcbtool.c @@ -105,43 +105,97 @@ static const char *cli_full_license = "\n"; static const char *commands_help = -"Commands:\n" +"DCBX Commands:\n" " <gc|go> dcbx get configured or operational DCBX versions\n" " the operational version takes effect on next\n" " restart of the dcbd service\n" -" sc dcbx v:[12] set the DCBX version to be used on next\n" +" sc dcbx v:[12] set the DCBX version to be used after next\n" " dcbd restart\n" +"Per Port Commands:\n" " gc <ifname> <feature> get configuration of <feature> on port <ifname>\n" " go <ifname> <feature> get operational status of <feature>\n" " on port <ifname>\n" " gp <ifname> <feature> get peer configuration of <feature>\n" " on port <ifname>\n" -" features:\n" -" dcb DCB state of port (only for the 'gc' command)\n" -" pg priority groups\n" -" pfc priority groups\n" -" app:<subtype> application specific\n" -" bcn backwards congestion notification\n" -" ll:<subtype> logical link status\n" -" subtype = [0|fcoe]: FCoE\n\n" -" sc <ifname> dcb [<on|off>] set the DCB state of the port\n" -" sc <ifname> pg \\ set priority group configuration\n" -" [e:<0|1>] \\ enable/disable feature\n" -" [a:<0|1>] \\ enable/disable advertise\n" -" [w:<0|1>] \\ enable/disable willing mode\n" -" [[up2tc:xxxxxxxx] \\ user priority to traffic class mapping\n" -" pgpct:x,x,x,x,x,x,x,x \\ priority group percent of link\n" -" pgid:xxxxxxxx \\ priority group ID of user priority\n" -" uppct:x,x,x,x,x,x,x,x \\ user priority percent of bandwidth group\n" -" [ strict:xxxxxxxx ]] strict priority setting\n" -" sc <ifname> pfc \\ set priority flow control settings\n" -" [e:x] [a:x] [w:x] \\\n" -" [pfcup:xxxxxxxx] ] enable/disable priority flow control\n" -" sc <ifname> app:<subtype> \\\n" -" [e:x] [a:x] [w:x] \\\n" -" [appcfg:xxxx...xxxx] application config data\n\n" +" sc <ifname> <feature> <args> general form of set feature configuration\n\n" +" 'feature' can be:\n" +" dcb DCB state of port\n" +" pg priority groups\n" +" pfc priority groups\n" +" app:<subtype> application specific data\n" +" bcn backwards congestion notification\n" +" ll:<subtype> logical link status\n\n" +" 'subtype' can be:\n" +" [0|fcoe] FCoE\n\n" +" 'args' can include:\n" +" [e:<0|1>] controls feature enable\n" +" [a:<0|1>] controls feature advertise via DCBX\n" +" [w:<0|1>] controls feature DCBX willing mode\n" +" [feature specific args] arguments specific to a feature\n\n" +" feature specific arguments for 'dcb':\n" +" [on|off] the 'dcb' configuration does not use the\n" +" enable, advertise or willing mode parameters\n" +" 'dcb' also does not use the 'go' or 'gp'\n" +" commands.\n\n" +" feature specific arguments for 'pg':\n" +" [pgid:xxxxxxxx] priority group ID of user priority.\n" +" From left to right (priorities 0-7), x is\n" +" the corresponding priority group value\n" +" 0-7 (for priority groups with bandwidth)\n" +" or 'f' (the no bandwidth allocation group)\n" +" [pgpct:x,x,x,x,x,x,x,x] priority group percent of link.\n" +" From left to right (priority groups 0-7),\n" +" x is the percentage of link bandwidth\n" +" assigned the total must equal 100%.\n" +" [uppct:x,x,x,x,x,x,x,x] user priority percent of bandwidth group.\n" +" From left to right (priorities 0-7),\n" +" x is the percentage of priority group\n" +" bandwidth assigned to the priority.\n" +" The sum of percentages for priorities in the\n" +" same priority group must be 100.\n" +" [strict:xxxxxxxx] strict priority setting.\n" +" From left to right (priorities 0-7),\n" +" x is 0 or 1. 1 indicates that the priority\n" +" may utilize all of the bandwidth allocated\n" +" to its priority group.\n" +" [up2tc:xxxxxxxx] user priority to traffic class mapping.\n" +" From left to right (priorities 0-7), x is\n" +" a the corresponding traffic class (0-7)\n" +" (this argument is currently ignored).\n\n" +" feature specific arguments for 'pfc':\n" +" [pfcup:xxxxxxxx] enable/disable priority flow control.\n" +" From left to right (priorities 0-7),\n" +" x is 0 or 1. 1 indicates that the priority\n" +" is configured to transmit priority pause.\n\n" +" feature specific arguments for 'app:<subtype>':\n" +" [appcfg:xx] 'xx' is a hexadecimal value representing an\n" +" 8 bit bitmap where 1 bits indicate the\n" +" priority which frames for the application\n" +" specified by the subtype should use.\n" +" The lowest order bit maps to priority 0.\n\n" +" feature specific arguments for 'll:<subtype>':\n" +" [status:<0|1>] for testing, the logical link status may\n" +" be set to 0 or 1. This setting is not\n" +" persisted.\n\n" +" feature specific arguments for 'bcn':\n" +" [rpadmin:xxxxxxxx] user priorities for which a reaction point\n" +" should be enabled. From left to right\n" +" (priorities 0-7), x is 0 or 1\n" +" [alpha:<0.0-1.0>] alpha - floating point value between 0 and 1\n" +" [beta:<0.0-1.0>] beta - floating point value between 0 and 1\n" +" [gd:<0.0-1.0>] decrement coefficient - floating point value\n" +" between 0 and 1\n" +" [gi:<0.0-1.0>] increment coefficient - floating point value\n" +" between 0 and 1\n" +" [tmax:<0-1000000>] max time to backoff after BCN0\n" +" [td:<1-10000>] drift interval\n" +" [rmin:<1-1000>] default rate after first BCN0\n" +" [dw:<1-64>] derived weight (1 = 0.125)\n" +" [rd:<1-100>] drift factor\n" +" [ru:<1-100>] rate unit\n" +" [wrtt:<0-10>] RTT moving average weight\n" +" [ri:<0-10000>] initial rate\n\n" " help show command information\n" -" level <value > set debug level for events\n" " license show license information\n"; static struct clif *clif_conn; @@ -313,19 +367,6 @@ static int cli_cmd_quit(struct clif *cli } -static int cli_cmd_level(struct clif *clif, int argc, char *argv[], int raw) -{ - char cmd[256]; - if (argc != 1) { - printf("Invalid LEVEL command: needs one argument (debug " - "level)\n"); - return 0; - } - snprintf(cmd, sizeof(cmd), "L%s", argv[0]); - return clif_command(clif, cmd, raw); -} - - static void cli_list_interfaces(struct clif *clif) { struct dirent *dent; @@ -384,7 +425,6 @@ static struct cli_cmd cli_commands[] = { { "ping", cli_cmd_ping }, { "help", cli_cmd_help }, { "interface", cli_cmd_interface }, - { "level", cli_cmd_level }, { "license", cli_cmd_license }, { "quit", cli_cmd_quit }, { NULL, NULL } Index: dcbd-0.7.31rt/drv_cfg.c =================================================================== --- dcbd-0.7.31rt.orig/drv_cfg.c +++ dcbd-0.7.31rt/drv_cfg.c @@ -703,7 +703,7 @@ static int set_bcn_cfg(char *ifname, bcn rta_parent = add_rta(nlh, DCB_ATTR_BCN, NULL, 0); for (i = DCB_BCN_ATTR_RP_0; i <= DCB_BCN_ATTR_RP_7; i++) { rta_child = add_rta(nlh, i, - (void *)&bcn_data->bcn_up_settings[i - DCB_BCN_ATTR_RP_0].rp_admin, + (void *)&bcn_data->up_settings[i - DCB_BCN_ATTR_RP_0].rp_admin, sizeof(__u8)); rta_parent->rta_len += NLA_ALIGN(rta_child->rta_len); } @@ -717,7 +717,7 @@ static int set_bcn_cfg(char *ifname, bcn temp_int = 0; for (i = BCN_ADDR_OPTION_LEN/2; i < BCN_ADDR_OPTION_LEN; i++) - temp_int |= bcn_data->bcna[i]<<(i- BCN_ADDR_OPTION_LEN/2)*8; + temp_int |= bcn_data->bcna[i] << ((i- BCN_ADDR_OPTION_LEN/2)*8); rta_child = add_rta(nlh, DCB_BCN_ATTR_BCNA_1, (void *)&temp_int, sizeof(__u32)); rta_parent->rta_len += NLA_ALIGN(rta_child->rta_len); @@ -797,10 +797,10 @@ int set_hw_bcn(char *ifname, bcn_cfg *bc } for (i = 0; i < MAX_TRAFFIC_CLASSES; i++) { - if (bcn_temp->bcn_up_settings[i].cp_admin) - bcn_temp->bcn_up_settings[i].cp_admin = 1; + if (bcn_temp->up_settings[i].cp_admin) + bcn_temp->up_settings[i].cp_admin = 1; else - bcn_temp->bcn_up_settings[i].cp_admin = 0; + bcn_temp->up_settings[i].cp_admin = 0; } return set_bcn_cfg(ifname, bcn_temp); Index: dcbd-0.7.31rt/event_iface.c =================================================================== --- dcbd-0.7.31rt.orig/event_iface.c +++ dcbd-0.7.31rt/event_iface.c @@ -165,7 +165,10 @@ static void event_if_decode_nlmsg(int ro val = get_port_hw_resetting( device_name); if (val != 1) { + if (!init_cfg()) + break; remove_adapter(device_name); + destroy_cfg(); } else { printf("******* IGNORING: %s\n", device_name); Index: dcbd-0.7.31rt/include/dcb_protocol.h =================================================================== --- dcbd-0.7.31rt.orig/include/dcb_protocol.h +++ dcbd-0.7.31rt/include/dcb_protocol.h @@ -131,7 +131,7 @@ dcb_result get_oper_llink(char *device_n dcb_result get_peer_llink(char *device_name, u32 subtype, llink_attribs *llink_data); -dcb_result dcb_check_config(pg_attribs *pg); +dcb_result dcb_check_config(full_dcb_attrib_ptrs *attribs); void rebalance_uppcts(pg_attribs *pg); dcb_result run_feature_protocol(char *device_name, u32 EventFlag, u32 Subtype); @@ -141,7 +141,7 @@ dcb_result run_dcb_protocol(char *device void remove_all_adapters(void); -void log_message(u32 dwMsgId, char *pFormat, ...); +void log_message(u32 dwMsgId, const char *pFormat, ...); #ifdef __cplusplus } Index: dcbd-0.7.31rt/include/dcb_types.h =================================================================== --- dcbd-0.7.31rt.orig/include/dcb_types.h +++ dcbd-0.7.31rt/include/dcb_types.h @@ -79,7 +79,14 @@ #define BCN_ADDR_OPTION_LEN 8 /* 8 hex digits */ #define BCN_ADDR_OPTION_BYTES 34 /* bytes for 8 hex digits plus NULL */ -#define BCN_CP_SAMP_INTERVAL 140000 + +#define DEF_BCN_CP_SAMP_INTERVAL 140000 /* sampling interval */ +#define MIN_BCN_CP_SAMP_INTERVAL 1 +#define MAX_BCN_CP_SAMP_INTERVAL 256000 + +#define DEF_BCN_LINK_CAPACITY 10000 /* 1 = 1 Mbps */ +#define MIN_BCN_LINK_CAPACITY 0 +#define MAX_BCN_LINK_CAPACITY 10000 /* DCBX subtypes */ typedef enum { @@ -174,6 +181,7 @@ typedef struct dcb_pfc_stats_type{ #define APP_FCOE_STYPE 0 #define APP_FCOE_STYPE_LEN 1 #define LLINK_FCOE_STYPE 0 +#define APP_FCOE_DEFAULT_DATA 0x08 /* user priority 3 */ /* Max TLV length */ #define DCB_MAX_TLV_LENGTH 507 @@ -261,7 +269,7 @@ typedef struct bcn_cfg { boolean_t rp_admin; /* RP admin mode */ boolean_t rp_oper; /* RP Operational mode */ boolean_t rem_tag_oper; /* Remove CM tag Operational mode */ - }bcn_up_settings[MAX_USER_PRIORITIES]; /* Index is user priority */ + }up_settings[MAX_USER_PRIORITIES]; /* Index is user priority */ double rp_alpha; /* RP max decrease factor */ double rp_beta; /* RP max increase factor */ double rp_gd; /* RP decrement coefficient */ Index: dcbd-0.7.31rt/include/version.h =================================================================== --- dcbd-0.7.31rt.orig/include/version.h +++ dcbd-0.7.31rt/include/version.h @@ -28,7 +28,7 @@ #ifndef VERSION_H #define VERSION_H -#define VERSION_STR "0.7.31rt" +#define VERSION_STR "0.7.35rt" #define DCBTOOL_VERSION VERSION_STR #endif /* VERSION_H */ Index: dcbd-0.7.31rt/lldp/rx.c =================================================================== --- dcbd-0.7.31rt.orig/lldp/rx.c +++ dcbd-0.7.31rt/lldp/rx.c @@ -191,11 +191,11 @@ void rxProcessFrame(struct port * port) goto out; } - if ((tlv_length == 0) && (tlv->type != TYPE_0)) { - printf("ERROR: tlv_length == 0\n"); - free_unpkd_tlv(tlv); - goto out; - } + if ((tlv_length == 0) && (tlv->type != TYPE_0)) { + printf("ERROR: tlv_length == 0\n"); + free_unpkd_tlv(tlv); + goto out; + } tlv->type = tlv_type; tlv->length = tlv_length; tlv->info = (u8 *)malloc(tlv_length); @@ -563,6 +563,7 @@ static u32 check_feature_not_present(cha { pg_attribs peer_pg; pfc_attribs peer_pfc; + feature_support dcb_support; bcn_attribs peer_bcn; app_attribs peer_app; llink_attribs peer_llink; @@ -587,6 +588,12 @@ static u32 check_feature_not_present(cha } break; case DCB_REMOTE_CHANGE_BCN: + if (get_dcb_support(device_name, &dcb_support) != dcb_success) + return FALSE; + + if (!dcb_support.bcn) + return FALSE; + if ((get_peer_bcn(device_name, &peer_bcn) == dcb_success) && (peer_bcn.protocol.TLVPresent == TRUE)) { peer_bcn.protocol.TLVPresent = FALSE; @@ -1009,31 +1016,40 @@ boolean_t unpack_dcbx1_tlvs(struct port switch(dcbtlv->type) { case DCB_CONTROL_TLV: port->rx.manifest->dcbx_ctrl = dcbtlv; - break; + break; case DCB_PRIORITY_GROUPS_TLV: /* store if subtype 2 is not present */ if (port->rx.dcbx_st == dcbx_subtype1) { port->rx.manifest->dcbx_pg = dcbtlv; } - break; + break; case DCB_PRIORITY_FLOW_CONTROL_TLV: /* store if subtype 2 is not present */ if (port->rx.dcbx_st == dcbx_subtype1) { port->rx.manifest->dcbx_pfc = dcbtlv; } - break; + break; case DCB_BCN_TLV: port->rx.manifest->dcbx_bcn = dcbtlv; - break; + break; case DCB_APPLICATION_TLV: /* store if subtype 2 is not present */ - if (port->rx.dcbx_st == dcbx_subtype1) { + if ((port->rx.dcbx_st == dcbx_subtype1) && + (dcbtlv->info[DCBX_HDR_SUB_TYPE_OFFSET] + == APP_FCOE_STYPE)) { port->rx.manifest->dcbx_app = dcbtlv; + } else { + free_unpkd_tlv(dcbtlv); } break; case DCB_LLINK_TLV: - port->rx.manifest->dcbx_llink = dcbtlv; - break; + if (dcbtlv->info[DCBX_HDR_SUB_TYPE_OFFSET] + == LLINK_FCOE_STYPE) { + port->rx.manifest->dcbx_llink = dcbtlv; + } else { + free_unpkd_tlv(dcbtlv); + } + break; default: free_unpkd_tlv(dcbtlv); break; @@ -1092,16 +1108,21 @@ boolean_t unpack_dcbx2_tlvs(struct port switch(dcbtlv->type) { case DCB_PRIORITY_GROUPS_TLV2: port->rx.manifest->dcbx_pg = dcbtlv; - break; + break; case DCB_PRIORITY_FLOW_CONTROL_TLV2: port->rx.manifest->dcbx_pfc = dcbtlv; - break; + break; case DCB_APPLICATION_TLV2: - port->rx.manifest->dcbx_app = dcbtlv; - break; + if (dcbtlv->info[DCBX_HDR_SUB_TYPE_OFFSET] + == APP_FCOE_STYPE) { + port->rx.manifest->dcbx_app = dcbtlv; + } else { + free_unpkd_tlv(dcbtlv); + } + break; default: free_unpkd_tlv(dcbtlv); - break; + break; } dcbtlv = NULL; } while(current < end); @@ -1403,27 +1424,27 @@ boolean_t process_dcbx_bcn_tlv(struct po for (i=0; i < MAX_USER_PRIORITIES; i++) { if (port->rx.manifest->dcbx_bcn->info [DCBX_BCN_SETTINGS_OFFSET + i] & BIT7) { - cfg->bcn_up_settings[i].cp_admin = TRUE; + cfg->up_settings[i].cp_admin = TRUE; } else { - cfg->bcn_up_settings[i].cp_admin = FALSE; + cfg->up_settings[i].cp_admin = FALSE; } if (port->rx.manifest->dcbx_bcn->info [DCBX_BCN_SETTINGS_OFFSET + i] & BIT6) { - cfg->bcn_up_settings[i].rp_admin = TRUE; + cfg->up_settings[i].rp_admin = TRUE; } else { - cfg->bcn_up_settings[i].rp_admin = FALSE; + cfg->up_settings[i].rp_admin = FALSE; } if (port->rx.manifest->dcbx_bcn->info [DCBX_BCN_SETTINGS_OFFSET + i] & BIT5) { - cfg->bcn_up_settings[i].rp_oper = TRUE; + cfg->up_settings[i].rp_oper = TRUE; } else { - cfg->bcn_up_settings[i].rp_oper = FALSE; + cfg->up_settings[i].rp_oper = FALSE; } if (port->rx.manifest->dcbx_bcn->info [DCBX_BCN_SETTINGS_OFFSET + i] & BIT4) { - cfg->bcn_up_settings[i].rem_tag_oper = TRUE; + cfg->up_settings[i].rem_tag_oper = TRUE; } else { - cfg->bcn_up_settings[i].rem_tag_oper = FALSE; + cfg->up_settings[i].rem_tag_oper = FALSE; } } @@ -1522,8 +1543,8 @@ boolean_t process_dcbx_app_tlv(struct po } peer_oui[0] = (u8)(pBuf[DCBX2_APP_BYTE1_OFFSET] & PROTO_ID_OUI_MASK); - peer_oui[1] = pBuf[DCBX2_APP_LOW_OUI_OFFSET2]; - peer_oui[2] = pBuf[DCBX2_APP_LOW_OUI_OFFSET1]; + peer_oui[1] = pBuf[DCBX2_APP_LOW_OUI_OFFSET1]; + peer_oui[2] = pBuf[DCBX2_APP_LOW_OUI_OFFSET2]; if (memcmp(peer_oui, oui, DCB_OUI_LEN) != 0) { sel_field = 0; peer_proto = 0; Index: dcbd-0.7.31rt/lldp/tlv.c =================================================================== --- dcbd-0.7.31rt.orig/lldp/tlv.c +++ dcbd-0.7.31rt/lldp/tlv.c @@ -821,7 +821,7 @@ struct unpacked_tlv *bld_dcbx2_app_tlv(s app_info->data.prot_id = PROTO_ID_FCOE; app_info->data.byte1 = (oui[0] & PROTO_ID_OUI_MASK) | (PROTO_ID_L2_ETH_TYPE & PROTO_ID_SF_TYPE); - app_info->data.low_oui = (oui[1]<<8) | oui[2]; + app_info->data.low_oui = (oui[2]<<8) | oui[1]; memcpy (&(app_info->data.up_map), &(app_cfg.AppData[0]), APP_FCOE_STYPE_LEN); @@ -887,14 +887,14 @@ struct unpacked_tlv *bld_dcbx_bcn_tlv(st pkt->bcna[i] = cfg->bcna[i]; } for (i=0; i < MAX_USER_PRIORITIES; i++) { - if (cfg->bcn_up_settings[i].cp_admin == TRUE) - pkt->bcn_up_settings[i].byte |= BIT7; - if (cfg->bcn_up_settings[i].rp_admin == TRUE) - pkt->bcn_up_settings[i].byte |= BIT6; - if (cfg->bcn_up_settings[i].rp_oper == TRUE) - pkt->bcn_up_settings[i].byte |= BIT5; - if (cfg->bcn_up_settings[i].rem_tag_oper == TRUE) - pkt->bcn_up_settings[i].byte |= BIT4; + if (cfg->up_settings[i].cp_admin == TRUE) + pkt->up_settings[i].byte |= BIT7; + if (cfg->up_settings[i].rp_admin == TRUE) + pkt->up_settings[i].byte |= BIT6; + if (cfg->up_settings[i].rp_oper == TRUE) + pkt->up_settings[i].byte |= BIT5; + if (cfg->up_settings[i].rem_tag_oper == TRUE) + pkt->up_settings[i].byte |= BIT4; } pkt->rp_alpha = cfg->rp_alpha; pkt->rp_beta = cfg->rp_beta; Index: dcbd-0.7.31rt/lldp/tlv.h =================================================================== --- dcbd-0.7.31rt.orig/lldp/tlv.h +++ dcbd-0.7.31rt/lldp/tlv.h @@ -114,8 +114,8 @@ #define DCB_APPLICATION_TLV2 4 /* Protocol EtherTypes */ -#define PROTO_ID_FCOE 0x8906 -#define PROTO_ID_FIP 0x8914 +#define PROTO_ID_FCOE 0x0689 /* network byte order */ +#define PROTO_ID_FIP 0x1489 /* network byte order */ /* Protocol Selector Field */ #define PROTO_ID_L2_ETH_TYPE 0x00 @@ -223,7 +223,7 @@ struct dcbx_bcn_cfg { /* :1 RP Operational mode */ /* :1 Remove CM tag Operational mode */ /* :4 padding */; - }bcn_up_settings[MAX_USER_PRIORITIES]; /* Index is user priority */ + }up_settings[MAX_USER_PRIORITIES]; /* Index is user priority */ double rp_alpha; /* RP max decrease factor */ double rp_beta; /* RP max increase factor */ double rp_gd; /* RP decrement coefficient */ Index: dcbd-0.7.31rt/log.c =================================================================== --- dcbd-0.7.31rt.orig/log.c +++ dcbd-0.7.31rt/log.c @@ -31,7 +31,7 @@ #include "messages.h" -void log_message(u32 msgid, char *format, ...) +void log_message(u32 msgid, const char *format, ...) { int a, b; char fmt[256]; Index: dcbd-0.7.31rt/nltest.c =================================================================== --- dcbd-0.7.31rt.orig/nltest.c +++ dcbd-0.7.31rt/nltest.c @@ -688,7 +688,8 @@ static int get_bcn(char *ifname, bcn_cfg struct nlmsghdr *nlh; struct dcbmsg *d; struct rtattr *rta_parent, *rta_child; - int i; + int i, j; + unsigned int temp_int; nlh = start_msg(RTM_GETDCB, DCB_CMD_BCN_GCFG); if (NULL==nlh) @@ -729,9 +730,10 @@ static int get_bcn(char *ifname, bcn_cfg NLMSG_ALIGN(rta_parent->rta_len)); for (i = 0; rta_parent > rta_child; i++) { if (i == DCB_BCN_ATTR_RP_ALL - DCB_BCN_ATTR_RP_0) { + printf("bcn param out of range\n"); break; } - bcn_data->bcn_up_settings[rta_child->rta_type + bcn_data->up_settings[rta_child->rta_type - DCB_BCN_ATTR_RP_0].rp_admin = *(__u8 *)NLA_DATA(rta_child); rta_child = (struct rtattr *)((char *)rta_child + @@ -739,6 +741,16 @@ static int get_bcn(char *ifname, bcn_cfg } + for (i = 0; i < BCN_ADDR_OPTION_LEN/4; i++) { /*2 bytes for BCNA data */ + temp_int = *(__u32 *)NLA_DATA(rta_child); + rta_child = (struct rtattr *)((char *)rta_child + + NLMSG_ALIGN(rta_child->rta_len)); + for (j = 0; j < 4; j++) { + bcn_data->bcna[j+i*4] = + (__u8)((temp_int & (0xFF << (j*8))) >> (j*8)); + } + } + bcn_data->rp_alpha = *(__u64 *)NLA_DATA(rta_child); rta_child = (struct rtattr *)((char *)rta_child + NLMSG_ALIGN(rta_child->rta_len)); @@ -816,11 +828,25 @@ static int set_bcn_cfg(char *ifname, bcn rta_parent = add_rta(nlh, DCB_ATTR_BCN, NULL, 0); for (i = DCB_BCN_ATTR_RP_0; i <= DCB_BCN_ATTR_RP_7; i++) { rta_child = add_rta(nlh, i, - (void *)&bcn_data->bcn_up_settings[i - DCB_BCN_ATTR_RP_0].rp_admin, + (void *)&bcn_data->up_settings[i - DCB_BCN_ATTR_RP_0].rp_admin, sizeof(__u8)); rta_parent->rta_len += NLA_ALIGN(rta_child->rta_len); } + temp_int = 0; + for (i = 0; i < BCN_ADDR_OPTION_LEN/2; i++) + temp_int |= bcn_data->bcna[i]<<(i*8); + rta_child = add_rta(nlh, DCB_BCN_ATTR_BCNA_0, + (void *)&temp_int, sizeof(__u32)); + rta_parent->rta_len += NLA_ALIGN(rta_child->rta_len); + + temp_int = 0; + for (i = BCN_ADDR_OPTION_LEN/2; i < BCN_ADDR_OPTION_LEN; i++) + temp_int |= bcn_data->bcna[i]<<((i- BCN_ADDR_OPTION_LEN/2)*8); + rta_child = add_rta(nlh, DCB_BCN_ATTR_BCNA_1, + (void *)&temp_int, sizeof(__u32)); + rta_parent->rta_len += NLA_ALIGN(rta_child->rta_len); + rta_child = add_rta(nlh, DCB_BCN_ATTR_ALPHA, (void *)&bcn_data->rp_alpha, sizeof(__u32)); rta_parent->rta_len += NLA_ALIGN(rta_child->rta_len); @@ -892,7 +918,7 @@ int set_hw_bcn(char *device_name, bcn_cf { for (i = 0; i <= 8; i++) { - bcn_data->bcn_up_settings[i].rp_admin = 1; + bcn_data->up_settings[i].rp_admin = 1; } bcn_data->rp_alpha = 0.5; bcn_data->rp_beta = 0.1; @@ -917,10 +943,10 @@ int set_hw_bcn(char *device_name, bcn_cf } for (i = 0; i < 8; i++) { - if (bcn_temp->bcn_up_settings[i].cp_admin) - bcn_temp->bcn_up_settings[i].cp_admin = 1; + if (bcn_temp->up_settings[i].cp_admin) + bcn_temp->up_settings[i].cp_admin = 1; else - bcn_temp->bcn_up_settings[i].cp_admin = 0; + bcn_temp->up_settings[i].cp_admin = 0; } return set_bcn_cfg(device_name, bcn_temp); @@ -1085,7 +1111,7 @@ int main(int argc, char *argv[]) printf("\nGETTING BCN: \n"); for (i = 0; i < 8; i++) { printf("BCN RP %d: %d\n", i, - bcn_data.bcn_up_settings[i].rp_admin); + bcn_data.up_settings[i].rp_admin); } printf("\nBCN RP ALPHA: %f\n", bcn_data.rp_alpha); printf("BCN RP BETA : %f\n", bcn_data.rp_beta); Index: dcbd-0.7.31rt/nltest.h =================================================================== --- dcbd-0.7.31rt.orig/nltest.h +++ dcbd-0.7.31rt/nltest.h @@ -41,6 +41,8 @@ #include <linux/rtnetlink.h> #include <linux/dcbnl.h> +#define BCN_ADDR_OPTION_LEN 8 /* 8 hex digits */ + enum dcb_pfc_type { pfc_disabled = 0, pfc_enabled_tx, @@ -68,7 +70,7 @@ typedef struct bcn_cfg { char rp_admin; /* RP admin mode */ char rp_oper; /* RP Operational mode */ char rem_tag_oper; /* Remove CM tag Operational mode */ - }bcn_up_settings[8]; /* Index is user priority */ + }up_settings[8]; /* Index is user priority */ float rp_alpha; /* RP max decrease factor */ float rp_beta; /* RP max increase factor */ float rp_gd; /* RP decrement coefficient */ Index: dcbd-0.7.31rt/SUMS =================================================================== --- dcbd-0.7.31rt.orig/SUMS +++ dcbd-0.7.31rt/SUMS @@ -1,30 +1,30 @@ 53544 3 dcbd7 -43967 36 clif_cmds.c +23633 36 clif_cmds.c 23104 2 libconfig/Makefile 61336 131 libconfig/libconfig-1.3.1.patch 25761 517 libconfig/libconfig-1.3.1.tar.gz -09662 5 log.c -13193 5 Makefile +04094 5 log.c +08091 5 Makefile 28010 10 common.c 30806 9 ctrl_iface.c 21712 23 dcbtool_cmds.c -32874 16 dcbtool.c +48513 19 dcbtool.c 01403 6 clif.c 39773 19 COPYING -42709 28 nltest.c +51226 29 nltest.c 41214 11 eloop.c 11591 5 bonding.c 28102 24 parse_cli.c -55083 10 dcb_rule_chk.cpp +13564 12 dcb_rule_chk.cpp 56189 4 os_unix.c 49466 19 README 62150 7 dcbtool7 -49463 21 drv_cfg.c -50144 121 dcb_protocol.cpp +58582 21 drv_cfg.c +00978 126 dcb_protocol.cpp 62067 3 include/ctrl_iface.h 55879 2 include/includes.h 04121 2 include/dcb_persist_store.h -35724 6 include/dcb_protocol.h +41008 6 include/dcb_protocol.h 36575 2 include/dcb_driver_interface.h 01776 3 include/dcbd.h 23709 3 include/dcb_rule_chk.h @@ -33,7 +33,7 @@ 08794 7 include/clif_cmds.h 08101 7 include/clif.h 44799 2 include/config.h -29498 2 include/version.h +29502 2 include/version.h 27192 3 include/messages.h 41092 12 include/common.h 55964 2 include/dcb_osdep.h @@ -43,24 +43,24 @@ 40725 3 include/drv_cfg.h 23005 2 include/dcb_events.h 11584 2 include/event_iface.h -32443 10 include/dcb_types.h +50008 11 include/dcb_types.h 56688 3 include/parse_cli.h -06160 2 dcbd.spec -11817 7 dcbd.init -52046 8 event_iface.c -45559 4 nltest.h +05164 2 dcbd.spec +04129 7 dcbd.init +52219 8 event_iface.c +62795 4 nltest.h 37630 9 lldp/l2_packet_linux.c 01032 3 lldp/agent.c 39750 6 lldp/l2_packet.h -16207 13 lldp/tlv.h +34822 13 lldp/tlv.h 08229 2 lldp/agent.h 15669 2 lldp/Makefile 44452 10 lldp/ports.c -41749 45 lldp/rx.c +16276 46 lldp/rx.c 24608 5 lldp/ports.h -54424 25 lldp/tlv.c +48526 25 lldp/tlv.c 15542 2 lldp/mibdata.h 07239 7 lldp/states.h 11172 14 lldp/tx.c -51199 44 config.c +24432 44 config.c 58610 9 dcbd.c Index: dcbd-0.7.31rt/dcbd.init =================================================================== --- dcbd-0.7.31rt.orig/dcbd.init +++ dcbd-0.7.31rt/dcbd.init @@ -150,6 +150,11 @@ rc_reset # See how we were called. case "$1" in start) + if ! /sbin/lsmod | grep dcbnl > /dev/null ; then + if find /lib/modules/$(uname -r)/kernel/net/dcb/dcbnl.ko ; then + modprobe dcbnl > /dev/null 2>&1 + fi + fi echo -n $"Starting $DCBD: " start_daemon $DCBD_BIN -d $OPTIONS rc_status -v Index: dcbd-0.7.31rt/Makefile =================================================================== --- dcbd-0.7.31rt.orig/Makefile +++ dcbd-0.7.31rt/Makefile @@ -36,8 +36,8 @@ LIB_DIR = lib CC = gcc CPP = g++ LD = g++ -CFLAGS = -g -Iinclude -I$(LIBCONFIG_H) -DDCBTRACE -Wall -CPPFLAGS = -g -static-libgcc -Iinclude -Wall +CFLAGS += -Iinclude -I$(LIBCONFIG_H) -DDCBTRACE $(OPT_FLAGS) +CPPFLAGS += -static-libgcc -Iinclude $(OPT_FLAGS) # files removal RM = /bin/rm -f Index: dcbd-0.7.31rt/lldp/Makefile =================================================================== --- dcbd-0.7.31rt.orig/lldp/Makefile +++ dcbd-0.7.31rt/lldp/Makefile @@ -29,7 +29,7 @@ CC = gcc LD = gcc # CFLAGS = -I. -ggdb -I../include -DDEBUG -Wall -CFLAGS = -I. -ggdb -I../include -Wall +CFLAGS += -I. -ggdb -I../include -Wall # library's object files. LLDP_OBJS = ports.o agent.o tlv.o l2_packet_linux.o tx.o rx.o
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor