Skip to content

Commit

Permalink
remove Multicard support
Browse files Browse the repository at this point in the history
Signed-off-by: Hans Ulli Kroll <[email protected]>
  • Loading branch information
Hans Ulli Kroll committed Aug 5, 2016
1 parent 00b47df commit d23e543
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 425 deletions.
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ HAS_WEPAUTO_OPEN_FIRST_SUPPORT=n
# Support user specific transmit rate of Multicast packet.
HAS_MCAST_RATE_SPECIFIC_SUPPORT=n

# Support for Multiple Cards
HAS_MC_SUPPORT=n

#Support for PCI-MSI
HAS_MSI_SUPPORT=n

Expand Down Expand Up @@ -526,10 +523,6 @@ ifeq ($(HAS_DFS_SUPPORT),y)
WFLAGS += -DDFS_SUPPORT
endif

ifeq ($(HAS_MC_SUPPORT),y)
WFLAGS += -DMULTIPLE_CARD_SUPPORT
endif

ifeq ($(HAS_LLTD),y)
WFLAGS += -DLLTD_SUPPORT
endif
Expand Down
364 changes: 0 additions & 364 deletions common/cmm_profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2318,370 +2318,6 @@ NDIS_STATUS RTMPSetProfileParameters(
return NDIS_STATUS_SUCCESS;
}


#ifdef MULTIPLE_CARD_SUPPORT
/* record whether the card in the card list is used in the card file*/
u8 MC_CardUsed[MAX_NUM_OF_MULTIPLE_CARD];
/* record used card mac address in the card list*/
static u8 MC_CardMac[MAX_NUM_OF_MULTIPLE_CARD][6];

