Commit b38e274fdb6dfa2dd77598b8b6e2c32d7608f494

Authored by Peter Meerwald
Committed by Greg Kroah-Hartman
1 parent f922ffc0b5

staging bcm: spelling of suppress in code

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 2 changed files with 14 additions and 14 deletions Inline Diff

drivers/staging/bcm/Adapter.h
1 /*********************************** 1 /***********************************
2 * Adapter.h 2 * Adapter.h
3 ************************************/ 3 ************************************/
4 #ifndef __ADAPTER_H__ 4 #ifndef __ADAPTER_H__
5 #define __ADAPTER_H__ 5 #define __ADAPTER_H__
6 6
7 #define MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES 256 7 #define MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES 256
8 #include "Debug.h" 8 #include "Debug.h"
9 9
10 struct bcm_leader { 10 struct bcm_leader {
11 USHORT Vcid; 11 USHORT Vcid;
12 USHORT PLength; 12 USHORT PLength;
13 UCHAR Status; 13 UCHAR Status;
14 UCHAR Unused[3]; 14 UCHAR Unused[3];
15 } __packed; 15 } __packed;
16 16
17 struct bcm_packettosend { 17 struct bcm_packettosend {
18 struct bcm_leader Leader; 18 struct bcm_leader Leader;
19 UCHAR ucPayload; 19 UCHAR ucPayload;
20 } __packed; 20 } __packed;
21 21
22 struct bcm_control_packet { 22 struct bcm_control_packet {
23 PVOID ControlBuff; 23 PVOID ControlBuff;
24 UINT ControlBuffLen; 24 UINT ControlBuffLen;
25 struct bcm_control_packet *next; 25 struct bcm_control_packet *next;
26 } __packed; 26 } __packed;
27 27
28 struct bcm_link_request { 28 struct bcm_link_request {
29 struct bcm_leader Leader; 29 struct bcm_leader Leader;
30 UCHAR szData[4]; 30 UCHAR szData[4];
31 } __packed; 31 } __packed;
32 32
33 #define MAX_IP_RANGE_LENGTH 4 33 #define MAX_IP_RANGE_LENGTH 4
34 #define MAX_PORT_RANGE 4 34 #define MAX_PORT_RANGE 4
35 #define MAX_PROTOCOL_LENGTH 32 35 #define MAX_PROTOCOL_LENGTH 32
36 #define IPV6_ADDRESS_SIZEINBYTES 0x10 36 #define IPV6_ADDRESS_SIZEINBYTES 0x10
37 37
38 typedef union _U_IP_ADDRESS { 38 typedef union _U_IP_ADDRESS {
39 struct { 39 struct {
40 ULONG ulIpv4Addr[MAX_IP_RANGE_LENGTH]; /* Source Ip Address Range */ 40 ULONG ulIpv4Addr[MAX_IP_RANGE_LENGTH]; /* Source Ip Address Range */
41 ULONG ulIpv4Mask[MAX_IP_RANGE_LENGTH]; /* Source Ip Mask Address Range */ 41 ULONG ulIpv4Mask[MAX_IP_RANGE_LENGTH]; /* Source Ip Mask Address Range */
42 }; 42 };
43 struct { 43 struct {
44 ULONG ulIpv6Addr[MAX_IP_RANGE_LENGTH * 4]; /* Source Ip Address Range */ 44 ULONG ulIpv6Addr[MAX_IP_RANGE_LENGTH * 4]; /* Source Ip Address Range */
45 ULONG ulIpv6Mask[MAX_IP_RANGE_LENGTH * 4]; /* Source Ip Mask Address Range */ 45 ULONG ulIpv6Mask[MAX_IP_RANGE_LENGTH * 4]; /* Source Ip Mask Address Range */
46 }; 46 };
47 struct { 47 struct {
48 UCHAR ucIpv4Address[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS]; 48 UCHAR ucIpv4Address[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS];
49 UCHAR ucIpv4Mask[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS]; 49 UCHAR ucIpv4Mask[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS];
50 }; 50 };
51 struct { 51 struct {
52 UCHAR ucIpv6Address[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES]; 52 UCHAR ucIpv6Address[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES];
53 UCHAR ucIpv6Mask[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES]; 53 UCHAR ucIpv6Mask[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES];
54 }; 54 };
55 } U_IP_ADDRESS; 55 } U_IP_ADDRESS;
56 56
57 struct bcm_hdr_supression_contextinfo { 57 struct bcm_hdr_suppression_contextinfo {
58 UCHAR ucaHdrSupressionInBuf[MAX_PHS_LENGTHS]; /* Intermediate buffer to accumulate pkt Header for PHS */ 58 UCHAR ucaHdrSuppressionInBuf[MAX_PHS_LENGTHS]; /* Intermediate buffer to accumulate pkt Header for PHS */
59 UCHAR ucaHdrSupressionOutBuf[MAX_PHS_LENGTHS + PHSI_LEN]; /* Intermediate buffer containing pkt Header after PHS */ 59 UCHAR ucaHdrSuppressionOutBuf[MAX_PHS_LENGTHS + PHSI_LEN]; /* Intermediate buffer containing pkt Header after PHS */
60 }; 60 };
61 61
62 struct bcm_classifier_rule { 62 struct bcm_classifier_rule {
63 ULONG ulSFID; 63 ULONG ulSFID;
64 UCHAR ucReserved[2]; 64 UCHAR ucReserved[2];
65 B_UINT16 uiClassifierRuleIndex; 65 B_UINT16 uiClassifierRuleIndex;
66 BOOLEAN bUsed; 66 BOOLEAN bUsed;
67 USHORT usVCID_Value; 67 USHORT usVCID_Value;
68 B_UINT8 u8ClassifierRulePriority; /* This field detemines the Classifier Priority */ 68 B_UINT8 u8ClassifierRulePriority; /* This field detemines the Classifier Priority */
69 U_IP_ADDRESS stSrcIpAddress; 69 U_IP_ADDRESS stSrcIpAddress;
70 UCHAR ucIPSourceAddressLength; /* Ip Source Address Length */ 70 UCHAR ucIPSourceAddressLength; /* Ip Source Address Length */
71 71
72 U_IP_ADDRESS stDestIpAddress; 72 U_IP_ADDRESS stDestIpAddress;
73 UCHAR ucIPDestinationAddressLength; /* Ip Destination Address Length */ 73 UCHAR ucIPDestinationAddressLength; /* Ip Destination Address Length */
74 UCHAR ucIPTypeOfServiceLength; /* Type of service Length */ 74 UCHAR ucIPTypeOfServiceLength; /* Type of service Length */
75 UCHAR ucTosLow; /* Tos Low */ 75 UCHAR ucTosLow; /* Tos Low */
76 UCHAR ucTosHigh; /* Tos High */ 76 UCHAR ucTosHigh; /* Tos High */
77 UCHAR ucTosMask; /* Tos Mask */ 77 UCHAR ucTosMask; /* Tos Mask */
78 78
79 UCHAR ucProtocolLength; /* protocol Length */ 79 UCHAR ucProtocolLength; /* protocol Length */
80 UCHAR ucProtocol[MAX_PROTOCOL_LENGTH]; /* protocol Length */ 80 UCHAR ucProtocol[MAX_PROTOCOL_LENGTH]; /* protocol Length */
81 USHORT usSrcPortRangeLo[MAX_PORT_RANGE]; 81 USHORT usSrcPortRangeLo[MAX_PORT_RANGE];
82 USHORT usSrcPortRangeHi[MAX_PORT_RANGE]; 82 USHORT usSrcPortRangeHi[MAX_PORT_RANGE];
83 UCHAR ucSrcPortRangeLength; 83 UCHAR ucSrcPortRangeLength;
84 84
85 USHORT usDestPortRangeLo[MAX_PORT_RANGE]; 85 USHORT usDestPortRangeLo[MAX_PORT_RANGE];
86 USHORT usDestPortRangeHi[MAX_PORT_RANGE]; 86 USHORT usDestPortRangeHi[MAX_PORT_RANGE];
87 UCHAR ucDestPortRangeLength; 87 UCHAR ucDestPortRangeLength;
88 88
89 BOOLEAN bProtocolValid; 89 BOOLEAN bProtocolValid;
90 BOOLEAN bTOSValid; 90 BOOLEAN bTOSValid;
91 BOOLEAN bDestIpValid; 91 BOOLEAN bDestIpValid;
92 BOOLEAN bSrcIpValid; 92 BOOLEAN bSrcIpValid;
93 93
94 /* For IPv6 Addressing */ 94 /* For IPv6 Addressing */
95 UCHAR ucDirection; 95 UCHAR ucDirection;
96 BOOLEAN bIpv6Protocol; 96 BOOLEAN bIpv6Protocol;
97 UINT32 u32PHSRuleID; 97 UINT32 u32PHSRuleID;
98 S_PHS_RULE sPhsRule; 98 S_PHS_RULE sPhsRule;
99 UCHAR u8AssociatedPHSI; 99 UCHAR u8AssociatedPHSI;
100 100
101 /* Classification fields for ETH CS */ 101 /* Classification fields for ETH CS */
102 UCHAR ucEthCSSrcMACLen; 102 UCHAR ucEthCSSrcMACLen;
103 UCHAR au8EThCSSrcMAC[MAC_ADDRESS_SIZE]; 103 UCHAR au8EThCSSrcMAC[MAC_ADDRESS_SIZE];
104 UCHAR au8EThCSSrcMACMask[MAC_ADDRESS_SIZE]; 104 UCHAR au8EThCSSrcMACMask[MAC_ADDRESS_SIZE];
105 UCHAR ucEthCSDestMACLen; 105 UCHAR ucEthCSDestMACLen;
106 UCHAR au8EThCSDestMAC[MAC_ADDRESS_SIZE]; 106 UCHAR au8EThCSDestMAC[MAC_ADDRESS_SIZE];
107 UCHAR au8EThCSDestMACMask[MAC_ADDRESS_SIZE]; 107 UCHAR au8EThCSDestMACMask[MAC_ADDRESS_SIZE];
108 UCHAR ucEtherTypeLen; 108 UCHAR ucEtherTypeLen;
109 UCHAR au8EthCSEtherType[NUM_ETHERTYPE_BYTES]; 109 UCHAR au8EthCSEtherType[NUM_ETHERTYPE_BYTES];
110 UCHAR usUserPriority[2]; 110 UCHAR usUserPriority[2];
111 USHORT usVLANID; 111 USHORT usVLANID;
112 USHORT usValidityBitMap; 112 USHORT usValidityBitMap;
113 }; 113 };
114 114
115 struct bcm_fragmented_packet_info { 115 struct bcm_fragmented_packet_info {
116 BOOLEAN bUsed; 116 BOOLEAN bUsed;
117 ULONG ulSrcIpAddress; 117 ULONG ulSrcIpAddress;
118 USHORT usIpIdentification; 118 USHORT usIpIdentification;
119 struct bcm_classifier_rule *pstMatchedClassifierEntry; 119 struct bcm_classifier_rule *pstMatchedClassifierEntry;
120 BOOLEAN bOutOfOrderFragment; 120 BOOLEAN bOutOfOrderFragment;
121 }; 121 };
122 122
123 struct bcm_packet_info { 123 struct bcm_packet_info {
124 /* classification extension Rule */ 124 /* classification extension Rule */
125 ULONG ulSFID; 125 ULONG ulSFID;
126 USHORT usVCID_Value; 126 USHORT usVCID_Value;
127 UINT uiThreshold; 127 UINT uiThreshold;
128 /* This field determines the priority of the SF Queues */ 128 /* This field determines the priority of the SF Queues */
129 B_UINT8 u8TrafficPriority; 129 B_UINT8 u8TrafficPriority;
130 130
131 BOOLEAN bValid; 131 BOOLEAN bValid;
132 BOOLEAN bActive; 132 BOOLEAN bActive;
133 BOOLEAN bActivateRequestSent; 133 BOOLEAN bActivateRequestSent;
134 134
135 B_UINT8 u8QueueType; /* BE or rtPS */ 135 B_UINT8 u8QueueType; /* BE or rtPS */
136 136
137 UINT uiMaxBucketSize; /* maximum size of the bucket for the queue */ 137 UINT uiMaxBucketSize; /* maximum size of the bucket for the queue */
138 UINT uiCurrentQueueDepthOnTarget; 138 UINT uiCurrentQueueDepthOnTarget;
139 UINT uiCurrentBytesOnHost; 139 UINT uiCurrentBytesOnHost;
140 UINT uiCurrentPacketsOnHost; 140 UINT uiCurrentPacketsOnHost;
141 UINT uiDroppedCountBytes; 141 UINT uiDroppedCountBytes;
142 UINT uiDroppedCountPackets; 142 UINT uiDroppedCountPackets;
143 UINT uiSentBytes; 143 UINT uiSentBytes;
144 UINT uiSentPackets; 144 UINT uiSentPackets;
145 UINT uiCurrentDrainRate; 145 UINT uiCurrentDrainRate;
146 UINT uiThisPeriodSentBytes; 146 UINT uiThisPeriodSentBytes;
147 LARGE_INTEGER liDrainCalculated; 147 LARGE_INTEGER liDrainCalculated;
148 UINT uiCurrentTokenCount; 148 UINT uiCurrentTokenCount;
149 LARGE_INTEGER liLastUpdateTokenAt; 149 LARGE_INTEGER liLastUpdateTokenAt;
150 UINT uiMaxAllowedRate; 150 UINT uiMaxAllowedRate;
151 UINT NumOfPacketsSent; 151 UINT NumOfPacketsSent;
152 UCHAR ucDirection; 152 UCHAR ucDirection;
153 USHORT usCID; 153 USHORT usCID;
154 S_MIBS_EXTSERVICEFLOW_PARAMETERS stMibsExtServiceFlowTable; 154 S_MIBS_EXTSERVICEFLOW_PARAMETERS stMibsExtServiceFlowTable;
155 UINT uiCurrentRxRate; 155 UINT uiCurrentRxRate;
156 UINT uiThisPeriodRxBytes; 156 UINT uiThisPeriodRxBytes;
157 UINT uiTotalRxBytes; 157 UINT uiTotalRxBytes;
158 UINT uiTotalTxBytes; 158 UINT uiTotalTxBytes;
159 UINT uiPendedLast; 159 UINT uiPendedLast;
160 UCHAR ucIpVersion; 160 UCHAR ucIpVersion;
161 161
162 union { 162 union {
163 struct { 163 struct {
164 struct sk_buff *FirstTxQueue; 164 struct sk_buff *FirstTxQueue;
165 struct sk_buff *LastTxQueue; 165 struct sk_buff *LastTxQueue;
166 }; 166 };
167 struct { 167 struct {
168 struct sk_buff *ControlHead; 168 struct sk_buff *ControlHead;
169 struct sk_buff *ControlTail; 169 struct sk_buff *ControlTail;
170 }; 170 };
171 }; 171 };
172 172
173 BOOLEAN bProtocolValid; 173 BOOLEAN bProtocolValid;
174 BOOLEAN bTOSValid; 174 BOOLEAN bTOSValid;
175 BOOLEAN bDestIpValid; 175 BOOLEAN bDestIpValid;
176 BOOLEAN bSrcIpValid; 176 BOOLEAN bSrcIpValid;
177 177
178 BOOLEAN bActiveSet; 178 BOOLEAN bActiveSet;
179 BOOLEAN bAdmittedSet; 179 BOOLEAN bAdmittedSet;
180 BOOLEAN bAuthorizedSet; 180 BOOLEAN bAuthorizedSet;
181 BOOLEAN bClassifierPriority; 181 BOOLEAN bClassifierPriority;
182 UCHAR ucServiceClassName[MAX_CLASS_NAME_LENGTH]; 182 UCHAR ucServiceClassName[MAX_CLASS_NAME_LENGTH];
183 BOOLEAN bHeaderSuppressionEnabled; 183 BOOLEAN bHeaderSuppressionEnabled;
184 spinlock_t SFQueueLock; 184 spinlock_t SFQueueLock;
185 void *pstSFIndication; 185 void *pstSFIndication;
186 struct timeval stLastUpdateTokenAt; 186 struct timeval stLastUpdateTokenAt;
187 atomic_t uiPerSFTxResourceCount; 187 atomic_t uiPerSFTxResourceCount;
188 UINT uiMaxLatency; 188 UINT uiMaxLatency;
189 UCHAR bIPCSSupport; 189 UCHAR bIPCSSupport;
190 UCHAR bEthCSSupport; 190 UCHAR bEthCSSupport;
191 }; 191 };
192 192
193 struct bcm_tarang_data { 193 struct bcm_tarang_data {
194 struct bcm_tarang_data *next; 194 struct bcm_tarang_data *next;
195 struct bcm_mini_adapter *Adapter; 195 struct bcm_mini_adapter *Adapter;
196 struct sk_buff *RxAppControlHead; 196 struct sk_buff *RxAppControlHead;
197 struct sk_buff *RxAppControlTail; 197 struct sk_buff *RxAppControlTail;
198 int AppCtrlQueueLen; 198 int AppCtrlQueueLen;
199 BOOLEAN MacTracingEnabled; 199 BOOLEAN MacTracingEnabled;
200 BOOLEAN bApplicationToExit; 200 BOOLEAN bApplicationToExit;
201 S_MIBS_DROPPED_APP_CNTRL_MESSAGES stDroppedAppCntrlMsgs; 201 S_MIBS_DROPPED_APP_CNTRL_MESSAGES stDroppedAppCntrlMsgs;
202 ULONG RxCntrlMsgBitMask; 202 ULONG RxCntrlMsgBitMask;
203 }; 203 };
204 204
205 struct bcm_targetdsx_buffer { 205 struct bcm_targetdsx_buffer {
206 ULONG ulTargetDsxBuffer; 206 ULONG ulTargetDsxBuffer;
207 B_UINT16 tid; 207 B_UINT16 tid;
208 BOOLEAN valid; 208 BOOLEAN valid;
209 }; 209 };
210 210
211 typedef int (*FP_FLASH_WRITE)(struct bcm_mini_adapter *, UINT, PVOID); 211 typedef int (*FP_FLASH_WRITE)(struct bcm_mini_adapter *, UINT, PVOID);
212 212
213 typedef int (*FP_FLASH_WRITE_STATUS)(struct bcm_mini_adapter *, UINT, PVOID); 213 typedef int (*FP_FLASH_WRITE_STATUS)(struct bcm_mini_adapter *, UINT, PVOID);
214 214
215 /* 215 /*
216 * Driver adapter data structure 216 * Driver adapter data structure
217 */ 217 */
218 struct bcm_mini_adapter { 218 struct bcm_mini_adapter {
219 struct bcm_mini_adapter *next; 219 struct bcm_mini_adapter *next;
220 struct net_device *dev; 220 struct net_device *dev;
221 u32 msg_enable; 221 u32 msg_enable;
222 CHAR *caDsxReqResp; 222 CHAR *caDsxReqResp;
223 atomic_t ApplicationRunning; 223 atomic_t ApplicationRunning;
224 BOOLEAN AppCtrlQueueOverFlow; 224 BOOLEAN AppCtrlQueueOverFlow;
225 atomic_t CurrentApplicationCount; 225 atomic_t CurrentApplicationCount;
226 atomic_t RegisteredApplicationCount; 226 atomic_t RegisteredApplicationCount;
227 BOOLEAN LinkUpStatus; 227 BOOLEAN LinkUpStatus;
228 BOOLEAN TimerActive; 228 BOOLEAN TimerActive;
229 u32 StatisticsPointer; 229 u32 StatisticsPointer;
230 struct sk_buff *RxControlHead; 230 struct sk_buff *RxControlHead;
231 struct sk_buff *RxControlTail; 231 struct sk_buff *RxControlTail;
232 struct semaphore RxAppControlQueuelock; 232 struct semaphore RxAppControlQueuelock;
233 struct semaphore fw_download_sema; 233 struct semaphore fw_download_sema;
234 struct bcm_tarang_data *pTarangs; 234 struct bcm_tarang_data *pTarangs;
235 spinlock_t control_queue_lock; 235 spinlock_t control_queue_lock;
236 wait_queue_head_t process_read_wait_queue; 236 wait_queue_head_t process_read_wait_queue;
237 237
238 /* the pointer to the first packet we have queued in send 238 /* the pointer to the first packet we have queued in send
239 * deserialized miniport support variables 239 * deserialized miniport support variables
240 */ 240 */
241 atomic_t TotalPacketCount; 241 atomic_t TotalPacketCount;
242 atomic_t TxPktAvail; 242 atomic_t TxPktAvail;
243 243
244 /* this to keep track of the Tx and Rx MailBox Registers. */ 244 /* this to keep track of the Tx and Rx MailBox Registers. */
245 atomic_t CurrNumFreeTxDesc; 245 atomic_t CurrNumFreeTxDesc;
246 /* to keep track the no of byte received */ 246 /* to keep track the no of byte received */
247 USHORT PrevNumRecvDescs; 247 USHORT PrevNumRecvDescs;
248 USHORT CurrNumRecvDescs; 248 USHORT CurrNumRecvDescs;
249 UINT u32TotalDSD; 249 UINT u32TotalDSD;
250 struct bcm_packet_info PackInfo[NO_OF_QUEUES]; 250 struct bcm_packet_info PackInfo[NO_OF_QUEUES];
251 struct bcm_classifier_rule astClassifierTable[MAX_CLASSIFIERS]; 251 struct bcm_classifier_rule astClassifierTable[MAX_CLASSIFIERS];
252 BOOLEAN TransferMode; 252 BOOLEAN TransferMode;
253 253
254 /*************** qos ******************/ 254 /*************** qos ******************/
255 BOOLEAN bETHCSEnabled; 255 BOOLEAN bETHCSEnabled;
256 ULONG BEBucketSize; 256 ULONG BEBucketSize;
257 ULONG rtPSBucketSize; 257 ULONG rtPSBucketSize;
258 UCHAR LinkStatus; 258 UCHAR LinkStatus;
259 BOOLEAN AutoLinkUp; 259 BOOLEAN AutoLinkUp;
260 BOOLEAN AutoSyncup; 260 BOOLEAN AutoSyncup;
261 261
262 int major; 262 int major;
263 int minor; 263 int minor;
264 wait_queue_head_t tx_packet_wait_queue; 264 wait_queue_head_t tx_packet_wait_queue;
265 wait_queue_head_t process_rx_cntrlpkt; 265 wait_queue_head_t process_rx_cntrlpkt;
266 atomic_t process_waiting; 266 atomic_t process_waiting;
267 BOOLEAN fw_download_done; 267 BOOLEAN fw_download_done;
268 268
269 char *txctlpacket[MAX_CNTRL_PKTS]; 269 char *txctlpacket[MAX_CNTRL_PKTS];
270 atomic_t cntrlpktCnt ; 270 atomic_t cntrlpktCnt ;
271 atomic_t index_app_read_cntrlpkt; 271 atomic_t index_app_read_cntrlpkt;
272 atomic_t index_wr_txcntrlpkt; 272 atomic_t index_wr_txcntrlpkt;
273 atomic_t index_rd_txcntrlpkt; 273 atomic_t index_rd_txcntrlpkt;
274 UINT index_datpkt; 274 UINT index_datpkt;
275 struct semaphore rdmwrmsync; 275 struct semaphore rdmwrmsync;
276 276
277 struct bcm_targetdsx_buffer astTargetDsxBuffer[MAX_TARGET_DSX_BUFFERS]; 277 struct bcm_targetdsx_buffer astTargetDsxBuffer[MAX_TARGET_DSX_BUFFERS];
278 ULONG ulFreeTargetBufferCnt; 278 ULONG ulFreeTargetBufferCnt;
279 ULONG ulCurrentTargetBuffer; 279 ULONG ulCurrentTargetBuffer;
280 ULONG ulTotalTargetBuffersAvailable; 280 ULONG ulTotalTargetBuffersAvailable;
281 unsigned long chip_id; 281 unsigned long chip_id;
282 wait_queue_head_t lowpower_mode_wait_queue; 282 wait_queue_head_t lowpower_mode_wait_queue;
283 BOOLEAN bFlashBoot; 283 BOOLEAN bFlashBoot;
284 BOOLEAN bBinDownloaded; 284 BOOLEAN bBinDownloaded;
285 BOOLEAN bCfgDownloaded; 285 BOOLEAN bCfgDownloaded;
286 BOOLEAN bSyncUpRequestSent; 286 BOOLEAN bSyncUpRequestSent;
287 USHORT usBestEffortQueueIndex; 287 USHORT usBestEffortQueueIndex;
288 wait_queue_head_t ioctl_fw_dnld_wait_queue; 288 wait_queue_head_t ioctl_fw_dnld_wait_queue;
289 BOOLEAN waiting_to_fw_download_done; 289 BOOLEAN waiting_to_fw_download_done;
290 pid_t fw_download_process_pid; 290 pid_t fw_download_process_pid;
291 PSTARGETPARAMS pstargetparams; 291 PSTARGETPARAMS pstargetparams;
292 BOOLEAN device_removed; 292 BOOLEAN device_removed;
293 BOOLEAN DeviceAccess; 293 BOOLEAN DeviceAccess;
294 BOOLEAN bIsAutoCorrectEnabled; 294 BOOLEAN bIsAutoCorrectEnabled;
295 BOOLEAN bDDRInitDone; 295 BOOLEAN bDDRInitDone;
296 int DDRSetting; 296 int DDRSetting;
297 ULONG ulPowerSaveMode; 297 ULONG ulPowerSaveMode;
298 spinlock_t txtransmitlock; 298 spinlock_t txtransmitlock;
299 B_UINT8 txtransmit_running; 299 B_UINT8 txtransmit_running;
300 /* Thread for control packet handling */ 300 /* Thread for control packet handling */
301 struct task_struct *control_packet_handler; 301 struct task_struct *control_packet_handler;
302 /* thread for transmitting packets. */ 302 /* thread for transmitting packets. */
303 struct task_struct *transmit_packet_thread; 303 struct task_struct *transmit_packet_thread;
304 304
305 /* LED Related Structures */ 305 /* LED Related Structures */
306 LED_INFO_STRUCT LEDInfo; 306 LED_INFO_STRUCT LEDInfo;
307 307
308 /* Driver State for LED Blinking */ 308 /* Driver State for LED Blinking */
309 LedEventInfo_t DriverState; 309 LedEventInfo_t DriverState;
310 /* Interface Specific */ 310 /* Interface Specific */
311 PVOID pvInterfaceAdapter; 311 PVOID pvInterfaceAdapter;
312 int (*bcm_file_download)(PVOID, 312 int (*bcm_file_download)(PVOID,
313 struct file *, 313 struct file *,
314 unsigned int); 314 unsigned int);
315 int (*bcm_file_readback_from_chip)(PVOID, 315 int (*bcm_file_readback_from_chip)(PVOID,
316 struct file *, 316 struct file *,
317 unsigned int); 317 unsigned int);
318 int (*interface_rdm)(PVOID, 318 int (*interface_rdm)(PVOID,
319 UINT, 319 UINT,
320 PVOID, 320 PVOID,
321 int); 321 int);
322 int (*interface_wrm)(PVOID, 322 int (*interface_wrm)(PVOID,
323 UINT, 323 UINT,
324 PVOID, 324 PVOID,
325 int); 325 int);
326 int (*interface_transmit)(PVOID, PVOID , UINT); 326 int (*interface_transmit)(PVOID, PVOID , UINT);
327 BOOLEAN IdleMode; 327 BOOLEAN IdleMode;
328 BOOLEAN bDregRequestSentInIdleMode; 328 BOOLEAN bDregRequestSentInIdleMode;
329 BOOLEAN bTriedToWakeUpFromlowPowerMode; 329 BOOLEAN bTriedToWakeUpFromlowPowerMode;
330 BOOLEAN bShutStatus; 330 BOOLEAN bShutStatus;
331 BOOLEAN bWakeUpDevice; 331 BOOLEAN bWakeUpDevice;
332 unsigned int usIdleModePattern; 332 unsigned int usIdleModePattern;
333 /* BOOLEAN bTriedToWakeUpFromShutdown; */ 333 /* BOOLEAN bTriedToWakeUpFromShutdown; */
334 BOOLEAN bLinkDownRequested; 334 BOOLEAN bLinkDownRequested;
335 int downloadDDR; 335 int downloadDDR;
336 PHS_DEVICE_EXTENSION stBCMPhsContext; 336 PHS_DEVICE_EXTENSION stBCMPhsContext;
337 struct bcm_hdr_supression_contextinfo stPhsTxContextInfo; 337 struct bcm_hdr_suppression_contextinfo stPhsTxContextInfo;
338 uint8_t ucaPHSPktRestoreBuf[2048]; 338 uint8_t ucaPHSPktRestoreBuf[2048];
339 uint8_t bPHSEnabled; 339 uint8_t bPHSEnabled;
340 BOOLEAN AutoFirmDld; 340 BOOLEAN AutoFirmDld;
341 BOOLEAN bMipsConfig; 341 BOOLEAN bMipsConfig;
342 BOOLEAN bDPLLConfig; 342 BOOLEAN bDPLLConfig;
343 UINT32 aTxPktSizeHist[MIBS_MAX_HIST_ENTRIES]; 343 UINT32 aTxPktSizeHist[MIBS_MAX_HIST_ENTRIES];
344 UINT32 aRxPktSizeHist[MIBS_MAX_HIST_ENTRIES]; 344 UINT32 aRxPktSizeHist[MIBS_MAX_HIST_ENTRIES];
345 struct bcm_fragmented_packet_info astFragmentedPktClassifierTable[MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES]; 345 struct bcm_fragmented_packet_info astFragmentedPktClassifierTable[MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES];
346 atomic_t uiMBupdate; 346 atomic_t uiMBupdate;
347 UINT32 PmuMode; 347 UINT32 PmuMode;
348 NVM_TYPE eNVMType; 348 NVM_TYPE eNVMType;
349 UINT uiSectorSize; 349 UINT uiSectorSize;
350 UINT uiSectorSizeInCFG; 350 UINT uiSectorSizeInCFG;
351 BOOLEAN bSectorSizeOverride; 351 BOOLEAN bSectorSizeOverride;
352 BOOLEAN bStatusWrite; 352 BOOLEAN bStatusWrite;
353 UINT uiNVMDSDSize; 353 UINT uiNVMDSDSize;
354 UINT uiVendorExtnFlag; 354 UINT uiVendorExtnFlag;
355 /* it will always represent chosen DSD at any point of time. 355 /* it will always represent chosen DSD at any point of time.
356 * Generally it is Active DSD but in case of NVM RD/WR it might be different. 356 * Generally it is Active DSD but in case of NVM RD/WR it might be different.
357 */ 357 */
358 UINT ulFlashCalStart; 358 UINT ulFlashCalStart;
359 ULONG ulFlashControlSectionStart; 359 ULONG ulFlashControlSectionStart;
360 ULONG ulFlashWriteSize; 360 ULONG ulFlashWriteSize;
361 ULONG ulFlashID; 361 ULONG ulFlashID;
362 FP_FLASH_WRITE fpFlashWrite; 362 FP_FLASH_WRITE fpFlashWrite;
363 FP_FLASH_WRITE_STATUS fpFlashWriteWithStatusCheck; 363 FP_FLASH_WRITE_STATUS fpFlashWriteWithStatusCheck;
364 364
365 struct semaphore NVMRdmWrmLock; 365 struct semaphore NVMRdmWrmLock;
366 struct device *pstCreatedClassDevice; 366 struct device *pstCreatedClassDevice;
367 367
368 /* BOOLEAN InterfaceUpStatus; */ 368 /* BOOLEAN InterfaceUpStatus; */
369 PFLASH2X_CS_INFO psFlash2xCSInfo; 369 PFLASH2X_CS_INFO psFlash2xCSInfo;
370 PFLASH_CS_INFO psFlashCSInfo; 370 PFLASH_CS_INFO psFlashCSInfo;
371 PFLASH2X_VENDORSPECIFIC_INFO psFlash2xVendorInfo; 371 PFLASH2X_VENDORSPECIFIC_INFO psFlash2xVendorInfo;
372 UINT uiFlashBaseAdd; /* Flash start address */ 372 UINT uiFlashBaseAdd; /* Flash start address */
373 UINT uiActiveISOOffset; /* Active ISO offset chosen before f/w download */ 373 UINT uiActiveISOOffset; /* Active ISO offset chosen before f/w download */
374 FLASH2X_SECTION_VAL eActiveISO; /* Active ISO section val */ 374 FLASH2X_SECTION_VAL eActiveISO; /* Active ISO section val */
375 FLASH2X_SECTION_VAL eActiveDSD; /* Active DSD val chosen before f/w download */ 375 FLASH2X_SECTION_VAL eActiveDSD; /* Active DSD val chosen before f/w download */
376 UINT uiActiveDSDOffsetAtFwDld; /* For accessing Active DSD chosen before f/w download */ 376 UINT uiActiveDSDOffsetAtFwDld; /* For accessing Active DSD chosen before f/w download */
377 UINT uiFlashLayoutMajorVersion; 377 UINT uiFlashLayoutMajorVersion;
378 UINT uiFlashLayoutMinorVersion; 378 UINT uiFlashLayoutMinorVersion;
379 BOOLEAN bAllDSDWriteAllow; 379 BOOLEAN bAllDSDWriteAllow;
380 BOOLEAN bSigCorrupted; 380 BOOLEAN bSigCorrupted;
381 /* this should be set who so ever want to change the Headers. after Wrtie it should be reset immediately. */ 381 /* this should be set who so ever want to change the Headers. after Wrtie it should be reset immediately. */
382 BOOLEAN bHeaderChangeAllowed; 382 BOOLEAN bHeaderChangeAllowed;
383 int SelectedChip; 383 int SelectedChip;
384 BOOLEAN bEndPointHalted; 384 BOOLEAN bEndPointHalted;
385 /* while bFlashRawRead will be true, Driver ignore map lay out and consider flash as of without any map. */ 385 /* while bFlashRawRead will be true, Driver ignore map lay out and consider flash as of without any map. */
386 BOOLEAN bFlashRawRead; 386 BOOLEAN bFlashRawRead;
387 BOOLEAN bPreparingForLowPowerMode; 387 BOOLEAN bPreparingForLowPowerMode;
388 BOOLEAN bDoSuspend; 388 BOOLEAN bDoSuspend;
389 UINT syscfgBefFwDld; 389 UINT syscfgBefFwDld;
390 BOOLEAN StopAllXaction; 390 BOOLEAN StopAllXaction;
391 UINT32 liTimeSinceLastNetEntry; /* Used to Support extended CAPI requirements from */ 391 UINT32 liTimeSinceLastNetEntry; /* Used to Support extended CAPI requirements from */
392 struct semaphore LowPowerModeSync; 392 struct semaphore LowPowerModeSync;
393 ULONG liDrainCalculated; 393 ULONG liDrainCalculated;
394 UINT gpioBitMap; 394 UINT gpioBitMap;
395 S_BCM_DEBUG_STATE stDebugState; 395 S_BCM_DEBUG_STATE stDebugState;
396 }; 396 };
397 397
398 #define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev) 398 #define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev)
399 399
400 struct bcm_eth_header { 400 struct bcm_eth_header {
401 UCHAR au8DestinationAddress[6]; 401 UCHAR au8DestinationAddress[6];
402 UCHAR au8SourceAddress[6]; 402 UCHAR au8SourceAddress[6];
403 USHORT u16Etype; 403 USHORT u16Etype;
404 } __packed; 404 } __packed;
405 405
406 struct bcm_firmware_info { 406 struct bcm_firmware_info {
407 void __user *pvMappedFirmwareAddress; 407 void __user *pvMappedFirmwareAddress;
408 ULONG u32FirmwareLength; 408 ULONG u32FirmwareLength;
409 ULONG u32StartingAddress; 409 ULONG u32StartingAddress;
410 } __packed; 410 } __packed;
411 411
412 /* holds the value of net_device structure.. */ 412 /* holds the value of net_device structure.. */
413 extern struct net_device *gblpnetdev; 413 extern struct net_device *gblpnetdev;
414 414
415 struct bcm_ddr_setting { 415 struct bcm_ddr_setting {
416 UINT ulRegAddress; 416 UINT ulRegAddress;
417 UINT ulRegValue; 417 UINT ulRegValue;
418 }; 418 };
419 int InitAdapter(struct bcm_mini_adapter *psAdapter); 419 int InitAdapter(struct bcm_mini_adapter *psAdapter);
420 420
421 /* ===================================================================== 421 /* =====================================================================
422 * Beceem vendor request codes for EP0 422 * Beceem vendor request codes for EP0
423 * ===================================================================== 423 * =====================================================================
424 */ 424 */
425 425
426 #define BCM_REQUEST_READ 0x2 426 #define BCM_REQUEST_READ 0x2
427 #define BCM_REQUEST_WRITE 0x1 427 #define BCM_REQUEST_WRITE 0x1
428 #define EP2_MPS_REG 0x0F0110A0 428 #define EP2_MPS_REG 0x0F0110A0
429 #define EP2_MPS 0x40 429 #define EP2_MPS 0x40
430 430
431 #define EP2_CFG_REG 0x0F0110A8 431 #define EP2_CFG_REG 0x0F0110A8
432 #define EP2_CFG_INT 0x27 432 #define EP2_CFG_INT 0x27
433 #define EP2_CFG_BULK 0x25 433 #define EP2_CFG_BULK 0x25
434 434
435 #define EP4_MPS_REG 0x0F0110F0 435 #define EP4_MPS_REG 0x0F0110F0
436 #define EP4_MPS 0x8C 436 #define EP4_MPS 0x8C
437 437
438 #define EP4_CFG_REG 0x0F0110F8 438 #define EP4_CFG_REG 0x0F0110F8
439 439
440 #define ISO_MPS_REG 0x0F0110C8 440 #define ISO_MPS_REG 0x0F0110C8
441 #define ISO_MPS 0x00000000 441 #define ISO_MPS 0x00000000
442 442
443 #define EP1 0 443 #define EP1 0
444 #define EP2 1 444 #define EP2 1
445 #define EP3 2 445 #define EP3 2
446 #define EP4 3 446 #define EP4 3
447 #define EP5 4 447 #define EP5 4
448 #define EP6 5 448 #define EP6 5
449 449
450 enum bcm_einterface_setting { 450 enum bcm_einterface_setting {
451 DEFAULT_SETTING_0 = 0, 451 DEFAULT_SETTING_0 = 0,
452 ALTERNATE_SETTING_1 = 1, 452 ALTERNATE_SETTING_1 = 1,
453 }; 453 };
454 454
455 #endif /* __ADAPTER_H__ */ 455 #endif /* __ADAPTER_H__ */
456 456
drivers/staging/bcm/PHSModule.c
1 #include "headers.h" 1 #include "headers.h"
2 2
3 static UINT CreateSFToClassifierRuleMapping(B_UINT16 uiVcid,B_UINT16 uiClsId,S_SERVICEFLOW_TABLE *psServiceFlowTable,S_PHS_RULE *psPhsRule,B_UINT8 u8AssociatedPHSI); 3 static UINT CreateSFToClassifierRuleMapping(B_UINT16 uiVcid,B_UINT16 uiClsId,S_SERVICEFLOW_TABLE *psServiceFlowTable,S_PHS_RULE *psPhsRule,B_UINT8 u8AssociatedPHSI);
4 4
5 static UINT CreateClassiferToPHSRuleMapping(B_UINT16 uiVcid,B_UINT16 uiClsId,S_SERVICEFLOW_ENTRY *pstServiceFlowEntry,S_PHS_RULE *psPhsRule,B_UINT8 u8AssociatedPHSI); 5 static UINT CreateClassiferToPHSRuleMapping(B_UINT16 uiVcid,B_UINT16 uiClsId,S_SERVICEFLOW_ENTRY *pstServiceFlowEntry,S_PHS_RULE *psPhsRule,B_UINT8 u8AssociatedPHSI);
6 6
7 static UINT CreateClassifierPHSRule(B_UINT16 uiClsId,S_CLASSIFIER_TABLE *psaClassifiertable ,S_PHS_RULE *psPhsRule,E_CLASSIFIER_ENTRY_CONTEXT eClsContext,B_UINT8 u8AssociatedPHSI); 7 static UINT CreateClassifierPHSRule(B_UINT16 uiClsId,S_CLASSIFIER_TABLE *psaClassifiertable ,S_PHS_RULE *psPhsRule,E_CLASSIFIER_ENTRY_CONTEXT eClsContext,B_UINT8 u8AssociatedPHSI);
8 8
9 static UINT UpdateClassifierPHSRule(B_UINT16 uiClsId,S_CLASSIFIER_ENTRY *pstClassifierEntry,S_CLASSIFIER_TABLE *psaClassifiertable ,S_PHS_RULE *psPhsRule,B_UINT8 u8AssociatedPHSI); 9 static UINT UpdateClassifierPHSRule(B_UINT16 uiClsId,S_CLASSIFIER_ENTRY *pstClassifierEntry,S_CLASSIFIER_TABLE *psaClassifiertable ,S_PHS_RULE *psPhsRule,B_UINT8 u8AssociatedPHSI);
10 10
11 static BOOLEAN ValidatePHSRuleComplete(S_PHS_RULE *psPhsRule); 11 static BOOLEAN ValidatePHSRuleComplete(S_PHS_RULE *psPhsRule);
12 12
13 static BOOLEAN DerefPhsRule(B_UINT16 uiClsId,S_CLASSIFIER_TABLE *psaClassifiertable,S_PHS_RULE *pstPhsRule); 13 static BOOLEAN DerefPhsRule(B_UINT16 uiClsId,S_CLASSIFIER_TABLE *psaClassifiertable,S_PHS_RULE *pstPhsRule);
14 14
15 static UINT GetClassifierEntry(S_CLASSIFIER_TABLE *pstClassifierTable,B_UINT32 uiClsid,E_CLASSIFIER_ENTRY_CONTEXT eClsContext, S_CLASSIFIER_ENTRY **ppstClassifierEntry); 15 static UINT GetClassifierEntry(S_CLASSIFIER_TABLE *pstClassifierTable,B_UINT32 uiClsid,E_CLASSIFIER_ENTRY_CONTEXT eClsContext, S_CLASSIFIER_ENTRY **ppstClassifierEntry);
16 16
17 static UINT GetPhsRuleEntry(S_CLASSIFIER_TABLE *pstClassifierTable,B_UINT32 uiPHSI,E_CLASSIFIER_ENTRY_CONTEXT eClsContext,S_PHS_RULE **ppstPhsRule); 17 static UINT GetPhsRuleEntry(S_CLASSIFIER_TABLE *pstClassifierTable,B_UINT32 uiPHSI,E_CLASSIFIER_ENTRY_CONTEXT eClsContext,S_PHS_RULE **ppstPhsRule);
18 18
19 static void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTable); 19 static void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTable);
20 20
21 static int phs_compress(S_PHS_RULE *phs_members,unsigned char *in_buf, 21 static int phs_compress(S_PHS_RULE *phs_members,unsigned char *in_buf,
22 unsigned char *out_buf,unsigned int *header_size,UINT *new_header_size ); 22 unsigned char *out_buf,unsigned int *header_size,UINT *new_header_size );
23 23
24 24
25 static int verify_suppress_phsf(unsigned char *in_buffer,unsigned char *out_buffer, 25 static int verify_suppress_phsf(unsigned char *in_buffer,unsigned char *out_buffer,
26 unsigned char *phsf,unsigned char *phsm,unsigned int phss,unsigned int phsv,UINT *new_header_size ); 26 unsigned char *phsf,unsigned char *phsm,unsigned int phss,unsigned int phsv,UINT *new_header_size );
27 27
28 static int phs_decompress(unsigned char *in_buf,unsigned char *out_buf,\ 28 static int phs_decompress(unsigned char *in_buf,unsigned char *out_buf,\
29 S_PHS_RULE *phs_rules,UINT *header_size); 29 S_PHS_RULE *phs_rules,UINT *header_size);
30 30
31 31
32 static ULONG PhsCompress(void* pvContext, 32 static ULONG PhsCompress(void* pvContext,
33 B_UINT16 uiVcid, 33 B_UINT16 uiVcid,
34 B_UINT16 uiClsId, 34 B_UINT16 uiClsId,
35 void *pvInputBuffer, 35 void *pvInputBuffer,
36 void *pvOutputBuffer, 36 void *pvOutputBuffer,
37 UINT *pOldHeaderSize, 37 UINT *pOldHeaderSize,
38 UINT *pNewHeaderSize ); 38 UINT *pNewHeaderSize );
39 39
40 static ULONG PhsDeCompress(void* pvContext, 40 static ULONG PhsDeCompress(void* pvContext,
41 B_UINT16 uiVcid, 41 B_UINT16 uiVcid,
42 void *pvInputBuffer, 42 void *pvInputBuffer,
43 void *pvOutputBuffer, 43 void *pvOutputBuffer,
44 UINT *pInHeaderSize, 44 UINT *pInHeaderSize,
45 UINT *pOutHeaderSize); 45 UINT *pOutHeaderSize);
46 46
47 47
48 48
49 #define IN 49 #define IN
50 #define OUT 50 #define OUT
51 51
52 /* 52 /*
53 Function: PHSTransmit 53 Function: PHSTransmit
54 54
55 Description: This routine handle PHS(Payload Header Suppression for Tx path. 55 Description: This routine handle PHS(Payload Header Suppression for Tx path.
56 It extracts a fragment of the NDIS_PACKET containing the header 56 It extracts a fragment of the NDIS_PACKET containing the header
57 to be suppressed. It then suppresses the header by invoking PHS exported compress routine. 57 to be suppressed. It then suppresses the header by invoking PHS exported compress routine.
58 The header data after suppression is copied back to the NDIS_PACKET. 58 The header data after suppression is copied back to the NDIS_PACKET.
59 59
60 60
61 Input parameters: IN struct bcm_mini_adapter *Adapter - Miniport Adapter Context 61 Input parameters: IN struct bcm_mini_adapter *Adapter - Miniport Adapter Context
62 IN Packet - NDIS packet containing data to be transmitted 62 IN Packet - NDIS packet containing data to be transmitted
63 IN USHORT Vcid - vcid pertaining to connection on which the packet is being sent.Used to 63 IN USHORT Vcid - vcid pertaining to connection on which the packet is being sent.Used to
64 identify PHS rule to be applied. 64 identify PHS rule to be applied.
65 B_UINT16 uiClassifierRuleID - Classifier Rule ID 65 B_UINT16 uiClassifierRuleID - Classifier Rule ID
66 BOOLEAN bHeaderSuppressionEnabled - indicates if header suprression is enabled for SF. 66 BOOLEAN bHeaderSuppressionEnabled - indicates if header suprression is enabled for SF.
67 67
68 Return: STATUS_SUCCESS - If the send was successful. 68 Return: STATUS_SUCCESS - If the send was successful.
69 Other - If an error occured. 69 Other - If an error occured.
70 */ 70 */
71 71
72 int PHSTransmit(struct bcm_mini_adapter *Adapter, 72 int PHSTransmit(struct bcm_mini_adapter *Adapter,
73 struct sk_buff **pPacket, 73 struct sk_buff **pPacket,
74 USHORT Vcid, 74 USHORT Vcid,
75 B_UINT16 uiClassifierRuleID, 75 B_UINT16 uiClassifierRuleID,
76 BOOLEAN bHeaderSuppressionEnabled, 76 BOOLEAN bHeaderSuppressionEnabled,
77 UINT *PacketLen, 77 UINT *PacketLen,
78 UCHAR bEthCSSupport) 78 UCHAR bEthCSSupport)
79 { 79 {
80 80
81 //PHS Sepcific 81 //PHS Sepcific
82 UINT unPHSPktHdrBytesCopied = 0; 82 UINT unPHSPktHdrBytesCopied = 0;
83 UINT unPhsOldHdrSize = 0; 83 UINT unPhsOldHdrSize = 0;
84 UINT unPHSNewPktHeaderLen = 0; 84 UINT unPHSNewPktHeaderLen = 0;
85 /* Pointer to PHS IN Hdr Buffer */ 85 /* Pointer to PHS IN Hdr Buffer */
86 PUCHAR pucPHSPktHdrInBuf = 86 PUCHAR pucPHSPktHdrInBuf =
87 Adapter->stPhsTxContextInfo.ucaHdrSupressionInBuf; 87 Adapter->stPhsTxContextInfo.ucaHdrSuppressionInBuf;
88 /* Pointer to PHS OUT Hdr Buffer */ 88 /* Pointer to PHS OUT Hdr Buffer */
89 PUCHAR pucPHSPktHdrOutBuf = 89 PUCHAR pucPHSPktHdrOutBuf =
90 Adapter->stPhsTxContextInfo.ucaHdrSupressionOutBuf; 90 Adapter->stPhsTxContextInfo.ucaHdrSuppressionOutBuf;
91 UINT usPacketType; 91 UINT usPacketType;
92 UINT BytesToRemove=0; 92 UINT BytesToRemove=0;
93 BOOLEAN bPHSI = 0; 93 BOOLEAN bPHSI = 0;
94 LONG ulPhsStatus = 0; 94 LONG ulPhsStatus = 0;
95 UINT numBytesCompressed = 0; 95 UINT numBytesCompressed = 0;
96 struct sk_buff *newPacket = NULL; 96 struct sk_buff *newPacket = NULL;
97 struct sk_buff *Packet = *pPacket; 97 struct sk_buff *Packet = *pPacket;
98 98
99 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "In PHSTransmit"); 99 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "In PHSTransmit");
100 100
101 if(!bEthCSSupport) 101 if(!bEthCSSupport)
102 BytesToRemove=ETH_HLEN; 102 BytesToRemove=ETH_HLEN;
103 /* 103 /*
104 Accumulate the header upto the size we support suppression 104 Accumulate the header upto the size we support suppression
105 from NDIS packet 105 from NDIS packet
106 */ 106 */
107 107
108 usPacketType=((struct ethhdr *)(Packet->data))->h_proto; 108 usPacketType=((struct ethhdr *)(Packet->data))->h_proto;
109 109
110 110
111 pucPHSPktHdrInBuf = Packet->data + BytesToRemove; 111 pucPHSPktHdrInBuf = Packet->data + BytesToRemove;
112 //considering data after ethernet header 112 //considering data after ethernet header
113 if((*PacketLen - BytesToRemove) < MAX_PHS_LENGTHS) 113 if((*PacketLen - BytesToRemove) < MAX_PHS_LENGTHS)
114 { 114 {
115 115
116 unPHSPktHdrBytesCopied = (*PacketLen - BytesToRemove); 116 unPHSPktHdrBytesCopied = (*PacketLen - BytesToRemove);
117 } 117 }
118 else 118 else
119 { 119 {
120 unPHSPktHdrBytesCopied = MAX_PHS_LENGTHS; 120 unPHSPktHdrBytesCopied = MAX_PHS_LENGTHS;
121 } 121 }
122 122
123 if( (unPHSPktHdrBytesCopied > 0 ) && 123 if( (unPHSPktHdrBytesCopied > 0 ) &&
124 (unPHSPktHdrBytesCopied <= MAX_PHS_LENGTHS)) 124 (unPHSPktHdrBytesCopied <= MAX_PHS_LENGTHS))
125 { 125 {
126 126
127 127
128 // Step 2 Suppress Header using PHS and fill into intermediate ucaPHSPktHdrOutBuf. 128 // Step 2 Suppress Header using PHS and fill into intermediate ucaPHSPktHdrOutBuf.
129 // Suppress only if IP Header and PHS Enabled For the Service Flow 129 // Suppress only if IP Header and PHS Enabled For the Service Flow
130 if(((usPacketType == ETHERNET_FRAMETYPE_IPV4) || 130 if(((usPacketType == ETHERNET_FRAMETYPE_IPV4) ||
131 (usPacketType == ETHERNET_FRAMETYPE_IPV6)) && 131 (usPacketType == ETHERNET_FRAMETYPE_IPV6)) &&
132 (bHeaderSuppressionEnabled)) 132 (bHeaderSuppressionEnabled))
133 { 133 {
134 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nTrying to PHS Compress Using Classifier rule 0x%X",uiClassifierRuleID); 134 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nTrying to PHS Compress Using Classifier rule 0x%X",uiClassifierRuleID);
135 135
136 136
137 unPHSNewPktHeaderLen = unPHSPktHdrBytesCopied; 137 unPHSNewPktHeaderLen = unPHSPktHdrBytesCopied;
138 ulPhsStatus = PhsCompress(&Adapter->stBCMPhsContext, 138 ulPhsStatus = PhsCompress(&Adapter->stBCMPhsContext,
139 Vcid, 139 Vcid,
140 uiClassifierRuleID, 140 uiClassifierRuleID,
141 pucPHSPktHdrInBuf, 141 pucPHSPktHdrInBuf,
142 pucPHSPktHdrOutBuf, 142 pucPHSPktHdrOutBuf,
143 &unPhsOldHdrSize, 143 &unPhsOldHdrSize,
144 &unPHSNewPktHeaderLen); 144 &unPHSNewPktHeaderLen);
145 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nPHS Old header Size : %d New Header Size %d\n",unPhsOldHdrSize,unPHSNewPktHeaderLen); 145 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nPHS Old header Size : %d New Header Size %d\n",unPhsOldHdrSize,unPHSNewPktHeaderLen);
146 146
147 if(unPHSNewPktHeaderLen == unPhsOldHdrSize) 147 if(unPHSNewPktHeaderLen == unPhsOldHdrSize)
148 { 148 {
149 if( ulPhsStatus == STATUS_PHS_COMPRESSED) 149 if( ulPhsStatus == STATUS_PHS_COMPRESSED)
150 bPHSI = *pucPHSPktHdrOutBuf; 150 bPHSI = *pucPHSPktHdrOutBuf;
151 ulPhsStatus = STATUS_PHS_NOCOMPRESSION; 151 ulPhsStatus = STATUS_PHS_NOCOMPRESSION;
152 } 152 }
153 153
154 if( ulPhsStatus == STATUS_PHS_COMPRESSED) 154 if( ulPhsStatus == STATUS_PHS_COMPRESSED)
155 { 155 {
156 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"PHS Sending packet Compressed"); 156 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"PHS Sending packet Compressed");
157 157
158 if(skb_cloned(Packet)) 158 if(skb_cloned(Packet))
159 { 159 {
160 newPacket = skb_copy(Packet, GFP_ATOMIC); 160 newPacket = skb_copy(Packet, GFP_ATOMIC);
161 161
162 if(newPacket == NULL) 162 if(newPacket == NULL)
163 return STATUS_FAILURE; 163 return STATUS_FAILURE;
164 164
165 dev_kfree_skb(Packet); 165 dev_kfree_skb(Packet);
166 *pPacket = Packet = newPacket; 166 *pPacket = Packet = newPacket;
167 pucPHSPktHdrInBuf = Packet->data + BytesToRemove; 167 pucPHSPktHdrInBuf = Packet->data + BytesToRemove;
168 } 168 }
169 169
170 numBytesCompressed = unPhsOldHdrSize - (unPHSNewPktHeaderLen+PHSI_LEN); 170 numBytesCompressed = unPhsOldHdrSize - (unPHSNewPktHeaderLen+PHSI_LEN);
171 171
172 memcpy(pucPHSPktHdrInBuf + numBytesCompressed, pucPHSPktHdrOutBuf, unPHSNewPktHeaderLen + PHSI_LEN); 172 memcpy(pucPHSPktHdrInBuf + numBytesCompressed, pucPHSPktHdrOutBuf, unPHSNewPktHeaderLen + PHSI_LEN);
173 memcpy(Packet->data + numBytesCompressed, Packet->data, BytesToRemove); 173 memcpy(Packet->data + numBytesCompressed, Packet->data, BytesToRemove);
174 skb_pull(Packet, numBytesCompressed); 174 skb_pull(Packet, numBytesCompressed);
175 175
176 return STATUS_SUCCESS; 176 return STATUS_SUCCESS;
177 } 177 }
178 178
179 else 179 else
180 { 180 {
181 //if one byte headroom is not available, increase it through skb_cow 181 //if one byte headroom is not available, increase it through skb_cow
182 if(!(skb_headroom(Packet) > 0)) 182 if(!(skb_headroom(Packet) > 0))
183 { 183 {
184 if(skb_cow(Packet, 1)) 184 if(skb_cow(Packet, 1))
185 { 185 {
186 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "SKB Cow Failed\n"); 186 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "SKB Cow Failed\n");
187 return STATUS_FAILURE; 187 return STATUS_FAILURE;
188 } 188 }
189 } 189 }
190 skb_push(Packet, 1); 190 skb_push(Packet, 1);
191 191
192 // CAUTION: The MAC Header is getting corrupted here for IP CS - can be saved by copying 14 Bytes. not needed .... hence corrupting it. 192 // CAUTION: The MAC Header is getting corrupted here for IP CS - can be saved by copying 14 Bytes. not needed .... hence corrupting it.
193 *(Packet->data + BytesToRemove) = bPHSI; 193 *(Packet->data + BytesToRemove) = bPHSI;
194 return STATUS_SUCCESS; 194 return STATUS_SUCCESS;
195 } 195 }
196 } 196 }
197 else 197 else
198 { 198 {
199 if(!bHeaderSuppressionEnabled) 199 if(!bHeaderSuppressionEnabled)
200 { 200 {
201 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nHeader Suppression Disabled For SF: No PHS\n"); 201 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nHeader Suppression Disabled For SF: No PHS\n");
202 } 202 }
203 203
204 return STATUS_SUCCESS; 204 return STATUS_SUCCESS;
205 } 205 }
206 } 206 }
207 207
208 //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"PHSTransmit : Dumping data packet After PHS"); 208 //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"PHSTransmit : Dumping data packet After PHS");
209 return STATUS_SUCCESS; 209 return STATUS_SUCCESS;
210 } 210 }
211 211
212 int PHSReceive(struct bcm_mini_adapter *Adapter, 212 int PHSReceive(struct bcm_mini_adapter *Adapter,
213 USHORT usVcid, 213 USHORT usVcid,
214 struct sk_buff *packet, 214 struct sk_buff *packet,
215 UINT *punPacketLen, 215 UINT *punPacketLen,
216 UCHAR *pucEthernetHdr, 216 UCHAR *pucEthernetHdr,
217 UINT bHeaderSuppressionEnabled) 217 UINT bHeaderSuppressionEnabled)
218 { 218 {
219 u32 nStandardPktHdrLen = 0; 219 u32 nStandardPktHdrLen = 0;
220 u32 nTotalsupressedPktHdrBytes = 0; 220 u32 nTotalsuppressedPktHdrBytes = 0;
221 int ulPhsStatus = 0; 221 int ulPhsStatus = 0;
222 PUCHAR pucInBuff = NULL ; 222 PUCHAR pucInBuff = NULL ;
223 UINT TotalBytesAdded = 0; 223 UINT TotalBytesAdded = 0;
224 if(!bHeaderSuppressionEnabled) 224 if(!bHeaderSuppressionEnabled)
225 { 225 {
226 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nPhs Disabled for incoming packet"); 226 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nPhs Disabled for incoming packet");
227 return ulPhsStatus; 227 return ulPhsStatus;
228 } 228 }
229 229
230 pucInBuff = packet->data; 230 pucInBuff = packet->data;
231 231
232 //Restore PHS suppressed header 232 //Restore PHS suppressed header
233 nStandardPktHdrLen = packet->len; 233 nStandardPktHdrLen = packet->len;
234 ulPhsStatus = PhsDeCompress(&Adapter->stBCMPhsContext, 234 ulPhsStatus = PhsDeCompress(&Adapter->stBCMPhsContext,
235 usVcid, 235 usVcid,
236 pucInBuff, 236 pucInBuff,
237 Adapter->ucaPHSPktRestoreBuf, 237 Adapter->ucaPHSPktRestoreBuf,
238 &nTotalsupressedPktHdrBytes, 238 &nTotalsuppressedPktHdrBytes,
239 &nStandardPktHdrLen); 239 &nStandardPktHdrLen);
240 240
241 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nSuppressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x", 241 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nSuppressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x",
242 nTotalsupressedPktHdrBytes,nStandardPktHdrLen); 242 nTotalsuppressedPktHdrBytes,nStandardPktHdrLen);
243 243
244 if(ulPhsStatus != STATUS_PHS_COMPRESSED) 244 if(ulPhsStatus != STATUS_PHS_COMPRESSED)
245 { 245 {
246 skb_pull(packet, 1); 246 skb_pull(packet, 1);
247 return STATUS_SUCCESS; 247 return STATUS_SUCCESS;
248 } 248 }
249 else 249 else
250 { 250 {
251 TotalBytesAdded = nStandardPktHdrLen - nTotalsupressedPktHdrBytes - PHSI_LEN; 251 TotalBytesAdded = nStandardPktHdrLen - nTotalsuppressedPktHdrBytes - PHSI_LEN;
252 if(TotalBytesAdded) 252 if(TotalBytesAdded)
253 { 253 {
254 if(skb_headroom(packet) >= (SKB_RESERVE_ETHERNET_HEADER + TotalBytesAdded)) 254 if(skb_headroom(packet) >= (SKB_RESERVE_ETHERNET_HEADER + TotalBytesAdded))
255 skb_push(packet, TotalBytesAdded); 255 skb_push(packet, TotalBytesAdded);
256 else 256 else
257 { 257 {
258 if(skb_cow(packet, skb_headroom(packet) + TotalBytesAdded)) 258 if(skb_cow(packet, skb_headroom(packet) + TotalBytesAdded))
259 { 259 {
260 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "cow failed in receive\n"); 260 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "cow failed in receive\n");
261 return STATUS_FAILURE; 261 return STATUS_FAILURE;
262 } 262 }
263 263
264 skb_push(packet, TotalBytesAdded); 264 skb_push(packet, TotalBytesAdded);
265 } 265 }
266 } 266 }
267 267
268 memcpy(packet->data, Adapter->ucaPHSPktRestoreBuf, nStandardPktHdrLen); 268 memcpy(packet->data, Adapter->ucaPHSPktRestoreBuf, nStandardPktHdrLen);
269 } 269 }
270 270
271 return STATUS_SUCCESS; 271 return STATUS_SUCCESS;
272 } 272 }
273 273
274 void DumpFullPacket(UCHAR *pBuf,UINT nPktLen) 274 void DumpFullPacket(UCHAR *pBuf,UINT nPktLen)
275 { 275 {
276 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 276 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
277 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL,"Dumping Data Packet"); 277 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL,"Dumping Data Packet");
278 BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL,pBuf,nPktLen); 278 BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL,pBuf,nPktLen);
279 } 279 }
280 280
281 //----------------------------------------------------------------------------- 281 //-----------------------------------------------------------------------------
282 // Procedure: phs_init 282 // Procedure: phs_init
283 // 283 //
284 // Description: This routine is responsible for allocating memory for classifier and 284 // Description: This routine is responsible for allocating memory for classifier and
285 // PHS rules. 285 // PHS rules.
286 // 286 //
287 // Arguments: 287 // Arguments:
288 // pPhsdeviceExtension - ptr to Device extension containing PHS Classifier rules and PHS Rules , RX, TX buffer etc 288 // pPhsdeviceExtension - ptr to Device extension containing PHS Classifier rules and PHS Rules , RX, TX buffer etc
289 // 289 //
290 // Returns: 290 // Returns:
291 // TRUE(1) -If allocation of memory was success full. 291 // TRUE(1) -If allocation of memory was success full.
292 // FALSE -If allocation of memory fails. 292 // FALSE -If allocation of memory fails.
293 //----------------------------------------------------------------------------- 293 //-----------------------------------------------------------------------------
294 int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension, struct bcm_mini_adapter *Adapter) 294 int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension, struct bcm_mini_adapter *Adapter)
295 { 295 {
296 int i; 296 int i;
297 S_SERVICEFLOW_TABLE *pstServiceFlowTable; 297 S_SERVICEFLOW_TABLE *pstServiceFlowTable;
298 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nPHS:phs_init function "); 298 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nPHS:phs_init function ");
299 299
300 if(pPhsdeviceExtension->pstServiceFlowPhsRulesTable) 300 if(pPhsdeviceExtension->pstServiceFlowPhsRulesTable)
301 return -EINVAL; 301 return -EINVAL;
302 302
303 pPhsdeviceExtension->pstServiceFlowPhsRulesTable = 303 pPhsdeviceExtension->pstServiceFlowPhsRulesTable =
304 kzalloc(sizeof(S_SERVICEFLOW_TABLE), GFP_KERNEL); 304 kzalloc(sizeof(S_SERVICEFLOW_TABLE), GFP_KERNEL);
305 305
306 if(!pPhsdeviceExtension->pstServiceFlowPhsRulesTable) 306 if(!pPhsdeviceExtension->pstServiceFlowPhsRulesTable)
307 { 307 {
308 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation ServiceFlowPhsRulesTable failed"); 308 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation ServiceFlowPhsRulesTable failed");
309 return -ENOMEM; 309 return -ENOMEM;
310 } 310 }
311 311
312 pstServiceFlowTable = pPhsdeviceExtension->pstServiceFlowPhsRulesTable; 312 pstServiceFlowTable = pPhsdeviceExtension->pstServiceFlowPhsRulesTable;
313 for(i=0;i<MAX_SERVICEFLOWS;i++) 313 for(i=0;i<MAX_SERVICEFLOWS;i++)
314 { 314 {
315 S_SERVICEFLOW_ENTRY sServiceFlow = pstServiceFlowTable->stSFList[i]; 315 S_SERVICEFLOW_ENTRY sServiceFlow = pstServiceFlowTable->stSFList[i];
316 sServiceFlow.pstClassifierTable = kzalloc(sizeof(S_CLASSIFIER_TABLE), GFP_KERNEL); 316 sServiceFlow.pstClassifierTable = kzalloc(sizeof(S_CLASSIFIER_TABLE), GFP_KERNEL);
317 if(!sServiceFlow.pstClassifierTable) 317 if(!sServiceFlow.pstClassifierTable)
318 { 318 {
319 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation failed"); 319 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation failed");
320 free_phs_serviceflow_rules(pPhsdeviceExtension-> 320 free_phs_serviceflow_rules(pPhsdeviceExtension->
321 pstServiceFlowPhsRulesTable); 321 pstServiceFlowPhsRulesTable);
322 pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL; 322 pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL;
323 return -ENOMEM; 323 return -ENOMEM;
324 } 324 }
325 } 325 }
326 326
327 pPhsdeviceExtension->CompressedTxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL); 327 pPhsdeviceExtension->CompressedTxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL);
328 328
329 if(pPhsdeviceExtension->CompressedTxBuffer == NULL) 329 if(pPhsdeviceExtension->CompressedTxBuffer == NULL)
330 { 330 {
331 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation failed"); 331 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation failed");
332 free_phs_serviceflow_rules(pPhsdeviceExtension->pstServiceFlowPhsRulesTable); 332 free_phs_serviceflow_rules(pPhsdeviceExtension->pstServiceFlowPhsRulesTable);
333 pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL; 333 pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL;
334 return -ENOMEM; 334 return -ENOMEM;
335 } 335 }
336 336
337 pPhsdeviceExtension->UnCompressedRxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL); 337 pPhsdeviceExtension->UnCompressedRxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL);
338 if(pPhsdeviceExtension->UnCompressedRxBuffer == NULL) 338 if(pPhsdeviceExtension->UnCompressedRxBuffer == NULL)
339 { 339 {
340 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation failed"); 340 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation failed");
341 kfree(pPhsdeviceExtension->CompressedTxBuffer); 341 kfree(pPhsdeviceExtension->CompressedTxBuffer);
342 free_phs_serviceflow_rules(pPhsdeviceExtension->pstServiceFlowPhsRulesTable); 342 free_phs_serviceflow_rules(pPhsdeviceExtension->pstServiceFlowPhsRulesTable);
343 pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL; 343 pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL;
344 return -ENOMEM; 344 return -ENOMEM;
345 } 345 }
346 346
347 347
348 348
349 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\n phs_init Successfull"); 349 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\n phs_init Successfull");
350 return STATUS_SUCCESS; 350 return STATUS_SUCCESS;
351 } 351 }
352 352
353 353
354 int PhsCleanup(IN PPHS_DEVICE_EXTENSION pPHSDeviceExt) 354 int PhsCleanup(IN PPHS_DEVICE_EXTENSION pPHSDeviceExt)
355 { 355 {
356 if(pPHSDeviceExt->pstServiceFlowPhsRulesTable) 356 if(pPHSDeviceExt->pstServiceFlowPhsRulesTable)
357 { 357 {
358 free_phs_serviceflow_rules(pPHSDeviceExt->pstServiceFlowPhsRulesTable); 358 free_phs_serviceflow_rules(pPHSDeviceExt->pstServiceFlowPhsRulesTable);
359 pPHSDeviceExt->pstServiceFlowPhsRulesTable = NULL; 359 pPHSDeviceExt->pstServiceFlowPhsRulesTable = NULL;
360 } 360 }
361 361
362 kfree(pPHSDeviceExt->CompressedTxBuffer); 362 kfree(pPHSDeviceExt->CompressedTxBuffer);
363 pPHSDeviceExt->CompressedTxBuffer = NULL; 363 pPHSDeviceExt->CompressedTxBuffer = NULL;
364 364
365 kfree(pPHSDeviceExt->UnCompressedRxBuffer); 365 kfree(pPHSDeviceExt->UnCompressedRxBuffer);
366 pPHSDeviceExt->UnCompressedRxBuffer = NULL; 366 pPHSDeviceExt->UnCompressedRxBuffer = NULL;
367 367
368 return 0; 368 return 0;
369 } 369 }
370 370
371 371
372 372
373 //PHS functions 373 //PHS functions
374 /*++ 374 /*++
375 PhsUpdateClassifierRule 375 PhsUpdateClassifierRule
376 376
377 Routine Description: 377 Routine Description:
378 Exported function to add or modify a PHS Rule. 378 Exported function to add or modify a PHS Rule.
379 379
380 Arguments: 380 Arguments:
381 IN void* pvContext - PHS Driver Specific Context 381 IN void* pvContext - PHS Driver Specific Context
382 IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rule applies 382 IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rule applies
383 IN B_UINT16 uiClsId - The Classifier ID within the Service Flow for which the PHS rule applies. 383 IN B_UINT16 uiClsId - The Classifier ID within the Service Flow for which the PHS rule applies.
384 IN S_PHS_RULE *psPhsRule - The PHS Rule strcuture to be added to the PHS Rule table. 384 IN S_PHS_RULE *psPhsRule - The PHS Rule strcuture to be added to the PHS Rule table.
385 385
386 Return Value: 386 Return Value:
387 387
388 0 if successful, 388 0 if successful,
389 >0 Error. 389 >0 Error.
390 390
391 --*/ 391 --*/
392 ULONG PhsUpdateClassifierRule(IN void* pvContext, 392 ULONG PhsUpdateClassifierRule(IN void* pvContext,
393 IN B_UINT16 uiVcid , 393 IN B_UINT16 uiVcid ,
394 IN B_UINT16 uiClsId , 394 IN B_UINT16 uiClsId ,
395 IN S_PHS_RULE *psPhsRule, 395 IN S_PHS_RULE *psPhsRule,
396 IN B_UINT8 u8AssociatedPHSI) 396 IN B_UINT8 u8AssociatedPHSI)
397 { 397 {
398 ULONG lStatus =0; 398 ULONG lStatus =0;
399 UINT nSFIndex =0 ; 399 UINT nSFIndex =0 ;
400 S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; 400 S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL;
401 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 401 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
402 402
403 403
404 404
405 PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; 405 PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext;
406 406
407 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"PHS With Corr2 Changes \n"); 407 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"PHS With Corr2 Changes \n");
408 408
409 if(pDeviceExtension == NULL) 409 if(pDeviceExtension == NULL)
410 { 410 {
411 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"Invalid Device Extension\n"); 411 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"Invalid Device Extension\n");
412 return ERR_PHS_INVALID_DEVICE_EXETENSION; 412 return ERR_PHS_INVALID_DEVICE_EXETENSION;
413 } 413 }
414 414
415 415
416 if(u8AssociatedPHSI == 0) 416 if(u8AssociatedPHSI == 0)
417 { 417 {
418 return ERR_PHS_INVALID_PHS_RULE; 418 return ERR_PHS_INVALID_PHS_RULE;
419 } 419 }
420 420
421 /* Retrieve the SFID Entry Index for requested Service Flow */ 421 /* Retrieve the SFID Entry Index for requested Service Flow */
422 422
423 nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, 423 nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable,
424 uiVcid,&pstServiceFlowEntry); 424 uiVcid,&pstServiceFlowEntry);
425 425
426 if(nSFIndex == PHS_INVALID_TABLE_INDEX) 426 if(nSFIndex == PHS_INVALID_TABLE_INDEX)
427 { 427 {
428 /* This is a new SF. Create a mapping entry for this */ 428 /* This is a new SF. Create a mapping entry for this */
429 lStatus = CreateSFToClassifierRuleMapping(uiVcid, uiClsId, 429 lStatus = CreateSFToClassifierRuleMapping(uiVcid, uiClsId,
430 pDeviceExtension->pstServiceFlowPhsRulesTable, psPhsRule, u8AssociatedPHSI); 430 pDeviceExtension->pstServiceFlowPhsRulesTable, psPhsRule, u8AssociatedPHSI);
431 return lStatus; 431 return lStatus;
432 } 432 }
433 433
434 /* SF already Exists Add PHS Rule to existing SF */ 434 /* SF already Exists Add PHS Rule to existing SF */
435 lStatus = CreateClassiferToPHSRuleMapping(uiVcid, uiClsId, 435 lStatus = CreateClassiferToPHSRuleMapping(uiVcid, uiClsId,
436 pstServiceFlowEntry, psPhsRule, u8AssociatedPHSI); 436 pstServiceFlowEntry, psPhsRule, u8AssociatedPHSI);
437 437
438 return lStatus; 438 return lStatus;
439 } 439 }
440 440
441 /*++ 441 /*++
442 PhsDeletePHSRule 442 PhsDeletePHSRule
443 443
444 Routine Description: 444 Routine Description:
445 Deletes the specified phs Rule within Vcid 445 Deletes the specified phs Rule within Vcid
446 446
447 Arguments: 447 Arguments:
448 IN void* pvContext - PHS Driver Specific Context 448 IN void* pvContext - PHS Driver Specific Context
449 IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rule applies 449 IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rule applies
450 IN B_UINT8 u8PHSI - the PHS Index identifying PHS rule to be deleted. 450 IN B_UINT8 u8PHSI - the PHS Index identifying PHS rule to be deleted.
451 451
452 Return Value: 452 Return Value:
453 453
454 0 if successful, 454 0 if successful,
455 >0 Error. 455 >0 Error.
456 456
457 --*/ 457 --*/
458 458
459 ULONG PhsDeletePHSRule(IN void* pvContext,IN B_UINT16 uiVcid,IN B_UINT8 u8PHSI) 459 ULONG PhsDeletePHSRule(IN void* pvContext,IN B_UINT16 uiVcid,IN B_UINT8 u8PHSI)
460 { 460 {
461 ULONG lStatus =0; 461 ULONG lStatus =0;
462 UINT nSFIndex =0, nClsidIndex =0 ; 462 UINT nSFIndex =0, nClsidIndex =0 ;
463 S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; 463 S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL;
464 S_CLASSIFIER_TABLE *pstClassifierRulesTable = NULL; 464 S_CLASSIFIER_TABLE *pstClassifierRulesTable = NULL;
465 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 465 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
466 466
467 467
468 PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; 468 PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext;
469 469
470 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "======>\n"); 470 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "======>\n");
471 471
472 if(pDeviceExtension) 472 if(pDeviceExtension)
473 { 473 {
474 474
475 //Retrieve the SFID Entry Index for requested Service Flow 475 //Retrieve the SFID Entry Index for requested Service Flow
476 nSFIndex = GetServiceFlowEntry(pDeviceExtension 476 nSFIndex = GetServiceFlowEntry(pDeviceExtension
477 ->pstServiceFlowPhsRulesTable,uiVcid,&pstServiceFlowEntry); 477 ->pstServiceFlowPhsRulesTable,uiVcid,&pstServiceFlowEntry);
478 478
479 if(nSFIndex == PHS_INVALID_TABLE_INDEX) 479 if(nSFIndex == PHS_INVALID_TABLE_INDEX)
480 { 480 {
481 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "SFID Match Failed\n"); 481 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "SFID Match Failed\n");
482 return ERR_SF_MATCH_FAIL; 482 return ERR_SF_MATCH_FAIL;
483 } 483 }
484 484
485 pstClassifierRulesTable=pstServiceFlowEntry->pstClassifierTable; 485 pstClassifierRulesTable=pstServiceFlowEntry->pstClassifierTable;
486 if(pstClassifierRulesTable) 486 if(pstClassifierRulesTable)
487 { 487 {
488 for(nClsidIndex=0;nClsidIndex<MAX_PHSRULE_PER_SF;nClsidIndex++) 488 for(nClsidIndex=0;nClsidIndex<MAX_PHSRULE_PER_SF;nClsidIndex++)
489 { 489 {
490 if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].bUsed && pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule) 490 if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].bUsed && pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule)
491 { 491 {
492 if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8PHSI == u8PHSI) { 492 if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8PHSI == u8PHSI) {
493 if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt) 493 if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
494 pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt--; 494 pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt--;
495 if(0 == pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt) 495 if(0 == pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
496 kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule); 496 kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule);
497 memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0, 497 memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0,
498 sizeof(S_CLASSIFIER_ENTRY)); 498 sizeof(S_CLASSIFIER_ENTRY));
499 } 499 }
500 } 500 }
501 } 501 }
502 } 502 }
503 503
504 } 504 }
505 return lStatus; 505 return lStatus;
506 } 506 }
507 507
508 /*++ 508 /*++
509 PhsDeleteClassifierRule 509 PhsDeleteClassifierRule
510 510
511 Routine Description: 511 Routine Description:
512 Exported function to Delete a PHS Rule for the SFID,CLSID Pair. 512 Exported function to Delete a PHS Rule for the SFID,CLSID Pair.
513 513
514 Arguments: 514 Arguments:
515 IN void* pvContext - PHS Driver Specific Context 515 IN void* pvContext - PHS Driver Specific Context
516 IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rule applies 516 IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rule applies
517 IN B_UINT16 uiClsId - The Classifier ID within the Service Flow for which the PHS rule applies. 517 IN B_UINT16 uiClsId - The Classifier ID within the Service Flow for which the PHS rule applies.
518 518
519 Return Value: 519 Return Value:
520 520
521 0 if successful, 521 0 if successful,
522 >0 Error. 522 >0 Error.
523 523
524 --*/ 524 --*/
525 ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16 uiClsId) 525 ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16 uiClsId)
526 { 526 {
527 ULONG lStatus =0; 527 ULONG lStatus =0;
528 UINT nSFIndex =0, nClsidIndex =0 ; 528 UINT nSFIndex =0, nClsidIndex =0 ;
529 S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; 529 S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL;
530 S_CLASSIFIER_ENTRY *pstClassifierEntry = NULL; 530 S_CLASSIFIER_ENTRY *pstClassifierEntry = NULL;
531 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 531 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
532 PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; 532 PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext;
533 533
534 if(pDeviceExtension) 534 if(pDeviceExtension)
535 { 535 {
536 //Retrieve the SFID Entry Index for requested Service Flow 536 //Retrieve the SFID Entry Index for requested Service Flow
537 nSFIndex = GetServiceFlowEntry(pDeviceExtension 537 nSFIndex = GetServiceFlowEntry(pDeviceExtension
538 ->pstServiceFlowPhsRulesTable, uiVcid, &pstServiceFlowEntry); 538 ->pstServiceFlowPhsRulesTable, uiVcid, &pstServiceFlowEntry);
539 if(nSFIndex == PHS_INVALID_TABLE_INDEX) 539 if(nSFIndex == PHS_INVALID_TABLE_INDEX)
540 { 540 {
541 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"SFID Match Failed\n"); 541 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"SFID Match Failed\n");
542 return ERR_SF_MATCH_FAIL; 542 return ERR_SF_MATCH_FAIL;
543 } 543 }
544 544
545 nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable, 545 nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable,
546 uiClsId, eActiveClassifierRuleContext, &pstClassifierEntry); 546 uiClsId, eActiveClassifierRuleContext, &pstClassifierEntry);
547 if((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule)) 547 if((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule))
548 { 548 {
549 if(pstClassifierEntry->pstPhsRule) 549 if(pstClassifierEntry->pstPhsRule)
550 { 550 {
551 if(pstClassifierEntry->pstPhsRule->u8RefCnt) 551 if(pstClassifierEntry->pstPhsRule->u8RefCnt)
552 pstClassifierEntry->pstPhsRule->u8RefCnt--; 552 pstClassifierEntry->pstPhsRule->u8RefCnt--;
553 if(0==pstClassifierEntry->pstPhsRule->u8RefCnt) 553 if(0==pstClassifierEntry->pstPhsRule->u8RefCnt)
554 kfree(pstClassifierEntry->pstPhsRule); 554 kfree(pstClassifierEntry->pstPhsRule);
555 555
556 } 556 }
557 memset(pstClassifierEntry, 0, sizeof(S_CLASSIFIER_ENTRY)); 557 memset(pstClassifierEntry, 0, sizeof(S_CLASSIFIER_ENTRY));
558 } 558 }
559 559
560 nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable, 560 nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable,
561 uiClsId,eOldClassifierRuleContext,&pstClassifierEntry); 561 uiClsId,eOldClassifierRuleContext,&pstClassifierEntry);
562 562
563 if((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule)) 563 if((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule))
564 { 564 {
565 kfree(pstClassifierEntry->pstPhsRule); 565 kfree(pstClassifierEntry->pstPhsRule);
566 memset(pstClassifierEntry, 0, sizeof(S_CLASSIFIER_ENTRY)); 566 memset(pstClassifierEntry, 0, sizeof(S_CLASSIFIER_ENTRY));
567 } 567 }
568 } 568 }
569 return lStatus; 569 return lStatus;
570 } 570 }
571 571
572 /*++ 572 /*++
573 PhsDeleteSFRules 573 PhsDeleteSFRules
574 574
575 Routine Description: 575 Routine Description:
576 Exported function to Delete a all PHS Rules for the SFID. 576 Exported function to Delete a all PHS Rules for the SFID.
577 577
578 Arguments: 578 Arguments:
579 IN void* pvContext - PHS Driver Specific Context 579 IN void* pvContext - PHS Driver Specific Context
580 IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rules need to be deleted 580 IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rules need to be deleted
581 581
582 Return Value: 582 Return Value:
583 583
584 0 if successful, 584 0 if successful,
585 >0 Error. 585 >0 Error.
586 586
587 --*/ 587 --*/
588 ULONG PhsDeleteSFRules(IN void* pvContext,IN B_UINT16 uiVcid) 588 ULONG PhsDeleteSFRules(IN void* pvContext,IN B_UINT16 uiVcid)
589 { 589 {
590 590
591 ULONG lStatus =0; 591 ULONG lStatus =0;
592 UINT nSFIndex =0, nClsidIndex =0 ; 592 UINT nSFIndex =0, nClsidIndex =0 ;
593 S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; 593 S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL;
594 S_CLASSIFIER_TABLE *pstClassifierRulesTable = NULL; 594 S_CLASSIFIER_TABLE *pstClassifierRulesTable = NULL;
595 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 595 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
596 PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; 596 PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext;
597 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"====> \n"); 597 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"====> \n");
598 598
599 if(pDeviceExtension) 599 if(pDeviceExtension)
600 { 600 {
601 //Retrieve the SFID Entry Index for requested Service Flow 601 //Retrieve the SFID Entry Index for requested Service Flow
602 nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, 602 nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable,
603 uiVcid,&pstServiceFlowEntry); 603 uiVcid,&pstServiceFlowEntry);
604 if(nSFIndex == PHS_INVALID_TABLE_INDEX) 604 if(nSFIndex == PHS_INVALID_TABLE_INDEX)
605 { 605 {
606 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "SFID Match Failed\n"); 606 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "SFID Match Failed\n");
607 return ERR_SF_MATCH_FAIL; 607 return ERR_SF_MATCH_FAIL;
608 } 608 }
609 609
610 pstClassifierRulesTable=pstServiceFlowEntry->pstClassifierTable; 610 pstClassifierRulesTable=pstServiceFlowEntry->pstClassifierTable;
611 if(pstClassifierRulesTable) 611 if(pstClassifierRulesTable)
612 { 612 {
613 for(nClsidIndex=0;nClsidIndex<MAX_PHSRULE_PER_SF;nClsidIndex++) 613 for(nClsidIndex=0;nClsidIndex<MAX_PHSRULE_PER_SF;nClsidIndex++)
614 { 614 {
615 if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule) 615 if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule)
616 { 616 {
617 if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] 617 if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex]
618 .pstPhsRule->u8RefCnt) 618 .pstPhsRule->u8RefCnt)
619 pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] 619 pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex]
620 .pstPhsRule->u8RefCnt--; 620 .pstPhsRule->u8RefCnt--;
621 if(0==pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] 621 if(0==pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex]
622 .pstPhsRule->u8RefCnt) 622 .pstPhsRule->u8RefCnt)
623 kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule); 623 kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule);
624 pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] 624 pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex]
625 .pstPhsRule = NULL; 625 .pstPhsRule = NULL;
626 } 626 }
627 memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0, sizeof(S_CLASSIFIER_ENTRY)); 627 memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0, sizeof(S_CLASSIFIER_ENTRY));
628 if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule) 628 if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule)
629 { 629 {
630 if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] 630 if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex]
631 .pstPhsRule->u8RefCnt) 631 .pstPhsRule->u8RefCnt)
632 pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] 632 pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex]
633 .pstPhsRule->u8RefCnt--; 633 .pstPhsRule->u8RefCnt--;
634 if(0 == pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] 634 if(0 == pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex]
635 .pstPhsRule->u8RefCnt) 635 .pstPhsRule->u8RefCnt)
636 kfree(pstClassifierRulesTable 636 kfree(pstClassifierRulesTable
637 ->stOldPhsRulesList[nClsidIndex].pstPhsRule); 637 ->stOldPhsRulesList[nClsidIndex].pstPhsRule);
638 pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] 638 pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex]
639 .pstPhsRule = NULL; 639 .pstPhsRule = NULL;
640 } 640 }
641 memset(&pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex], 0, sizeof(S_CLASSIFIER_ENTRY)); 641 memset(&pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex], 0, sizeof(S_CLASSIFIER_ENTRY));
642 } 642 }
643 } 643 }
644 pstServiceFlowEntry->bUsed = FALSE; 644 pstServiceFlowEntry->bUsed = FALSE;
645 pstServiceFlowEntry->uiVcid = 0; 645 pstServiceFlowEntry->uiVcid = 0;
646 646
647 } 647 }
648 648
649 return lStatus; 649 return lStatus;
650 } 650 }
651 651
652 652
653 /*++ 653 /*++
654 PhsCompress 654 PhsCompress
655 655
656 Routine Description: 656 Routine Description:
657 Exported function to compress the data using PHS. 657 Exported function to compress the data using PHS.
658 658
659 Arguments: 659 Arguments:
660 IN void* pvContext - PHS Driver Specific Context. 660 IN void* pvContext - PHS Driver Specific Context.
661 IN B_UINT16 uiVcid - The Service Flow ID to which current packet header compression applies. 661 IN B_UINT16 uiVcid - The Service Flow ID to which current packet header compression applies.
662 IN UINT uiClsId - The Classifier ID to which current packet header compression applies. 662 IN UINT uiClsId - The Classifier ID to which current packet header compression applies.
663 IN void *pvInputBuffer - The Input buffer containg packet header data 663 IN void *pvInputBuffer - The Input buffer containg packet header data
664 IN void *pvOutputBuffer - The output buffer returned by this function after PHS 664 IN void *pvOutputBuffer - The output buffer returned by this function after PHS
665 IN UINT *pOldHeaderSize - The actual size of the header before PHS 665 IN UINT *pOldHeaderSize - The actual size of the header before PHS
666 IN UINT *pNewHeaderSize - The new size of the header after applying PHS 666 IN UINT *pNewHeaderSize - The new size of the header after applying PHS
667 667
668 Return Value: 668 Return Value:
669 669
670 0 if successful, 670 0 if successful,
671 >0 Error. 671 >0 Error.
672 672
673 --*/ 673 --*/
674 ULONG PhsCompress(IN void* pvContext, 674 ULONG PhsCompress(IN void* pvContext,
675 IN B_UINT16 uiVcid, 675 IN B_UINT16 uiVcid,
676 IN B_UINT16 uiClsId, 676 IN B_UINT16 uiClsId,
677 IN void *pvInputBuffer, 677 IN void *pvInputBuffer,
678 OUT void *pvOutputBuffer, 678 OUT void *pvOutputBuffer,
679 OUT UINT *pOldHeaderSize, 679 OUT UINT *pOldHeaderSize,
680 OUT UINT *pNewHeaderSize ) 680 OUT UINT *pNewHeaderSize )
681 { 681 {
682 UINT nSFIndex =0, nClsidIndex =0 ; 682 UINT nSFIndex =0, nClsidIndex =0 ;
683 S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; 683 S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL;
684 S_CLASSIFIER_ENTRY *pstClassifierEntry = NULL; 684 S_CLASSIFIER_ENTRY *pstClassifierEntry = NULL;
685 S_PHS_RULE *pstPhsRule = NULL; 685 S_PHS_RULE *pstPhsRule = NULL;
686 ULONG lStatus =0; 686 ULONG lStatus =0;
687 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 687 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
688 688
689 689
690 690
691 PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; 691 PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext;
692 692
693 693
694 if(pDeviceExtension == NULL) 694 if(pDeviceExtension == NULL)
695 { 695 {
696 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"Invalid Device Extension\n"); 696 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"Invalid Device Extension\n");
697 lStatus = STATUS_PHS_NOCOMPRESSION ; 697 lStatus = STATUS_PHS_NOCOMPRESSION ;
698 return lStatus; 698 return lStatus;
699 699
700 } 700 }
701 701
702 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"Suppressing header \n"); 702 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"Suppressing header \n");
703 703
704 704
705 //Retrieve the SFID Entry Index for requested Service Flow 705 //Retrieve the SFID Entry Index for requested Service Flow
706 nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, 706 nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable,
707 uiVcid,&pstServiceFlowEntry); 707 uiVcid,&pstServiceFlowEntry);
708 if(nSFIndex == PHS_INVALID_TABLE_INDEX) 708 if(nSFIndex == PHS_INVALID_TABLE_INDEX)
709 { 709 {
710 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"SFID Match Failed\n"); 710 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"SFID Match Failed\n");
711 lStatus = STATUS_PHS_NOCOMPRESSION ; 711 lStatus = STATUS_PHS_NOCOMPRESSION ;
712 return lStatus; 712 return lStatus;
713 } 713 }
714 714
715 nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable, 715 nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable,
716 uiClsId,eActiveClassifierRuleContext,&pstClassifierEntry); 716 uiClsId,eActiveClassifierRuleContext,&pstClassifierEntry);
717 717
718 if(nClsidIndex == PHS_INVALID_TABLE_INDEX) 718 if(nClsidIndex == PHS_INVALID_TABLE_INDEX)
719 { 719 {
720 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"No PHS Rule Defined For Classifier\n"); 720 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"No PHS Rule Defined For Classifier\n");
721 lStatus = STATUS_PHS_NOCOMPRESSION ; 721 lStatus = STATUS_PHS_NOCOMPRESSION ;
722 return lStatus; 722 return lStatus;
723 } 723 }
724 724
725 725
726 //get rule from SF id,Cls ID pair and proceed 726 //get rule from SF id,Cls ID pair and proceed
727 pstPhsRule = pstClassifierEntry->pstPhsRule; 727 pstPhsRule = pstClassifierEntry->pstPhsRule;
728 728
729 if(!ValidatePHSRuleComplete(pstPhsRule)) 729 if(!ValidatePHSRuleComplete(pstPhsRule))
730 { 730 {
731 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"PHS Rule Defined For Classifier But Not Complete\n"); 731 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"PHS Rule Defined For Classifier But Not Complete\n");
732 lStatus = STATUS_PHS_NOCOMPRESSION ; 732 lStatus = STATUS_PHS_NOCOMPRESSION ;
733 return lStatus; 733 return lStatus;
734 } 734 }
735 735
736 //Compress Packet 736 //Compress Packet
737 lStatus = phs_compress(pstPhsRule,(PUCHAR)pvInputBuffer, 737 lStatus = phs_compress(pstPhsRule,(PUCHAR)pvInputBuffer,
738 (PUCHAR)pvOutputBuffer, pOldHeaderSize,pNewHeaderSize); 738 (PUCHAR)pvOutputBuffer, pOldHeaderSize,pNewHeaderSize);
739 739
740 if(lStatus == STATUS_PHS_COMPRESSED) 740 if(lStatus == STATUS_PHS_COMPRESSED)
741 { 741 {
742 pstPhsRule->PHSModifiedBytes += *pOldHeaderSize - *pNewHeaderSize - 1; 742 pstPhsRule->PHSModifiedBytes += *pOldHeaderSize - *pNewHeaderSize - 1;
743 pstPhsRule->PHSModifiedNumPackets++; 743 pstPhsRule->PHSModifiedNumPackets++;
744 } 744 }
745 else 745 else
746 pstPhsRule->PHSErrorNumPackets++; 746 pstPhsRule->PHSErrorNumPackets++;
747 747
748 return lStatus; 748 return lStatus;
749 } 749 }
750 750
751 /*++ 751 /*++
752 PhsDeCompress 752 PhsDeCompress
753 753
754 Routine Description: 754 Routine Description:
755 Exported function to restore the packet header in Rx path. 755 Exported function to restore the packet header in Rx path.
756 756
757 Arguments: 757 Arguments:
758 IN void* pvContext - PHS Driver Specific Context. 758 IN void* pvContext - PHS Driver Specific Context.
759 IN B_UINT16 uiVcid - The Service Flow ID to which current packet header restoration applies. 759 IN B_UINT16 uiVcid - The Service Flow ID to which current packet header restoration applies.
760 IN void *pvInputBuffer - The Input buffer containg suppressed packet header data 760 IN void *pvInputBuffer - The Input buffer containg suppressed packet header data
761 OUT void *pvOutputBuffer - The output buffer returned by this function after restoration 761 OUT void *pvOutputBuffer - The output buffer returned by this function after restoration
762 OUT UINT *pHeaderSize - The packet header size after restoration is returned in this parameter. 762 OUT UINT *pHeaderSize - The packet header size after restoration is returned in this parameter.
763 763
764 Return Value: 764 Return Value:
765 765
766 0 if successful, 766 0 if successful,
767 >0 Error. 767 >0 Error.
768 768
769 --*/ 769 --*/
770 ULONG PhsDeCompress(IN void* pvContext, 770 ULONG PhsDeCompress(IN void* pvContext,
771 IN B_UINT16 uiVcid, 771 IN B_UINT16 uiVcid,
772 IN void *pvInputBuffer, 772 IN void *pvInputBuffer,
773 OUT void *pvOutputBuffer, 773 OUT void *pvOutputBuffer,
774 OUT UINT *pInHeaderSize, 774 OUT UINT *pInHeaderSize,
775 OUT UINT *pOutHeaderSize ) 775 OUT UINT *pOutHeaderSize )
776 { 776 {
777 UINT nSFIndex =0, nPhsRuleIndex =0 ; 777 UINT nSFIndex =0, nPhsRuleIndex =0 ;
778 S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; 778 S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL;
779 S_PHS_RULE *pstPhsRule = NULL; 779 S_PHS_RULE *pstPhsRule = NULL;
780 UINT phsi; 780 UINT phsi;
781 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 781 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
782 PPHS_DEVICE_EXTENSION pDeviceExtension= 782 PPHS_DEVICE_EXTENSION pDeviceExtension=
783 (PPHS_DEVICE_EXTENSION)pvContext; 783 (PPHS_DEVICE_EXTENSION)pvContext;
784 784
785 *pInHeaderSize = 0; 785 *pInHeaderSize = 0;
786 786
787 if(pDeviceExtension == NULL) 787 if(pDeviceExtension == NULL)
788 { 788 {
789 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"Invalid Device Extension\n"); 789 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"Invalid Device Extension\n");
790 return ERR_PHS_INVALID_DEVICE_EXETENSION; 790 return ERR_PHS_INVALID_DEVICE_EXETENSION;
791 } 791 }
792 792
793 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"Restoring header\n"); 793 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"Restoring header\n");
794 794
795 phsi = *((unsigned char *)(pvInputBuffer)); 795 phsi = *((unsigned char *)(pvInputBuffer));
796 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"PHSI To Be Used For restore : %x\n",phsi); 796 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"PHSI To Be Used For restore : %x\n",phsi);
797 if(phsi == UNCOMPRESSED_PACKET ) 797 if(phsi == UNCOMPRESSED_PACKET )
798 { 798 {
799 return STATUS_PHS_NOCOMPRESSION; 799 return STATUS_PHS_NOCOMPRESSION;
800 } 800 }
801 801
802 //Retrieve the SFID Entry Index for requested Service Flow 802 //Retrieve the SFID Entry Index for requested Service Flow
803 nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, 803 nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable,
804 uiVcid,&pstServiceFlowEntry); 804 uiVcid,&pstServiceFlowEntry);
805 if(nSFIndex == PHS_INVALID_TABLE_INDEX) 805 if(nSFIndex == PHS_INVALID_TABLE_INDEX)
806 { 806 {
807 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"SFID Match Failed During Lookup\n"); 807 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"SFID Match Failed During Lookup\n");
808 return ERR_SF_MATCH_FAIL; 808 return ERR_SF_MATCH_FAIL;
809 } 809 }
810 810
811 nPhsRuleIndex = GetPhsRuleEntry(pstServiceFlowEntry->pstClassifierTable,phsi, 811 nPhsRuleIndex = GetPhsRuleEntry(pstServiceFlowEntry->pstClassifierTable,phsi,
812 eActiveClassifierRuleContext,&pstPhsRule); 812 eActiveClassifierRuleContext,&pstPhsRule);
813 if(nPhsRuleIndex == PHS_INVALID_TABLE_INDEX) 813 if(nPhsRuleIndex == PHS_INVALID_TABLE_INDEX)
814 { 814 {
815 //Phs Rule does not exist in active rules table. Lets try in the old rules table. 815 //Phs Rule does not exist in active rules table. Lets try in the old rules table.
816 nPhsRuleIndex = GetPhsRuleEntry(pstServiceFlowEntry->pstClassifierTable, 816 nPhsRuleIndex = GetPhsRuleEntry(pstServiceFlowEntry->pstClassifierTable,
817 phsi,eOldClassifierRuleContext,&pstPhsRule); 817 phsi,eOldClassifierRuleContext,&pstPhsRule);
818 if(nPhsRuleIndex == PHS_INVALID_TABLE_INDEX) 818 if(nPhsRuleIndex == PHS_INVALID_TABLE_INDEX)
819 { 819 {
820 return ERR_PHSRULE_MATCH_FAIL; 820 return ERR_PHSRULE_MATCH_FAIL;
821 } 821 }
822 822
823 } 823 }
824 824
825 *pInHeaderSize = phs_decompress((PUCHAR)pvInputBuffer, 825 *pInHeaderSize = phs_decompress((PUCHAR)pvInputBuffer,
826 (PUCHAR)pvOutputBuffer,pstPhsRule,pOutHeaderSize); 826 (PUCHAR)pvOutputBuffer,pstPhsRule,pOutHeaderSize);
827 827
828 pstPhsRule->PHSModifiedBytes += *pOutHeaderSize - *pInHeaderSize - 1; 828 pstPhsRule->PHSModifiedBytes += *pOutHeaderSize - *pInHeaderSize - 1;
829 829
830 pstPhsRule->PHSModifiedNumPackets++; 830 pstPhsRule->PHSModifiedNumPackets++;
831 return STATUS_PHS_COMPRESSED; 831 return STATUS_PHS_COMPRESSED;
832 } 832 }
833 833
834 834
835 //----------------------------------------------------------------------------- 835 //-----------------------------------------------------------------------------
836 // Procedure: free_phs_serviceflow_rules 836 // Procedure: free_phs_serviceflow_rules
837 // 837 //
838 // Description: This routine is responsible for freeing memory allocated for PHS rules. 838 // Description: This routine is responsible for freeing memory allocated for PHS rules.
839 // 839 //
840 // Arguments: 840 // Arguments:
841 // rules - ptr to S_SERVICEFLOW_TABLE structure. 841 // rules - ptr to S_SERVICEFLOW_TABLE structure.
842 // 842 //
843 // Returns: 843 // Returns:
844 // Does not return any value. 844 // Does not return any value.
845 //----------------------------------------------------------------------------- 845 //-----------------------------------------------------------------------------
846 846
847 static void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTable) 847 static void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTable)
848 { 848 {
849 int i,j; 849 int i,j;
850 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 850 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
851 851
852 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "=======>\n"); 852 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "=======>\n");
853 if(psServiceFlowRulesTable) 853 if(psServiceFlowRulesTable)
854 { 854 {
855 for(i=0;i<MAX_SERVICEFLOWS;i++) 855 for(i=0;i<MAX_SERVICEFLOWS;i++)
856 { 856 {
857 S_SERVICEFLOW_ENTRY stServiceFlowEntry = 857 S_SERVICEFLOW_ENTRY stServiceFlowEntry =
858 psServiceFlowRulesTable->stSFList[i]; 858 psServiceFlowRulesTable->stSFList[i];
859 S_CLASSIFIER_TABLE *pstClassifierRulesTable = 859 S_CLASSIFIER_TABLE *pstClassifierRulesTable =
860 stServiceFlowEntry.pstClassifierTable; 860 stServiceFlowEntry.pstClassifierTable;
861 861
862 if(pstClassifierRulesTable) 862 if(pstClassifierRulesTable)
863 { 863 {
864 for(j=0;j<MAX_PHSRULE_PER_SF;j++) 864 for(j=0;j<MAX_PHSRULE_PER_SF;j++)
865 { 865 {
866 if(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule) 866 if(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule)
867 { 867 {
868 if(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule 868 if(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule
869 ->u8RefCnt) 869 ->u8RefCnt)
870 pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule 870 pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule
871 ->u8RefCnt--; 871 ->u8RefCnt--;
872 if(0==pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule 872 if(0==pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule
873 ->u8RefCnt) 873 ->u8RefCnt)
874 kfree(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule); 874 kfree(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule);
875 pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule = NULL; 875 pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule = NULL;
876 } 876 }
877 if(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule) 877 if(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule)
878 { 878 {
879 if(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule 879 if(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule
880 ->u8RefCnt) 880 ->u8RefCnt)
881 pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule 881 pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule
882 ->u8RefCnt--; 882 ->u8RefCnt--;
883 if(0==pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule 883 if(0==pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule
884 ->u8RefCnt) 884 ->u8RefCnt)
885 kfree(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule); 885 kfree(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule);
886 pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule = NULL; 886 pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule = NULL;
887 } 887 }
888 } 888 }
889 kfree(pstClassifierRulesTable); 889 kfree(pstClassifierRulesTable);
890 stServiceFlowEntry.pstClassifierTable = pstClassifierRulesTable = NULL; 890 stServiceFlowEntry.pstClassifierTable = pstClassifierRulesTable = NULL;
891 } 891 }
892 } 892 }
893 } 893 }
894 894
895 kfree(psServiceFlowRulesTable); 895 kfree(psServiceFlowRulesTable);
896 psServiceFlowRulesTable = NULL; 896 psServiceFlowRulesTable = NULL;
897 } 897 }
898 898
899 899
900 900
901 static BOOLEAN ValidatePHSRuleComplete(IN S_PHS_RULE *psPhsRule) 901 static BOOLEAN ValidatePHSRuleComplete(IN S_PHS_RULE *psPhsRule)
902 { 902 {
903 if(psPhsRule) 903 if(psPhsRule)
904 { 904 {
905 if(!psPhsRule->u8PHSI) 905 if(!psPhsRule->u8PHSI)
906 { 906 {
907 // PHSI is not valid 907 // PHSI is not valid
908 return FALSE; 908 return FALSE;
909 } 909 }
910 910
911 if(!psPhsRule->u8PHSS) 911 if(!psPhsRule->u8PHSS)
912 { 912 {
913 //PHSS Is Undefined 913 //PHSS Is Undefined
914 return FALSE; 914 return FALSE;
915 } 915 }
916 916
917 //Check if PHSF is defines for the PHS Rule 917 //Check if PHSF is defines for the PHS Rule
918 if(!psPhsRule->u8PHSFLength) // If any part of PHSF is valid then Rule contains valid PHSF 918 if(!psPhsRule->u8PHSFLength) // If any part of PHSF is valid then Rule contains valid PHSF
919 { 919 {
920 return FALSE; 920 return FALSE;
921 } 921 }
922 return TRUE; 922 return TRUE;
923 } 923 }
924 else 924 else
925 { 925 {
926 return FALSE; 926 return FALSE;
927 } 927 }
928 } 928 }
929 929
930 UINT GetServiceFlowEntry(IN S_SERVICEFLOW_TABLE *psServiceFlowTable, 930 UINT GetServiceFlowEntry(IN S_SERVICEFLOW_TABLE *psServiceFlowTable,
931 IN B_UINT16 uiVcid,S_SERVICEFLOW_ENTRY **ppstServiceFlowEntry) 931 IN B_UINT16 uiVcid,S_SERVICEFLOW_ENTRY **ppstServiceFlowEntry)
932 { 932 {
933 int i; 933 int i;
934 for(i=0;i<MAX_SERVICEFLOWS;i++) 934 for(i=0;i<MAX_SERVICEFLOWS;i++)
935 { 935 {
936 if(psServiceFlowTable->stSFList[i].bUsed) 936 if(psServiceFlowTable->stSFList[i].bUsed)
937 { 937 {
938 if(psServiceFlowTable->stSFList[i].uiVcid == uiVcid) 938 if(psServiceFlowTable->stSFList[i].uiVcid == uiVcid)
939 { 939 {
940 *ppstServiceFlowEntry = &psServiceFlowTable->stSFList[i]; 940 *ppstServiceFlowEntry = &psServiceFlowTable->stSFList[i];
941 return i; 941 return i;
942 } 942 }
943 } 943 }
944 } 944 }
945 945
946 *ppstServiceFlowEntry = NULL; 946 *ppstServiceFlowEntry = NULL;
947 return PHS_INVALID_TABLE_INDEX; 947 return PHS_INVALID_TABLE_INDEX;
948 } 948 }
949 949
950 950
951 UINT GetClassifierEntry(IN S_CLASSIFIER_TABLE *pstClassifierTable, 951 UINT GetClassifierEntry(IN S_CLASSIFIER_TABLE *pstClassifierTable,
952 IN B_UINT32 uiClsid,E_CLASSIFIER_ENTRY_CONTEXT eClsContext, 952 IN B_UINT32 uiClsid,E_CLASSIFIER_ENTRY_CONTEXT eClsContext,
953 OUT S_CLASSIFIER_ENTRY **ppstClassifierEntry) 953 OUT S_CLASSIFIER_ENTRY **ppstClassifierEntry)
954 { 954 {
955 int i; 955 int i;
956 S_CLASSIFIER_ENTRY *psClassifierRules = NULL; 956 S_CLASSIFIER_ENTRY *psClassifierRules = NULL;
957 for(i=0;i<MAX_PHSRULE_PER_SF;i++) 957 for(i=0;i<MAX_PHSRULE_PER_SF;i++)
958 { 958 {
959 959
960 if(eClsContext == eActiveClassifierRuleContext) 960 if(eClsContext == eActiveClassifierRuleContext)
961 { 961 {
962 psClassifierRules = &pstClassifierTable->stActivePhsRulesList[i]; 962 psClassifierRules = &pstClassifierTable->stActivePhsRulesList[i];
963 } 963 }
964 else 964 else
965 { 965 {
966 psClassifierRules = &pstClassifierTable->stOldPhsRulesList[i]; 966 psClassifierRules = &pstClassifierTable->stOldPhsRulesList[i];
967 } 967 }
968 968
969 if(psClassifierRules->bUsed) 969 if(psClassifierRules->bUsed)
970 { 970 {
971 if(psClassifierRules->uiClassifierRuleId == uiClsid) 971 if(psClassifierRules->uiClassifierRuleId == uiClsid)
972 { 972 {
973 *ppstClassifierEntry = psClassifierRules; 973 *ppstClassifierEntry = psClassifierRules;
974 return i; 974 return i;
975 } 975 }
976 } 976 }
977 977
978 } 978 }
979 979
980 *ppstClassifierEntry = NULL; 980 *ppstClassifierEntry = NULL;
981 return PHS_INVALID_TABLE_INDEX; 981 return PHS_INVALID_TABLE_INDEX;
982 } 982 }
983 983
984 static UINT GetPhsRuleEntry(IN S_CLASSIFIER_TABLE *pstClassifierTable, 984 static UINT GetPhsRuleEntry(IN S_CLASSIFIER_TABLE *pstClassifierTable,
985 IN B_UINT32 uiPHSI,E_CLASSIFIER_ENTRY_CONTEXT eClsContext, 985 IN B_UINT32 uiPHSI,E_CLASSIFIER_ENTRY_CONTEXT eClsContext,
986 OUT S_PHS_RULE **ppstPhsRule) 986 OUT S_PHS_RULE **ppstPhsRule)
987 { 987 {
988 int i; 988 int i;
989 S_CLASSIFIER_ENTRY *pstClassifierRule = NULL; 989 S_CLASSIFIER_ENTRY *pstClassifierRule = NULL;
990 for(i=0;i<MAX_PHSRULE_PER_SF;i++) 990 for(i=0;i<MAX_PHSRULE_PER_SF;i++)
991 { 991 {
992 if(eClsContext == eActiveClassifierRuleContext) 992 if(eClsContext == eActiveClassifierRuleContext)
993 { 993 {
994 pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[i]; 994 pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[i];
995 } 995 }
996 else 996 else
997 { 997 {
998 pstClassifierRule = &pstClassifierTable->stOldPhsRulesList[i]; 998 pstClassifierRule = &pstClassifierTable->stOldPhsRulesList[i];
999 } 999 }
1000 if(pstClassifierRule->bUsed) 1000 if(pstClassifierRule->bUsed)
1001 { 1001 {
1002 if(pstClassifierRule->u8PHSI == uiPHSI) 1002 if(pstClassifierRule->u8PHSI == uiPHSI)
1003 { 1003 {
1004 *ppstPhsRule = pstClassifierRule->pstPhsRule; 1004 *ppstPhsRule = pstClassifierRule->pstPhsRule;
1005 return i; 1005 return i;
1006 } 1006 }
1007 } 1007 }
1008 1008
1009 } 1009 }
1010 1010
1011 *ppstPhsRule = NULL; 1011 *ppstPhsRule = NULL;
1012 return PHS_INVALID_TABLE_INDEX; 1012 return PHS_INVALID_TABLE_INDEX;
1013 } 1013 }
1014 1014
1015 UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid,IN B_UINT16 uiClsId, 1015 UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid,IN B_UINT16 uiClsId,
1016 IN S_SERVICEFLOW_TABLE *psServiceFlowTable,S_PHS_RULE *psPhsRule, 1016 IN S_SERVICEFLOW_TABLE *psServiceFlowTable,S_PHS_RULE *psPhsRule,
1017 B_UINT8 u8AssociatedPHSI) 1017 B_UINT8 u8AssociatedPHSI)
1018 { 1018 {
1019 1019
1020 S_CLASSIFIER_TABLE *psaClassifiertable = NULL; 1020 S_CLASSIFIER_TABLE *psaClassifiertable = NULL;
1021 UINT uiStatus = 0; 1021 UINT uiStatus = 0;
1022 int iSfIndex; 1022 int iSfIndex;
1023 BOOLEAN bFreeEntryFound =FALSE; 1023 BOOLEAN bFreeEntryFound =FALSE;
1024 //Check for a free entry in SFID table 1024 //Check for a free entry in SFID table
1025 for(iSfIndex=0;iSfIndex < MAX_SERVICEFLOWS;iSfIndex++) 1025 for(iSfIndex=0;iSfIndex < MAX_SERVICEFLOWS;iSfIndex++)
1026 { 1026 {
1027 if(!psServiceFlowTable->stSFList[iSfIndex].bUsed) 1027 if(!psServiceFlowTable->stSFList[iSfIndex].bUsed)
1028 { 1028 {
1029 bFreeEntryFound = TRUE; 1029 bFreeEntryFound = TRUE;
1030 break; 1030 break;
1031 } 1031 }
1032 } 1032 }
1033 1033
1034 if(!bFreeEntryFound) 1034 if(!bFreeEntryFound)
1035 return ERR_SFTABLE_FULL; 1035 return ERR_SFTABLE_FULL;
1036 1036
1037 1037
1038 psaClassifiertable = psServiceFlowTable->stSFList[iSfIndex].pstClassifierTable; 1038 psaClassifiertable = psServiceFlowTable->stSFList[iSfIndex].pstClassifierTable;
1039 uiStatus = CreateClassifierPHSRule(uiClsId,psaClassifiertable,psPhsRule, 1039 uiStatus = CreateClassifierPHSRule(uiClsId,psaClassifiertable,psPhsRule,
1040 eActiveClassifierRuleContext,u8AssociatedPHSI); 1040 eActiveClassifierRuleContext,u8AssociatedPHSI);
1041 if(uiStatus == PHS_SUCCESS) 1041 if(uiStatus == PHS_SUCCESS)
1042 { 1042 {
1043 //Add entry at free index to the SF 1043 //Add entry at free index to the SF
1044 psServiceFlowTable->stSFList[iSfIndex].bUsed = TRUE; 1044 psServiceFlowTable->stSFList[iSfIndex].bUsed = TRUE;
1045 psServiceFlowTable->stSFList[iSfIndex].uiVcid = uiVcid; 1045 psServiceFlowTable->stSFList[iSfIndex].uiVcid = uiVcid;
1046 } 1046 }
1047 1047
1048 return uiStatus; 1048 return uiStatus;
1049 1049
1050 } 1050 }
1051 1051
1052 UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, 1052 UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid,
1053 IN B_UINT16 uiClsId,IN S_SERVICEFLOW_ENTRY *pstServiceFlowEntry, 1053 IN B_UINT16 uiClsId,IN S_SERVICEFLOW_ENTRY *pstServiceFlowEntry,
1054 S_PHS_RULE *psPhsRule,B_UINT8 u8AssociatedPHSI) 1054 S_PHS_RULE *psPhsRule,B_UINT8 u8AssociatedPHSI)
1055 { 1055 {
1056 S_CLASSIFIER_ENTRY *pstClassifierEntry = NULL; 1056 S_CLASSIFIER_ENTRY *pstClassifierEntry = NULL;
1057 UINT uiStatus =PHS_SUCCESS; 1057 UINT uiStatus =PHS_SUCCESS;
1058 UINT nClassifierIndex = 0; 1058 UINT nClassifierIndex = 0;
1059 S_CLASSIFIER_TABLE *psaClassifiertable = NULL; 1059 S_CLASSIFIER_TABLE *psaClassifiertable = NULL;
1060 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 1060 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
1061 psaClassifiertable = pstServiceFlowEntry->pstClassifierTable; 1061 psaClassifiertable = pstServiceFlowEntry->pstClassifierTable;
1062 1062
1063 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "==>"); 1063 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "==>");
1064 1064
1065 /* Check if the supplied Classifier already exists */ 1065 /* Check if the supplied Classifier already exists */
1066 nClassifierIndex =GetClassifierEntry( 1066 nClassifierIndex =GetClassifierEntry(
1067 pstServiceFlowEntry->pstClassifierTable,uiClsId, 1067 pstServiceFlowEntry->pstClassifierTable,uiClsId,
1068 eActiveClassifierRuleContext,&pstClassifierEntry); 1068 eActiveClassifierRuleContext,&pstClassifierEntry);
1069 if(nClassifierIndex == PHS_INVALID_TABLE_INDEX) 1069 if(nClassifierIndex == PHS_INVALID_TABLE_INDEX)
1070 { 1070 {
1071 /* 1071 /*
1072 The Classifier doesn't exist. So its a new classifier being added. 1072 The Classifier doesn't exist. So its a new classifier being added.
1073 Add new entry to associate PHS Rule to the Classifier 1073 Add new entry to associate PHS Rule to the Classifier
1074 */ 1074 */
1075 1075
1076 uiStatus = CreateClassifierPHSRule(uiClsId,psaClassifiertable, 1076 uiStatus = CreateClassifierPHSRule(uiClsId,psaClassifiertable,
1077 psPhsRule,eActiveClassifierRuleContext,u8AssociatedPHSI); 1077 psPhsRule,eActiveClassifierRuleContext,u8AssociatedPHSI);
1078 return uiStatus; 1078 return uiStatus;
1079 } 1079 }
1080 1080
1081 /* 1081 /*
1082 The Classifier exists.The PHS Rule for this classifier 1082 The Classifier exists.The PHS Rule for this classifier
1083 is being modified 1083 is being modified
1084 */ 1084 */
1085 if(pstClassifierEntry->u8PHSI == psPhsRule->u8PHSI) 1085 if(pstClassifierEntry->u8PHSI == psPhsRule->u8PHSI)
1086 { 1086 {
1087 if(pstClassifierEntry->pstPhsRule == NULL) 1087 if(pstClassifierEntry->pstPhsRule == NULL)
1088 return ERR_PHS_INVALID_PHS_RULE; 1088 return ERR_PHS_INVALID_PHS_RULE;
1089 1089
1090 /* 1090 /*
1091 This rule already exists if any fields are changed for this PHS 1091 This rule already exists if any fields are changed for this PHS
1092 rule update them. 1092 rule update them.
1093 */ 1093 */
1094 /* If any part of PHSF is valid then we update PHSF */ 1094 /* If any part of PHSF is valid then we update PHSF */
1095 if(psPhsRule->u8PHSFLength) 1095 if(psPhsRule->u8PHSFLength)
1096 { 1096 {
1097 //update PHSF 1097 //update PHSF
1098 memcpy(pstClassifierEntry->pstPhsRule->u8PHSF, 1098 memcpy(pstClassifierEntry->pstPhsRule->u8PHSF,
1099 psPhsRule->u8PHSF , MAX_PHS_LENGTHS); 1099 psPhsRule->u8PHSF , MAX_PHS_LENGTHS);
1100 } 1100 }
1101 if(psPhsRule->u8PHSFLength) 1101 if(psPhsRule->u8PHSFLength)
1102 { 1102 {
1103 //update PHSFLen 1103 //update PHSFLen
1104 pstClassifierEntry->pstPhsRule->u8PHSFLength = 1104 pstClassifierEntry->pstPhsRule->u8PHSFLength =
1105 psPhsRule->u8PHSFLength; 1105 psPhsRule->u8PHSFLength;
1106 } 1106 }
1107 if(psPhsRule->u8PHSMLength) 1107 if(psPhsRule->u8PHSMLength)
1108 { 1108 {
1109 //update PHSM 1109 //update PHSM
1110 memcpy(pstClassifierEntry->pstPhsRule->u8PHSM, 1110 memcpy(pstClassifierEntry->pstPhsRule->u8PHSM,
1111 psPhsRule->u8PHSM, MAX_PHS_LENGTHS); 1111 psPhsRule->u8PHSM, MAX_PHS_LENGTHS);
1112 } 1112 }
1113 if(psPhsRule->u8PHSMLength) 1113 if(psPhsRule->u8PHSMLength)
1114 { 1114 {
1115 //update PHSM Len 1115 //update PHSM Len
1116 pstClassifierEntry->pstPhsRule->u8PHSMLength = 1116 pstClassifierEntry->pstPhsRule->u8PHSMLength =
1117 psPhsRule->u8PHSMLength; 1117 psPhsRule->u8PHSMLength;
1118 } 1118 }
1119 if(psPhsRule->u8PHSS) 1119 if(psPhsRule->u8PHSS)
1120 { 1120 {
1121 //update PHSS 1121 //update PHSS
1122 pstClassifierEntry->pstPhsRule->u8PHSS = psPhsRule->u8PHSS; 1122 pstClassifierEntry->pstPhsRule->u8PHSS = psPhsRule->u8PHSS;
1123 } 1123 }
1124 1124
1125 //update PHSV 1125 //update PHSV
1126 pstClassifierEntry->pstPhsRule->u8PHSV = psPhsRule->u8PHSV; 1126 pstClassifierEntry->pstPhsRule->u8PHSV = psPhsRule->u8PHSV;
1127 1127
1128 } 1128 }
1129 else 1129 else
1130 { 1130 {
1131 /* 1131 /*
1132 A new rule is being set for this classifier. 1132 A new rule is being set for this classifier.
1133 */ 1133 */
1134 uiStatus=UpdateClassifierPHSRule( uiClsId, pstClassifierEntry, 1134 uiStatus=UpdateClassifierPHSRule( uiClsId, pstClassifierEntry,
1135 psaClassifiertable, psPhsRule, u8AssociatedPHSI); 1135 psaClassifiertable, psPhsRule, u8AssociatedPHSI);
1136 } 1136 }
1137 1137
1138 1138
1139 1139
1140 return uiStatus; 1140 return uiStatus;
1141 } 1141 }
1142 1142
1143 static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, 1143 static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId,
1144 S_CLASSIFIER_TABLE *psaClassifiertable ,S_PHS_RULE *psPhsRule, 1144 S_CLASSIFIER_TABLE *psaClassifiertable ,S_PHS_RULE *psPhsRule,
1145 E_CLASSIFIER_ENTRY_CONTEXT eClsContext,B_UINT8 u8AssociatedPHSI) 1145 E_CLASSIFIER_ENTRY_CONTEXT eClsContext,B_UINT8 u8AssociatedPHSI)
1146 { 1146 {
1147 UINT iClassifierIndex = 0; 1147 UINT iClassifierIndex = 0;
1148 BOOLEAN bFreeEntryFound = FALSE; 1148 BOOLEAN bFreeEntryFound = FALSE;
1149 S_CLASSIFIER_ENTRY *psClassifierRules = NULL; 1149 S_CLASSIFIER_ENTRY *psClassifierRules = NULL;
1150 UINT nStatus = PHS_SUCCESS; 1150 UINT nStatus = PHS_SUCCESS;
1151 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 1151 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
1152 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"Inside CreateClassifierPHSRule"); 1152 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"Inside CreateClassifierPHSRule");
1153 if(psaClassifiertable == NULL) 1153 if(psaClassifiertable == NULL)
1154 { 1154 {
1155 return ERR_INVALID_CLASSIFIERTABLE_FOR_SF; 1155 return ERR_INVALID_CLASSIFIERTABLE_FOR_SF;
1156 } 1156 }
1157 1157
1158 if(eClsContext == eOldClassifierRuleContext) 1158 if(eClsContext == eOldClassifierRuleContext)
1159 { 1159 {
1160 /* If An Old Entry for this classifier ID already exists in the 1160 /* If An Old Entry for this classifier ID already exists in the
1161 old rules table replace it. */ 1161 old rules table replace it. */
1162 1162
1163 iClassifierIndex = 1163 iClassifierIndex =
1164 GetClassifierEntry(psaClassifiertable, uiClsId, 1164 GetClassifierEntry(psaClassifiertable, uiClsId,
1165 eClsContext,&psClassifierRules); 1165 eClsContext,&psClassifierRules);
1166 if(iClassifierIndex != PHS_INVALID_TABLE_INDEX) 1166 if(iClassifierIndex != PHS_INVALID_TABLE_INDEX)
1167 { 1167 {
1168 /* 1168 /*
1169 The Classifier already exists in the old rules table 1169 The Classifier already exists in the old rules table
1170 Lets replace the old classifier with the new one. 1170 Lets replace the old classifier with the new one.
1171 */ 1171 */
1172 bFreeEntryFound = TRUE; 1172 bFreeEntryFound = TRUE;
1173 } 1173 }
1174 } 1174 }
1175 1175
1176 if(!bFreeEntryFound) 1176 if(!bFreeEntryFound)
1177 { 1177 {
1178 /* 1178 /*
1179 Continue to search for a free location to add the rule 1179 Continue to search for a free location to add the rule
1180 */ 1180 */
1181 for(iClassifierIndex = 0; iClassifierIndex < 1181 for(iClassifierIndex = 0; iClassifierIndex <
1182 MAX_PHSRULE_PER_SF; iClassifierIndex++) 1182 MAX_PHSRULE_PER_SF; iClassifierIndex++)
1183 { 1183 {
1184 if(eClsContext == eActiveClassifierRuleContext) 1184 if(eClsContext == eActiveClassifierRuleContext)
1185 { 1185 {
1186 psClassifierRules = 1186 psClassifierRules =
1187 &psaClassifiertable->stActivePhsRulesList[iClassifierIndex]; 1187 &psaClassifiertable->stActivePhsRulesList[iClassifierIndex];
1188 } 1188 }
1189 else 1189 else
1190 { 1190 {
1191 psClassifierRules = 1191 psClassifierRules =
1192 &psaClassifiertable->stOldPhsRulesList[iClassifierIndex]; 1192 &psaClassifiertable->stOldPhsRulesList[iClassifierIndex];
1193 } 1193 }
1194 1194
1195 if(!psClassifierRules->bUsed) 1195 if(!psClassifierRules->bUsed)
1196 { 1196 {
1197 bFreeEntryFound = TRUE; 1197 bFreeEntryFound = TRUE;
1198 break; 1198 break;
1199 } 1199 }
1200 } 1200 }
1201 } 1201 }
1202 1202
1203 if(!bFreeEntryFound) 1203 if(!bFreeEntryFound)
1204 { 1204 {
1205 if(eClsContext == eActiveClassifierRuleContext) 1205 if(eClsContext == eActiveClassifierRuleContext)
1206 { 1206 {
1207 return ERR_CLSASSIFIER_TABLE_FULL; 1207 return ERR_CLSASSIFIER_TABLE_FULL;
1208 } 1208 }
1209 else 1209 else
1210 { 1210 {
1211 //Lets replace the oldest rule if we are looking in old Rule table 1211 //Lets replace the oldest rule if we are looking in old Rule table
1212 if(psaClassifiertable->uiOldestPhsRuleIndex >= 1212 if(psaClassifiertable->uiOldestPhsRuleIndex >=
1213 MAX_PHSRULE_PER_SF) 1213 MAX_PHSRULE_PER_SF)
1214 { 1214 {
1215 psaClassifiertable->uiOldestPhsRuleIndex =0; 1215 psaClassifiertable->uiOldestPhsRuleIndex =0;
1216 } 1216 }
1217 1217
1218 iClassifierIndex = psaClassifiertable->uiOldestPhsRuleIndex; 1218 iClassifierIndex = psaClassifiertable->uiOldestPhsRuleIndex;
1219 psClassifierRules = 1219 psClassifierRules =
1220 &psaClassifiertable->stOldPhsRulesList[iClassifierIndex]; 1220 &psaClassifiertable->stOldPhsRulesList[iClassifierIndex];
1221 1221
1222 (psaClassifiertable->uiOldestPhsRuleIndex)++; 1222 (psaClassifiertable->uiOldestPhsRuleIndex)++;
1223 } 1223 }
1224 } 1224 }
1225 1225
1226 if(eClsContext == eOldClassifierRuleContext) 1226 if(eClsContext == eOldClassifierRuleContext)
1227 { 1227 {
1228 if(psClassifierRules->pstPhsRule == NULL) 1228 if(psClassifierRules->pstPhsRule == NULL)
1229 { 1229 {
1230 psClassifierRules->pstPhsRule = kmalloc(sizeof(S_PHS_RULE),GFP_KERNEL); 1230 psClassifierRules->pstPhsRule = kmalloc(sizeof(S_PHS_RULE),GFP_KERNEL);
1231 1231
1232 if(NULL == psClassifierRules->pstPhsRule) 1232 if(NULL == psClassifierRules->pstPhsRule)
1233 return ERR_PHSRULE_MEMALLOC_FAIL; 1233 return ERR_PHSRULE_MEMALLOC_FAIL;
1234 } 1234 }
1235 1235
1236 psClassifierRules->bUsed = TRUE; 1236 psClassifierRules->bUsed = TRUE;
1237 psClassifierRules->uiClassifierRuleId = uiClsId; 1237 psClassifierRules->uiClassifierRuleId = uiClsId;
1238 psClassifierRules->u8PHSI = psPhsRule->u8PHSI; 1238 psClassifierRules->u8PHSI = psPhsRule->u8PHSI;
1239 psClassifierRules->bUnclassifiedPHSRule = psPhsRule->bUnclassifiedPHSRule; 1239 psClassifierRules->bUnclassifiedPHSRule = psPhsRule->bUnclassifiedPHSRule;
1240 1240
1241 /* Update The PHS rule */ 1241 /* Update The PHS rule */
1242 memcpy(psClassifierRules->pstPhsRule, 1242 memcpy(psClassifierRules->pstPhsRule,
1243 psPhsRule, sizeof(S_PHS_RULE)); 1243 psPhsRule, sizeof(S_PHS_RULE));
1244 } 1244 }
1245 else 1245 else
1246 { 1246 {
1247 nStatus = UpdateClassifierPHSRule(uiClsId,psClassifierRules, 1247 nStatus = UpdateClassifierPHSRule(uiClsId,psClassifierRules,
1248 psaClassifiertable,psPhsRule,u8AssociatedPHSI); 1248 psaClassifiertable,psPhsRule,u8AssociatedPHSI);
1249 } 1249 }
1250 return nStatus; 1250 return nStatus;
1251 } 1251 }
1252 1252
1253 1253
1254 static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, 1254 static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId,
1255 IN S_CLASSIFIER_ENTRY *pstClassifierEntry, 1255 IN S_CLASSIFIER_ENTRY *pstClassifierEntry,
1256 S_CLASSIFIER_TABLE *psaClassifiertable ,S_PHS_RULE *psPhsRule, 1256 S_CLASSIFIER_TABLE *psaClassifiertable ,S_PHS_RULE *psPhsRule,
1257 B_UINT8 u8AssociatedPHSI) 1257 B_UINT8 u8AssociatedPHSI)
1258 { 1258 {
1259 S_PHS_RULE *pstAddPhsRule = NULL; 1259 S_PHS_RULE *pstAddPhsRule = NULL;
1260 UINT nPhsRuleIndex = 0; 1260 UINT nPhsRuleIndex = 0;
1261 BOOLEAN bPHSRuleOrphaned = FALSE; 1261 BOOLEAN bPHSRuleOrphaned = FALSE;
1262 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 1262 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
1263 psPhsRule->u8RefCnt =0; 1263 psPhsRule->u8RefCnt =0;
1264 1264
1265 /* Step 1 Deref Any Exisiting PHS Rule in this classifier Entry*/ 1265 /* Step 1 Deref Any Exisiting PHS Rule in this classifier Entry*/
1266 bPHSRuleOrphaned = DerefPhsRule( uiClsId, psaClassifiertable, 1266 bPHSRuleOrphaned = DerefPhsRule( uiClsId, psaClassifiertable,
1267 pstClassifierEntry->pstPhsRule); 1267 pstClassifierEntry->pstPhsRule);
1268 1268
1269 //Step 2 Search if there is a PHS Rule with u8AssociatedPHSI in Classifier table for this SF 1269 //Step 2 Search if there is a PHS Rule with u8AssociatedPHSI in Classifier table for this SF
1270 nPhsRuleIndex =GetPhsRuleEntry(psaClassifiertable,u8AssociatedPHSI, 1270 nPhsRuleIndex =GetPhsRuleEntry(psaClassifiertable,u8AssociatedPHSI,
1271 eActiveClassifierRuleContext, &pstAddPhsRule); 1271 eActiveClassifierRuleContext, &pstAddPhsRule);
1272 if(PHS_INVALID_TABLE_INDEX == nPhsRuleIndex) 1272 if(PHS_INVALID_TABLE_INDEX == nPhsRuleIndex)
1273 { 1273 {
1274 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAdding New PHSRuleEntry For Classifier"); 1274 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAdding New PHSRuleEntry For Classifier");
1275 1275
1276 if(psPhsRule->u8PHSI == 0) 1276 if(psPhsRule->u8PHSI == 0)
1277 { 1277 {
1278 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nError PHSI is Zero\n"); 1278 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nError PHSI is Zero\n");
1279 return ERR_PHS_INVALID_PHS_RULE; 1279 return ERR_PHS_INVALID_PHS_RULE;
1280 } 1280 }
1281 //Step 2.a PHS Rule Does Not Exist .Create New PHS Rule for uiClsId 1281 //Step 2.a PHS Rule Does Not Exist .Create New PHS Rule for uiClsId
1282 if(FALSE == bPHSRuleOrphaned) 1282 if(FALSE == bPHSRuleOrphaned)
1283 { 1283 {
1284 pstClassifierEntry->pstPhsRule = kmalloc(sizeof(S_PHS_RULE), GFP_KERNEL); 1284 pstClassifierEntry->pstPhsRule = kmalloc(sizeof(S_PHS_RULE), GFP_KERNEL);
1285 if(NULL == pstClassifierEntry->pstPhsRule) 1285 if(NULL == pstClassifierEntry->pstPhsRule)
1286 { 1286 {
1287 return ERR_PHSRULE_MEMALLOC_FAIL; 1287 return ERR_PHSRULE_MEMALLOC_FAIL;
1288 } 1288 }
1289 } 1289 }
1290 memcpy(pstClassifierEntry->pstPhsRule, psPhsRule, sizeof(S_PHS_RULE)); 1290 memcpy(pstClassifierEntry->pstPhsRule, psPhsRule, sizeof(S_PHS_RULE));
1291 1291
1292 } 1292 }
1293 else 1293 else
1294 { 1294 {
1295 //Step 2.b PHS Rule Exists Tie uiClsId with the existing PHS Rule 1295 //Step 2.b PHS Rule Exists Tie uiClsId with the existing PHS Rule
1296 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nTying Classifier to Existing PHS Rule"); 1296 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nTying Classifier to Existing PHS Rule");
1297 if(bPHSRuleOrphaned) 1297 if(bPHSRuleOrphaned)
1298 { 1298 {
1299 kfree(pstClassifierEntry->pstPhsRule); 1299 kfree(pstClassifierEntry->pstPhsRule);
1300 pstClassifierEntry->pstPhsRule = NULL; 1300 pstClassifierEntry->pstPhsRule = NULL;
1301 } 1301 }
1302 pstClassifierEntry->pstPhsRule = pstAddPhsRule; 1302 pstClassifierEntry->pstPhsRule = pstAddPhsRule;
1303 1303
1304 } 1304 }
1305 pstClassifierEntry->bUsed = TRUE; 1305 pstClassifierEntry->bUsed = TRUE;
1306 pstClassifierEntry->u8PHSI = pstClassifierEntry->pstPhsRule->u8PHSI; 1306 pstClassifierEntry->u8PHSI = pstClassifierEntry->pstPhsRule->u8PHSI;
1307 pstClassifierEntry->uiClassifierRuleId = uiClsId; 1307 pstClassifierEntry->uiClassifierRuleId = uiClsId;
1308 pstClassifierEntry->pstPhsRule->u8RefCnt++; 1308 pstClassifierEntry->pstPhsRule->u8RefCnt++;
1309 pstClassifierEntry->bUnclassifiedPHSRule = pstClassifierEntry->pstPhsRule->bUnclassifiedPHSRule; 1309 pstClassifierEntry->bUnclassifiedPHSRule = pstClassifierEntry->pstPhsRule->bUnclassifiedPHSRule;
1310 1310
1311 return PHS_SUCCESS; 1311 return PHS_SUCCESS;
1312 1312
1313 } 1313 }
1314 1314
1315 static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId,S_CLASSIFIER_TABLE *psaClassifiertable,S_PHS_RULE *pstPhsRule) 1315 static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId,S_CLASSIFIER_TABLE *psaClassifiertable,S_PHS_RULE *pstPhsRule)
1316 { 1316 {
1317 if(pstPhsRule==NULL) 1317 if(pstPhsRule==NULL)
1318 return FALSE; 1318 return FALSE;
1319 if(pstPhsRule->u8RefCnt) 1319 if(pstPhsRule->u8RefCnt)
1320 pstPhsRule->u8RefCnt--; 1320 pstPhsRule->u8RefCnt--;
1321 if(0==pstPhsRule->u8RefCnt) 1321 if(0==pstPhsRule->u8RefCnt)
1322 { 1322 {
1323 /*if(pstPhsRule->u8PHSI) 1323 /*if(pstPhsRule->u8PHSI)
1324 //Store the currently active rule into the old rules list 1324 //Store the currently active rule into the old rules list
1325 CreateClassifierPHSRule(uiClsId,psaClassifiertable,pstPhsRule,eOldClassifierRuleContext,pstPhsRule->u8PHSI);*/ 1325 CreateClassifierPHSRule(uiClsId,psaClassifiertable,pstPhsRule,eOldClassifierRuleContext,pstPhsRule->u8PHSI);*/
1326 return TRUE; 1326 return TRUE;
1327 } 1327 }
1328 else 1328 else
1329 { 1329 {
1330 return FALSE; 1330 return FALSE;
1331 } 1331 }
1332 } 1332 }
1333 1333
1334 void DumpPhsRules(PPHS_DEVICE_EXTENSION pDeviceExtension) 1334 void DumpPhsRules(PPHS_DEVICE_EXTENSION pDeviceExtension)
1335 { 1335 {
1336 int i,j,k,l; 1336 int i,j,k,l;
1337 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 1337 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
1338 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n Dumping PHS Rules : \n"); 1338 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n Dumping PHS Rules : \n");
1339 for(i=0;i<MAX_SERVICEFLOWS;i++) 1339 for(i=0;i<MAX_SERVICEFLOWS;i++)
1340 { 1340 {
1341 S_SERVICEFLOW_ENTRY stServFlowEntry = 1341 S_SERVICEFLOW_ENTRY stServFlowEntry =
1342 pDeviceExtension->pstServiceFlowPhsRulesTable->stSFList[i]; 1342 pDeviceExtension->pstServiceFlowPhsRulesTable->stSFList[i];
1343 if(stServFlowEntry.bUsed) 1343 if(stServFlowEntry.bUsed)
1344 { 1344 {
1345 for(j=0;j<MAX_PHSRULE_PER_SF;j++) 1345 for(j=0;j<MAX_PHSRULE_PER_SF;j++)
1346 { 1346 {
1347 for(l=0;l<2;l++) 1347 for(l=0;l<2;l++)
1348 { 1348 {
1349 S_CLASSIFIER_ENTRY stClsEntry; 1349 S_CLASSIFIER_ENTRY stClsEntry;
1350 if(l==0) 1350 if(l==0)
1351 { 1351 {
1352 stClsEntry = stServFlowEntry.pstClassifierTable->stActivePhsRulesList[j]; 1352 stClsEntry = stServFlowEntry.pstClassifierTable->stActivePhsRulesList[j];
1353 if(stClsEntry.bUsed) 1353 if(stClsEntry.bUsed)
1354 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n Active PHS Rule : \n"); 1354 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n Active PHS Rule : \n");
1355 } 1355 }
1356 else 1356 else
1357 { 1357 {
1358 stClsEntry = stServFlowEntry.pstClassifierTable->stOldPhsRulesList[j]; 1358 stClsEntry = stServFlowEntry.pstClassifierTable->stOldPhsRulesList[j];
1359 if(stClsEntry.bUsed) 1359 if(stClsEntry.bUsed)
1360 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n Old PHS Rule : \n"); 1360 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n Old PHS Rule : \n");
1361 } 1361 }
1362 if(stClsEntry.bUsed) 1362 if(stClsEntry.bUsed)
1363 { 1363 {
1364 1364
1365 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n VCID : %#X",stServFlowEntry.uiVcid); 1365 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n VCID : %#X",stServFlowEntry.uiVcid);
1366 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n ClassifierID : %#X",stClsEntry.uiClassifierRuleId); 1366 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n ClassifierID : %#X",stClsEntry.uiClassifierRuleId);
1367 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSRuleID : %#X",stClsEntry.u8PHSI); 1367 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSRuleID : %#X",stClsEntry.u8PHSI);
1368 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n****************PHS Rule********************\n"); 1368 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n****************PHS Rule********************\n");
1369 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSI : %#X",stClsEntry.pstPhsRule->u8PHSI); 1369 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSI : %#X",stClsEntry.pstPhsRule->u8PHSI);
1370 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSFLength : %#X ",stClsEntry.pstPhsRule->u8PHSFLength); 1370 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSFLength : %#X ",stClsEntry.pstPhsRule->u8PHSFLength);
1371 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSF : "); 1371 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSF : ");
1372 for(k=0;k<stClsEntry.pstPhsRule->u8PHSFLength;k++) 1372 for(k=0;k<stClsEntry.pstPhsRule->u8PHSFLength;k++)
1373 { 1373 {
1374 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "%#X ",stClsEntry.pstPhsRule->u8PHSF[k]); 1374 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "%#X ",stClsEntry.pstPhsRule->u8PHSF[k]);
1375 } 1375 }
1376 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSMLength : %#X",stClsEntry.pstPhsRule->u8PHSMLength); 1376 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSMLength : %#X",stClsEntry.pstPhsRule->u8PHSMLength);
1377 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSM :"); 1377 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSM :");
1378 for(k=0;k<stClsEntry.pstPhsRule->u8PHSMLength;k++) 1378 for(k=0;k<stClsEntry.pstPhsRule->u8PHSMLength;k++)
1379 { 1379 {
1380 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "%#X ",stClsEntry.pstPhsRule->u8PHSM[k]); 1380 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "%#X ",stClsEntry.pstPhsRule->u8PHSM[k]);
1381 } 1381 }
1382 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSS : %#X ",stClsEntry.pstPhsRule->u8PHSS); 1382 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSS : %#X ",stClsEntry.pstPhsRule->u8PHSS);
1383 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSV : %#X",stClsEntry.pstPhsRule->u8PHSV); 1383 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSV : %#X",stClsEntry.pstPhsRule->u8PHSV);
1384 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n********************************************\n"); 1384 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n********************************************\n");
1385 } 1385 }
1386 } 1386 }
1387 } 1387 }
1388 } 1388 }
1389 } 1389 }
1390 } 1390 }
1391 1391
1392 1392
1393 //----------------------------------------------------------------------------- 1393 //-----------------------------------------------------------------------------
1394 // Procedure: phs_decompress 1394 // Procedure: phs_decompress
1395 // 1395 //
1396 // Description: This routine restores the static fields within the packet. 1396 // Description: This routine restores the static fields within the packet.
1397 // 1397 //
1398 // Arguments: 1398 // Arguments:
1399 // in_buf - ptr to incoming packet buffer. 1399 // in_buf - ptr to incoming packet buffer.
1400 // out_buf - ptr to output buffer where the suppressed header is copied. 1400 // out_buf - ptr to output buffer where the suppressed header is copied.
1401 // decomp_phs_rules - ptr to PHS rule. 1401 // decomp_phs_rules - ptr to PHS rule.
1402 // header_size - ptr to field which holds the phss or phsf_length. 1402 // header_size - ptr to field which holds the phss or phsf_length.
1403 // 1403 //
1404 // Returns: 1404 // Returns:
1405 // size -The number of bytes of dynamic fields present with in the incoming packet 1405 // size -The number of bytes of dynamic fields present with in the incoming packet
1406 // header. 1406 // header.
1407 // 0 -If PHS rule is NULL.If PHSI is 0 indicateing packet as uncompressed. 1407 // 0 -If PHS rule is NULL.If PHSI is 0 indicateing packet as uncompressed.
1408 //----------------------------------------------------------------------------- 1408 //-----------------------------------------------------------------------------
1409 1409
1410 int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, 1410 int phs_decompress(unsigned char *in_buf,unsigned char *out_buf,
1411 S_PHS_RULE *decomp_phs_rules,UINT *header_size) 1411 S_PHS_RULE *decomp_phs_rules,UINT *header_size)
1412 { 1412 {
1413 int phss,size=0; 1413 int phss,size=0;
1414 S_PHS_RULE *tmp_memb; 1414 S_PHS_RULE *tmp_memb;
1415 int bit,i=0; 1415 int bit,i=0;
1416 unsigned char *phsf,*phsm; 1416 unsigned char *phsf,*phsm;
1417 int in_buf_len = *header_size-1; 1417 int in_buf_len = *header_size-1;
1418 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 1418 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
1419 in_buf++; 1419 in_buf++;
1420 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"====>\n"); 1420 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"====>\n");
1421 *header_size = 0; 1421 *header_size = 0;
1422 1422
1423 if((decomp_phs_rules == NULL )) 1423 if((decomp_phs_rules == NULL ))
1424 return 0; 1424 return 0;
1425 1425
1426 1426
1427 tmp_memb = decomp_phs_rules; 1427 tmp_memb = decomp_phs_rules;
1428 //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI 1 %d",phsi)); 1428 //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI 1 %d",phsi));
1429 //*header_size = tmp_memb->u8PHSFLength; 1429 //*header_size = tmp_memb->u8PHSFLength;
1430 phss = tmp_memb->u8PHSS; 1430 phss = tmp_memb->u8PHSS;
1431 phsf = tmp_memb->u8PHSF; 1431 phsf = tmp_memb->u8PHSF;
1432 phsm = tmp_memb->u8PHSM; 1432 phsm = tmp_memb->u8PHSM;
1433 1433
1434 if(phss > MAX_PHS_LENGTHS) 1434 if(phss > MAX_PHS_LENGTHS)
1435 phss = MAX_PHS_LENGTHS; 1435 phss = MAX_PHS_LENGTHS;
1436 //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI %d phss %d index %d",phsi,phss,index)); 1436 //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI %d phss %d index %d",phsi,phss,index));
1437 while((phss > 0) && (size < in_buf_len)) 1437 while((phss > 0) && (size < in_buf_len))
1438 { 1438 {
1439 bit = ((*phsm << i)& SUPPRESS); 1439 bit = ((*phsm << i)& SUPPRESS);
1440 1440
1441 if(bit == SUPPRESS) 1441 if(bit == SUPPRESS)
1442 { 1442 {
1443 *out_buf = *phsf; 1443 *out_buf = *phsf;
1444 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phss %d phsf %d ouput %d", 1444 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phss %d phsf %d ouput %d",
1445 phss,*phsf,*out_buf); 1445 phss,*phsf,*out_buf);
1446 } 1446 }
1447 else 1447 else
1448 { 1448 {
1449 *out_buf = *in_buf; 1449 *out_buf = *in_buf;
1450 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phss %d input %d ouput %d", 1450 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phss %d input %d ouput %d",
1451 phss,*in_buf,*out_buf); 1451 phss,*in_buf,*out_buf);
1452 in_buf++; 1452 in_buf++;
1453 size++; 1453 size++;
1454 } 1454 }
1455 out_buf++; 1455 out_buf++;
1456 phsf++; 1456 phsf++;
1457 phss--; 1457 phss--;
1458 i++; 1458 i++;
1459 *header_size=*header_size + 1; 1459 *header_size=*header_size + 1;
1460 1460
1461 if(i > MAX_NO_BIT) 1461 if(i > MAX_NO_BIT)
1462 { 1462 {
1463 i=0; 1463 i=0;
1464 phsm++; 1464 phsm++;
1465 } 1465 }
1466 } 1466 }
1467 return size; 1467 return size;
1468 } 1468 }
1469 1469
1470 1470
1471 1471
1472 1472
1473 //----------------------------------------------------------------------------- 1473 //-----------------------------------------------------------------------------
1474 // Procedure: phs_compress 1474 // Procedure: phs_compress
1475 // 1475 //
1476 // Description: This routine suppresses the static fields within the packet.Before 1476 // Description: This routine suppresses the static fields within the packet.Before
1477 // that it will verify the fields to be suppressed with the corresponding fields in the 1477 // that it will verify the fields to be suppressed with the corresponding fields in the
1478 // phsf. For verification it checks the phsv field of PHS rule. If set and verification 1478 // phsf. For verification it checks the phsv field of PHS rule. If set and verification
1479 // succeeds it suppresses the field.If any one static field is found different none of 1479 // succeeds it suppresses the field.If any one static field is found different none of
1480 // the static fields are suppressed then the packet is sent as uncompressed packet with 1480 // the static fields are suppressed then the packet is sent as uncompressed packet with
1481 // phsi=0. 1481 // phsi=0.
1482 // 1482 //
1483 // Arguments: 1483 // Arguments:
1484 // phs_rule - ptr to PHS rule. 1484 // phs_rule - ptr to PHS rule.
1485 // in_buf - ptr to incoming packet buffer. 1485 // in_buf - ptr to incoming packet buffer.
1486 // out_buf - ptr to output buffer where the suppressed header is copied. 1486 // out_buf - ptr to output buffer where the suppressed header is copied.
1487 // header_size - ptr to field which holds the phss. 1487 // header_size - ptr to field which holds the phss.
1488 // 1488 //
1489 // Returns: 1489 // Returns:
1490 // size-The number of bytes copied into the output buffer i.e dynamic fields 1490 // size-The number of bytes copied into the output buffer i.e dynamic fields
1491 // 0 -If PHS rule is NULL.If PHSV field is not set.If the verification fails. 1491 // 0 -If PHS rule is NULL.If PHSV field is not set.If the verification fails.
1492 //----------------------------------------------------------------------------- 1492 //-----------------------------------------------------------------------------
1493 static int phs_compress(S_PHS_RULE *phs_rule,unsigned char *in_buf 1493 static int phs_compress(S_PHS_RULE *phs_rule,unsigned char *in_buf
1494 ,unsigned char *out_buf,UINT *header_size,UINT *new_header_size) 1494 ,unsigned char *out_buf,UINT *header_size,UINT *new_header_size)
1495 { 1495 {
1496 unsigned char *old_addr = out_buf; 1496 unsigned char *old_addr = out_buf;
1497 int supress = 0; 1497 int suppress = 0;
1498 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 1498 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
1499 if(phs_rule == NULL) 1499 if(phs_rule == NULL)
1500 { 1500 {
1501 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nphs_compress(): phs_rule null!"); 1501 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nphs_compress(): phs_rule null!");
1502 *out_buf = ZERO_PHSI; 1502 *out_buf = ZERO_PHSI;
1503 return STATUS_PHS_NOCOMPRESSION; 1503 return STATUS_PHS_NOCOMPRESSION;
1504 } 1504 }
1505 1505
1506 1506
1507 if(phs_rule->u8PHSS <= *new_header_size) 1507 if(phs_rule->u8PHSS <= *new_header_size)
1508 { 1508 {
1509 *header_size = phs_rule->u8PHSS; 1509 *header_size = phs_rule->u8PHSS;
1510 } 1510 }
1511 else 1511 else
1512 { 1512 {
1513 *header_size = *new_header_size; 1513 *header_size = *new_header_size;
1514 } 1514 }
1515 //To copy PHSI 1515 //To copy PHSI
1516 out_buf++; 1516 out_buf++;
1517 supress = verify_suppress_phsf(in_buf,out_buf,phs_rule->u8PHSF, 1517 suppress = verify_suppress_phsf(in_buf,out_buf,phs_rule->u8PHSF,
1518 phs_rule->u8PHSM, phs_rule->u8PHSS, phs_rule->u8PHSV,new_header_size); 1518 phs_rule->u8PHSM, phs_rule->u8PHSS, phs_rule->u8PHSV,new_header_size);
1519 1519
1520 if(supress == STATUS_PHS_COMPRESSED) 1520 if(suppress == STATUS_PHS_COMPRESSED)
1521 { 1521 {
1522 *old_addr = (unsigned char)phs_rule->u8PHSI; 1522 *old_addr = (unsigned char)phs_rule->u8PHSI;
1523 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In phs_compress phsi %d",phs_rule->u8PHSI); 1523 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In phs_compress phsi %d",phs_rule->u8PHSI);
1524 } 1524 }
1525 else 1525 else
1526 { 1526 {
1527 *old_addr = ZERO_PHSI; 1527 *old_addr = ZERO_PHSI;
1528 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In phs_compress PHSV Verification failed"); 1528 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In phs_compress PHSV Verification failed");
1529 } 1529 }
1530 return supress; 1530 return suppress;
1531 } 1531 }
1532 1532
1533 1533
1534 //----------------------------------------------------------------------------- 1534 //-----------------------------------------------------------------------------
1535 // Procedure: verify_suppress_phsf 1535 // Procedure: verify_suppress_phsf
1536 // 1536 //
1537 // Description: This routine verifies the fields of the packet and if all the 1537 // Description: This routine verifies the fields of the packet and if all the
1538 // static fields are equal it adds the phsi of that PHS rule.If any static 1538 // static fields are equal it adds the phsi of that PHS rule.If any static
1539 // field differs it woun't suppress any field. 1539 // field differs it woun't suppress any field.
1540 // 1540 //
1541 // Arguments: 1541 // Arguments:
1542 // rules_set - ptr to classifier_rules. 1542 // rules_set - ptr to classifier_rules.
1543 // in_buffer - ptr to incoming packet buffer. 1543 // in_buffer - ptr to incoming packet buffer.
1544 // out_buffer - ptr to output buffer where the suppressed header is copied. 1544 // out_buffer - ptr to output buffer where the suppressed header is copied.
1545 // phsf - ptr to phsf. 1545 // phsf - ptr to phsf.
1546 // phsm - ptr to phsm. 1546 // phsm - ptr to phsm.
1547 // phss - variable holding phss. 1547 // phss - variable holding phss.
1548 // 1548 //
1549 // Returns: 1549 // Returns:
1550 // size-The number of bytes copied into the output buffer i.e dynamic fields. 1550 // size-The number of bytes copied into the output buffer i.e dynamic fields.
1551 // 0 -Packet has failed the verification. 1551 // 0 -Packet has failed the verification.
1552 //----------------------------------------------------------------------------- 1552 //-----------------------------------------------------------------------------
1553 1553
1554 static int verify_suppress_phsf(unsigned char *in_buffer,unsigned char *out_buffer, 1554 static int verify_suppress_phsf(unsigned char *in_buffer,unsigned char *out_buffer,
1555 unsigned char *phsf,unsigned char *phsm,unsigned int phss, 1555 unsigned char *phsf,unsigned char *phsm,unsigned int phss,
1556 unsigned int phsv,UINT* new_header_size) 1556 unsigned int phsv,UINT* new_header_size)
1557 { 1557 {
1558 unsigned int size=0; 1558 unsigned int size=0;
1559 int bit,i=0; 1559 int bit,i=0;
1560 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 1560 struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
1561 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In verify_phsf PHSM - 0x%X",*phsm); 1561 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In verify_phsf PHSM - 0x%X",*phsm);
1562 1562
1563 1563
1564 if(phss>(*new_header_size)) 1564 if(phss>(*new_header_size))
1565 { 1565 {
1566 phss=*new_header_size; 1566 phss=*new_header_size;
1567 } 1567 }
1568 while(phss > 0) 1568 while(phss > 0)
1569 { 1569 {
1570 bit = ((*phsm << i)& SUPPRESS); 1570 bit = ((*phsm << i)& SUPPRESS);
1571 if(bit == SUPPRESS) 1571 if(bit == SUPPRESS)
1572 { 1572 {
1573 1573
1574 if(*in_buffer != *phsf) 1574 if(*in_buffer != *phsf)
1575 { 1575 {
1576 if(phsv == VERIFY) 1576 if(phsv == VERIFY)
1577 { 1577 {
1578 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In verify_phsf failed for field %d buf %d phsf %d",phss,*in_buffer,*phsf); 1578 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In verify_phsf failed for field %d buf %d phsf %d",phss,*in_buffer,*phsf);
1579 return STATUS_PHS_NOCOMPRESSION; 1579 return STATUS_PHS_NOCOMPRESSION;
1580 } 1580 }
1581 } 1581 }
1582 else 1582 else
1583 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In verify_phsf success for field %d buf %d phsf %d",phss,*in_buffer,*phsf); 1583 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In verify_phsf success for field %d buf %d phsf %d",phss,*in_buffer,*phsf);
1584 } 1584 }
1585 else 1585 else
1586 { 1586 {
1587 *out_buffer = *in_buffer; 1587 *out_buffer = *in_buffer;
1588 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In copying_header input %d out %d",*in_buffer,*out_buffer); 1588 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In copying_header input %d out %d",*in_buffer,*out_buffer);
1589 out_buffer++; 1589 out_buffer++;
1590 size++; 1590 size++;
1591 } 1591 }
1592 in_buffer++; 1592 in_buffer++;
1593 phsf++; 1593 phsf++;
1594 phss--; 1594 phss--;
1595 i++; 1595 i++;
1596 if(i > MAX_NO_BIT) 1596 if(i > MAX_NO_BIT)
1597 { 1597 {
1598 i=0; 1598 i=0;
1599 phsm++; 1599 phsm++;
1600 } 1600 }
1601 } 1601 }
1602 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In verify_phsf success"); 1602 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In verify_phsf success");
1603 *new_header_size = size; 1603 *new_header_size = size;
1604 return STATUS_PHS_COMPRESSED; 1604 return STATUS_PHS_COMPRESSED;
1605 } 1605 }
1606 1606
1607 1607
1608 1608
1609 1609
1610 1610
1611 1611
1612 1612