none
WIFI Network Packet compression using NDIS Filter Driver RRS feed

  • Question

  • Hi,

    I inserted the below link sample "NDIS 6.0 Filter Driver" and want to do Compression(usingRtlCompressBuffer API) of the network packets in function FilterSendNetBufferLists()

    http://code.msdn.microsoft.com/windowshardware/NDISLWFSYS-Sample-NDIS-60-42b76875

    FilterSendNetBufferLists(){

    if (pFilter->TrackSends)
            {
                FILTER_ACQUIRE_LOCK(&pFilter->Lock, DispatchLevel);
                CurrNbl = NetBufferLists;

    //I want to use RtlCompressBufferAPI here and compress each Netbufferlist.Will I be able to achieve some percent of Network packet size compression by doing this here??Or any other better way can you all suggest which will achieve some percent of network packet size compression.

                while (CurrNbl)
                {
                    pFilter->OutstandingSends++;
                    FILTER_LOG_SEND_REF(1, pFilter, CurrNbl, pFilter->OutstandingSends);

                    CurrNbl = NET_BUFFER_LIST_NEXT_NBL(CurrNbl);
                }
                FILTER_RELEASE_LOCK(&pFilter->Lock, DispatchLevel);
            }

             NdisFSendNetBufferLists(pFilter->FilterHandle, NetBufferLists, PortNumber, SendFlags);

    }

    Friday, December 20, 2013 7:33 AM

Answers

  • You need to study the NDIS NetBufferList (NBL) and NetBuffer (NB) structures more carefully.

    For example, a NBL actually has no "data" within it. Instead it is a structure that primarily contains a linked list of NBs. It is the NBs that contain the actual "packet data" that could potentially be compressed.

    You cannot modify memory that you do not own. So, you will need to allocate your own NBL, NBs, MDLs and memory for the compressed data.

    It is unlikely that compression will actually be of any use at this level. If you could compress by a miraculous 50-percent you might cut the number of packets by two - but that is not the norm. I would expect that in the real world this technique _might_ result in eliminating the need to send an occasional packet or two, but would have no measurable improvement in most cases.

    Of course this _might_ be beneficial _if_ you know in advance that the data _is_ highly compressible.

    Offhand I'd say this is a very bad idea.

    Good luck!

    Thomas F. Divine


    Thomas F. Divine

    Saturday, January 25, 2014 3:52 PM

All replies

  • OR DO I need to use the NET_buffer management functions in some combination to extract the buffer to compress it.Please let me know your views on this as I am new to network layers

    http://msdn.microsoft.com/en-us/library/windows/hardware/ff568414(v=vs.85).aspx

    Friday, December 20, 2013 10:10 AM
  • You need to study the NDIS NetBufferList (NBL) and NetBuffer (NB) structures more carefully.

    For example, a NBL actually has no "data" within it. Instead it is a structure that primarily contains a linked list of NBs. It is the NBs that contain the actual "packet data" that could potentially be compressed.

    You cannot modify memory that you do not own. So, you will need to allocate your own NBL, NBs, MDLs and memory for the compressed data.

    It is unlikely that compression will actually be of any use at this level. If you could compress by a miraculous 50-percent you might cut the number of packets by two - but that is not the norm. I would expect that in the real world this technique _might_ result in eliminating the need to send an occasional packet or two, but would have no measurable improvement in most cases.

    Of course this _might_ be beneficial _if_ you know in advance that the data _is_ highly compressible.

    Offhand I'd say this is a very bad idea.

    Good luck!

    Thomas F. Divine


    Thomas F. Divine

    Saturday, January 25, 2014 3:52 PM
  • Thanks for the reply.

    If I am able to achieve 5-15% compression is also fine

    Any simple methods by setting some flags I can achieve some % of compression or How about compressing as shown below

    In
    FilterSendNetBufferLists() function

    if (pFilter->State != FilterRunning)
            {
                FILTER_RELEASE_LOCK(&pFilter->Lock, DispatchLevel);

                CurrNbl = NetBufferLists;

    //Compressing the CurNbl structure before it is put in the List.Will I achieve some % level of compression by doing this

                 while (CurrNbl)
                {
                    NET_BUFFER_LIST_STATUS(CurrNbl) = NDIS_STATUS_PAUSED;
                    CurrNbl = NET_BUFFER_LIST_NEXT_NBL(CurrNbl);
                }
                NdisFSendNetBufferListsComplete(pFilter->FilterHandle,
                            NetBufferLists,
                            DispatchLevel ? NDIS_SEND_COMPLETE_FLAGS_DISPATCH_LEVEL : 0);
                break;

            }

    Monday, January 27, 2014 7:15 AM
  • Three are no simple methods. Sorry. In addition, each IP datagram spans multiple packets. To compress you must reassemble Al the packets that comprise the datagram, compress the datagram data and then fragment and send a new series of packets that comprise the compressed datagram.

    In most cases your compression may reduce the data in ONLY the last packet of the compressed datagram - but the last packet will probably not be empty and wild need to be sent anyway. No win!

    Bad idea!


    Thomas F. Divine

    Tuesday, January 28, 2014 5:11 PM