/*
========================================================================
Routine Description:
Get card profile path.
Arguments:
pAd
Return Value:
TRUE - Find a card profile
FALSE - use default profile
Note:
========================================================================
*/
BOOLEAN RTMP_CardInfoRead(
IN struct rtmp_adapter *pAd)
{
#define MC_SELECT_CARDID 0 /* use CARD ID (0 ~ 31) to identify different cards */
#define MC_SELECT_MAC 1 /* use CARD MAC to identify different cards */
#define MC_SELECT_CARDTYPE 2 /* use CARD type (abgn or bgn) to identify different cards */

#define LETTER_CASE_TRANSLATE(txt_p, card_id) \
{ UINT32 _len; char _char; \
for(_len=0; _len<strlen(card_id); _len++) { \
_char = *(txt_p + _len); \
if (('A' <= _char) && (_char <= 'Z')) \
*(txt_p+_len) = 'a'+(_char-'A'); \
} }

RTMP_OS_FD srcf;
INT retval;
char *buffer, tmpbuf;
STRING card_id_buf[30], RFIC_word[30];
BOOLEAN flg_match_ok = FALSE;
INT32 card_select_method;
INT32 card_free_id, card_nouse_id, card_same_mac_id, card_match_id;
EEPROM_ANTENNA_STRUC antenna;
USHORT addr01, addr23, addr45;
u8 mac[6];
UINT32 data, card_index;
UCHAR *start_ptr;
RTMP_OS_FS_INFO osFSInfo;

/* init*/
os_alloc_mem(NULL, (UCHAR **)&buffer, MAX_INI_BUFFER_SIZE);
if (buffer == NULL)
return FALSE;

os_alloc_mem(NULL, (UCHAR **)&tmpbuf, MAX_PARAM_BUFFER_SIZE);
if(tmpbuf == NULL)
{
kfree(buffer);
return NDIS_STATUS_FAILURE;
}

/* get RF IC type*/
RTMP_IO_READ32(pAd, E2PROM_CSR, &data);

RT28xx_EEPROM_READ16(pAd, EEPROM_NIC1_OFFSET, antenna.word);

if ((antenna.field.RfIcType == RFIC_2850) ||
(antenna.field.RfIcType == RFIC_2750) ||
(antenna.field.RfIcType == RFIC_2853) ||
(antenna.field.RfIcType == RFIC_3853) ||
(antenna.field.RfIcType == RFIC_7650) ||
(antenna.field.RfIcType == RFIC_7610U) ||
(antenna.field.RfIcType == RFIC_5592))
{
/* ABGN card */
strcpy(RFIC_word, "abgn");
}
else if (antenna.field.RfIcType == RFIC_7610E)
{
/* ABGN card */
strcpy(RFIC_word, "an");
}
else
{
/* BGN card */
strcpy(RFIC_word, "bgn");
}

/* get MAC address*/
RT28xx_EEPROM_READ16(pAd, 0x04, addr01);
RT28xx_EEPROM_READ16(pAd, 0x06, addr23);
RT28xx_EEPROM_READ16(pAd, 0x08, addr45);

mac[0] = (UCHAR)(addr01 & 0xff);
mac[1] = (UCHAR)(addr01 >> 8);
mac[2] = (UCHAR)(addr23 & 0xff);
mac[3] = (UCHAR)(addr23 >> 8);
mac[4] = (UCHAR)(addr45 & 0xff);
mac[5] = (UCHAR)(addr45 >> 8);

DBGPRINT(RT_DEBUG_TRACE, ("mac addr=%02x:%02x:%02x:%02x:%02x:%02x!\n", PRINT_MAC(mac)));

RtmpOSFSInfoChange(&osFSInfo, TRUE);
/* open card information file*/
srcf = RtmpOSFileOpen(CARD_INFO_PATH, O_RDONLY, 0);
if (IS_FILE_OPEN_ERR(srcf))
{
/* card information file does not exist */
DBGPRINT(RT_DEBUG_TRACE,
("--> Error opening %s\n", CARD_INFO_PATH));
goto free_resource;
}

/* card information file exists so reading the card information */
memset(buffer, 0x00, MAX_INI_BUFFER_SIZE);
retval = RtmpOSFileRead(srcf, buffer, MAX_INI_BUFFER_SIZE);
if (retval < 0)
{
/* read fail */
DBGPRINT(RT_DEBUG_TRACE,
("--> Read %s error %d\n", CARD_INFO_PATH, -retval));
}
else
{
/* get card selection method */
memset(tmpbuf, 0x00, MAX_PARAM_BUFFER_SIZE);
card_select_method = MC_SELECT_CARDTYPE; /* default*/

if (RTMPGetKeyParameter("SELECT", tmpbuf, 256, buffer, TRUE))
{
if (strcmp(tmpbuf, "CARDID") == 0)
card_select_method = MC_SELECT_CARDID;
else if (strcmp(tmpbuf, "MAC") == 0)
card_select_method = MC_SELECT_MAC;
else if (strcmp(tmpbuf, "CARDTYPE") == 0)
card_select_method = MC_SELECT_CARDTYPE;
}

DBGPRINT(RT_DEBUG_TRACE,
("MC> Card Selection = %d\n", card_select_method));

/* init*/
card_free_id = -1;
card_nouse_id = -1;
card_same_mac_id = -1;
card_match_id = -1;

/* search current card information records*/
for(card_index=0;
card_index<MAX_NUM_OF_MULTIPLE_CARD;
card_index++)
{
if ((*(UINT32 *)&MC_CardMac[card_index][0] == 0) &&
(*(UINT16 *)&MC_CardMac[card_index][4] == 0))
{
/* MAC is all-0 so the entry is available*/
MC_CardUsed[card_index] = 0;

if (card_free_id < 0)
card_free_id = card_index; /* 1st free entry*/
}
else
{
if (memcmp(MC_CardMac[card_index], mac, 6) == 0)
{
/* we find the entry with same MAC*/
if (card_same_mac_id < 0)
card_same_mac_id = card_index; /* 1st same entry*/
}
else
{
/* MAC is not all-0 but used flag == 0*/
if ((MC_CardUsed[card_index] == 0) &&
(card_nouse_id < 0))
{
card_nouse_id = card_index; /* 1st available entry*/
}
}
}
}

DBGPRINT(RT_DEBUG_TRACE,
("MC> Free = %d, Same = %d, NOUSE = %d\n",
card_free_id, card_same_mac_id, card_nouse_id));

if ((card_same_mac_id >= 0) &&
((card_select_method == MC_SELECT_CARDID) ||
(card_select_method == MC_SELECT_CARDTYPE)))
{
/* same MAC entry is found*/
card_match_id = card_same_mac_id;

if (card_select_method == MC_SELECT_CARDTYPE)
{
/* for CARDTYPE*/
snprintf(card_id_buf, sizeof(card_id_buf), "%02dCARDTYPE%s",
card_match_id, RFIC_word);

if ((start_ptr = (PUCHAR)rtstrstruncasecmp(buffer, card_id_buf)) != NULL)
{
/* we found the card ID*/
LETTER_CASE_TRANSLATE(start_ptr, card_id_buf);
}
}
}
else
{
/* the card is 1st plug-in, try to find the match card profile*/
switch(card_select_method)
{
case MC_SELECT_CARDID: /* CARDID*/
default:
if (card_free_id >= 0)
card_match_id = card_free_id;
else
card_match_id = card_nouse_id;
break;

case MC_SELECT_MAC: /* MAC*/
snprintf(card_id_buf, sizeof(card_id_buf), "MAC%02x:%02x:%02x:%02x:%02x:%02x",
mac[0], mac[1], mac[2],
mac[3], mac[4], mac[5]);

/* try to find the key word in the card file */
if ((start_ptr = (PUCHAR)rtstrstruncasecmp(buffer, card_id_buf)) != NULL)
{
LETTER_CASE_TRANSLATE(start_ptr, card_id_buf);

/* get the row ID (2 ASCII characters) */
start_ptr -= 2;
card_id_buf[0] = *(start_ptr);
card_id_buf[1] = *(start_ptr+1);
card_id_buf[2] = 0x00;

card_match_id = simple_strtol(card_id_buf, 0, 10);
}
break;

case MC_SELECT_CARDTYPE: /* CARDTYPE*/
card_nouse_id = -1;

for(card_index=0;
card_index<MAX_NUM_OF_MULTIPLE_CARD;
card_index++)
{
snprintf(card_id_buf, sizeof(card_id_buf), "%02dCARDTYPE%s",
card_index, RFIC_word);

if ((start_ptr = (PUCHAR)rtstrstruncasecmp(buffer,
card_id_buf)) != NULL)
{
LETTER_CASE_TRANSLATE(start_ptr, card_id_buf);

if (MC_CardUsed[card_index] == 0)
{
/* current the card profile is not used */
if ((*(UINT32 *)&MC_CardMac[card_index][0] == 0) &&
(*(UINT16 *)&MC_CardMac[card_index][4] == 0))
{
/* find it and no previous card use it*/
card_match_id = card_index;
break;
}
else
{
/* ever a card use it*/
if (card_nouse_id < 0)
card_nouse_id = card_index;
}
}
}
}

/* if not find a free one, use the available one*/
if (card_match_id < 0)
card_match_id = card_nouse_id;
break;
}
}

if (card_match_id >= 0)
{
/* make up search keyword*/
switch(card_select_method)
{
case MC_SELECT_CARDID: /* CARDID*/
snprintf(card_id_buf, sizeof(card_id_buf), "%02dCARDID", card_match_id);
break;

case MC_SELECT_MAC: /* MAC*/
snprintf(card_id_buf, sizeof(card_id_buf),
"%02dmac%02x:%02x:%02x:%02x:%02x:%02x",
card_match_id,
mac[0], mac[1], mac[2],
mac[3], mac[4], mac[5]);
break;

case MC_SELECT_CARDTYPE: /* CARDTYPE*/
default:
snprintf(card_id_buf, sizeof(card_id_buf), "%02dcardtype%s",
card_match_id, RFIC_word);
break;
}

DBGPRINT(RT_DEBUG_TRACE, ("Search Keyword = %s\n", card_id_buf));

/* read card file path*/
if (RTMPGetKeyParameter(card_id_buf, tmpbuf, 256, buffer, TRUE))
{
if (strlen(tmpbuf) < sizeof(pAd->MC_FileName))
{
/* backup card information*/
pAd->MC_RowID = card_match_id; /* base 0 */
MC_CardUsed[card_match_id] = 1;
memcpy(MC_CardMac[card_match_id], mac, sizeof(mac));

/* backup card file path*/
NdisMoveMemory(pAd->MC_FileName, tmpbuf , strlen(tmpbuf));
pAd->MC_FileName[strlen(tmpbuf)] = '\0';
flg_match_ok = TRUE;

DBGPRINT(RT_DEBUG_TRACE,
("Card Profile Name = %s\n", pAd->MC_FileName));
}
else
{
DBGPRINT(RT_DEBUG_ERROR,
("Card Profile Name length too large!\n"));
}
}
else
{
DBGPRINT(RT_DEBUG_ERROR,
("Can not find search key word in card.dat!\n"));
}

if ((flg_match_ok != TRUE) &&
(card_match_id < MAX_NUM_OF_MULTIPLE_CARD))
{
MC_CardUsed[card_match_id] = 0;
memset(MC_CardMac[card_match_id], 0, sizeof(mac));
}
} /* if (card_match_id >= 0)*/
}


/* close file*/
retval = RtmpOSFileClose(srcf);

free_resource:
RtmpOSFSInfoChange(&osFSInfo, FALSE);
/* kfree(buffer);*/
/* kfree(tmpbuf);*/
kfree(buffer);
kfree(tmpbuf);

return flg_match_ok;
}
#endif /* MULTIPLE_CARD_SUPPORT */



#ifdef SINGLE_SKU_V2
NDIS_STATUS RTMPSetSingleSKUParameters(
IN struct rtmp_adapter*pAd)
Expand Down
Loading

0 comments on commit d23e543

Please sign in to comment.