I think Afghanistan is secure enough that we can be assured that it will be denied as a massive safe haven and training facility to our enemy with present forces while focusing our efforts to eliminate the next.
Afghanistan with its porous border with Pakistan and tribesmen content to live in little fiefdoms in mountain hideouts for ever will probably not be completely policeable in our lifetime. But thats not necessary and not our objective.
The threat of international terror is greater when there is some hope among their leaders of success. When we deny them everything but the mountains of Afghanistan, impoverished shi'its tribes in southern Iraq etc and take out their grip on recognized governments and the resulting funds and military technology, they will likely lose critical mass and their existence as an organized threat will be threatened.
In one sense, it's a matter of diminishing returns. We could spend the next 10 years chasing gunmen through the Afghan hills while greater threats are strengthening.