cfg80211 is the Linux 802.11 configuration API. cfg80211 replaces Wireless-Extensions. nl80211 is used to configure a cfg80211 device and is used for kernel ←→ userspace communication. Wireless extensions is now in maintenance mode, no new features will be added to it, we'll only fix bugs for it. cfg80211 is now feature-par complete with wireless-extensions, it actually has a lot more features that are simply not available and will never be available through wireless extensions. When implementing a cfg80211 driver wireless extensions support is still provided automatically for you through cfg80211 through CONFIG_CFG80211_WEXT. Distributions no longer needing wireless extensions can remove this and are encouraged to do so. cfg80211 also provides full regulatory support, this is done through wireless-regdb and the usage of CRDA.
All new Linux wireless drivers should be written targeting either cfg80211 for fullmac devices or mac80211 for softmac devices.
We now have a few cfg80211 drivers, a good example of a full cfg80211 drivers is the Atheros ath6kl driver. Instead of writing wext ioctls you now write cfg80211 operation callbacks and fill in the wiphy struct to indicate to cfg80211 its device capabilities.
Then you allocate the wiphy by specifying the cfg80211 ops and fill the wiphy. For more details refer to cfg80211.h and as an example driver you can read ath6kl (or any other cfg80211-only driver, or even mac80211.) There's a list of APIs per interface mode.
Linux wireless regulatory documentation: