Loading drivers/staging/bcm/Adapter.h +32 −98 Original line number Diff line number Diff line Loading @@ -7,53 +7,6 @@ #define MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES 256 #include "Debug.h" typedef struct _LIST_ENTRY{ struct _LIST_ENTRY *next; struct _LIST_ENTRY *prev; } LIST_ENTRY, *PLIST_ENTRY; typedef struct _BCM_LIST_ENTRY { LIST_ENTRY Link; } BCM_LIST_ENTRY, *PBCM_LIST_ENTRY; typedef enum _RCB_STATUS { DRIVER_PROCESSED=1, APPLICATION_PROCESSED } RCB_STATUS, *PRCB_STATUS; #define fFILLED 1 #define fEMPTY 0 struct _BCM_CB { // The network packet that this RCB is receiving PVOID pv_packet; // Describes the length of the packet . UINT ui_packet_length; // Pointer to the first buffer in the packet (only one buffer for Rx) PUCHAR buffer; atomic_t status; UINT filled; } __attribute__((packed)); typedef struct _BCM_CB BCM_CB,*PBCM_CB; typedef BCM_CB BCM_RCB, *PBCM_RCB; typedef BCM_CB BCM_TCB, *PBCM_TCB; /* This is to be stored in the "pvOsDepData" of ADAPTER */ typedef struct LINUX_DEP_DATA { struct net_device *virtualdev; /* Our Interface (veth0) */ struct net_device *actualdev; /* True Interface (eth0) */ struct net_device_stats netstats; /* Net statistics */ struct fasync_struct *async_queue; /* For asynchronus notification */ } LINUX_DEP_DATA, *PLINUX_DEP_DATA; struct _LEADER { USHORT Vcid; Loading Loading @@ -429,7 +382,9 @@ Driver adapter data structure struct _MINI_ADAPTER { struct _MINI_ADAPTER *next; PVOID pvOsDepData; struct net_device *dev; u32 msg_enable; CHAR *caDsxReqResp; atomic_t ApplicationRunning; volatile INT CtrlQueueLen; Loading @@ -437,18 +392,18 @@ struct _MINI_ADAPTER BOOLEAN AppCtrlQueueOverFlow; atomic_t CurrentApplicationCount; atomic_t RegisteredApplicationCount; BOOLEAN LinkUpStatus; BOOLEAN TimerActive; ULONG StatisticsPointer; u32 StatisticsPointer; struct sk_buff *RxControlHead; struct sk_buff *RxControlTail; // spinlock_t RxControlQueuelock; struct semaphore RxAppControlQueuelock; struct semaphore fw_download_sema; PPER_TARANG_DATA pTarangs; spinlock_t control_queue_lock; wait_queue_head_t process_read_wait_queue; ULONG bcm_jiffies; /* Store Jiffies value */ // the pointer to the first packet we have queued in send // deserialized miniport support variables Loading @@ -458,24 +413,15 @@ struct _MINI_ADAPTER // this to keep track of the Tx and Rx MailBox Registers. atomic_t CurrNumFreeTxDesc; // to keep track the no of byte recieved atomic_t RxRollOverCount; USHORT PrevNumRecvDescs; USHORT CurrNumRecvDescs; atomic_t GoodRxByteCount; atomic_t GoodRxPktCount; atomic_t BadRxByteCount; atomic_t RxPacketDroppedCount; atomic_t GoodTxByteCount; atomic_t TxTotalPacketCount; atomic_t TxDroppedPacketCount; ULONG LinkUpStatus; BOOLEAN TransferMode; UINT u32TotalDSD; PacketInfo PackInfo[NO_OF_QUEUES]; S_CLASSIFIER_RULE astClassifierTable[MAX_CLASSIFIERS]; BOOLEAN TransferMode; /*************** qos ******************/ UINT bETHCSEnabled; BOOLEAN bETHCSEnabled; ULONG BEBucketSize; ULONG rtPSBucketSize; Loading @@ -483,7 +429,6 @@ struct _MINI_ADAPTER BOOLEAN AutoLinkUp; BOOLEAN AutoSyncup; struct net_device *dev; int major; int minor; wait_queue_head_t tx_packet_wait_queue; Loading @@ -491,8 +436,6 @@ struct _MINI_ADAPTER atomic_t process_waiting; BOOLEAN fw_download_done; unsigned int ctrlpkt_present; BOOLEAN packets_given_to_all; char *txctlpacket[MAX_CNTRL_PKTS]; atomic_t cntrlpktCnt ; atomic_t index_app_read_cntrlpkt; Loading @@ -505,31 +448,27 @@ struct _MINI_ADAPTER ULONG ulFreeTargetBufferCnt; ULONG ulCurrentTargetBuffer; ULONG ulTotalTargetBuffersAvailable; unsigned int timeout; int irq; unsigned long chip_id; unsigned int bFlashBoot; unsigned int if_up; // spinlock_t sleeper_lock; atomic_t rdm_wrm_access; atomic_t tx_rx_access; wait_queue_head_t lowpower_mode_wait_queue; atomic_t bAbortedByHost; BOOLEAN bFlashBoot; BOOLEAN bBinDownloaded; BOOLEAN bCfgDownloaded; USHORT usBestEffortQueueIndex; BOOLEAN bSyncUpRequestSent; // struct semaphore data_packet_queue_lock; USHORT usBestEffortQueueIndex; wait_queue_head_t ioctl_fw_dnld_wait_queue; BOOLEAN waiting_to_fw_download_done; pid_t fw_download_process_pid; PSTARGETPARAMS pstargetparams; BOOLEAN device_removed; BOOLEAN DeviceAccess; INT DDRSetting; BOOLEAN bIsAutoCorrectEnabled; BOOLEAN bDDRInitDone; INT DDRSetting; ULONG ulPowerSaveMode; BOOLEAN bIsAutoCorrectEnabled; spinlock_t txtransmitlock; B_UINT8 txtransmit_running; /* Thread for control packet handling */ Loading Loading @@ -567,13 +506,13 @@ struct _MINI_ADAPTER unsigned int usIdleModePattern; //BOOLEAN bTriedToWakeUpFromShutdown; BOOLEAN bLinkDownRequested; unsigned int check_for_hang; int downloadDDR; PHS_DEVICE_EXTENSION stBCMPhsContext; S_HDR_SUPRESSION_CONTEXTINFO stPhsTxContextInfo; uint8_t ucaPHSPktRestoreBuf[2048]; uint8_t bPHSEnabled; int AutoFirmDld; BOOLEAN AutoFirmDld; BOOLEAN bMipsConfig; BOOLEAN bDPLLConfig; UINT32 aTxPktSizeHist[MIBS_MAX_HIST_ENTRIES]; Loading @@ -599,10 +538,9 @@ struct _MINI_ADAPTER struct semaphore NVMRdmWrmLock; BOOLEAN bNetworkInterfaceRegistered; BOOLEAN bNetdeviceNotifierRegistered; struct device *pstCreatedClassDevice; BOOLEAN bUsbClassDriverRegistered; // BOOLEAN InterfaceUpStatus; PFLASH2X_CS_INFO psFlash2xCSInfo; PFLASH_CS_INFO psFlashCSInfo ; Loading Loading @@ -630,17 +568,13 @@ struct _MINI_ADAPTER struct semaphore LowPowerModeSync; ULONG liDrainCalculated; UINT gpioBitMap; S_BCM_DEBUG_STATE stDebugState; }; typedef struct _MINI_ADAPTER MINI_ADAPTER, *PMINI_ADAPTER; typedef struct _DEVICE_EXTENSION { PMINI_ADAPTER pAdapt; }DEVICE_EXTENSION,*PDEVICE_EXTENSION; #define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev) struct _ETH_HEADER_STRUC { UCHAR au8DestinationAddress[6]; Loading drivers/staging/bcm/Arp.cdeleted 100644 → 0 +0 −94 Original line number Diff line number Diff line /* * File Name: Arp.c * Abstract: This file contains the routines for handling ARP PACKETS */ #include "headers.h" #define ARP_PKT_SIZE 60 /* ========================================================================= * Function - reply_to_arp_request() * * Description - When this host tries to broadcast ARP request packet through * the virtual interface (veth0), reply directly to upper layer. * This function allocates a new skb for ARP reply packet, * fills in the fields of the packet and then sends it to * upper layer. * * Parameters - skb: Pointer to sk_buff structure of the ARP request pkt. * * Returns - None * =========================================================================*/ VOID reply_to_arp_request(struct sk_buff *skb) { PMINI_ADAPTER Adapter; struct ArpHeader *pArpHdr = NULL; struct ethhdr *pethhdr = NULL; UCHAR uiIPHdr[4]; /* Check for valid skb */ if(skb == NULL) { BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Invalid skb: Cannot reply to ARP request\n"); return; } Adapter = GET_BCM_ADAPTER(skb->dev); /* Print the ARP Request Packet */ BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, "ARP Packet Dump :"); BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, (PUCHAR)(skb->data), skb->len); /* * Extract the Ethernet Header and Arp Payload including Header */ pethhdr = (struct ethhdr *)skb->data; pArpHdr = (struct ArpHeader *)(skb->data+ETH_HLEN); if(Adapter->bETHCSEnabled) { if(memcmp(pethhdr->h_source, Adapter->dev->dev_addr, ETH_ALEN)) { bcm_kfree_skb(skb); return; } } // Set the Ethernet Header First. memcpy(pethhdr->h_dest, pethhdr->h_source, ETH_ALEN); if(!memcmp(pethhdr->h_source, Adapter->dev->dev_addr, ETH_ALEN)) { pethhdr->h_source[5]++; } /* Set the reply to ARP Reply */ pArpHdr->arp.ar_op = ntohs(ARPOP_REPLY); /* Set the HW Address properly */ memcpy(pArpHdr->ar_sha, pethhdr->h_source, ETH_ALEN); memcpy(pArpHdr->ar_tha, pethhdr->h_dest, ETH_ALEN); // Swapping the IP Adddress memcpy(uiIPHdr,pArpHdr->ar_sip,4); memcpy(pArpHdr->ar_sip,pArpHdr->ar_tip,4); memcpy(pArpHdr->ar_tip,uiIPHdr,4); /* Print the ARP Reply Packet */ BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, "ARP REPLY PACKET: "); /* Send the Packet to upper layer */ BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, (PUCHAR)(skb->data), skb->len); skb->protocol = eth_type_trans(skb,skb->dev); skb->pkt_type = PACKET_HOST; // skb->mac.raw=skb->data+LEADER_SIZE; skb_set_mac_header (skb, LEADER_SIZE); netif_rx(skb); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, "<=============\n"); return; } Loading
drivers/staging/bcm/Adapter.h +32 −98 Original line number Diff line number Diff line Loading @@ -7,53 +7,6 @@ #define MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES 256 #include "Debug.h" typedef struct _LIST_ENTRY{ struct _LIST_ENTRY *next; struct _LIST_ENTRY *prev; } LIST_ENTRY, *PLIST_ENTRY; typedef struct _BCM_LIST_ENTRY { LIST_ENTRY Link; } BCM_LIST_ENTRY, *PBCM_LIST_ENTRY; typedef enum _RCB_STATUS { DRIVER_PROCESSED=1, APPLICATION_PROCESSED } RCB_STATUS, *PRCB_STATUS; #define fFILLED 1 #define fEMPTY 0 struct _BCM_CB { // The network packet that this RCB is receiving PVOID pv_packet; // Describes the length of the packet . UINT ui_packet_length; // Pointer to the first buffer in the packet (only one buffer for Rx) PUCHAR buffer; atomic_t status; UINT filled; } __attribute__((packed)); typedef struct _BCM_CB BCM_CB,*PBCM_CB; typedef BCM_CB BCM_RCB, *PBCM_RCB; typedef BCM_CB BCM_TCB, *PBCM_TCB; /* This is to be stored in the "pvOsDepData" of ADAPTER */ typedef struct LINUX_DEP_DATA { struct net_device *virtualdev; /* Our Interface (veth0) */ struct net_device *actualdev; /* True Interface (eth0) */ struct net_device_stats netstats; /* Net statistics */ struct fasync_struct *async_queue; /* For asynchronus notification */ } LINUX_DEP_DATA, *PLINUX_DEP_DATA; struct _LEADER { USHORT Vcid; Loading Loading @@ -429,7 +382,9 @@ Driver adapter data structure struct _MINI_ADAPTER { struct _MINI_ADAPTER *next; PVOID pvOsDepData; struct net_device *dev; u32 msg_enable; CHAR *caDsxReqResp; atomic_t ApplicationRunning; volatile INT CtrlQueueLen; Loading @@ -437,18 +392,18 @@ struct _MINI_ADAPTER BOOLEAN AppCtrlQueueOverFlow; atomic_t CurrentApplicationCount; atomic_t RegisteredApplicationCount; BOOLEAN LinkUpStatus; BOOLEAN TimerActive; ULONG StatisticsPointer; u32 StatisticsPointer; struct sk_buff *RxControlHead; struct sk_buff *RxControlTail; // spinlock_t RxControlQueuelock; struct semaphore RxAppControlQueuelock; struct semaphore fw_download_sema; PPER_TARANG_DATA pTarangs; spinlock_t control_queue_lock; wait_queue_head_t process_read_wait_queue; ULONG bcm_jiffies; /* Store Jiffies value */ // the pointer to the first packet we have queued in send // deserialized miniport support variables Loading @@ -458,24 +413,15 @@ struct _MINI_ADAPTER // this to keep track of the Tx and Rx MailBox Registers. atomic_t CurrNumFreeTxDesc; // to keep track the no of byte recieved atomic_t RxRollOverCount; USHORT PrevNumRecvDescs; USHORT CurrNumRecvDescs; atomic_t GoodRxByteCount; atomic_t GoodRxPktCount; atomic_t BadRxByteCount; atomic_t RxPacketDroppedCount; atomic_t GoodTxByteCount; atomic_t TxTotalPacketCount; atomic_t TxDroppedPacketCount; ULONG LinkUpStatus; BOOLEAN TransferMode; UINT u32TotalDSD; PacketInfo PackInfo[NO_OF_QUEUES]; S_CLASSIFIER_RULE astClassifierTable[MAX_CLASSIFIERS]; BOOLEAN TransferMode; /*************** qos ******************/ UINT bETHCSEnabled; BOOLEAN bETHCSEnabled; ULONG BEBucketSize; ULONG rtPSBucketSize; Loading @@ -483,7 +429,6 @@ struct _MINI_ADAPTER BOOLEAN AutoLinkUp; BOOLEAN AutoSyncup; struct net_device *dev; int major; int minor; wait_queue_head_t tx_packet_wait_queue; Loading @@ -491,8 +436,6 @@ struct _MINI_ADAPTER atomic_t process_waiting; BOOLEAN fw_download_done; unsigned int ctrlpkt_present; BOOLEAN packets_given_to_all; char *txctlpacket[MAX_CNTRL_PKTS]; atomic_t cntrlpktCnt ; atomic_t index_app_read_cntrlpkt; Loading @@ -505,31 +448,27 @@ struct _MINI_ADAPTER ULONG ulFreeTargetBufferCnt; ULONG ulCurrentTargetBuffer; ULONG ulTotalTargetBuffersAvailable; unsigned int timeout; int irq; unsigned long chip_id; unsigned int bFlashBoot; unsigned int if_up; // spinlock_t sleeper_lock; atomic_t rdm_wrm_access; atomic_t tx_rx_access; wait_queue_head_t lowpower_mode_wait_queue; atomic_t bAbortedByHost; BOOLEAN bFlashBoot; BOOLEAN bBinDownloaded; BOOLEAN bCfgDownloaded; USHORT usBestEffortQueueIndex; BOOLEAN bSyncUpRequestSent; // struct semaphore data_packet_queue_lock; USHORT usBestEffortQueueIndex; wait_queue_head_t ioctl_fw_dnld_wait_queue; BOOLEAN waiting_to_fw_download_done; pid_t fw_download_process_pid; PSTARGETPARAMS pstargetparams; BOOLEAN device_removed; BOOLEAN DeviceAccess; INT DDRSetting; BOOLEAN bIsAutoCorrectEnabled; BOOLEAN bDDRInitDone; INT DDRSetting; ULONG ulPowerSaveMode; BOOLEAN bIsAutoCorrectEnabled; spinlock_t txtransmitlock; B_UINT8 txtransmit_running; /* Thread for control packet handling */ Loading Loading @@ -567,13 +506,13 @@ struct _MINI_ADAPTER unsigned int usIdleModePattern; //BOOLEAN bTriedToWakeUpFromShutdown; BOOLEAN bLinkDownRequested; unsigned int check_for_hang; int downloadDDR; PHS_DEVICE_EXTENSION stBCMPhsContext; S_HDR_SUPRESSION_CONTEXTINFO stPhsTxContextInfo; uint8_t ucaPHSPktRestoreBuf[2048]; uint8_t bPHSEnabled; int AutoFirmDld; BOOLEAN AutoFirmDld; BOOLEAN bMipsConfig; BOOLEAN bDPLLConfig; UINT32 aTxPktSizeHist[MIBS_MAX_HIST_ENTRIES]; Loading @@ -599,10 +538,9 @@ struct _MINI_ADAPTER struct semaphore NVMRdmWrmLock; BOOLEAN bNetworkInterfaceRegistered; BOOLEAN bNetdeviceNotifierRegistered; struct device *pstCreatedClassDevice; BOOLEAN bUsbClassDriverRegistered; // BOOLEAN InterfaceUpStatus; PFLASH2X_CS_INFO psFlash2xCSInfo; PFLASH_CS_INFO psFlashCSInfo ; Loading Loading @@ -630,17 +568,13 @@ struct _MINI_ADAPTER struct semaphore LowPowerModeSync; ULONG liDrainCalculated; UINT gpioBitMap; S_BCM_DEBUG_STATE stDebugState; }; typedef struct _MINI_ADAPTER MINI_ADAPTER, *PMINI_ADAPTER; typedef struct _DEVICE_EXTENSION { PMINI_ADAPTER pAdapt; }DEVICE_EXTENSION,*PDEVICE_EXTENSION; #define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev) struct _ETH_HEADER_STRUC { UCHAR au8DestinationAddress[6]; Loading
drivers/staging/bcm/Arp.cdeleted 100644 → 0 +0 −94 Original line number Diff line number Diff line /* * File Name: Arp.c * Abstract: This file contains the routines for handling ARP PACKETS */ #include "headers.h" #define ARP_PKT_SIZE 60 /* ========================================================================= * Function - reply_to_arp_request() * * Description - When this host tries to broadcast ARP request packet through * the virtual interface (veth0), reply directly to upper layer. * This function allocates a new skb for ARP reply packet, * fills in the fields of the packet and then sends it to * upper layer. * * Parameters - skb: Pointer to sk_buff structure of the ARP request pkt. * * Returns - None * =========================================================================*/ VOID reply_to_arp_request(struct sk_buff *skb) { PMINI_ADAPTER Adapter; struct ArpHeader *pArpHdr = NULL; struct ethhdr *pethhdr = NULL; UCHAR uiIPHdr[4]; /* Check for valid skb */ if(skb == NULL) { BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Invalid skb: Cannot reply to ARP request\n"); return; } Adapter = GET_BCM_ADAPTER(skb->dev); /* Print the ARP Request Packet */ BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, "ARP Packet Dump :"); BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, (PUCHAR)(skb->data), skb->len); /* * Extract the Ethernet Header and Arp Payload including Header */ pethhdr = (struct ethhdr *)skb->data; pArpHdr = (struct ArpHeader *)(skb->data+ETH_HLEN); if(Adapter->bETHCSEnabled) { if(memcmp(pethhdr->h_source, Adapter->dev->dev_addr, ETH_ALEN)) { bcm_kfree_skb(skb); return; } } // Set the Ethernet Header First. memcpy(pethhdr->h_dest, pethhdr->h_source, ETH_ALEN); if(!memcmp(pethhdr->h_source, Adapter->dev->dev_addr, ETH_ALEN)) { pethhdr->h_source[5]++; } /* Set the reply to ARP Reply */ pArpHdr->arp.ar_op = ntohs(ARPOP_REPLY); /* Set the HW Address properly */ memcpy(pArpHdr->ar_sha, pethhdr->h_source, ETH_ALEN); memcpy(pArpHdr->ar_tha, pethhdr->h_dest, ETH_ALEN); // Swapping the IP Adddress memcpy(uiIPHdr,pArpHdr->ar_sip,4); memcpy(pArpHdr->ar_sip,pArpHdr->ar_tip,4); memcpy(pArpHdr->ar_tip,uiIPHdr,4); /* Print the ARP Reply Packet */ BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, "ARP REPLY PACKET: "); /* Send the Packet to upper layer */ BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, (PUCHAR)(skb->data), skb->len); skb->protocol = eth_type_trans(skb,skb->dev); skb->pkt_type = PACKET_HOST; // skb->mac.raw=skb->data+LEADER_SIZE; skb_set_mac_header (skb, LEADER_SIZE); netif_rx(skb); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, ARP_RESP, DBG_LVL_ALL, "<=============\n"); return; }